<?php $ci = get_instance();?>
<div id="div_print" style="page-break-after: always;">
<style type="text/css">
	.img-valign {
	  vertical-align: middle;
	  margin-bottom: 0.75em;
	}
	.title{
		font-size: 20px;
		font-weight: bold;
		text-align: center;
	}
	.chinese{
		font-family: "KaiTi";
		font-size: 24px;
		font-weight: bold;
		text-align: center;
	}
	.chinese_small{
		font-family: "KaiTi";
		font-size: 14px;
		text-align: center;
	}
	.title_small{
		font-size: 14px;
		text-align: center;
	}
	.small{
		font-size: 12px;
	}
	.container{
		zoom:80%;
		background-color: white;
	}
	.R_th_c{
		width: 1%;
		white-space: nowrap;
		text-align: center;
		padding: 2px 5px;
	}
	.R_td_c{
		white-space: nowrap;
		text-align: center;
		vertical-align: middle;
		padding: 2px 5px;
	}
	.page-footer, .page-footer-space {
	  	height: 120px;
	}
	.page-footer {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: auto;
		z-index: -1;
		-webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
	}
</style>
<div class="container">
<div class="title">
	<table style="width:99%; margin-left: auto; margin-right: auto; font-size: 18px;" align="center" border="0">
		<tr>
		    <td rowspan="6" style="width: 20%;"><center><img class="img-valign" src="<?php echo base_url("assets/img/logo.png");?>" style="width: 80px; padding-right: 0px; padding-top: 10px;"></center></td>
		    <td style="padding-left: 0px; width: 1000px;"><center><span class="chinese"><?php echo $company->CNAME;?></span></center></td>
		    <td rowspan="4" style="width: 20%;"></td>
	  	</tr>
	  	<tr>
	    	<td style="padding-left: 0px;"><center><span class="title"><?php echo $ci->fm->decrypt($this->company_name);?></span></center></td>
	  	</tr>
	  	<tr>
	    	<td style="padding-left: 0px;"><center><span class="small"><?php echo $company->ADD1;?></span></center></td>
	  	</tr>
	  	<tr>
	    	<td style="padding-left: 0px;"><center><span class="small">Tel: <?php echo $company->TEL;?>	H/P:<?php echo $company->HP;?></span></center></td>
	  	</tr>
	  	<tr>
		    <td style="padding-left: 0px;"><center><span class="small">Fax: <?php echo $company->FAX;?></span></center></td>
		    <td style="text-align: right; font-weight: bold;">TAX INVOICE</td>
	  	</tr>
	  	<tr>
		    <td style="padding-left: 0px;"><center><span class="small">Co. Reg. No.<?php echo $company->CO_REG_NO;?> | GST Reg. No.<?php echo $company->GST_REG_NO;?></span></center></td>
		    <td style="text-align: right;">No. <span style="font-family: 'Courier'; font-size: 22px;"><?php echo $data->REFNO;?></span></td>
	  	</tr>
	  	<tr>
	  		<td colspan="2" style="padding-top: 15px; font-size: 16px; width: 60%;">M/s: <?php echo $data->DEBTOR_NAME;?><br/><?php echo $data->DEBTOR_ADD1;?></td>
	  		<td style="text-align: right; padding-top: 15px; font-size: 16px;"><span class="chinese_small" style="font-size: 16px;">日期</span> / Date: <?php if(isset($data)) echo date("Y-m-d",strtotime($data->DATE));?></td>
	  	</tr>
	</table>
</div>

<div class="report_table_content print_font border">
	<div style="padding-bottom: 30px; padding-top: 2px;">
			<table class="" style="width: 100%;" border="1">
				<thead>
				 	<tr style="" class="">
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 8mm;">
				 			<span class="chinese_small">号码</span><br/><span class="title_small">No.</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">件银</span><br/><span class="title_small">Price<br/>Per Piece</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">单位</span><br/><span class="title_small">UOM</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">饰件</span><br/><span class="title_small">Particulars</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">数量</span><br/><span class="title_small">Qty</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">重量</span><br/><span class="title_small">Weight</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">个</span><br/><span class="title_small">Unit</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;;">
				 			<span class="chinese_small">尺</span><br/><span class="title_small">Foot</span>
				 		</th>
				 		<th class="R" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">长度</span><br/><span class="title_small">Length</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">总长</span><br/><span class="title_small">T.Length</span>
				 		</th>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px;">
				 			<span class="chinese_small">共计工银</span><br/><span class="title_small">T.Labour<br/>Charges</span>
				 		</th>
				 	</tr>
				</thead>
				<tbody>
				<?php if(count($list) > 0):?>
					<?php $no=1;?><tr></tr>
					<?php foreach($list as $x):?>
						<tr class="tr_data" style="font-size: 14px;">
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $no;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->PRICE;?></td>
							<td class="" style="white-space: nowrap; text-align: center; padding: 5px 5px; font-size: 12px;"><?php echo $x->UNIT;?></td>
							<td class="" style="white-space: nowrap; text-align: left; padding: 5px 5px; font-size: 12px;"><?php echo $x->ITEM_NAME;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->QTY;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->WEIGHT;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->UNIT_QTY;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->FOOT;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->INCH;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->LENGTH;?></td>
							<td class="" style="white-space: nowrap; text-align: right; padding: 5px 5px; font-size: 12px;"><?php echo $x->LABOUR;?></td>
						</tr>
					<?php $no++;?>
					<?php endforeach;?>
				<?php else:?>
				<?php endif;?>
				</tbody>
				<thead>
					<tr style="" class="">
				 		<th class="" colspan="99" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 5px;">
				 			&nbsp;
				 		</th>
				 	</tr>
				</thead>
				<thead>
				 	<tr style="" class="">
				 		<th class="" colspan="2" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 5px;">
				 			<span class="chinese_small">重量</span><br/><span class="title_small">Weight</span>
				 		</th>
				 		<td class="" colspan="7" style="white-space: nowrap; text-align: right; padding: 2px 10px; font-size: 14px;">
				 			<?php echo $data->WEIGHT;?>
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">工银</span><br/><span class="title_small">Labour Charge ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php echo number_format((float)$item_total, 2, '.', '');?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<th class="" colspan="2" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 5px;">
				 			<span class="chinese_small">升足</span><br/><span class="title_small">Pure Gold (gm)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; font-size: 14px;" colspan="5">
				 			<?php echo $data->PUREGOLD;?>
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 10px;">
							<span class="chinese_small">金價</span><br/><span class="title_small">Rate</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; font-size: 14px;">
				 			<?php echo $data->RATE;?>
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">結價</span><br/><span class="title_small">Nett Value ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php if($data->INCLUDE_GOLD == 1){ echo $data->GOLDPRICE;}else{echo "0";}?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<th class="" colspan="2" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 5px;">
				 			<span class="chinese_small">交足金</span><br/><span class="title_small">Pure Gold Received</span>
				 		</th>
				 		<td class="" colspan="6" style="white-space: nowrap; text-align: right; padding: 2px 10px; font-size: 14px;">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">共</span><br/><span class="title_small">Total ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php if($data->INCLUDE_GOLD == 1){ echo number_format((float)($item_total+$data->GOLDPRICE), 2, '.', '');}else{echo number_format((float)($item_total), 2, '.', '');}?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<td class="" colspan="8" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">退貨</span><br/><span class="title_small">Goods Return ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php if($data->RETURN != "" && $data->RETURN != 0) echo number_format((float)($data->RETURN), 2, '.', '');?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<td class="" colspan="8" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">折扣</span><br/><span class="title_small">Discount (%)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php echo $data->DISCOUNT;?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<td class="" colspan="8" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="title_small">GST 7%($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php if($data->ITEM_GST != "" && $data->GST != ""){ 
								echo number_format((float)($data->ITEM_GST+$data->GST), 2, '.', '');
							}elseif($data->ITEM_GST == "" && $data->GST != ""){
								echo number_format((float)($data->GST), 2, '.', '');
							}elseif($data->ITEM_GST != "" && $data->GST == ""){
								echo number_format((float)($data->ITEM_GST), 2, '.', '');
							}
							?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<td class="" colspan="8" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">總共</span><br/><span class="title_small">Amount Due ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php echo $data->AMOUNT;?>
				 		</td>
				 	</tr>
				 	<tr style="" class="">
				 		<td class="" colspan="8">
				 			
				 		</td>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px;">
				 			
				 		</td>
				 		<th class="" style="white-space: nowrap; text-align: center; padding: 2px 10px; width: 80px;">
				 			<span class="chinese_small">支票/現金</span><br/><span class="title_small">Cheque /Cash ($)</span>
				 		</th>
				 		<td class="" style="white-space: nowrap; text-align: right; padding: 2px 10px; width: 100px; font-size: 14px;">
							<?php if($data->CASHAMT != "") echo "Cash Amt: ".$data->CASHAMT;?>
							<?php if($data->BCAMT != "") echo "<br/>Bank/Cheque Amt: ".$data->BCAMT;?>
				 		</td>
				 	</tr>
				</thead>
			</table>
			<div class="page-footer-space">&nbsp;</div>
		</div>
	</div>
		<div class="page-footer">
		  	<table class="R_table" style="">
				<tr>
					<td>
						<table class="R_table" style="margin-top:100px;bottom:0mm;">
							<tr>
								<td class="R_td R_border_bottom" style="text-align: center; width:40%;">
									
								</td>
								<td style="width:10%;"></td>
								<td class="R_td R_border_bottom" style="text-align: center; width:40%;">
								</td>
							</tr>
							<tr>
								<td class="R_td" style="text-align: center;">
									<span class="chinese_small">收貨人簽名</span><br/><span class="title_small">Received By:</span><br/><br/>
								</td>
								<td></td>
								<td class="R_td" style="text-align: center;">
									<span class="chinese_small">經手人簽名</span><br/><span class="title_small">Issued By:</span><br/>
									<p style="font-size: 14px;"><?php echo $username;?></p>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<table class="R_table" style="bottom:0mm;">
				<tr>
					<td>
						<table style="margin-top:20px;">
							<tr>
								<td class="small" style="text-align: left; padding-right: 10px; font-size: 10px; width: 50%;">
									The abovementioned goods which are handed over on the express condition that they remain the property of <span style="font-weight: bold;">KENG HENG GOLDTECH PTE LTD</span> until fully paid for and the recipientshang shall be held responsible for any loss or damage. Further the abovementioned goods must be returned immediately on demand.
								</td>
								<td class="chinese_small" style="text-align: left; font-size: 12px; width: 50%;">
									上述各貨如取貨人尚未清還銀額乃屬<span style="font-weight: bold;">京興金工私人有限公司</span>之物倘有損失破壞取貨人應當負完全責任如要討取核所收貨人當即可交回。
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		 </div>
	</div>
</div>
<script>
	$(document).ready(function(){
		<?php if(isset($list)):?>
		$(".btn_print").show();
		$(".btn_excel").show();	
		<?php endif;?>	
	});

</script>