

<!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>
/* Red border */
hr.new1 {
  border-top: 1px solid red;
}

/* Dashed red border */
hr.new2 {
  border-top: 1px dashed red;
}

/* Dotted red border */
hr.new3 {
  border-top: 1px dotted red;
}

/* Thick red border */
hr.new4 {
  border: 1px solid red;
}

/* Large rounded green border */
hr.new5 {
  border: 10px solid green;
  border-radius: 5px;
}
</style>

<style>

#cust {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width:20%;
    font-size:10px;
    border: 1px solid black;

  }

  #cust td, #cust th {
    border: 0px solid;
    padding: 3px;
    font-size:10px;
    text-align:right;

  }

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

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

  #cust th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align:right;
    background-color: #d9deda;
    color: black;
    padding:2px;
  }

  #cust {
  margin-left: auto;
  margin-right: 0;
}

  hr.new1 {
    border-top: 1px dotted black;
  }
  .khazanah{
    border:1px solid black;
    margin-left:20px;
    padding:10px;
    width : 250px;
    transform: rotate(-90deg);
    font-size:12px;
  }

  #inside {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width:100%;
    font-size:15px;
  }

  #inside td, #inside th {
    border: none;
    padding: 2px;
  }

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

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

  #inside th {
    padding-top: 12px;
    padding-bottom: 10px;
    text-align: left;
    background-color: #4CAF50;
    color: white;
  }




  #semakan {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width:100%;
    margin-top:40px;
    font-size:12px;
  }

  #semakan td, #semakan th {
    border: none;
    padding: 2px;
    text-align: center;
  }

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

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

  #semakan th {
    padding-top: 12px;
    padding-bottom: 10px;
    text-align: left;
    background-color: #4CAF50;
    color: white;
  }

  #salinan {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width:100%;
    font-size:12px;
  }

  #salinan td, #salinan th {
    padding: 2px;
  }


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

  #salinan tr:hover {background-color: #ffffff;}

  #salinan th {
    padding-top: 12px;
    padding-bottom: 10px;
    text-align: right;
    background-color: #ffffff;
    color: black;
    padding:2px;
  }
  #perjanjian {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width: 100%;
    font-size:12px;

  }

  #perjanjian td, #perjanjian th {
    border: 1px solid #ddd;
    padding: 2px;
    font-size:10px;
  }

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

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

  #perjanjian th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d9deda;
    color: black;
    padding:5px;
  }
  #keuntungan {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width: 100%;
    font-size:12px;

  }

  #keuntungan td, #keuntungan th {
    border: 1px solid #ddd;
    padding: 2px;
    font-size:10px;
  }

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

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

  #keuntungan th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d9deda;
    color: black;
    padding:2px;
  }

  #payment {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width: 60%;
    font-size:13px;
    border: 1px solid black;

  }

  #payment td, #payment th {
    border: 0px solid;
    padding: 3px;
    font-size:15px;
    text-align: left;

  }

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

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

  #payment th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align:left;
    background-color: #d9deda;
    color: black;
    padding:2px;
  }

  #payment {
  margin-left: auto;
  margin-right: auto;
}

  #akuan td, #akuan th {
    padding: 7px;
    font-size:10px;
    padding:4px;
  }

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

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

  #akuan th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d9deda;
    color: black;
    padding:3px;
  }
  .page-break{
    page-break-before:always;
  }
  
  .formula{
    font-family: Arial, Helvetica, sans-serif;
    font-size:12px;
  }
  
  #copy_cust {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width:10%;
    font-size:12px;

  }



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

  #copy_cust tr:hover {background-color:#ffffff}

  #copy_cust th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d9deda;
    color: black;
    padding:4px;
  }


  #copy_cust {
    font-family: Arial, Helvetica, sans-serif;
    border-collapse:collapse;
    width: 50%;
    font-size:12px;


  }

  #copy_cust td, #copy_cust th {
    border: 1px solid #ddd;
    padding: 2px;
    font-size:10px;
    text-align:right;
    width: 10%;

  }

  #copy_cust {
    margin-right:0px;margin-left:auto
}

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

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

  #inside th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
    background-color: #d9deda;
    color: black;
    padding:4px;
  }
 
  .header-style{
    display: flex;
    justify-content: space-between;
    align-items: center
  }

  .header-style span {
    font-family: Arial, Helvetica, sans-serif;
    text-align: right;
    background-color: #d9deda;
    color: black;
    padding: 2px;
    font-size: 10px;
    border: 1px solid black;
  }

  .receipt-type-style {
    position: absolute;
    right: 0; 
    height: 100%; 
    width:40px; 
    display:flex; 
    justify-content:center; 
    align-items:end;
    font-size: 45px;
    font-weight: bold;
  }
</style>







<div class="header-style">
  <div style="display: flex; align-items:center">
    <img src="{{ asset('img/kopkb.png') }}" style="width:80px; margin-right: 10px" alt="User Image" class="center" >
    <img src="{{ asset('img/ARRAHN1.png') }}" style="width:50px" alt="User Image" class="center" >
  </div>
  <div>
    <span><strong>UNTUK KEGUNAAN PELANGGAN</strong></span>
  </div>
</div>

<br>

<div style="position: relative">
  <div class="receipt-type-style">T</div>
  <table id="inside">

      <tr>
          <td colspan="3">Nama</td>
          <td>: {{ $customers_info['nama'] }} </td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td> <b>No SAG</b></td>
          <td>: <b>{{ $gadai['norujukan'] }}</b> </td>
      </tr>
      <tr>
          <td colspan="3">No K/P </td>
          <td>: @php
              if ($customers_info['kpbaru'] == '') {
                  echo $customers_info['kplama'];
              } else {
                  echo $customers_info['kpbaru'];
              }
          @endphp </td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td> Tarikh Bayar</td>
          <td>: @php
              $time = new DateTime($penebusan['t_tebus']);
              $date = $time->format('d/m/Y');
              echo $date;
          @endphp</td>
      </tr>

      <tr>
          <td colspan="3"></td>
          <td></td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td>Masa Bayaran </td>
          @php
              $masa_bayaran = strtotime($transaction_keuntungan['tarikh_bayaran']);
              $masa = date('H:i:s', $masa_bayaran);
          @endphp
          <td>: {{ $masa }} </td>
      </tr>

      <tr>
          <td colspan="3"></td>
          <td></td>
          <td colspan="3"> </td>
          <td></td>
          <td> </td>

          <td>Tempoh Simpan</td>
          <td>: {{ $gadai['tempoh'] }}</td>
      </tr>

      <tr>
  </table>
</div>
  <br>

<table id="payment">
  <tr>
    <td style="width:10px">B. Pembiayaan + Keuntungan</td>
    <td style="width:5px"> </td>
    @php $temp_loan = $gadai['bakipjm'] + $transaction_keuntungan['bayaran_keuntungan']; @endphp
    <td style="width:10px">: RM {{ number_format($temp_loan,2) }} </td>
  </tr>
  <tr>
    <td style="width:10px">(-) Bayaran Pelanggan</td>
    <td style="width:5px"> </td>
    @php $temp_totalpay = $transaction_keuntungan['bayaran_pembiayaan'] + $transaction_keuntungan['bayaran_keuntungan']; @endphp
    <td style="width:10px">: RM {{ number_format($temp_totalpay,2) }} </td>
  </tr>
  <tr>
    <td style="width:10px;">Jumlah Bayaran</td>
    <td style="width:5px"> </td>
    @php $total = $temp_loan - $temp_totalpay; @endphp
    <td style="width:10px;">: RM {{ number_format($total,2) }}</td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
    <td style="width:10px; font-size:17px"><b>Pembiayaan Baru</b></td>
    <td style="width:5px"> </td>
    <td style="width:10px; font-size: 17px">: <b>RM {{ number_format($gadai['bakipjm'] - $transaction_keuntungan['bayaran_pembiayaan'],2) }}</b></td>
  </tr>
</table>
<table id="payment" style="border: none; margin-top:20px; width:55%">
  <tr>
      <td>Marhun: {{ $gadai['marhun'] }}</td>
  </tr>
</table>


  <table id="semakan">
      <tr>
      <td colspan="3">.................................................... </td>
      <td></td> 
      <td colspan="3">.................................................... </td>
      <td></td> 
      <td colspan="3">.................................................... </td>
</tr>
<tr>
  <td colspan="3">Khazanah</td>
  <td></td> 
  <td colspan="3">Pelanggan</td>
  <td></td> 
  <td colspan="3">Ar-Rahn</td>
</tr>
<tr>
      <td colspan="3"> {{ $khazanah_user->name }}</td>
      <td></td> 
      <td colspan="3">{{ $customers_info['nama'] }} </td>
      <td></td> 
      <td colspan="3">{{ Auth::user()->name }}</td>


</tr>
  </table>
  <hr class="new2"></hr>

</table>

<div class="header-style">
  <div style="display: flex; align-items:center">
    <img src="{{ asset('img/kopkb.png') }}" style="width:80px; margin-right: 10px" alt="User Image" class="center" >
    <img src="{{ asset('img/ARRAHN1.png') }}" style="width:50px" alt="User Image" class="center" >
  </div>
  <div>
    <span><strong>UNTUK KEGUNAAN PEJABAT</strong></span>
  </div>
</div>

<br>
<div style="position: relative">
  <div class="receipt-type-style">PS</div>
  <table id="inside">

      <tr>
          <td colspan="3">Nama</td>
          <td>: {{ $customers_info['nama'] }} </td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td> <b>No SAG</b></td>
          <td>: <b>{{ $gadai['norujukan'] }}</b> </td>
      </tr>
      <tr>
          <td colspan="3">No K/P </td>
          <td>: @php
              if ($customers_info['kpbaru'] == '') {
                  echo $customers_info['kplama'];
              } else {
                  echo $customers_info['kpbaru'];
              }
          @endphp </td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td> Tarikh Bayar</td>
          <td>: @php
              $time = new DateTime($penebusan['t_tebus']);
              $date = $time->format('d/m/Y');
              echo $date;
          @endphp</td>
      </tr>

      <tr>
          <td colspan="3"></td>
          <td></td>
          <td colspan="3"> </td>
          <td> </td>
          <td> </td>
          <td>Masa Bayaran </td>
          @php
              $masa_bayaran = strtotime($transaction_keuntungan['tarikh_bayaran']);
              $masa = date('H:i:s', $masa_bayaran);
          @endphp
          <td>: {{ $masa }} </td>
      </tr>

      <tr>
          <td colspan="3"></td>
          <td></td>
          <td colspan="3"> </td>
          <td></td>
          <td> </td>

          <td>Tempoh Simpan</td>
          <td>: {{ $gadai['tempoh'] }}</td>
      </tr>

      <tr>
  </table>
</div>
<br>


<table id="payment">
  <tr>
    <td style="width:10px">B. Pembiayaan + Keuntungan</td>
    <td style="width:5px"> </td>
    @php $temp_loan = $gadai['bakipjm'] + $transaction_keuntungan['bayaran_keuntungan']; @endphp
    <td style="width:10px">: RM {{ number_format($temp_loan,2) }} </td>
  </tr>
  <tr>
    <td style="width:10px">(-) Bayaran Pelanggan</td>
    <td style="width:5px"> </td>
    @php $temp_totalpay = $transaction_keuntungan['bayaran_pembiayaan'] + $transaction_keuntungan['bayaran_keuntungan']; @endphp
    <td style="width:10px">: RM {{ number_format($temp_totalpay,2) }} </td>
  </tr>
  <tr>
    <td style="width:10px;">Jumlah Bayaran</td>
    <td style="width:5px"> </td>
    @php $total = $temp_loan - $temp_totalpay; @endphp
    <td style="width:10px;">: RM {{ number_format($total,2) }}</td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
      <td></td>
  </tr>
  <tr>
    <td style="width:10px; font-size:17px"><b>Pembiayaan Baru</b></td>
    <td style="width:5px"> </td>
    <td style="width:10px; font-size: 17px">: <b>RM {{ number_format($gadai['bakipjm'] - $transaction_keuntungan['bayaran_pembiayaan'],2) }}</b></td>
  </tr>
</table>
<table id="payment" style="border: none; margin-top:20px; width:55%">
  <tr>
      <td>Marhun: {{ $gadai['marhun'] }}</td>
  </tr>
</table>
<table id="semakan">
    <tr>
    <td colspan="3">.................................................... </td>
    <td></td> 
    <td colspan="3">.................................................... </td>
    <td></td> 
    <td colspan="3">.................................................... </td>
</tr>
<tr>
  <td colspan="3">Khazanah</td>
  <td></td> 
  <td colspan="3">Pelanggan</td>
  <td></td> 
  <td colspan="3">Ar-Rahn</td>
</tr>
<tr>

    <td colspan="3"> {{ $khazanah_user->name }}</td>
    <td></td> 
    <td colspan="3">{{ $customers_info['nama'] }} </td>
    <td></td> 
    <td colspan="3">{{ Auth::user()->name }}</td>


</tr>
</table>
<table id="inside" style="width: 45%; margin-top:10px">
  <tr>
      <td>Duit Pelanggan</td>
      <td>: RM {{ number_format($transaction_tebus['duitpelanggan'], 2) }}</td>
  </tr>
  <tr>
      <td>Jumlah Perlu Dibayar</td>
      <td>: RM {{ number_format($transaction_tebus['duit_masuk'], 2) }}</td>
  </tr>
  <tr>
      <td>Baki</td>
      <td>: RM {{ number_format($transaction_tebus['bakipelanggan'], 2) }}</td>
  </tr>
</table>
<table id="semakan">
  <tr style="visibility: hidden">
    <td colspan="3">.................................................... </td>
    <td></td> 
    <td colspan="3">.................................................... </td>
    <td></td> 
    <td colspan="3">.................................................... </td>
    <td></td> 
    <td colspan="3">.................................................... </td>
  </tr>
</table>
<br>