<html>
<head>
  <title><?php echo $menu_label ?></title>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/custom/css/print_new.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 <=15):
            $MaxList = 15;
            
        ?>
      <!-- Start Item <=8 -->
      <table class="header">
        <tr>
             <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom head-left">
                  <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-right bdr-top bdr-bottom head-right">
              <h2>SALES RECEIPT</h2>
            </td>
        </tr>
        <tr>
            <td class="bdr-left bdr-right bdr-bottom head-left-bottom-1 text-top">
                <span class="small_bold span_block">Paid To :</span>
                <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 class="bdr-right bdr-bottom head-left-bottom-2 text-top">
                <span class="small_bold span_block">Bank :</span>
                <span class="small_bold span_block" ><?php echo $detail->AccountName." (".$detail->BankCurrCode.")";?></span>
                <span class="small_bold span_block" >Kurs : <?php echo $detail->BankCurrRate;?>  USD / IDR</span>
                <!-- <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->CustomerAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span> -->
            </td>
            <td class="bdr-right bdr-bottom head-right-bottom text-top">
                <span class="small_bold span_block pay_no" > SRec No : <?php echo $detail->SRecNumber;?></span>
            </td>
            <td class="bdr-right bdr-bottom head-right-bottom text-top">
              <span class="small_bold span_block pay_date" > SRec Date : <?php echo date("d-m-Y", strtotime($detail->SRecDate));?></span>
            </td>
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="content">
        <tr class="content-top">
          <th class="bdr-left bdr-right bdr-top bdr-bottom list-qty" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-number" rowspan="2"><span class="normal_bold">Invoice No</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-desc" rowspan="2"><span class="normal_bold">Inv. Date</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right"><span class="normal_bold">Invoice Amount</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Invoice Owing</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-center" ><span class="normal_bold">Downpayment</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Discount</span></th>
          <th class="bdr-right bdr-top bdr-bottom text-right list-amount"><span class="normal_bold">Load Rounding</span></th>
          <th  class="bdr-right bdr-top bdr-bottom text-right list-amount" colspan="3"><span class="normal_bold">Payment Amount</span></th>
        </tr>
        <tr class="content-top">
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
             <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
                <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->BankCurrCode;?></span></th>
            <?php endif;?>
        </tr>
        <?php for($x = 0; $x < $CountList; $x++):?>
        <tr class="content-middle">
          <td  class="bdr-left text-top" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="text-top" ><span class="small_bold txt_inv_number"><?php echo $list[$x]['InvoiceNumber']; ?></span></td>
          <td  class="text-center text-top"><span class="small_bold"><?php echo date("d-m-Y", strtotime($list[$x]['InvoiceDate']));?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceAmount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceOwing'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['ReceiptTotalDP'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['ReceiptDiscount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"> <?php echo number_format($list[$x]['BebanPembulatan'],"2",",","."); ?></span></td>
           <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
              <td  class="bdr-right text-right text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
            <?php else:?>
              <td  class="bdr-right text-right text-top"><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
          <?php endif;?>
        </tr>
        <?php endfor; ?>
          <?php

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

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

            for($xi = 0; $xi < $ListDiff; $xi++):
          ?>
        <tr class="content-middle no-item">
            <td  class="bdr-left" ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php else:?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
          <?php endif;?>
            <td  class=" bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr class="content-bottom">
          <td colspan="7" class="bdr-left bdr-right bdr-top bdr-bottom content-bottom-desc">
              <span class="normal_bold">Description :</span>
              <?php if($detail->SRecDesc != ""):?>
              <span class="small_bold span_block">
              <?php echo preg_replace( "/\r|\n/", "", substr($detail->SRecDesc,0,225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
          <td class="bdr-right bdr-top bdr-bottom content-bottom-amount" colspan="3">
              <table border="0" class="tbl-item">
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">DP Partial</span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalDPUsed,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">Total Receipt (IDR) </span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form --> 
        <div class="footer">
            <div class="footer-top">
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Prepared By</div>
                    <?php if($detail->nm_prepared !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_prepared;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>       
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Approved Mng.</div>
                    <?php if($detail->nm_manager  !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_manager;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>    
                <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)){?>
                    <div class="footer-status"><h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4></div>     
                <?php }?>
                <div class='clear-float'></div>
            </div>

            <div class="footer-bottom">
                <div class="footer-bottom-company">
                    <?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName; ?>
                    <div class="footer-bottom-page">Page : 1 Of 1</div>
                </div>
                <div class='clear-float'></div>
            </div>
        </div>

      <?php else:?>
      <?php
        $MaxList = 55;
        if($CountList <= $MaxList):
      ?>
      <!-- Item > 8 and item <=34 -->
      <!-- Start Item <=34 -->
      <table class="header">
        <tr>
             <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom head-left">
                  <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-right bdr-top bdr-bottom head-right">
              <h2>SALES RECEIPT</h2>
            </td>
        </tr>
        <tr>
            <td class="bdr-left bdr-right bdr-bottom head-left-bottom-1 text-top">
                <span class="small_bold span_block">Paid To :</span>
                <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 class="bdr-right bdr-bottom head-left-bottom-2 text-top">
                <span class="small_bold span_block">Bank :</span>
                <span class="small_bold span_block" ><?php echo $detail->AccountName." (".$detail->BankCurrCode.")";?></span>
                <span class="small_bold span_block" >Kurs : <?php echo $detail->BankCurrRate;?>  USD / IDR</span>
                <!-- <span class="small_bold span_block" ><?php echo preg_replace( "/\r|\n/", "", $detail->CustomerAddress ); ?> - &nbsp;&nbsp; <?php echo $detail->PhoneNumber;?></span> -->
            </td>
            <td class="bdr-right bdr-bottom head-right-bottom text-top">
                <span class="small_bold span_block pay_no" > SRec No : <?php echo $detail->SRecNumber;?></span>
            </td>
            <td class="bdr-right bdr-bottom head-right-bottom text-top">
              <span class="small_bold span_block pay_date" > SRec Date : <?php echo date("d-m-Y", strtotime($detail->SRecDate));?></span>
            </td>
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="content">
         <!-- Detail Item -->
      <table class="content">
        <tr class="content-top">
          <th class="bdr-left bdr-right bdr-top bdr-bottom list-qty" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-number" rowspan="2"><span class="normal_bold">Invoice No</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-desc" rowspan="2"><span class="normal_bold">Inv. Date</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right"><span class="normal_bold">Invoice Amount</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Invoice Owing</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-center" ><span class="normal_bold">Downpayment</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Discount</span></th>
          <th class="bdr-right bdr-top bdr-bottom text-right list-amount"><span class="normal_bold">Load Rounding</span></th>
          <th  class="bdr-right bdr-top bdr-bottom text-right list-amount" colspan="2"><span class="normal_bold">Payment Amount</span></th>
        </tr>
        <tr class="content-top">
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
             <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
                <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->BankCurrCode;?></span></th>
            <?php endif;?>
        </tr>
        <?php for($x = 0; $x < $CountList; $x++):?>
        <tr class="content-middle">
          <td  class="bdr-left text-top" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="text-top" ><span class="small_bold txt_inv_number"><?php echo $list[$x]['InvoiceNumber']; ?></span></td>
          <td  class="text-center text-top"><span class="small_bold"><?php echo date("d-m-Y", strtotime($list[$x]['InvoiceDate']));?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceAmount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['InvoiceOwing'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['ReceiptTotalDP'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['ReceiptDiscount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"> <?php echo number_format($list[$x]['BebanPembulatan'],"2",",","."); ?></span></td>
           <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class="text-right text-top"><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
              <td  class="bdr-right text-right text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Receipt_Currency'],"2",",","."); ?></span></td>
            <?php else:?>
              <td  class="bdr-right text-right text-top"><span class="small_bold"><?php echo number_format($list[$x]['PaymentAmount'],"2",",","."); ?></span></td>
          <?php endif;?>
        </tr>
        <?php endfor; ?>
          <?php

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

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

            for($xi = 0; $xi < $ListDiff; $xi++):
          ?>
        <tr class="content-middle no-item">
            <td  class="bdr-left" ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php else:?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
          <?php endif;?>
            <td  class=" bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr class="content-bottom">
          <td colspan="7" class="bdr-left bdr-right bdr-top bdr-bottom content-bottom-desc">
              <span class="normal_bold">Description :</span>
              <?php if($detail->SRecDesc != ""):?>
              <span class="small_bold span_block">
              <?php echo preg_replace( "/\r|\n/", "", substr($detail->SRecDesc,0,225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
           <td class="bdr-right bdr-top bdr-bottom content-bottom-amount" colspan="3">
              <table border="0" class="tbl-item">
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">DP Partial</span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalDPUsed,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">Total Receipt (IDR) </span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form --> 
        <div class="footer">
            <div class="footer-top">
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Prepared By</div>
                    <?php if($detail->nm_prepared !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_prepared;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>       
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Approved Mng.</div>
                    <?php if($detail->nm_manager  !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_manager;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>    
                <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)){?>
                    <div class="footer-status"><h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4></div>     
                <?php }?>
                <div class='clear-float'></div>
            </div>

            <div class="footer-bottom">
                <div class="footer-bottom-company">
                    <?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName; ?>
                    <div class="footer-bottom-page">Page : 1 Of 1</div>
                </div>
                <div class='clear-float'></div>
            </div>
        </div>

      <?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) + 34; // Index Item To

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

            $ListTo[1] = $CountList - 34;

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

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

          }
      ?>

      <!-- Header Form -->
       <table class="header">
        <tr>
             <td colspan="2" class="bdr-left bdr-right bdr-top bdr-bottom head-left">
                  <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-right bdr-top bdr-bottom head-right">
              <h2>SALES RECEIPT</h2>
            </td>
        </tr>
        <tr>
            <td class="bdr-left bdr-right bdr-bottom head-left-bottom-1 text-top">
                <span class="small_bold span_block">Paid To :</span>
                <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 class="bdr-right bdr-bottom head-left-bottom-2 text-top">
                <span class="small_bold span_block">Bank :</span>
                <span class="small_bold span_block" ><?php echo $detail->BankName." (".$detail->BankCode.")";?></span>
                <span class="small_bold span_block" >Kurs : <?php echo $detail->BankCurrRate;?>  USD / 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-right bdr-bottom head-right-bottom text-top">
                <span class="small_bold span_block pay_no" > PPay No : <?php echo $detail->PPayNumber;?></span>
            </td>
            <td class="bdr-right bdr-bottom head-right-bottom text-top">
              <span class="small_bold span_block pay_date" > PPay Date : <?php echo date("d-m-Y", strtotime($detail->PPayDate));?></span>
            </td>
        </tr>
      </table>
      <!-- Detail Item -->
      <table class="content">
         <!-- Detail Item -->
      <table class="content">
        <tr class="content-top">
          <th class="bdr-left bdr-right bdr-top bdr-bottom list-qty" rowspan="2"><span class="normal_bold">Paid</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-number" rowspan="2"><span class="normal_bold">Invoice No</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-desc" rowspan="2"><span class="normal_bold">Inv. Date</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right"><span class="normal_bold">Invoice Amount</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Invoice Owing</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-center" ><span class="normal_bold">Downpayment</span></th>
          <th class="bdr-right bdr-top bdr-bottom list-amount text-right" ><span class="normal_bold">Discount</span></th>
          <th class="bdr-right bdr-top bdr-bottom text-right list-amount"><span class="normal_bold">Load Rounding</span></th>
          <th  class="bdr-right bdr-top bdr-bottom text-right list-amount" colspan="2"><span class="normal_bold">Payment Amount</span></th>
        </tr>
        <tr class="content-top">
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom"><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
            <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->CurrencyCode;?></span></th>
             <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
                <th class="bdr-right bdr-bottom" ><span class="normal_bold"><?php echo $detail->BankCurrCode;?></span></th>
            <?php endif;?>
        </tr>
        <?php for($x = $ListTo[0]; $x <= $ListTo[1]; $x++):?>
        <tr class="content-middle">
          <td  class="bdr-left text-top" ><span class="small_bold"><?php echo $list[$x]['Paid']; ?></span></td>
          <td  class="text-top" ><span class="small_bold txt_inv_number"><?php echo $list[$x]['Invoice_Number']; ?></span></td>
          <td  class="text-center text-top"><span class="small_bold"><?php echo date("d-m-Y", strtotime($list[$x]['Invoice_Date']));?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Invoice_Amount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Invoice_Owing'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Payment_DP'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Payment_Discount'],"2",",","."); ?></span></td>
          <td  class="text-right text-top" ><span class="small_bold"> <?php echo number_format($list[$x]['Load_Rounding'],"2",",","."); ?></span></td>
           <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class="text-right text-top"><span class="small_bold"><?php echo number_format($list[$x]['Payment_Amount'],"2",",","."); ?></span></td>
              <td  class="bdr-right text-right text-right text-top" ><span class="small_bold"><?php echo number_format($list[$x]['Payment_Currency'],"2",",","."); ?></span></td>
            <?php else:?>
              <td  class="bdr-right text-right text-top"><span class="small_bold"><?php echo number_format($list[$x]['Payment_Amount'],"2",",","."); ?></span></td>
          <?php endif;?>
        </tr>
        <?php endfor; ?>
        <?php
        // Count Last Item
        if(($i+1) == $paper_count):
          $ListDiff = $MaxList - ($CountList - $ListTo[0]);
          for($xi = 0; $xi < $ListDiff; $xi++):
        ?>
      <tr class="content-middle no-item">
            <td  class="bdr-left" ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php if($detail->CurrencyCode != $detail->BankCurrCode):?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
            <?php else:?>
              <td  class=" " ><span class="small_bold">&nbsp;</span></td>
          <?php endif;?>
            <td  class=" bdr-right" ><span class="small_bold">&nbsp;</span></td>
        </tr>
        <?php endfor;?>
        <?php endif;?>
        <!-- Description -->
        <tr class="content-bottom">
          <td colspan="7" class="bdr-left bdr-right bdr-top bdr-bottom content-bottom-desc">
              <span class="normal_bold">Description :</span>
              <?php if($detail->PPayDesc != ""):?>
              <span class="small_bold span_block">
              <?php echo preg_replace( "/\r|\n/", "", substr($detail->PPayDesc,0,225) ); ?>
              </span>
              <?php else:?>
              <span class="normal_bold span_block">&nbsp;</span>
              <?php endif;?>
          </td>
           <td class="bdr-right bdr-top bdr-bottom content-bottom-amount" colspan="3">
              <table border="0" class="tbl-item">
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">DP Partial</span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalDPUsed,"2",",","."); ?></span></td>
                </tr>
                <tr>
                    <td class="content-bottom-amount-label"> <span class="small_bold">Total Receipt (IDR) </span></td>
                     <td class=" "> <span class="small_bold"> : </span></td>
                    <td class="content-bottom-amount-value"> <span class="small_bold"> <?php echo number_format($detail->SRecTotalAmount,"2",",","."); ?></span></td>
                </tr>
              </table>
          </td>
        </tr>             
      </table>
      <!-- Footer Form --> 
        <div class="margin-page">
            <div class="footer-top">
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Prepared By</div>
                    <?php if($detail->nm_prepared !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_prepared;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>       
                <div class="footer-paraf-div">
                    <div class="footer-paraf-by normal_bold">Elektronik Approved Mng.</div>
                    <?php if($detail->nm_manager  !=""):?>
                    <span class="text-underline text-center footer-paraf-name"><?php echo $detail->nm_manager;?></span>
                        <?php else:?>
                    <span class="text-underline normal_bold span_block footer-paraf-name">____________</span>
                    <?php endif;?>
                </div>    
                <?php if(($detail->TransStatus == 3) or ($detail->TransStatus == 9)){?>
                    <div class="footer-status"><h4 id="title-form" class="suspended">DOKUMEN TIDAK BERLAKU</h4></div>     
                <?php }?>
                <div class='clear-float'></div>
            </div>

            <div class="footer-bottom">
                <div class="footer-bottom-company">
                    <?php echo $this->load->model('file/m_new_company')->get_company_name($this->session->userdata('company')); ?> - <?php echo $detail->BranchName; ?>
                    <div class="footer-bottom-page"><?php echo "Page : ".($i+1)." Of ".$paper_count;?></div>
                </div>
                <div class='clear-float'></div>
            </div>
        </div>

      <?php endfor;?>
      <?php endif;?>
      <!-- End Item <=8 -->
    <?php endif;?>
        </div>
  </div>
</body>
</html>

<script type="text/javascript">

function print_detail(){
  var data_print  = $("#print-container").html();
  Popup(data_print);
  
}


function Popup(data) 
{
    var mywindow = window.open('', 'print-container', 'height=528,width=700');
    var css = css_print();
    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;
}

$('.txt_inv_number').on('click',function(){
    var ADebtNumber   = $(this).html();
    ADebtNumber       = ADebtNumber.trim();
    ADebtNumber       = ADebtNumber.replace('&nbsp;','');
    var arrNumber     = ADebtNumber.split("/");
    var type_trans    = arrNumber[1];
    var no_type       = type_trans.substr(-2,2);  
    if(no_type == 'SI'){ 
      parent.tab_edit('Edit Sales Invoice', 'list/sales_invoice', 'icon-edit', 'edit', ADebtNumber);
    }else{
      parent.tab_edit('Edit Sales Order', 'list/sales_order', 'icon-edit', 'edit', ADebtNumber);
    }
}).on('mouseover',function(){
    $(this).css({"color":"blue","text-decoration":"underline","cursor":"pointer"});
}).on('mouseout',function(){
    $(this).css({"color":"#000000","text-decoration":"none"});
});
</script>