<style>
#header {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#header td, #customers th {
 
  padding:4px;
  font-size:10px;
}

#header tr:nth-child(even){background-color: #ffffff;}

#header tr:hover {background-color: #ddd;}

#header th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
}
</style>




<style>
#scan {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#scan td, #scan th {
 
  padding: 8px;
  font-size:11px;
}

#scan tr:nth-child(even){background-color: #ffffff;}

#scan tr:hover {background-color: #ddd;}

#scan th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
}
</style>


<style>
#scan {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#scan td, #scan th {
  border-collapse: collapse;
  padding: 8px;
  font-size:11px;
}

#scan tr:nth-child(even){background-color: #ffffff;}

#scan tr:hover {background-color: #ddd;}

#scan th {
  border-collapse: collapse;
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
}
</style>



<style>
#details {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
  border:1px solid black;
  
}

#details td, #details th {
 
  padding: 8px;
  font-size:11px;
  text-align:center;
  border:1px solid black;

  
}

#details tr:nth-child(even){background-color: #ffffff;}

#details tr:hover {background-color: #ddd;}

#details th {
  padding-top: 12px;
 font-style:bold;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
  border:1px solid black;
}
</style>

<style>
#sign {
  font-family: Arial, Helvetica, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

#sign td, #sign th {

  padding: 8px;
  font-size:11px;
  text-align: center;
}

#sign tr:nth-child(even){background-color: #ffffff;}

#sign tr:hover {background-color: #ddd;}

#sign th {
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: left;
  padding:4px;
  color:black;
}
</style>








<table id="header">
  <tr>
    <th rowspan="4"  style="width:50px"><br><img src="{{ asset('img/ARRAHN1.png') }}" style="width:70px"></img></th>
    <th colspan="1">KOPERASI PERMODALAN KELANTAN BERHAD</th>
  </tr>
  <tr>
    <td>{{ $cawangan_detail['namacaw'] }}</td>
    <td></td>
  </tr>
  <tr>
    <td>{{ $cawangan_detail['alamat1'] }}</td>
    <td></td>
  </tr>
  <tr>
    <td>{{ $cawangan_detail['alamat2'].' No Tel : '. $cawangan_detail['notel'].' No Faks : '. $cawangan_detail['nofaks'] }}</td>
    <td></td>
  </tr>
</table>
<br>

<table id="scan">
  <tr>
    <th colspan ="5"><b>Laporan Kawalan Stok</b></th>
    <th> </th>
    <th> </th>
    <th><b> Tarikh Cetak:</b>
        @php 
          $myDateTime = DateTime::createFromFormat('Y-m-d', $tarikh_cetak);
          $formattedweddingdate = $myDateTime->format('d-m-Y');
          echo($formattedweddingdate)
        @endphp
    </th>
    <th></th>
  </tr>
  <tr>
    <td style="width:10px"> <b>TARIKH</b></td>
    <td>@php 
          $myDateTime = DateTime::createFromFormat('Y-m-d', $tebus_date);
          $formattedweddingdate = $myDateTime->format('d-m-Y');
          echo($formattedweddingdate)
        @endphp</td>
    <td style="width:50px">   
    </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>

<br>
<table id="details">
  <tr>
    <th colspan="2" style="text-align: center;">Nilai Marhun</th>
    <th colspan="2" style="text-align: center;">RM1.00 - RM400.99</th>
    <th colspan="2" style="text-align: center;">RM401.00 - RM2,000.99</th>
    <th colspan="2" style="text-align: center;">RM2,001.00 - RM1,000,000.00</th>
    <th colspan="2" style="text-align: center;">Jumlah</th>
  </tr>
  <tr>
    <th colspan="2"></th>
    <th style="text-align: center;">Bil</th>
    <th style="text-align: center;">Pembiayaan</th>
    <th style="text-align: center;">Bil</th>
    <th style="text-align: center;">Pembiayaan</th>
    <th style="text-align: center;">Bil</th>
    <th style="text-align: center;">Pembiayaan</th>
    <th style="text-align: center;">Bil</th>
    <th style="text-align: center;">Pembiayaan</th>
  </tr>
  @php $counter = 1;@endphp

    <tr>
      <td>Pembiayaan</td>
      <td>
        <span>Baki C/F</span><br>
        <span>Hari Ini</span><br>
        <span>Jumlah</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai1'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[0]['gadaiini1'][0]['bil']) }}</span><br>
        <span>{{ $gad1 = ($kawalanstok[0]['gadai1'][0]['bil'] + $kawalanstok[0]['gadaiini1'][0]['bil']) }}</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai1'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[0]['gadaiini1'][0]['pinj']),2) }}</span><br>
        <span>@php $gadpinj1 = ($kawalanstok[0]['gadai1'][0]['pinj'] + $kawalanstok[0]['gadaiini1'][0]['pinj']); echo number_format($gadpinj1,2) @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai2'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[0]['gadaiini2'][0]['bil']) }}</span><br>
        <span>@php $gad2 = ($kawalanstok[0]['gadai2'][0]['bil'] + $kawalanstok[0]['gadaiini2'][0]['bil']); echo number_format($gad2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai2'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[0]['gadaiini2'][0]['pinj']),2) }}</span><br>
        <span>@php $gadpinj2 = ($kawalanstok[0]['gadai2'][0]['pinj'] + $kawalanstok[0]['gadaiini2'][0]['pinj']); echo number_format($gadpinj2,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai3'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[0]['gadaiini3'][0]['bil']) }}</span><br>
        <span>@php $gad3 = ($kawalanstok[0]['gadai3'][0]['bil'] + $kawalanstok[0]['gadaiini3'][0]['bil']); echo number_format($gad3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[0]['gadai3'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[0]['gadaiini3'][0]['pinj']),2) }}</span><br>
        <span>@php $gadpinj3 = ($kawalanstok[0]['gadai3'][0]['pinj'] + $kawalanstok[0]['gadaiini3'][0]['pinj']); echo number_format($gadpinj3,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalbilgadaikeseluruhan = $kawalanstok[0]['gadai1'][0]['bil'] + $kawalanstok[0]['gadai2'][0]['bil'] + $kawalanstok[0]['gadai3'][0]['bil']; echo number_format($totalbilgadaikeseluruhan); @endphp</span><br>
        <span>@php $totalbilgadaisehari = $kawalanstok[0]['gadaiini1'][0]['bil'] + $kawalanstok[0]['gadaiini2'][0]['bil'] + $kawalanstok[0]['gadaiini3'][0]['bil']; echo number_format($totalbilgadaisehari); @endphp</span><br>
        <span>@php $totalbilgadai = $totalbilgadaikeseluruhan + $totalbilgadaisehari; echo number_format($totalbilgadai); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalpinjgadaikeseluruhan = $kawalanstok[0]['gadai1'][0]['pinj'] + $kawalanstok[0]['gadai2'][0]['pinj'] + $kawalanstok[0]['gadai3'][0]['pinj']; echo number_format($totalpinjgadaikeseluruhan,2); @endphp</span><br>
        <span>@php $totalpinjgadaisehari = $kawalanstok[0]['gadaiini1'][0]['pinj'] + $kawalanstok[0]['gadaiini2'][0]['pinj'] + $kawalanstok[0]['gadaiini3'][0]['pinj']; echo number_format($totalpinjgadaisehari,2); @endphp</span><br>
        <span>@php $totalpinjgadai = $totalpinjgadaikeseluruhan + $totalpinjgadaisehari; echo number_format($totalpinjgadai,2); @endphp</span>
      </td>

    </tr>
    <tr>
      <td>Penyelesaian Pem.</td>
      <td>
        <span>Baki C/F</span><br>
        <span>Hari Ini</span><br>
        <span>Jumlah</span>
      </td>
      <td style="text-align:right;">
        <span>{{ number_format($kawalanstok[1]['tebus1'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[1]['tebusini1'][0]['bil']) }}</span><br>
        <span>@php $teb1 = ($kawalanstok[1]['tebus1'][0]['bil'] + $kawalanstok[1]['tebusini1'][0]['bil']); echo number_format($teb1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[1]['tebus1'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[1]['tebusini1'][0]['pinj']),2) }}</span><br>
        <span>@php $tebpinj1 = ($kawalanstok[1]['tebus1'][0]['pinj'] + $kawalanstok[1]['tebusini1'][0]['pinj']); echo number_format($tebpinj1,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[1]['tebus2'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[1]['tebusini2'][0]['bil']) }}</span><br>
        <span>@php $teb2 = ($kawalanstok[1]['tebus2'][0]['bil'] + $kawalanstok[1]['tebusini2'][0]['bil']); echo number_format($teb2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[1]['tebus2'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[1]['tebusini2'][0]['pinj']),2) }}</span><br>
        <span>@php $tebpinj2 = ($kawalanstok[1]['tebus2'][0]['pinj'] + $kawalanstok[1]['tebusini2'][0]['pinj']); echo number_format($tebpinj2,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[1]['tebus3'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[1]['tebusini3'][0]['bil']) }}</span><br>
        <span>@php $teb3 = ($kawalanstok[1]['tebus3'][0]['bil'] + $kawalanstok[1]['tebusini3'][0]['bil']); echo number_format($teb3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[1]['tebus3'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[1]['tebusini3'][0]['pinj']),2) }}</span><br>
        <span>@php $tebpinj3 = ($kawalanstok[1]['tebus3'][0]['pinj'] + $kawalanstok[1]['tebusini3'][0]['pinj']); echo number_format($tebpinj3,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalbiltebuskeseluruhan = $kawalanstok[1]['tebus1'][0]['bil'] + $kawalanstok[1]['tebus2'][0]['bil'] + $kawalanstok[1]['tebus3'][0]['bil']; echo number_format($totalbiltebuskeseluruhan); @endphp</span><br>
        <span>@php $totalbiltebussehari = $kawalanstok[1]['tebusini1'][0]['bil'] + $kawalanstok[1]['tebusini2'][0]['bil'] + $kawalanstok[1]['tebusini3'][0]['bil']; echo number_format($totalbiltebussehari); @endphp</span><br>
        <span>@php $totalbiltebus = $totalbiltebuskeseluruhan + $totalbiltebussehari; echo number_format($totalbiltebus); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalpinjtebuskeseluruhan = $kawalanstok[1]['tebus1'][0]['pinj'] + $kawalanstok[1]['tebus2'][0]['pinj'] + $kawalanstok[1]['tebus3'][0]['pinj']; echo number_format($totalpinjtebuskeseluruhan,2); @endphp</span><br>
        <span>@php $totalpinjtebussehari = $kawalanstok[1]['tebusini1'][0]['pinj'] + $kawalanstok[1]['tebusini2'][0]['pinj'] + $kawalanstok[1]['tebusini3'][0]['pinj']; echo number_format($totalpinjtebussehari,2); @endphp</span><br>
        <span>@php $totalpinjtebus = $totalpinjtebuskeseluruhan + $totalpinjtebussehari; echo number_format($totalpinjtebus,2); @endphp</span>
      </td>
    </tr>
    <tr>
      <td>Ansuran Pembiayaan</td>
      <td>
        <span>Baki C/F</span><br>
        <span>Hari Ini</span><br>
        <span>Jumlah</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[4]['ans1']['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[4]['ansini1']['bil']) }}</span><br>
        <span>@php $ans1 = ($kawalanstok[4]['ans1']['bil'] + $kawalanstok[4]['ansini1']['bil']); echo number_format($ans1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[4]['ans1']['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[4]['ansini1']['pinj']),2) }}</span><br>
        <span>@php $anspinj1 = ($kawalanstok[4]['ans1']['pinj'] + $kawalanstok[4]['ansini1']['pinj']); echo number_format($anspinj1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[4]['ans2']['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[4]['ansini2']['bil']) }}</span><br>
        <span>@php $ans2 = ($kawalanstok[4]['ans2']['bil'] + $kawalanstok[4]['ansini2']['bil']); echo number_format($ans2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[4]['ans2']['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[4]['ansini2']['pinj']),2) }}</span><br>
        <span>@php $anspinj2 = ($kawalanstok[4]['ans2']['pinj'] + $kawalanstok[4]['ansini2']['pinj']); echo number_format($anspinj2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format(intval($kawalanstok[4]['ans3']['bil'])) }}</span><br>
        <span>{{ number_format(intval($kawalanstok[4]['ansini3']['bil'])) }}</span><br>
        <span>@php $ans3 = ($kawalanstok[4]['ans3']['bil'] + $kawalanstok[4]['ansini3']['bil']); echo number_format($ans3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[4]['ans3']['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[4]['ansini3']['pinj']),2) }}</span><br>
        <span>@php $anspinj3 = ($kawalanstok[4]['ans3']['pinj'] + $kawalanstok[4]['ansini3']['pinj']); echo number_format($anspinj3,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalbilanskeseluruhan = $kawalanstok[4]['ans1']['bil'] + $kawalanstok[4]['ans2']['bil'] + $kawalanstok[4]['ans3']['bil']; echo number_format($totalbilanskeseluruhan); @endphp</span><br>
        <span>@php $totalbilanssehari = $kawalanstok[4]['ansini1']['bil'] + $kawalanstok[4]['ansini2']['bil'] + $kawalanstok[4]['ansini3']['bil']; echo number_format($totalbilanssehari); @endphp</span><br>
       <span>@php $totalbilans = $totalbilanskeseluruhan + $totalbilanssehari; echo number_format($totalbilans); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalpinjanskeseluruhan = $kawalanstok[4]['ans1']['pinj'] + $kawalanstok[4]['ans2']['pinj'] + $kawalanstok[4]['ans3']['pinj']; echo number_format($totalpinjanskeseluruhan,2); @endphp</span><br>
        <span>@php $totalpinjanssehari = $kawalanstok[4]['ansini1']['pinj'] + $kawalanstok[4]['ansini2']['pinj'] + $kawalanstok[4]['ansini3']['pinj']; echo number_format($totalpinjanssehari,2); @endphp</span><br>
        <span>@php $totalpinjans = floatval($totalpinjanskeseluruhan + $totalpinjanssehari); echo number_format($totalpinjans,2); @endphp</span>
      </td>
    </tr>
    <tr>
      <td>Lelongan</td>
      <td>
        <span>Baki C/F</span><br>
        <span>Hari Ini</span><br>
        <span>Jumlah</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[2]['lelong1'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[2]['lelongini1'][0]['bil']) }}</span><br>
        <span>@php $lel1 = ($kawalanstok[2]['lelong1'][0]['bil'] + $kawalanstok[2]['lelongini1'][0]['bil']); echo number_format($lel1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[2]['lelong1'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[2]['lelongini1'][0]['pinj']),2) }}</span><br>
        <span>@php $lelpinj1 = ($kawalanstok[2]['lelong1'][0]['pinj'] + $kawalanstok[2]['lelongini1'][0]['pinj']); echo number_format($lelpinj1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[2]['lelong2'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[2]['lelongini2'][0]['bil']) }}</span><br>
        <span>@php $lel2 = ($kawalanstok[2]['lelong2'][0]['bil'] + $kawalanstok[2]['lelongini2'][0]['bil']); echo number_format($lel2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[2]['lelong2'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[2]['lelongini2'][0]['pinj']),2) }}</span><br>
        <span>@php $lelpinj2 = ($kawalanstok[2]['lelong2'][0]['pinj'] + $kawalanstok[2]['lelongini2'][0]['pinj']); echo number_format($lelpinj2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format(intval($kawalanstok[2]['lelong3'][0]['bil'])) }}</span><br>
        <span>{{ number_format(intval($kawalanstok[2]['lelongini3'][0]['bil'])) }}</span><br>
        <span>@php $lel3 = ($kawalanstok[2]['lelong3'][0]['bil'] + $kawalanstok[2]['lelongini3'][0]['bil']); echo number_format($lel3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[2]['lelong3'][0]['pinj'],2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[2]['lelongini3'][0]['pinj']),2) }}</span><br>
        <span>@php $lelpinj3 = ($kawalanstok[2]['lelong3'][0]['pinj'] + $kawalanstok[2]['lelongini3'][0]['pinj']); echo number_format($lelpinj3,2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalbillelongkeseluruhan = $kawalanstok[2]['lelong1'][0]['bil'] + $kawalanstok[2]['lelong2'][0]['bil'] + $kawalanstok[2]['lelong3'][0]['bil']; echo number_format($totalbillelongkeseluruhan); @endphp</span><br>
        <span>@php $totalbillelongsehari = $kawalanstok[2]['lelongini1'][0]['bil'] + $kawalanstok[2]['lelongini2'][0]['bil'] + $kawalanstok[2]['lelongini3'][0]['bil']; echo number_format($totalbillelongsehari); @endphp</span><br>
       <span>@php $totalbillelong = $totalbillelongkeseluruhan + $totalbillelongsehari; echo number_format($totalbillelong); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalpinjlelongkeseluruhan = $kawalanstok[2]['lelong1'][0]['pinj'] + $kawalanstok[2]['lelong2'][0]['pinj'] + $kawalanstok[2]['lelong3'][0]['pinj']; echo number_format($totalpinjlelongkeseluruhan,2); @endphp</span><br>
        <span>@php $totalpinjlelongsehari = $kawalanstok[2]['lelongini1'][0]['pinj'] + $kawalanstok[2]['lelongini2'][0]['pinj'] + $kawalanstok[2]['lelongini3'][0]['pinj']; echo number_format($totalpinjlelongsehari,2); @endphp</span><br>
        <span>@php $totalpinjlelong = floatval($totalpinjlelongkeseluruhan + $totalpinjlelongsehari); echo number_format($totalpinjlelong,2); @endphp</span>
      </td>
    </tr>
    <tr>
      <td>Hapus Kira</td>
      <td>
        <span>Baki C/F</span><br>
        <span>Hari Ini</span><br>
        <span>Jumlah</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[3]['hapuskira1'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[3]['hapuskiraini1'][0]['bil']) }}</span><br>
        <span>@php $hpk1 = $kawalanstok[3]['hapuskira1'][0]['bil'] + $kawalanstok[3]['hapuskiraini1'][0]['bil']; echo number_format($hpk1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskira1'][0]['pinj']),2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskiraini1'][0]['pinj']),2) }}</span><br>
        <span>@php $hpkpinj1 = ($kawalanstok[3]['hapuskira1'][0]['pinj'] + $kawalanstok[3]['hapuskiraini1'][0]['pinj']); echo number_format($hpkpinj1); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[3]['hapuskira2'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[3]['hapuskiraini2'][0]['bil']) }}</span><br>
        <span>@php $hpk2 = ($kawalanstok[3]['hapuskira2'][0]['bil'] + $kawalanstok[3]['hapuskiraini2'][0]['bil']); echo number_format($hpk2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskira2'][0]['pinj']),2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskiraini2'][0]['pinj']),2) }}</span><br>
        <span>@php $hpkpinj2 = ($kawalanstok[3]['hapuskira2'][0]['pinj'] + $kawalanstok[3]['hapuskiraini2'][0]['pinj']); echo number_format($hpkpinj2); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format($kawalanstok[3]['hapuskira3'][0]['bil']) }}</span><br>
        <span>{{ number_format($kawalanstok[3]['hapuskiraini3'][0]['bil']) }}</span><br>
        <span>@php $hpk3 = ($kawalanstok[3]['hapuskira3'][0]['bil'] + $kawalanstok[3]['hapuskiraini3'][0]['bil']); echo number_format($hpk3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskira3'][0]['pinj']),2) }}</span><br>
        <span>{{ number_format(floatval($kawalanstok[3]['hapuskiraini3'][0]['pinj']),2) }}</span><br>
        <span>@php $hpkpinj3 = $kawalanstok[3]['hapuskira3'][0]['pinj'] + $kawalanstok[3]['hapuskiraini3'][0]['pinj']; echo number_format($hpkpinj3); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalbilhapuskirakeseluruhan = $kawalanstok[3]['hapuskira1'][0]['bil'] + $kawalanstok[3]['hapuskira2'][0]['bil'] + $kawalanstok[3]['hapuskira3'][0]['bil']; echo number_format($totalbilhapuskirakeseluruhan); @endphp</span><br>
        <span>@php $totalbilhapuskirasehari = $kawalanstok[3]['hapuskiraini1'][0]['bil'] + $kawalanstok[3]['hapuskiraini2'][0]['bil'] + $kawalanstok[3]['hapuskiraini3'][0]['bil']; echo number_format($totalbilhapuskirasehari); @endphp</span><br>
        <span>@php $totalbilhapuskira = $totalbilhapuskirakeseluruhan + $totalbilhapuskirasehari; echo number_format($totalbilhapuskira); @endphp</span>
      </td>
      <td style="text-align: right;">
        <span>@php $totalpinjhapuskirakeseluruhan = $kawalanstok[3]['hapuskira1'][0]['pinj'] + $kawalanstok[3]['hapuskira2'][0]['pinj'] + $kawalanstok[3]['hapuskira3'][0]['pinj']; echo number_format($totalpinjhapuskirakeseluruhan,2); @endphp</span><br>
        <span>@php $totalpinjhapuskirasehari = $kawalanstok[3]['hapuskiraini1'][0]['pinj'] + $kawalanstok[3]['hapuskiraini2'][0]['pinj'] + $kawalanstok[3]['hapuskiraini3'][0]['pinj']; echo number_format($totalpinjhapuskirasehari,2); @endphp</span><br>
        <span>@php $totalpinjhapuskira = $totalpinjhapuskirakeseluruhan + $totalpinjhapuskirasehari; echo number_format($totalpinjhapuskira,2); @endphp</span>
      </td>
    </tr>
    @php $counter++;@endphp
  <tfoot>
    <tr style="font-weight:bold;">
      <td colspan="2">Baki</td>
      <td style="text-align: right;">
        @php $totalbil1 = $gad1 - $teb1 - $lel1 - $ans1 - $hpk1; echo number_format($totalbil1);@endphp
      </td>
      <td style="text-align: right;">
        @php $totalpinj1 = $gadpinj1 - $tebpinj1 - $lelpinj1 - $anspinj1 - $hpkpinj1; echo number_format($totalpinj1,2);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalbil2 = $gad2 - $teb2 - $lel2 - $ans2 - $hpk2; echo number_format($totalbil2);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalpinj2 = $gadpinj2 - $tebpinj2 - $lelpinj2 - $anspinj2 - $hpkpinj2; echo number_format($totalpinj2,2);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalbil3 = $gad3 - $teb3 - $lel3 = - $ans3 - $hpk3; echo number_format($totalbil3);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalpinj3 = $gadpinj3 - $tebpinj3 - $lelpinj3 - $anspinj3 - $hpkpinj3; echo number_format($totalpinj3,2);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalbil = $totalbilgadai-$totalbiltebus/*-$totalbilans*/-$totalbillelong-$totalbilhapuskira; echo number_format($totalbil);@endphp
        
      </td>
      <td style="text-align: right;">
        @php $totalpinj = $totalpinjgadai-$totalpinjtebus-$totalpinjans-$totalpinjlelong-$totalpinjhapuskira; echo number_format($totalpinj,2);@endphp
      </td>
    </tr>
    <tr>
      <td colspan="2"></td>
      <td style="text-align: right;">
      
        @php $percentbil1 = (($totalbil1)/$totalbil)*100; echo number_format($percentbil1,2) . ' %';@endphp
        
      </td>
      <td style="text-align: right;">
        @php $percentpinj1 = (($totalpinj1)/$totalpinj)*100; echo number_format($percentpinj1,2) . ' %';@endphp
        
      </td>
      <td style="text-align: right;">
        @php $percentbil2 = (($totalbil2)/$totalbil)*100; echo number_format($percentbil2,2) . ' %';@endphp
        
      </td>
      <td style="text-align: right;">
        @php $percentpinj2 = (($totalpinj2)/$totalpinj)*100; echo number_format($percentpinj2,2) . ' %';@endphp
        
      </td>
      <td style="text-align: right;">
        @php $percentbil3 = (($totalbil3)/$totalbil)*100; echo number_format($percentbil3,2) . ' %';@endphp
        
      </td>
      <td style="text-align: right;">
        @php $percentpinj3 = (($totalpinj3)/$totalpinj)*100;; echo number_format($percentpinj3,2) . ' %';@endphp
      </td>
      <td></td>
      <td></td>
    </tr>
  </tfoot>
</table>

<br>
<br>






