<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Purchase Debit Note</title>
<link rel="stylesheet" href="<?php echo base_url()?>css/stylesheets.css" type="text/css" media="screen"/>
<style media="print" type="text/css">
	body{FONT-SIZE: 8px;FONT-FAMILY: Arial;COLOR: #000000}
	.printButton { display: none;  }
	.contentarea { width:100%;  }
.linetable {
  border-style:solid;
  border-width:1px 0;
}
</style>
<script type="application/javascript">
function do_print(){
	window.print();
}
</script>
</head>

<div class="printButton" align="center">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr>
        <td align="center" colspan="2">
        	<?php 
			$js = 'onClick="do_print()" class="btn-icon btn-success-form Print" title="Print"';
			echo form_button('Print','<span class="i-printer">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="do_printexcel()" class="btn-icon btn-warning-form EXCEL" title="Download"';
			echo form_button('EXCEL','<span class="i-download">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="javascript:window.close();" class="btn-icon btn-danger-form Close" title="Close"';
			echo form_button('Close','<span class="i-switch">',$js);?>
        </td>
    </tr>
</table>
</div>
<body>
<div class="contentarea">
<div><h3><?php echo $this->lang->line('title2') ?></h3></div>
  <table border="0" cellpadding="1" cellspacing="0" width="100%">
  <tbody>
    <tr>
      <td>
      <table border="0" cellpadding="5" cellspacing="5" width="100%">
        <tbody>
          <tr>
            <td colspan="5">
      			<table border="0" cellpadding="5" cellspacing="5" width="100%">
                	<tr>
                    	<td width="10"><?php echo $this->lang->line('customer') ?></td>
                        <td width="40"><?php echo $salesOrder->customerName; ?></td>
                        <td width="20"></td>
                        <td width="10" align="right"><?php echo $this->lang->line('orderNo');?> :</td>
                        <td width="20"><?php echo $salesOrder->formNo; ?></td>
                    </tr>
                    <tr>
                    	<td width="10"></td>
                        <td width="40"></td>
                        <td width="10"></td>
                    	<td width="10" align="right"><?php echo $this->lang->line('salesorder') ?> :</td>
                        <td width="30"><?php echo $salesOrder->OrderNo;?></td>
                    </tr>
                    <tr>
                    	<td width="10"></td>
                        <td width="40"></td>
                        <td width="10"></td>
                    	<td width="10" align="right"><?php echo $this->lang->line('currency') ?> :</td>
                        <td width="30"><?php echo $salesOrder->fldcurr_code; ?></td>
                    </tr>
                    <tr>
                    	<td width="10"></td>
                        <td width="40"></td>
                        <td width="10"></td>
                    	<td width="10" align="right"><?php echo $this->lang->line('effective_date') ?> :</td>
                        <td width="30"><?php echo date("d-m-Y", strtotime($salesOrder->deliveryOrderDate));  ?></td>
                    </tr>
                    <tr>
                    	<td><?php echo $this->lang->line('location') ?></td>
                        <td><?php echo $salesOrder->locationCode; ?></td>
                        <td></td>
                        <td align="right"><?php echo $this->lang->line('salesperson') ?> :</td>
                        <td><?php echo $salesOrder->employeeName; ?></td>
                    </tr>
                </table>
            </td>
          </tr>
          <tr>
            <td colspan="5">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="5"><strong><?php echo $this->lang->line('memoandshipto') ?></strong></td>
          </tr>
          <tr>
            <td colspan="5">
            <table width="500">
            	<tr>
                	<td width="100"><?php echo $this->lang->line('shipto')?></td>
                    <td width="400" rowspan="4" valign="top"><?php echo $salesOrder->addressName; ?></td>
                </tr>
                <tr>
                	<td>&nbsp;</td>
                    </tr>
                <tr>
                	<td>&nbsp;</td>
                    </tr>
                <tr>
                	<td>&nbsp;</td>
                    </tr>
                <tr>
                	<td><?php echo form_label($this->lang->line('memo'),'memo');?></td>
                    <td><?php echo $headerDo->memo; ?>
                </tr>
            </table>
            </td>
          </tr>
          <tr>
            <td></td>
          </tr>
        </tbody>
      </table></td>
    </tr>
  </tbody>
  </table>
  <table border="0" id="oTable" cellpadding="5" cellspacing="0" width="100%">
	<thead class="linetable">
        <tr bgcolor="#FFFF00" class="linetable">
            		<th align="center" class="linetable">#</th>
            		<th align="left" class="linetable">&nbsp;<?php echo $this->lang->line('itemCode')?></th>
            		<th align="left" class="linetable">&nbsp;<?php echo $this->lang->line('description')?></th>
            		<th align="center" class="linetable"><?php echo $this->lang->line('daterequired')?></th>
            		<th align="center" class="linetable"><?php echo $this->lang->line('um')?></th>
            		<th align="right" class="linetable"><?php echo $this->lang->line('unitPrice')?></th>
            		<th align="right" class="linetable"><?php echo $this->lang->line('qtyOrd')?></th>
            		<th align="right" class="linetable"><?php echo $this->lang->line('qtySend')?></th>
            		<th align="right" class="linetable"><?php echo $this->lang->line('amount')?></th>
              	</tr>
        </thead>
        <tbody>
	<?php
	$bil=0; 
	$totalAmount = 0;
				if($datatbls1){
				foreach($datatbls1 as $datatbl):
				$bil++?>
                	<td align="center"><?php echo $datatbl->lineNo?></td>
                	<td>&nbsp;<?php echo $datatbl->itemCode?></td>
                    <td>&nbsp;<?php echo $datatbl->description ?></td>
                	<td id="requiredDate" align="center"><?php echo date("d-m-Y", strtotime($datatbl->requiredDate)) ?></td>
                	<td id="code" align="center"><?php echo $datatbl->code?></td>
                	<td id="unitPrice" align="right"><?php echo number_format(($datatbl->price != 0)? $datatbl->price : $datatbl->unitPrice ,2); ?></td>
                	<td id="quantityOrder" align="right"><?php echo number_format($datatbl->quantityOrder,2); ?></td>
                	<td id="quantitySent" align="right"><?php echo number_format($datatbl->quantitySent,2); ?></td>
                	<td id="amount" align="right"><?php echo number_format($datatbl->shipAmount,2); ?></td>
               </tr>
               
            <?php 
				$totalAmount = $totalAmount + $datatbl->shipAmount;
				endforeach; }
			else if($datatbls){
				foreach($datatbls as $datatbl):
				$bil++?>
            	<tr>
                	<td align="center"><?php echo $datatbl->lineNo?></td>
                	<td><?php echo $datatbl->itemCode?></td>
                    <td><?php echo $datatbl->description ?></td>
                    <td></td>
                	<td align="center"><?php echo $datatbl->code?></td>
                	<td align="right"><?php echo number_format($datatbl->unitPrice,2); ?></td>
                    <td></td>
                	<td align="right"><?php echo number_format($datatbl->quantitySent,2); ?></td>
                	<td align="right"><?php echo number_format($datatbl->amount,2); ?></td>
               </tr>
            <?php 
				$totalAmount = $totalAmount + $datatbl->amount;
				endforeach; }?>
            <tr>
        		<td align="right" colspan="8"><?php echo $this->lang->line('totalAmount')?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            	<td align="right" class="linetable"><strong><?php echo number_format($totalAmount,2)?></strong></td>
        	</tr>
		</tbody>
	</table>
    <table border="0" id="oTable2" cellpadding="5" cellspacing="5" width="100%">
        <tbody>
            <tr>
        		<td>&nbsp;</td>
        	</tr>
            <tr>
        		<td colspan="10"><strong><?php echo $this->lang->line('memoandshipto') ?></strong></td>
        	</tr>
            <tr>
        		<td colspan="10">
                	<table>
                    	<tr width="500">
                        	<td width="120"><?php echo $this->lang->line('shipMethod') ?></td>
                            <td width="120"><?php echo $shippingMethod->name; ?></td>
                            <td width="20"></td>
                        </tr>
                    </table>
                </td>
        	</tr>
            <tr>
        		<td align="center"><br><br><br><br>Memo:</td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td align="right"><br><br><br><br><br><br><?php echo $this->lang->line('preparedBy') ?><br><br><br><br></td>
                <td align="right"><br><br><br><br><br><br><?php echo $this->lang->line('approvedBy') ?><br><br><br><br></td>
        	</tr>
            <tr>
                <td colspan="10" align="right"><?php echo $this->lang->line('sys') ?></td>
        	</tr>
            <tr style="border-bottom:1px solid black">
        		<td></td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
        	</tr>
              <tr>
        		<td colspan="3"><?php 
				echo date("d-m-Y H:i:s A")
				?></td>
                <td colspan="3" align="center"><?php echo $this->lang->line('private') ?></td>
                <td colspan="4" align="right">1</td>
        	</tr>
		</tbody>
	</table>                                         
</div>
<div style="page-break-after:always"></div>
</body>
</html>
