<table id="receiptsTable" style="width: 100%; border-collapse: collapse">
    <thead>
    <tr style="background-color: #a1b5d3">
        <th>No.</th>
        <th>Receipt No</th>
        <th>Type</th>
        <th>Mode of Payment</th>
        <th>Ref</th>
        <th>Date Paid</th>
        <th>Amount Paid</th>
        <th>User</th>
        <th>Document</th>
    </tr>
    </thead>
    <tbody>
    @if(count($plcy->allocatedPremiums) > 0)
        @foreach($plcy->allocatedPremiums as $row)
            <tr>
                @if($row->type == 'DPV')
                    <td class="dr"></td>
                    <td><a href="{{url('direct-payment-voucher/'.$row->OriginalDirectPayment->stamp.'/finance?type=summary')}}" class="inner" style="color: red; font-weight: bold" >{{$row->type.$row->type_id}}</a></td>
                    <td>DIRECT PAYMENT VOUCHER</td>
                    <td>
                        @if($row->OriginalDirectPayment->modeOfPayment != null)
                            {{$row->OriginalDirectPayment->modeOfPayment->name}}
                            @if($row->OriginalDirectPayment->subModeOfPayment != null)
                                - {{$row->OriginalDirectPayment->subModeOfPayment->name}}
                            @endif
                        @endif
                    </td>
                    <td>{{$row->OriginalDirectPayment->ref}}</td>
                    <td>{{date('d/m/Y', strtotime($row->OriginalDirectPayment->pv_date))}}</td>
                    <td><b>{{number_format($row->amount,2)}}</b></td>
                    <td>
                        @if($row->user != null)
                            {{$row->user->firstName[0].". ".$row->user->lastName}}
                        @endif
                    </td>
                    <td><a href="{{url('direct-payment-voucher-pdf/'.$row->OriginalDirectPayment->stamp)}}" class="inner" style="color: red; font-weight: bold" >Direct PV</a></td>
                @elseif($row->type == 'RCT')
                    <td class="dr"></td>
                    <td><a href="{{url('receipt/'.$row->OriginalReceipt->stamp.'/finance?type=summary')}}" class="inner" style="color: red; font-weight: bold" >{{$row->type.$row->type_id}}</a></td>
                    <td>PREMIUM PAYMENT RECEIPT</td>
                    <td>
                        @if($row->OriginalReceipt->modeOfPayment != null)
                            {{$row->OriginalReceipt->modeOfPayment->name}}
                            @if($row->OriginalReceipt->subModeOfPayment != null)
                                - {{$row->OriginalReceipt->subModeOfPayment->name}}
                            @endif
                        @endif
                    </td>
                    <td>{{$row->OriginalReceipt->ref}}</td>
                    <td>{{date('d/m/Y', strtotime($row->OriginalReceipt->rct_date))}}</td>
                    <td><b>{{number_format($row->amount,2)}}</b></td>
                    <td>
                        @if($row->user != null)
                            {{$row->user->firstName[0].". ".$row->user->lastName}}
                        @endif
                    </td>
                    <td><a href="{{url('receipt-pdf/'.$row->OriginalReceipt->stamp)}}" class="inner" style="color: red; font-weight: bold" >Receipt</a></td>
                @endif
            </tr>
        @endforeach

    @endif

    </tbody>
    <tfoot>
    <tr style="background-color: #a1b5d3">
        <th>No.</th>
        <th>Receipt No</th>
        <th>Type</th>
        <th>Mode of Payment</th>
        <th>Ref</th>
        <th>Date Paid</th>
        <th>Amount Paid</th>
        <th>User</th>
        <th>Document</th>
    </tr>
    </tfoot>

</table>
