<?php echo $__env->make('dashboard.include.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

  
  <div class="content-wrapper">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">Reseller Received Orders</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/home">Home</a></li>
              <li class="breadcrumb-item active">Reseller Received COD</li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">
      <div class="card">
        <div class="card-body">
        <div class="row">
          <div class="col-md-12">
          <?php $__currentLoopData = $paymere; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>  
            <table class="table borderless"  border="0">
                <tbody>
                    <tr>
                    <td class="text-left"><b>Resller Name - </b>  <?php echo e($data->getresellerd2->companyname); ?></td>
                    <td class="text-center"><b>Genrate By - </b>  <?php echo e($data->genratedby); ?></td>
                    <td class="text-right"><b>Status - </b> <?php if($data->status == 0): ?> Not Paid <?php else: ?> Paid <?php endif; ?> </td>
                    <td class="text-right"><b>Paid Date - </b> <?php echo e($data->paiddate); ?></td>
                    </tr>
                </tbody>
            </table>  
            <table class="table borderless"  border="0">
                <tbody>
                    <tr>
                    <td class="text-left"><b>Collected COD - </b>  <?php echo e($data->collectedcod); ?></td>
                    <td class="text-right"><b>Delivery Charge - </b> <?php echo e($data->deliverycharge); ?> </td>
                    <td class="text-right"><b>Service Charge - </b> <?php echo e($data->servicecharge); ?></td>
                    <td class="text-right"><b>Products Charge - </b> <?php echo e($data->productscharge); ?></td>
                    <td class="text-right"><b>Payable COD - </b> <?php echo e($data->paidamount); ?> </td>
                    </tr>
                </tbody>
            </table> 
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
          </div>

        </div>
      </div>
        <div class="card">
        <div class="card-body">
            <div class="col-md-12">
            <table id="example12" class="table table-bordered" style="width:100%;">
                    <thead>
                        <tr>
                            <th>Invoice ID</th>
                            <th>Status</th>
                            <th>Weight (KG)</th>
                            <th>COD</th>
                            <th>Delivery Charge</th>
                            <th>Service Charge</th>
                            <th>Product Charge</th>
                            <th>Net Payable</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $item; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php $deli=0; $tot=0; $unit=0; ?>
                        <?php $__currentLoopData = $data->cus_or; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cudata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> 
                            <?php
                            $unit = ($cudata->orders->cost)*($cudata->qty);
                            $tot += $unit;
                            ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <td><a target="_blank"  href="viewallorders/<?php echo e($data->id); ?>"><?php echo e($data->id); ?></a></td>
                            <td>
                            <?php if($data->status == 33): ?>
                            <span class="badge badge-success">Received to Seller</span>
                            <?php elseif($data->status == 34): ?>
                            <span class="badge badge-danger">Return to Seller</span>
                            <?php elseif($data->status == 36): ?>
                            <span class="badge badge-dark">Refund to Seller</span>
                            <?php endif; ?>
                            </td>
                            <td><?php echo e($data->weight); ?></td>
                            <td>
                            <?php if($data->status == 33 ): ?>
                            <?php echo e($data->cod); ?>

                            <?php elseif($data->status == 34): ?>
                            0
                            <?php elseif($data->status == 36): ?>
                            -<?php echo e($data->cod); ?>

                            <?php endif; ?>
                            </td>
                            <td>
                            <?php if($data->status == 33 OR $data->status == 36): ?>
                            <?php echo e($data->orderdelivery); ?>

                            <?php elseif($data->status == 34): ?>
                            0
                            <?php endif; ?>
                            </td>
                            <td><?php echo e(100); ?></td>
                            <td><?php echo e($tot); ?></td>
                            <td>
                            <?php if($data->status == 33): ?>
                            <?php echo e($data->cod - ($data->orderdelivery+100+$tot)); ?>

                            <?php elseif($data->status == 34): ?>
                            <?php echo e(0 - 100); ?>

                            <?php elseif($data->status == 36): ?>
                            0
                            <?php endif; ?>
                            </td>
                        </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                    </tbody>
                </table>
            </div>
        </div>
        </div>
      

     

      </div>
    </section>
  </div>



  <?php echo $__env->make('dashboard.include.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;

<script>
$('#reservationdate').datetimepicker({
    format: 'YYYY/MM/DD'
    });


$(document).ready(function() {
    $('#example12').DataTable({
        "responsive": true, "lengthChange": true, "autoWidth": false,"order": [[ 0, "asc" ]],
      // "buttons": ["copy", "csv", "excel", "pdf", "print"]
      "buttons": [ {extend: 'copy',footer: true,exportOptions: {columns: [0,1,2,3,4,5,6,7,8]}},   
      {extend: 'csv',footer: true,exportOptions: {columns: [0,1,2,3,4,5,6,7,8]}},
      {extend: 'excel',footer: true,exportOptions: {columns: [0,1,2,3,4,5,6,7,8]}},
      {extend: 'pdf',footer: true,exportOptions: {columns: [0,1,2,3,4,5,6,7,8]}},
      {extend: 'print',footer: true,exportOptions: {columns: [0,1,2,3,4,5,6,7,8]}},      
    ],


    }).buttons().container().appendTo('#example12_wrapper .col-md-6:eq(0)');
} );

</script>