<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

@foreach($cus as $cuse)
@php $deli=0; $tot=0; $unit=0; @endphp
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;
  <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcSvU-Lq5SDZ7cz4aQFyikuKFKil0sC6Bb6bpw&usqp=CAU"   alt="logo">

    <div class="row">
        <div class="col-xs-1 col-md-1"></div>
        <div class="col-xs-7 col-md-7"><h5>Customer Name : {{$cuse->name}} 
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Date : {{$ldate}}</h5></div>
    </div>
    <div class="row">
    <div class="col-xs-4 col-md-4"><h5><a id="date"></a></h5></div>
    </div>
<br>

 <table class="table" id="book-table" name="book-table">
            <thead>
                  <tr>
                    <th style="width:60px" class="text-center">QTY</th>
                    <th class="text-left">DESCRIPTION</th>
                    <th style="width:140px" class="text-right">UNIT PRICE</th>
                    <th style="width:90px" class="text-right">TOTAL</th>
   
                  </tr>
            </thead>
            <tbody>
                    
            @foreach($cuse->cus_or as $data) 
                    <tr>
                        <td class="text-center">{{ $data->qty }}</td>
                        <td>{{ $data->orders->name }}
                        @if($data->attribute=="null" or $data->attribute=="")
                        @else
                            @foreach (json_decode($data->attribute) as $key => $val)
                                ({{$key }}:{{$val}})
                            @endforeach
                        @endif
                        </td>
                        <td class="text-right">{{ $data->orders->sell_price }}</td>
                        <td class="text-right"> {{ $data->qty * $data->orders->sell_price }}
                        </td>
                        <input type="hidden" value="">
                    </tr>
                    @php $deli+=$data->delivery;
                    $unit = ($data->orders->sell_price)*($data->qty);
                    $tot += $unit;
                    @endphp
            
                @endforeach
                    <tr>
                            <td colspan="2" rowspan="4">
                             
                              <td class="text-right"><strong>Delivery Charge</strong></td>
                              <td class="text-right">{{ $deli  }}  </td>
                          </tr>

                          <tr>
                            <td class="text-right no-border">
                              <strong>Total</strong>
                            </td>
                            <td class="text-right"><strong>{{ $tot+$deli }}</strong></td>
                          </tr>
            </tbody>
        </table>   
@endforeach


@foreach($cus as $cuse)
@php $deli=0; $tot=0; $unit=0; @endphp

            <div class="row" style="margin: -6mm 0mm 0mm -4mm;">
                <div class="col-xs-6 col-md-6">
                    <h2 style="text-align:center">PROOF OF DELIVERY</h2>
                   
                    <img src="https://i.ibb.co/nQHkBWp/dailuy.png" style="width: 200px;"  alt="logo">
                    
                    <img src="https://i.ibb.co/nQHkBWp/dailuy.png" style="width: 110px;"  alt="logo">
                    
                    <h5>Contact Number : {{$cuse->id}}</h5>
                    
                    
                    <h5>Issued Date : {{$ldate}} </h5>
                    <hr style='margin-top:0em;margin-bottom:0em'>
                    <h5>To : {{$cuse->name}}</h5>
                    <h5>Address : {{$cuse->address}}</h5>
                    <h5>Phone No : {{$cuse->phone}}</h5>
                   
                </div>
                <div class="col-xs-4 col-md-4">
                  
                    <br><br><br><br>
                @foreach($cuse->cus_or as $data) 
                    @php $deli+=$data->delivery;
                    $unit = ($data->orders->sell_price)*($data->qty);
                    $tot += $unit;
                    @endphp
                @endforeach
                  <h4>COD AMOUNT :  {{ $tot+$deli }}</h4>
                  <h6>Order No : {{$cuse->id}}</h6>
                  <h6>Weight : </h6>
                  <hr style='margin-top:0em;margin-bottom:0em'>
                  <h6>Name ; </h6>
                  <h6>Address : </h6>
                  <h6>NIC Number : </h6>
                  <h6>Date : </h6>
                  <h6>Signature : </h6>
                  <h6>Deliverd : Yes :  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;     No :</h6>
                </div>
                <div class="col-xs-2 col-md-2"></div>
               
            </div>
            <div class="row" style="margin: -0mm 0mm 0mm -4mm;">
                <div class="col-xs-10 col-md-10">
                    <hr style='margin-top:0em;margin-bottom:0em'>
                </div>
                <div class="col-xs-2 col-md-2">

                </div>  
            </div>
            <div class="breakNow"></div>
@endforeach
