<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 align="left" valign="middle">
	                <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()">Print</a>
                  </td>             
              </tr>
              </table>  
          </div>      
      </div>
      <br><br>
      <!-- Header -->
      <div id="list-print-container">
      <table width="95%" border="0" cellspacing="0" cellpadding="0" style="margin-left:30px;margin-right:30px; margin-top:10px;">
            <tr>
                <td height="18" colspan="5" class="s0 text-center text-middle"><?php echo $CompanyName ?></td>
            </tr>
            <tr>
                <td height="37" colspan="5" class="s1 text-center text-middle">List Chart Of Account</td>
            </tr>
            <tr>
                <td width="30" class="s4">No</td>
                <td width="120" class="s4">Account Number</td>
                <td width="150" class="s4">Account Name</td>
                <td width="150" class="s4">Account Type</td>
                <td width="150" class="s4">Branch Name</td>
            </tr>
            
        <?php	   
        $no = 1;
		foreach($list as $row){		   
        ?>
            <tr>
            	<td class="s5"><?php echo $no; ?></td>
                <td class="s5"><span style="padding-left:<?php echo $row->AccountLevel; ?>em;"><?php echo $row->AccountNumber; ?></span></td>
                <td class="s3"><span style="padding-left:<?php echo $row->AccountLevel; ?>em;"><?php echo $row->AccountName; ?></span></span></td>
                <td class="s5"><?php echo $row->AccountTypeName; ?></td>
                <td class="s5"><?php echo $row->BranchName; ?></td>
            </tr> 
        <?php
        $no++;
		}	   
        ?>
        </table>
      </div>
  </div>
</body>
</html>

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


function Popup(data) 
{
    var mywindow = window.open('', 'list-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>