<html>
<head>
  <title><?php echo $menu_label ?></title>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/custom/css/print.css">
</head>
<style type="text/css">
  @media print {
    .noPrint { display: none; }
  }
</style>
<body>
  <div class="easyui-layout" data-options="fit:true,border:false">
      <!-- Top view-->
      <div id="form-header" data-options="region:'north',border:false">
          <div id="form-header-wrapper">
              <table cellpadding="0" cellspacing="0" width="100%">
              <tr>
                  <td  valign="middle">
                      <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()" <?= in_array($detail->TransStatus,array(1,2,3,9))? "":"disabled" ?>>Print</a>
                      <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-excel'" onClick="modal_open('Import New Account','dlg_importfile');" >Export File</a>
	                    <input type="checkbox" name="c_recno" id="rec_no" value="rec_no" onClick="ShowHide(this.value)" checked="true">Rec No <input type="checkbox" name="c_recdate" id="rec_date" value="rec_date" onClick="ShowHide(this.value)" checked="true">Rec Date
	                   
	               </td>
              </tr>
              </table>  
          </div>      
      </div>
      <br><br>
      <!-- Header -->
      <div id="print-container">
        <?php
          $CountList = count($list); // Count total item
          if($CountList <= 8):
            $MaxList = 8;
            
        ?>
      <!-- Start Item <=8 -->
      <table class="tbl form-header-si">
        <tr>
             <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom customer-header">
              <span class="small_bold span_block" ><?php echo $detail->VendorName;?></span>
                  <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->VendorAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span>
            </td>
            <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom title-form-si">
              <h4 id="title-form">PURCHASE JOURNAL</h4>
            </td>
        </tr>
        <tr>
 			<td class="bdr-left bdr-right bdr-top bdr-bottom shippping-do" colspan="2">
            	<span class="small_bold span_block">Account :</span>
              	<span class="small_bold span_block" ><?php echo $detail->AccountName;?></span>
              	<span class="small_bold span_block" >Kurs : <?php echo number_format($detail->CurrencyRate,"2",",",".");?>  IDR / IDR</span>
                <!-- <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->VendorAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span> -->
            </td>

            <td class="bdr-left bdr-right bdr-top bdr-bottom no-form">
              <span class="small_bold span_block rec_no" > Pay No : <?php echo $detail->PPayNumber;?></span>
            </td>
             <td class="bdr-left bdr-right bdr-top bdr-bottom no-form">
              <span class="small_bold span_block rec_date" > Pay Date : <?php echo $detail->PPayDate;?></span>
            </td>
 
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="tbl tbl-item-si">
        <tr>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Invoice No. </span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Inv. Date </span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Amount</span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Owing</span></th>
         
          <th  class="list th-item "><span class="normal_bold">Receipt Amount</span></th>
          <th  class="list th-item " rowspan="2"><span class="normal_bold">Category Name </span></th>
        </tr>
        <tr>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
        </tr>
        <?php for($x = 0; $x < $CountList; $x++):?>
        <tr>
          <td  class="item_no_border bdr-left bdr-right item-unit text-center" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-no text-left" ><span class="small_bold"><?php echo $list[$x]['Invoice_Number']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-date text-center" ><span class="small_bold"><?php echo $list[$x]['Invoice_Date']; ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right"><span class="small_bold"><?php echo number_format($list[$x]['Invoice_Amount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['Invoice_Owing'],"2",",","."); ?></span></td>
          
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['Payment_Amount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo $list[$x]['CategoryName']; ?></span></td>
        </tr>
        <?php endfor; ?>
          <?php

          // Count Last Item
          if($CountList < $MaxList):

            $ListDiff   = $MaxList - $CountList; // Variabel Count Last Item

            for($xi = 0; $xi < $ListDiff; $xi++):
          ?>
        <tr>
        	<td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr>
          <td colspan="4" class="bdr-left bdr-right bdr-top bdr-bottom description-so">
              <span class="normal_bold">Description :</span>
              <?php if($detail->PPayDesc != ""):?>
              <span class="small_bold span_block">
              <br>

              <?php echo preg_replace( "/\r|\n/", "", character_limiter($detail->PPayDesc, 225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom" colspan="3">
              <table border="0" class="tbl-item">
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Balance: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPBalance,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Partial: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPPartial,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">Total Payment (IDR) :</span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->PPayTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form -->
      <table class="footer-form">
        <tr>
          <td   class="footer-paraf">
              <span class="normal_bold">Prepared By</span>
              <br><br>
              <?php if($detail->nm_prepared !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_prepared;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td  class="footer-paraf-customer">
             <span class="normal_bold">Approved Mng.</span>
              <br><br>
              <?php if($detail->nm_manager !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_manager;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td width="80%" class="text-right text-middle text-center">
              <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)):?>
                <h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4>
              <?php endif;?>
          </td>
        </tr>
        <tr>
          <td   colspan="4" width="100%">
            <table>
              <tr>
                <td class="footer-left">&nbsp;</td>
                <td class="footer-center"><span class="normal_bold"><?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName ?></span></td>
                <td class="footer-right"> <span class="normal_bold text-right">Page : 1 Of 1</span></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>

      <?php else:?>
      <?php
        $MaxList = 40;
        if($CountList <= $MaxList):
      ?>
      <!-- Item > 8 and item <=34 -->
      <!-- Start Item <=34 -->
      <table class="tbl form-header-si">
        <tr>
             <td class="bdr-left bdr-right bdr-top bdr-bottom customer-header">
              <span class="small_bold span_block" ><?php echo $detail->CustomerName;?></span>
                  <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->CustomerAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span>
            </td>
            <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom title-form-si">
              <h4 id="title-form">PURCHASE JOURNAL</h4>
            </td>
        </tr>
        <tr>
          <td class="bdr-left bdr-right bdr-top bdr-bottom shippping-do"><span class="small_bold span_block">Account :</span> <span class="small_bold span_block" ><?php echo $detail->AccountName;?></span> <span class="small_bold span_block" >Kurs : <?php echo number_format($detail->CurrencyRate,"2",",",".");?> IDR / IDR</span>
            <!-- <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->VendorAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span> --></td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom no-form"><span class="small_bold span_block rec_no" > Pay No : <?php echo $detail->PPayNumber;?></span></td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom no-form"><span class="small_bold span_block rec_date" > Pay Date : <?php echo $detail->PPayDate;?></span></td>
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="tbl tbl-item-si">
        <tr>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Invoice No. </span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Inv. Date </span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Amount</span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Owing</span></th>
         
          <th  class="list th-item "><span class="normal_bold">Receipt Amount</span></th>
          <th  class="list th-item " rowspan="2"><span class="normal_bold">Category Name </span></th>
        </tr>
        <tr>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
        </tr>
        <?php for($x = 0; $x < $CountList; $x++):?>
        <tr>
          <td  class="item_no_border bdr-left bdr-right item-unit text-center" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-no text-left" ><span class="small_bold"><?php echo $list[$x]['InvoiceNumber']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-date text-center" ><span class="small_bold"><?php echo $list[$x]['InvoiceDate']; ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right"><span class="small_bold"><?php echo number_format($list[$x]['InvoiceAmount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceOwing'],"2",",","."); ?></span></td>
          
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo $list[$x]['CategoryName']; ?></span></td>
        </tr>
        <?php endfor; ?>
          <?php

          // Count Last Item
          if($CountList < $MaxList):

            $ListDiff   = $MaxList - $CountList; // Variabel Count Last Item

            for($xi = 0; $xi < $ListDiff; $xi++):
          ?>
        <tr>
        	<td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr>
          <td colspan="4" class="bdr-left bdr-right bdr-top bdr-bottom description-so">
              <span class="normal_bold">Description :</span>
              <?php if($detail->PPayDesc != ""):?>
              <span class="small_bold span_block">
              <?php echo preg_replace( "/\r|\n/", "", character_limiter($detail->PPayDesc, 225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom" colspan="3">
              <table border="0" class="tbl-item">
              	 <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Balance: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPBalance,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Partial: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPPartial,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">Total <strong>Receipt</strong> (IDR) :</span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form -->
      <table class="footer-form">
        <tr>
          <td   class="footer-paraf">
              <span class="normal_bold">Prepared By</span>
              <br><br>
              <?php if($detail->nm_prepared !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_prepared;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td  class="footer-paraf-customer">
             <span class="normal_bold">Approved Mng.</span>
              <br><br>
              <?php if($detail->nm_manager !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_manager;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td width="80%" class="text-right text-middle text-center">
              <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)):?>
                <h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4>
              <?php endif;?>
          </td>
        </tr>
        <tr>
          <td   colspan="4" width="100%">
            <table>
              <tr>
                <td class="footer-left">&nbsp;</td>
                <td class="footer-center"><span class="normal_bold"><?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName ?></span></td>
                <td class="footer-right"> <span class="normal_bold text-right">Page : 1 Of 1</span></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>


      <?php else:?>
      <!-- Item > 8 and Item > 25 -->
      <?php 

        $paper_count  = ceil($CountList / $MaxList); // Page AMount
        $ListTo     = array(0,0); // Array to get index Item

        for($i = 0; $i < $paper_count; $i++): // Loop Until Last Form

          $ListTo[0] = $i * $MaxList; // Index Item From
          $ListTo[1] = ($i * $MaxList) + 30; // Index Item To

          if($ListTo[1] == $CountList){ // If Index Item To == Item AMount

            $ListTo[1] = $CountList - 30;

          }elseif($ListTo[1] > $CountList){ // If Index More Than Item AMount

            $ListTo[1] = ($CountList - (($i-1) * $MaxList))-1;

          }
      ?>

      <!-- Header Form -->
     <table class="tbl form-header-si">
        <tr>
             <td class="bdr-left bdr-right bdr-top bdr-bottom customer-header">
              <span class="small_bold span_block" ><?php echo $detail->CustomerName;?></span>
                  <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->CustomerAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span>
            </td>
            <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom title-form-si">
              <h4 id="title-form">PURCHASE JOURNAL</h4>
            </td>
        </tr>
        <tr>
          <td class="bdr-left bdr-right bdr-top bdr-bottom shippping-do"><span class="small_bold span_block">Account :</span> <span class="small_bold span_block" ><?php echo $detail->AccountName;?></span> <span class="small_bold span_block" >Kurs : <?php echo number_format($detail->CurrencyRate,"2",",",".");?> IDR / IDR</span>
            <!-- <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->VendorAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span> --></td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom no-form"><span class="small_bold span_block rec_no" > Pay No : <?php echo $detail->PPayNumber;?></span></td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom no-form"><span class="small_bold span_block rec_date" > Pay Date : <?php echo $detail->PPayDate;?></span></td>
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="tbl tbl-item-si">
        <tr>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Invoice No. </span></th>
          <th class="list th-item text-middle" rowspan="2"><span class="normal_bold">Inv. Date </span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Amount</span></th>
          <th class="list th-item" ><span class="normal_bold">Invoice Owing</span></th>
         
          <th  class="list th-item "><span class="normal_bold">Receipt Amount</span></th>
          <th  class="list th-item " rowspan="2"><span class="normal_bold">Category Name </span></th>
        </tr>
        <tr>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
          <th class="list th-item" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
        </tr>
        <?php for($x = 0; $x < $CountList; $x++):?>
        <tr>
          <td  class="item_no_border bdr-left bdr-right item-unit text-center" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-no text-left" ><span class="small_bold"><?php echo $list[$x]['InvoiceNumber']; ?></span></td>
          <td  class="item_no_border bdr-left bdr-right item-date text-center" ><span class="small_bold"><?php echo $list[$x]['InvoiceDate']; ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right"><span class="small_bold"><?php echo number_format($list[$x]['InvoiceAmount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceOwing'],"2",",","."); ?></span></td>
          
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
          <td  class="item_no_border bdr-right bdr-left item-price text-right" ><span class="small_bold"><?php echo $list[$x]['CategoryName']; ?></span></td>
        </tr>
        <?php endfor; ?>
        <?php
        // Count Last Item
        if(($i+1) == $paper_count):
          $ListDiff = $MaxList - ($CountList - $ListTo[0]);
          for($xi = 0; $xi < $ListDiff; $xi++):
        ?>
         <tr>
        	<td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
            <td  class="item_no_border bdr-left bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr>
          <td colspan="4" class="bdr-left bdr-right bdr-top bdr-bottom description-so">
              <span class="normal_bold">Description :</span>
              <?php if($detail->PPayDesc != ""):?>
              <span class="small_bold span_block">
              <?php echo preg_replace( "/\r|\n/", "", character_limiter($detail->PPayDesc, 225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
          <td class="bdr-left bdr-right bdr-top bdr-bottom" colspan="3">
              <table border="0" class="tbl-item">
              	 <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Balance: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPBalance,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">DP Partial: </span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SaldoDPPartial,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="item_no_border subtotal-si"> <span class="small_bold">Total Payment (IDR) :</span></td>
                    <td class="item_no_border subtotal-si"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form -->
      <table class="footer-form">
        <tr>
          <td   class="footer-paraf">
              <span class="normal_bold">Prepared By</span>
              <br><br>
              <?php if($detail->nm_prepared !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_prepared;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td  class="footer-paraf-customer">
             <span class="normal_bold">Approved Mng.</span>
              <br><br>
              <?php if($detail->nm_manager !=""):?>
              <span class="normal_bold span_block text-underline"><?php echo $detail->nm_manager;?></span>
          	  <?php else:?>
              <span class="normal_bold span_block">__________</span>
              <?php endif;?>
          </td>
          <td width="80%" class="text-right text-middle text-center">
              <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)):?>
                <h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4>
              <?php endif;?>
          </td>
        </tr>
        <tr>
          <td   colspan="4" width="100%">
            <table>
              <tr>
                <td class="footer-left">&nbsp;</td>
                <td class="footer-center"><span class="normal_bold"><?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName ?></span></td>
                <td class="footer-right"> <span class="normal_bold text-right"><?php echo "Page : ".($i+1)." Of ".$paper_count;?></span></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <?php endfor;?>
      <?php endif;?>
      <!-- End Item <=8 -->
    <?php endif;?>
        </div>
  </div>
</body>
</html>

<script type="text/javascript">
var data_append = ["","","","","","","","","","","","","","","",""];

function print_detail(){
  //var opt_print   = $("input[type='radio'][name='opt_print']:checked").val();
  var data_print  = $("#print-container").html();
  Popup(data_print);
  
}

// function ShowHide(element){
//   if($("#"+element).is(":checked") == false){
//     var no_value = $("#"+element).val();
//     var no = parseFloat(no_value) + 1;
//     if(no < 4){
//       var no_append = 1;
//     }else if(no < 8){
//       var no_append = 5
//     }else if(no < 12){
//       var no_append = 9;
//     }else{
//       var no_append = 13;
//     }
//     if(no_value == 0 || no_value == 4 || no_value == 8 || no_value == 12){
//       var append_data = '<td  style="border-right:0" width="20%"  class="'+element+'">'+data_append[no_value]+'</td>'
//                 +'<td   style="border-left:0" width="40%"  class="'+element+'">'+data_append[no]+'</td>';
//       $(".no_"+no_append).prepend(append_data);
//     }else{
//       var append_data = '<td  style="border-right:0" width="15%"  class="'+element+'">'+data_append[no_value]+'</td>'
//                 +'<td   style="border-left:0" width="25%"  class="'+element+'">'+data_append[no]+'</td>';
//       $(".no_"+no_append).append(append_data);
//     }
//     console.log(append_data);

//   }else{
//     var no_value = $("#"+element).val();
//     var no = no_value;
//     $("."+element).each(function(){
//       if(no == no_value){
//         data_append[no] = $(this).html();
//         console.log(data_append[no]);
//       }else{
//         data_append[no] = $(this).html();
//         console.log(data_append[no]);
//       }
//       console.log(no);
//       no++;
//     });
//     console.log("remove");
//     console.log(data_append[1]);
//     $("."+element).remove();
//   }
// }


function Popup(data) 
{
    var mywindow = window.open('', 'print-container', 'height=528,width=700');
    var css = '<link rel="stylesheet" href="<?php echo base_url()?>assets/custom/css/print.css" type="text/css" />';
    mywindow.document.write('<html><head><title>Print Detail</title>');
    mywindow.document.write(css);
    mywindow.document.write('</head><body >');
    mywindow.document.write(data);
    mywindow.document.write('</body></html>');

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10

    mywindow.print();
    mywindow.close();

    return true;
}
</script>