
    @isset($journal_list)
    @php($count = 0)
    @php($row_balance=0)

    @foreach($journal_list as $rows)

    @php($user           = $rows->user)
    @php($payment        = $rows->payment)
    @php($booking        = $rows->booking)
    @php($plot           = $booking->plot)
    @php($transaction    = $rows->transaction)

    <tr>
      @if($transaction->status == "Approve"|| $transaction->status == "Reversal" )

      <td>{{++$count}}</td>
      <td>{{EF::dateFormat($rows->created_at)}}</td>
      <td>{{$transaction->voucher_type}}-{{$transaction->voucher_number}}</td>
      <td>@isset($user->id){{$user->name}}@endisset</td>
      <td>@isset($plot->id) {{EF::showPlotFormat($plot)}} | {{$rows->booking->branch->name}} @endisset</td>
      <td>{{$rows->narration}}</td>
      <td>{{$rows->mode}}</td>
      <td>{{$rows->drawn_on}}</td>
      <td>{{$rows->instrument}}</td>
      <td>{{$rows->instrument_date}}</td>
      
      <td>
        @if($transaction->status == "Approve") 
          <span class="badge badge-success">{{EF::getstatus($transaction->status)}}</span>
        @elseif($transaction->status == "Reversal") 
          <span class="badge badge-primary">{{EF::getstatus($transaction->status)}}</span>
        @else
          <span class="badge badge-warning"> {{$transaction->status}}</span>
        @endif
      </td>
      <td>{{EF::numberFormat($rows->debit)}}</td>
      <td>{{EF::numberFormat($rows->credit)}}</td>
      <td> {{EF::numberFormat((($rows->debit)-($rows->credit))+($row_balance))}}</td>
    
      @php($row_balance = (($rows->debit)-($rows->credit))+($row_balance))
    
      @if(Auth::user()->hasAnyPermission(['All','Preview Voucher','Reverse Voucher']))
      <td class="text-center" > 
        <div class="item-action dropdown" >
          <a href="javascript:void(0)" data-toggle="dropdown" class="icon"><i class="fa fa-list-ul"></i></a>
          <div class="dropdown-menu dropdown-menu-right">

            @if(Auth::user()->hasAnyPermission(['All','Update Voucher']))
                     <a onclick="showVoucher(event,this)"  href="{{route('voucher.show',['id' => Crypt::encrypt($rows->transaction->id) ])}}" class="dropdown-item"><i class="dropdown-icon fa fa-edit"></i> Update</a>
                     @endif
           
           @if(Auth::user()->hasAnyPermission(['All','Preview Voucher']))
           <a href="{{route('document.voucherpreview',['id' => Crypt::encrypt($rows->transaction_id)])}}" id="pay" class="dropdown-item" ><i class="dropdown-icon fa fa-print"></i>Print</a>
           @endif
          
           @if($rows->transaction->status == "Approve" && !isset($rows->transaction->reverseTransaction->id) && $rows->payment->payment_type != "Booking JV")
           @if(Auth::user()->hasAnyPermission(['All','Reverse Voucher']))

              @if(isset($rows->booking->id) && $rows->booking->status != "Cancel" && $rows->payment->auto_jv == 0)

                <a href="" id="{{Crypt::encrypt($rows->transaction_id)}}" class="dropdown-item " content="reverse voucher" data-toggle="modal" data-target="#md_approve_voucher" onclick="getJorunalById(this);"><i class="dropdown-icon fa fa-check"></i> Reverse</a>

              @elseif(!isset($rows->booking->id) && ($rows->payroll_id == null) && $rows->payment->auto_jv == 0)
                <a href="" id="{{Crypt::encrypt($rows->transaction_id)}}" class="dropdown-item " content="reverse voucher" data-toggle="modal" data-target="#md_approve_voucher" onclick="getJorunalById(this);"><i class="dropdown-icon fa fa-check"></i> Reverse</a>
              @endif
              
         
           @endif
           @endif   
         </div>
       </div>
     </td>
     @endif

     @endif
   </tr>
   @endforeach
   @endisset
