      <div class="row clear">
          <table border="1" style="border-collapse: collapse; margin-top:3%; text-align: center; width:100%;">
            <thead>
              <tr>
              <th colspan="7" style="background: #E0E0E0; ">Payment History</th>
                
              </tr>
              <tr>

                 <th style ="width:5%;" >Sr. </th>
                 <th>Description</th>

                  <th>Debit</th>

                  <th>Credit</th>

                  <th>Balance</th>

                  <th>Status</th>

                  <th style="width: 15%;">Date</th>
              </tr>
              
              
            </thead>
            <tbody>
              <tr>
                <?php ($calculate_credit = $booking->agreed_amount); ?>
                <?php ($debit =$booking->agreed_amount); ?>
                <?php ($credit = 0); ?>
                <td>1</td>
                <td> Opening Balance</td>
                <td><?php echo e(EF::numberFormat($booking->agreed_amount)); ?></td>
                <td><?php echo e(EF::numberFormat(0)); ?> </td>
                <td><?php echo e(EF::numberFormat($booking->agreed_amount)); ?></td>
                <td>   </td>
                 <td>  </td>

                </tr>
            
                <?php $__currentLoopData = $payment; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                <td><?php echo e(($loop->iteration)+(1)); ?></td>
                 <td><?php echo e($rows->description); ?></td>

                 <?php if($rows->status == "Approve" || $rows->status == "Unpprove"): ?>
                  <td><?php echo e(EF::numberFormat(0)); ?></td>
                  <td><?php echo e(EF::numberFormat($rows->amount)); ?></td>
                 
                 <?php ($calculate_credit = $calculate_credit - ($rows->amount)); ?>
                  <?php ($credit = $credit + ($rows->amount)); ?>


                 
                 <?php elseif($rows->status == "Reversal"): ?>
                  <td><?php echo e(EF::numberFormat($rows->amount)); ?></td>
                  <td><?php echo e(EF::numberFormat(0)); ?></td>

                  <?php ($calculate_credit = $calculate_credit + ($rows->amount)); ?>
                  <?php ($debit = $debit + ($rows->amount)); ?>
                <?php else: ?>
                <td></td>
                <td></td>
                


                  
                 <?php endif; ?>
                
                <td><?php echo e(EF::numberFormat($calculate_credit)); ?></td>
                <td><?php echo e($rows->status); ?></td>
                <td> <?php echo e(EF::dateFormat($rows->created_at)); ?>

              </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <tr>
                   <th colspan="2" style="background: #E0E0E0; ">Total</th>
                 <th  style="background: #E0E0E0; "><?php echo e(EF::numberFormat($debit)); ?></th>
                  <th  style="background: #E0E0E0; "><?php echo e(EF::numberFormat($credit)); ?></th>
                   <th colspan="3"  style="background: #E0E0E0; "><b>Balance : <?php echo e(EF::numberFormat($debit-$credit)); ?> </b></th>
              

                  </tr>
            </tbody>
            
          </table>
      </div><?php /**PATH /var/www/skylite/resources/views/documents/payment_history.blade.php ENDPATH**/ ?>