<script>
    $(document).ready(function (){
        $('#req-payment-details').DataTable( {
            dom: 'lBfrtip',
            buttons: [
                { extend: 'excel', className: 'download-buttons'},
                { extend: 'pdf', className: 'download-buttons'},
            ]
        } );
    });
    var c = document.getElementsByClassName("cr");
    for (var i = 0; i < c.length; i++) {
        c[i].innerHTML = (i+1)+".";
    }
</script>
<style>
    #req-payment-details th, td {
        text-align: left;
        padding: 5px;
    }
    #req-payment-details tr:hover {background-color: #999ebe;}
</style>
<div class="error" style="text-align: center;">On this Window, you can view How a Bill was Paid</div>
<div class="guestDetails_inputDivider"></div>
<table style="width: 50%; border-collapse: collapse; padding: 5px">
    <tr>
        <th>Bill Invoice Number:</th>
        <td><b class="error"><?php echo strtoupper($bill->ref); ?></b></td>
    </tr>
    <tr>
        <th>Bill Narration:</th>
        <td><b class="error"><?php echo strtoupper($bill->narration); ?></b></td>
    </tr>
    <tr>
        <th>Date Created:</th>
        <td><b><?php echo e(date('d-m-Y', strtotime($bill->created_at))); ?></b></td>
    </tr>
    <tr>
        <td>
            <button type="button" class="navButtons" style="background-color: #d9ffff;color: black; margin-bottom: 0;font-weight: bold; min-width: 200px ;font-size: 14px">Bill Bal:
                <b class="error" style="margin-left: 10px">
                    <?php echo e(number_format($bill->amount - abs($bill->billPaidAmount($bill->id)),2)); ?>

                </b>
            </button>
        </td>
    </tr>
</table>
<div class="guestDetails_inputDivider"></div>
<table id="req-payment-details" style="width: 100%; border-collapse: collapse; ">
    <thead>
    <tr style="background-color: #a1b5d3">
        <th>No</th>
        <th>PV No.</th>
        <th>PV Type</th>
        <th>Paid From</th>
        <th>GL Account</th>
        <th>Paid To</th>
        <th>Mode</th>
        <th>REF</th>
        <th>Narration</th>
        <th>Amount Paid</th>
        <th>Date Paid</th>
        <th>Date of Payment</th>
        <th>User</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
    <?php $__currentLoopData = $paidReqs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php if($row->payment): ?>
            <tr>
                <td class="cr"></td>
                <td><a href="<?php echo e(url('payment/'.$row->payment->stamp.'/finance?type=summary')); ?>" class="inner"><b class="error">PV<?php echo e($row->payment->pv_id); ?></b></a></td>
                <td><?php echo e($row->payment->type); ?></td>
                <td>
                    <b>
                        <?php if($row->payment->account != null): ?>
                            <?php echo strtoupper($row->payment->account->acc_name); ?>

                        <?php endif; ?>
                    </b>
                </td>
                <td>
                    <b>
                        <?php if($row->payment->glAccount != null): ?>
                            <?php echo strtoupper($row->payment->glAccount->acc_name); ?>

                        <?php endif; ?>
                    </b>
                </td>
                <td>
                    <?php if($row->payment->type == 'refund-premium'): ?>
                        <?php if($row->payment->client != null): ?>
                            <?php echo strtoupper($row->payment->client->nms); ?>

                        <?php endif; ?>
                    <?php elseif($row->payment->type == 'remit-premium'): ?>
                        <?php if($row->payment->insurer != null): ?>
                            <?php echo strtoupper($row->payment->insurer->nm); ?>

                        <?php endif; ?>
                    <?php else: ?>
                        -
                    <?php endif; ?>
                </td>

                <td>
                    <?php if($row->payment->modeOfPayment != null): ?>
                        <?php echo $row->payment->modeOfPayment->name; ?>

                        <?php if($row->payment->subModeOfPayment != null): ?>
                            - <?php echo $row->payment->subModeOfPayment->name; ?>

                        <?php endif; ?>
                    <?php endif; ?>
                </td>
                <td><?php echo $row->payment->ref; ?></td>
                <td><?php echo $row->payment->nar; ?></td>
                <td><b><?php echo number_format($row->payment->amount,2); ?></b></td>
                <td><?php echo e(date('d/m/Y', strtotime($row->payment->pv_date))); ?></td>
                <td><?php echo e(date('d/m/Y', strtotime($row->payment->created_at))); ?></td>
                <td>
                    <?php if($row->payment->user != null): ?>
                        <?php echo $row->payment->user->firstName[0].". ".$row->payment->user->lastName; ?>

                    <?php endif; ?>
                </td>
                <td><a href="<?php echo e(url('payment-pdf/'.$row->payment->stamp.'/AddWatermark')); ?>" class="inner" target="_blank"><i class="fa fa-print error" style="font-size: 16px"></i></a></td>
            </tr>
        <?php endif; ?>

    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody>
    <tfoot>
    <tr style="background-color: #a1b5d3">
        <th>No</th>
        <th>PV No.</th>
        <th>PV Type</th>
        <th>Paid From</th>
        <th>GL Account</th>
        <th>Paid To</th>
        <th>Mode</th>
        <th>REF</th>
        <th>Narration</th>
        <th>Amount Paid</th>
        <th>Date Paid</th>
        <th>Date of Payment</th>
        <th>User</th>
        <th></th>
    </tr>
    </tfoot>
</table>
<?php /**PATH /home/zedarroot/public_html/edwulp/resources/views/finance/bills/view-bill-payment-details.blade.php ENDPATH**/ ?>