<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Pump Pending Slip Report | {{  $business_name->value }}</title>
    <style>
        .table,
        .tcell,
        .thead {
            border: 1px solid black;
        }

        .table {
            width: 100%;
            border-collapse: collapse;
        }

    </style>
</head>

<body>
<div>
    <div style="text-align: center">
        <h1>{{  $business_name->name }}</h1>
        {{-- <h1><img src="{{ public_path('assets/images/Logo_sadiq.png') }}" alt="" width="200"></h1> --}}
    </div>
    <div style="text-align: center;">
        <h4> Pump Pending Slip Report</h4>
    </div>
    <div style="text-align: right;">
        <span style="font-weight: bold">From Date:</span> <span
            style="text-decoration: underline">{{ date("M j, Y",strtotime($starting_date)) }}</span>
    </div>
    <div style="text-align: right; margin-top:10px;">
        <span style="font-weight: bold">To Date:</span> <span
            style="text-decoration: underline">{{ date("M j, Y",strtotime($ending_date)) }}</span>
    </div>
</div>
<br>
<table class="table">
    <thead>
    <tr>
        <th class="thead">#</th>
        <th class="thead">Date</th>
        <th class="thead">Slip No.</th>
        <th class="thead">Description</th>
        <th class="thead">Amount</th>

    </tr>
    </thead>
    <tbody>
    @php
        $iteration =0;
            $total = 0;
    @endphp
    @php
        $sub_total=0;
    @endphp
    <tr>
        <td class="thead" colspan="5"><b><u>{{ $vehicle->vehicle_no }}</u></b></td>
    </tr>
    @foreach($vehicle->tripOils as $oil)
        @php
            $iteration +=1;
            $pending_amount = $oil->total_amount;
            if($oil->short_amount >0){
                   $pending_amount = $oil->short_amount;
            }
            $sub_total +=$pending_amount;
        @endphp
        <tr>
            <td class="thead">{{$iteration }}</td>
            <td class="thead">{{ date("M j, Y",strtotime($oil->date)) }}</td>
            <td class="thead">{{ $oil->slip_number }}</td>
            <td class="thead">{{ ucwords($oil->payment_type)  }} {{ ucwords($oil->oil_type) }} in
                Trip {{ $oil->trip_id }}
                from {{ $oil->pump->name }}</td>
            <td class="thead">{{ number_format($pending_amount,0) }}</td>
        </tr>
    @endforeach
    <tr>
        <td class="thead" colspan="4" style="text-align: right;"><u><b>Sub Total:</b></u></td>
        <td class="thead" colspan=""><u>{{ number_format($sub_total,0) }}</u></td>
    </tr>
    @php
        $total +=$sub_total;
    @endphp
    </tbody>
    <tr>
        <td class="thead" colspan="4" style="text-align: right;"><u><b>Grand Total:</b></u></td>
        <td class="thead" colspan=""><u>{{ number_format($total,0) }}</u></td>
    </tr>
</table>

{{-- <div>
<div style="text-align: right;">
    Total: {{ $data['total_amount'] }}
</div>
</div> --}}
</body>

</html>
