
    <table style="margin-bottom: 25px; border: none;">
        <tbody>
            <tr>
                <td>{{$supplier->name}}</td>
                <td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
            </tr>
        </tbody>
    </table>
<br>
<table style="width:100%">
    <tbody>
        <tr>
            <td>Reference</td>
            <td>Marking</td>
            <td>Rate</td>
            <td>Amount</td>
            <td>Bank in Details</td>
        </tr>
        @foreach($transactions as $transaction)
            <tr style="margin-bottom: 10px;">
                @php
                    $bank = $transaction->owner->owner->bank;
                    if($transaction->owner->bank){
                        $bank = $transaction->owner->bank;
                    }
                @endphp
                <td>{{$transaction->owner->owner->marking}}</td>
                <td>{{$transaction->owner->owner->company->reference}}</td>
                <td>{{$transaction->currency_rate}}</td>
                <td>{{$transaction->currency->short_code}} {{number_format((float)$transaction->amount, 2, '.', '')}}</td>
                <td>Account Holder Name: {{$bank->holder_name}}<br>{{$bank->bank_name}}: {{$bank->account_no}}
                    <br>Branch: {{$bank->bank_branch}}@if($transaction->original_currency->short_code === 'USD')<br>Swift Code: {{$bank->swift}}@endif<br>Bank in Amount: {{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
            </tr>
        @endforeach
    </tbody>
</table>
<table style="margin-bottom: 25px; border: none;">
    <tbody>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Sub total booking amount: </td>
            @php
            $sub_total_booking_amount = number_format((float)$transactions->sum('original_amount'), 2, '.', '');
            @endphp
            <td>{{$transaction->original_currency->short_code}} {{$sub_total_booking_amount}}</td>
        </tr>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Transfer fee: </td>
            @php
            $transfer_fee = number_format((float)$transferFeeTransactions->sum('service_charge'), 2, '.', '');
            @endphp
            <td>{{$transaction->original_currency->short_code}} {{$transfer_fee}}</td>
        </tr>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Total booking amount: </td>
            @php
            $total_booking_amount = number_format((float) ($transactions->sum('original_amount') + $transfer_fee), 2, '.', '');
            @endphp
            <td>{{$transaction->original_currency->short_code}} {{$total_booking_amount}}</td>
        </tr>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Sub total amount: </td>
            @php
            $sub_total_amount = number_format((float)$transactions->sum('amount') + ($transfer_fee * 1/$transactions[0]->currency_rate), 2, '.', '');
            @endphp
            <td>MYR {{$sub_total_amount}}</td>
        </tr>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Service charge: </td>
            @php
            $service_charge = number_format((float)$transactions->sum('service_charge'), 2, '.', '');
            @endphp
            <td>MYR {{$service_charge}}</td>
        </tr>
        <tr>
            <td width="70%" style="text-align: right;" colspan="4">Total amount: </td>
            @php
            $total_amount = number_format((float)$sub_total_amount + $service_charge, 2, '.', '');
            @endphp
            <td>MYR {{$total_amount}}</td>
        </tr>
    </tbody>
</table>
