<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
    $(document).ready(function () {
      window.print();
      window.onfocus=function(){ window.close();}
    });
</script>
<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:12px;
}

#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%;
}

#details td, #details th {
 
  padding: 10px;
  font-size:12px;
}

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

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

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

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

#sign td, #sign th {

  padding: 8px;
  font-size:12px;
  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;
}

.main-table {
    border-collapse: collapse;
    width: 100%;
}

.main-table td,
.main-table th {
    border: 1px solid #ddd;
    padding: 2px;
    font-size: 9px;
}

.main-table th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d0d2d063;
    color: black;
    padding: 5px;
}
</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><b style="font-size:14px;font-weight:bold;">TAX INVOICE</b></td>
  </tr>
  <tr>
    <td>{{ $cawangan_detail['alamat1'] }}</td>
    <td>No Resit : <span>{{ $lelong['recno'] }}</span></td>
  </tr>
  <tr>
    <td>{{ $cawangan_detail['alamat2']}}</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td>{{ ' No Tel : '. $cawangan_detail['notel'].'    No Faks : '. $cawangan_detail['nofaks']  }}</td>
  </tr>
</table>
<br>
<br>


<table id="scan">
  <tr>
      <td>Batch No Lelongan : <span>{{ $lelong['batchno'] }}</span></td>
  </tr>
  <tr>
    <td>Tarikh Lelongan : <span>{{ $lelong['t_lelong'] }}</span></td>
</tr>
<tr>
  <td></td>
  <td></td>
</tr>
  <tr>
    <th colspan ="5"><b><u>RESIT BAYARAN {{ ($lelong['jumlah'] > 0) ? 'LEBIHAN LELONGAN' : 'RUGI LELONGAN' }}</u></b></th>
    <th> </th>
    <th> </th>
    <th></th>
  </tr>
</table>

<br>
<br>
<table id="details" style="width:70%;border:1px solid black;">
  <tr>
    <th>No Rujukan Surat Gadai</th>
    <td>{{ $lelong['norujukan'] }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Nama Pemilik</th>
    <td>{{ $lelong['nama'] }}</td>
    <th></th>
  </tr>
  <tr>
    <th>No K/P</th>
    <td>{{ $lelong['kpbaru'] }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Tarikh</th>
    <td>{{ $lelong['tarikh'] }}</td>
    <th></th>
  </tr>

  <tr style="border-top:1px solid black;">
    <th>Nama wakil</th>
    <td>@php if(sizeof($wakil) != 0){ echo $wakil['nama'];} else echo ''; @endphp</td>
    <th></th>
  </tr>
  <tr style="border-bottom:1px solid black;">
    <th>No K/P</th>
    <td>@php if(sizeof($wakil) != 0) echo $wakil['nokp']; else echo ''; @endphp</td>
    <th></th>
  </tr>
  <tr>
    <th>Harga Lelongan</th>
    <td>RM {{ number_format($lelong['hargajual'],2) }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Pembiayaan</th>
    <td>RM {{ number_format($lelong['pinjaman'],2) }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Baki Keuntungan</th>
    <td>RM {{ number_format($lelong['bakiupah'],2) }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Caj Lelong</th>
    <td>RM {{ number_format($lelong['cajlelong'],2) }}</td>
    <th></th>
  </tr>
  <tr>
    <th>{{ ($lelong['jumlah'] > 0) ? 'Lebihan Lelongan' : 'Rugi Lelongan' }}</th>
    <td>RM {{ number_format($lelong['jumlah'],2) }}</td>
    <th></th>
  </tr>
  <tr>
    <th>Jumlah Bayaran</th>
    <td><b>RM {{ number_format($lelong['jumlah'],2) }}</b></td>
    <th></th>
  </tr>
  <tr>
    <th>Jumlah Bayaran</th>
    <td><b>RM {{ number_format($lelong['jumlah'],2) }}</b></td>
    <th></th>
  </tr>
</table>
<table class="main-table" id="details" style="text-align:center; width:70%;border:1px solid black; margin-top:20px {{ ($batuPermataExist == false) ? 'display:none' : '' }}">
  <tr>
      <th style="text-align: center">Bil</th>
      <th style="text-align: center">Marhun</th>
      <th style="text-align: center">Karat</th>
      <th style="text-align: center">Berat(g)</th>
      <th style="text-align: center">Nota</th>
      <th style="text-align: center">Berat Permata(g)</th>
  </tr>
  @foreach($marhuns[0] as $marhun)
  <tr>
    <td>{{ $loop->iteration }}</td>
    <td>{{ $marhun['marhun'] }}</td>
    <td>{{ $marhun['karat'] }}</td>
    <td>{{ $marhun['berat'] }}</td>
    <td>{{ $marhun['tag_permata'] == 1 ? '(PMT) ' : '' }}{{ $marhun['nota'] }}</td>
    <td>{{ $marhun['tag_permata'] == 1 ? $marhun['berat_batu_permata'] : '-' }}</td>
  </tr>
  @endforeach
</table>
<table id="details">
  <td>*Sila semak batu permata.</td>
</table>

<br>

<table id="details">
  <td>Nota: Pastikan No Kad Pengenalan Surat Akuan Gadai dan Tandatangan. Sila ambil cop sekiranya surat gadai hilang/tidak dibawa manakala wakil diminta Tandatangan dan Cop Jari.</td>
</table>

<br>
<br>
<br>
<br>
<table id="sign">
 
  <tr>
    <td></td>
    <td colspan="2"> .................................................................. </td>
    <td> </td>
    <td colspan="2">.................................................................. </td>
    <td> </td>
  </tr>
  <tr>
    <td></td>
    <td colspan="2"><b> Tandatangan Pelanggan</b> </td>
    <td> </td>
    <td colspan="2"><b> Penandatangan Berkuasa </b></td>
    <td> </td>
  </tr>
</table>






