IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/de7e1d2f0918eae442417ef8a8def4f59b0da5f2.php

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-sm-12">
        <div class="card">
            <div class="header">
                <h2><strong>Invoices</strong></h2>
            </div>
            <div class="body table-responsive">
                <?php echo Form::open(['method' => 'GET',  'action' => ['School\Stock\InvoiceController@index'], 'class' => 'form-horizontal']); ?>

                    <div class="row clearfix">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-2 form-control-label">
                            <label for="classname">Financial Year</label>
                        </div>
                        <div class="col-sm-3">
                            <div class="form-group">
                               <?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>

                            </div>
                        </div>
                        <div class="col-sm-2">
                            <?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        </div>
                    </div>
                <?php echo Form::close(); ?>

                <br>
                <table class="table table-bordered table-striped table-hover dataTable js-basic-example">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>Date</th>
                            <th>Invoice No.</th>
                            <th>Customer Type</th>
                            <th>Name</th>
                            <th>Payable amount</th>
                            <th>Paid Amount</th>
                            <th>Balance</th>
                            <th>Note</th>
                            <th>Salesperson</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        <?php $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <th scope="row"><?php echo e($i); ?></th>
                            <td><?php echo e($var->invoiceDate); ?></td>
                            <td><?php echo e($var->invoiceNo); ?></td>
                            <td><?php echo e($var->customerType); ?></td>
                            <td>
                                <?php if($var->customerType == 'Student'): ?>
                                <?php echo e($var->student->name); ?>

                                <?php else: ?>
                                <?php if($var->customerType == 'Customer'): ?>
                                <?php echo e($var->customer->customerName); ?>

                                <?php else: ?>
                                <?php echo e($var->employee->name); ?>

                                <?php endif; ?>
                                <?php endif; ?>
                            </td>
                            <td><?php echo e($var->amountPayable); ?></td>
                            <td><?php $ip = \App\StockInvoicePayment::where('idInvoice','=',$var->idInvoice)
                                        ->select(DB::raw('SUM(paidAmount) as amountPaid'))->where('paymentStatus','!=','Cancelled')->first(); ?>
                                <?php echo e($ip->amountPaid); ?>

                            </td>
                            <td>
                                
                                <?php echo e($b = $var->amountPayable - $ip->amountPaid); ?>

                            </td>
                            <td><?php echo e($var->notes); ?></td>
                            <td><?php echo e($var->salesperson); ?></td>
                            <td>
                                <a href="<?php echo e(url('school/invoices/'.$var->idInvoice.'/print')); ?>" target="_blank" class="btn btn-sm btn-round btn-success">Print</a>
                                <a href="<?php echo e(url('school/invoices/'.$var->idInvoice.'/fake-print')); ?>" target="_blank" class="btn btn-sm btn-round btn-warning">Modify Print</a>
                                <button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="<?php echo e($var->idInvoice); ?>" data-type="confirm">Delete</button>
                            </td>
                        </tr>
                        <?php $i++; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
<script>
    $(document).on('click', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var id = $(this).data('id');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this invoice!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "<?php echo e(url('/school/invoices/')); ?>" +"/"+id                       
            })
            .done(function(data) {
                if(data.success == "FAILED"){
                    swal({
                        title: "Cannot be deleted", 
                        text: "Failed to delete invoice as relation exists", 
                        type: "error"
                    },function() {
                    });   
                }else{
                    swal({
                        title: "Deleted", 
                        text: "Invoice has been successfully deleted", 
                        type: "success"
                    },function() {
                        location.reload();
                    });
                }
                
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7