      <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>{{EF::numberFormat($booking->agreed_amount)}}</td>
                <td>{{EF::numberFormat(0)}} </td>
                <td>{{EF::numberFormat($booking->agreed_amount)}}</td>
                <td>   </td>
                 <td>  </td>

                </tr>
            
                @foreach($payment as $rows)
                <tr>
                <td>{{($loop->iteration)+(1)}}</td>
                 <td>{{$rows->description}}</td>

                 @if($rows->status == "Approve" || $rows->status == "Unpprove")
                  <td>{{EF::numberFormat(0)}}</td>
                  <td>{{EF::numberFormat($rows->amount)}}</td>
                 
                 @php($calculate_credit = $calculate_credit - ($rows->amount))
                  @php($credit = $credit + ($rows->amount))


                 
                 @elseif($rows->status == "Reversal")
                  <td>{{EF::numberFormat($rows->amount)}}</td>
                  <td>{{EF::numberFormat(0)}}</td>

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


                  
                 @endif
                
                <td>{{EF::numberFormat($calculate_credit)}}</td>
                <td>{{$rows->status}}</td>
                <td> {{EF::dateFormat($rows->created_at)}}
              </tr>
                @endforeach
                <tr>
                   <th colspan="2" style="background: #E0E0E0; ">Total</th>
                 <th  style="background: #E0E0E0; ">{{EF::numberFormat($debit)}}</th>
                  <th  style="background: #E0E0E0; ">{{EF::numberFormat($credit)}}</th>
                   <th colspan="3"  style="background: #E0E0E0; "><b>Balance : {{EF::numberFormat($debit-$credit)}} </b></th>
              

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