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

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Print</title>
    <!-- Google Font: Source Sans Pro -->
    
<style>
   /*@page { size: 1000pt 0pt; }*/
   /*embed{*/
   /*    width="1000px";*/
   /*    height="500px";*/
   /*}*/
   th{
       background-color:orange;
       text-align:left;
   }
   td{
       border-left:1px solid grey;
       border-bottom:1px solid grey;
   }
   .logo img{
       width:300px;
       margin:0 auto;
   }
   .table{
      align:center;
      margin-left:150px;
   }
</style>
</head>

<body class="abc">

   <div class="logo">
       
            <center> <img src="<?php  echo $pic ?>"   ></center>
        </div>

          <table  class="table table-bordered table-striped">
                <thead >
                  <tr>
                    <th style="width:30px">Sl.no</th>
              
                    <th>Slip No</th>
                    <th>Supplied Date</th>
                    <th >Customer</th>
                    <th >Invoice No</th>
                    <th >Gallon</th>
                    <th >Bill Amount</th>
                    <th >Payment Date</th>
                     <th >Paid Amount</th>
                     <th>Devided Amount</th>
                      <th>Balance Due</th>
                 </tr>
                </thead>
              <tbody>
        @php
         $i=1;
         $qty=0;
         $total=0;
         @endphp
         @foreach($data as $dat)
         @php
       
         $qty=App\Models\SellLines::where('transaction_id','=',$dat['transaction_id'])->sum('quantity');
         $balance = DB::table('transaction_payment')->where('transaction_payment.transaction_id', '=', $dat['tra_id'])->sum('transaction_payment.amount');
            $pay_status = round($dat['bill_amount'], 2) - round($balance, 2);
         $total+=round($dat['devided_amount'],3);
         @endphp
     
         <tr>
             <td>{{$i}}</td>
             <td>SRK :-{{$dat['transaction_id']}}</td>
             <td>{{date('d-m-Y',strtotime($dat['transaction_date']))}}</td>
             <td>{{$dat['company_name']}}</td>
             <td>{{$dat['ledger']}} - {{$dat['ledger_value']}}</td>
             <td>{{$qty}}</td>
             <td>{{round($dat['bill_amount'],2)}}</td>
             <td>{{date('d-m-Y',strtotime($dat['payment_date']))}}</td>
             <td>{{$dat['paid_amount']}}</td>
             <td>{{round($dat['devided_amount'],2)}}</td>
             <td>{{round($pay_status,1)}}</td>
         </tr>
   
         @php
         $i++;
         @endphp
         @endforeach
         
         
               </tbody>
                      <tfoot>

              <tr class="bg-gray font-17  footer-total">
              <td  ><strong>Total:</strong></td>
              <td></td>
           <td></td><td></td>
           <td></td>
           <td></td>
           <td></td>
           <td></td>
               <td></td>
           <td>{{$total}}</td>
             <td></td>
              </tr>
              </tfoot>
              </table>




</body>

</html>
