<?php
defined('BASEPATH') OR exit('No direct script access allowed'); 

function convert_tgl($tgl)
{
  return substr($tgl,-2,2).'-'.substr($tgl,5,2).'-'.substr($tgl,0,4);
}
?>


<table width="100%">
  <tr>
    <td rowspan="4">
      <img src="./<?php echo $pengaturan->url_logo_header ?>" height="60">
    </td>
    <th style="font-size:5mm">
      <center>PRAKTEK UMUM <?php echo strtoupper($pengaturan->perusahaan) ?></center>
    </th>
  </tr>
  <tr>
    <td>
      <center><?php echo $pengaturan->alamat ?></center>
    </td>
  </tr>
  <tr>
    <td>
      <center><?php echo $pengaturan->no_telp ?></center>
    </td>
  </tr>
  <?php if($pengaturan->sip != '-' && $pengaturan->sip != '' ){ ?>    
  <tr>
    <td>
      <center>SIP. <?php echo $pengaturan->sip ?></center>
    </td>
  </tr>
  <?php } ?>
</table>
<hr style="border-bottom:2px solid #999999; margin-top:-5px;">
<p style="text-align: center; font-size:5mm">
  <b>NOTA PEMBAYARAN</b>
</p>

<table width="100%">
  <tr>
    <th style="width: 100px; text-align: left;">Debitur</th>
    <td align="center" width="10px">:</td>
    <td align="left"><b><?php echo $pemeriksaan->debitur_value ?></b></td>
  </tr>
  <tr>
    <th style="text-align: left;">Tgl. Periksa</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php echo convert_tgl($pemeriksaan->tgl_pemeriksaan) ?></td>
  </tr>
  <tr>
    <th style="text-align: left;">No RM</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php echo $pasien->no_rm ?></td>
  </tr>
  <tr>
    <th style="text-align: left;">Nama</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php echo $pasien->nama ?></td>
  </tr>
  <tr>
    <th style="text-align: left;">Umur</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php echo $pasien->umur ?></td>
  </tr>
  <tr>
    <th style="text-align: left;">Jenis kelamin</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php if($pasien->jenis_kelamin == 'L'){ echo 'Laki-laki'; } else echo 'Perempuan'; ?></td>
  </tr>
  <tr>
    <th style="text-align: left;">Alamat</th>
    <td align="center" width="10px">:</td>
    <td align="left"><?php echo $pasien->alamat ?></td>
  </tr>
</table> 
<p></p>
<table width="100%">
  <thead>
    <tr>
      <th colspan="4" style="text-align: left; background-color: grey">OBAT</th>
    </tr>
    <tr>
      <td colspan="4" ><hr style="border-top:1px dotted #999999; margin-top:-5px;"></td>
    </tr>
    <tr>
      <th style="text-align: left;">#</th>
      <th style="text-align: center;">Jumlah</th>
      <th style="text-align: center;">Harga</th>
      <th style="text-align: right; width: 120px">Subtotal</th>
    </tr>
  </thead>
  <tbody>
    <?php if(isset($post['nota']['checkbox_detail_obat'])){ $urut = 0; $subtotal_obat = 0; foreach ($data_obat as $key) { $urut++; ?>
      <tr>
        <td><?php echo $key->nama ?></td>      
        <td style="text-align: center;"><?php echo $key->jumlah ?></td>
        <td style="text-align: center;">
          <?php echo $key->harga ?>
          <input type="hidden" id="harga_<?php echo $key->id ?>" value="<?php echo $key->harga ?>">
        </td>   
        <td style="text-align: right;">
          <?php echo 'Rp '. number_format($key->jumlah*$key->harga, 0, ",", "."); ?>
          <input type="hidden" id="subtotal_obat_<?php echo $key->id ?>" value="<?php echo $key->jumlah*$key->harga ?>">
        </td>
      </tr>
    <?php } } ?>
    <tr>
      <td colspan="4" align="right"><b>Total</b></td>
      <td style="text-align: right;" id="subtotal_obat"><b><?php echo 'Rp '. number_format($pemeriksaan->subtotal_obat, 0, ",", ".");  ?></b></td>
    </tr>
  </tbody>
</table>
<table width="100%">
  <thead> 
    <tr>
      <th colspan="4" style="text-align: left; background-color: grey">TINDAKAN</th>
    </tr>
    <tr>
      <td colspan="4" ><hr style="border-top:1px dotted #999999; margin-top:-5px;"></td>
    </tr>
    <tr>
      <th style="text-align: left;">#</th>
      <th style="text-align: right; width: 120px">Subtotal</th>
    </tr>
  </thead>
  <tbody id="check_box">
    <?php $urut = 0; foreach ($data_tindakan as $key){ $urut++; ?>
      <tr>
        <td><?php echo $key->nama ?></td>
        <td style="text-align: right;"><?php echo 'Rp '. number_format($key->total, 0, ",", "."); ?></td>       
      </tr>
    <?php } ?>
    <tr>
      <td align="right"><b>Total</b></td>
      <th style="text-align: right;"><b><?php echo 'Rp '. number_format($pemeriksaan->subtotal_tindakan, 0, ",", ".");  ?></b></th>
    </tr>
  </tbody>
</table>  
<table width="100%">
  <thead> 
    <tr>
      <th colspan="4" style="text-align: left; background-color: grey">JASA PEMERIKSAAN</th>
    </tr>
    <tr>
      <td colspan="4" ><hr style="border-top:1px dotted #999999; margin-top:-5px;"></td>
    </tr>
    <tr>
      <th style="text-align: left;">#</th>
      <th style="text-align: right; width: 120px">Subtotal</th>
    </tr>
  </thead>
  <tbody id="check_box">
    <tr>
      <td align="right"><b>Total</b></td>
      <th style="text-align: right;"><b><?php echo 'Rp '. number_format($pemeriksaan->biaya_pemeriksaan, 0, ",", ".");  ?></b></th>
    </tr>
  </tbody>
</table>
<table width="100%">
  <thead> 
    <tr>
      <td colspan="2" ><hr style="border-top:1px dotted #999999; margin-top:-5px;"></td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th style="text-align: right;">Total</th>  
      <th style="text-align: right; width: 120px"><?php echo 'Rp '.number_format($pemeriksaan->total, 0, ",", "."); ?></th>        
    </tr>
    <tr>
      <th style="text-align: right;"></th>
      <th style="text-align: right; width: 120px"></th>
    </tr>
  </tbody>
</table>
<table border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td style="padding: 10px">Tagihan yang harus dibayarkan oleh pasien : <b><?php if($pemeriksaan->kategori_debitur_value == 'Cash'){ echo 'Rp '.number_format($pemeriksaan->total, 0, ",", "."); } else echo 'Rp 0'; ?></b></td>
  </tr>
</table>
<table width="100%" style="padding-top: 100px;">
  <tr>
    <td rowspan="3" width="70%"></td>
    <td style="text-align: center;"><?php echo convert_tgl($pemeriksaan->tgl_pemeriksaan) ?></td>
  </tr>
  <tr>
    <td>
      <br>
      <br>
      <br>
      <br>
    </td>
  </tr>
  <tr>
    <td style="text-align: center;"><?php echo $pemeriksaan->nm_dokter ?>
  </td>
</tr>
</table>