<!DOCTYPE HTML>
<?php 
include('config.php');



	$sql = "SELECT * FROM posheader WHERE pos_autoid = '$autoid'";
	$dcon 	= $conn->query($sql) or die($sql);
	$rs 	= $dcon->fetch_array();
	
	$transno 		= $rs['pos_transno'];
	$transdate 		= dtostr($rs['pos_transdate']);
	$order_type 	= dtostr($rs['pos_order_type']);
	$table_no 		= dtostr($rs['pos_tableno']);
	$gtotal 		= $rs['pos_gtotal'];
	
	
	$outlet_autoid 	= $rs['outlet_autoid'];
	$outlet_addr 	= $_outlet_addr[$outlet_autoid];
	$outlet_phone 	= $_outlet_phone[$outlet_autoid];
?>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Print Nota</title>
    <?php include('../../common/script_css.php');?>
	<script type="text/javascript">
    function save_post(){

		url = '/save_post.php';
		$.post(url,{autoid:$('#pos_autoid').val()},function(e){
			$('#test').html(e);
			
			})


		}
    </script>
	<link rel="stylesheet" href="local_print.css">
</head>

<body class="print_body">
<form id="iform" name="iform" method="post">
<div class="noprint">
<div class="tbprint" id="nav">

	<input type="hidden" id="pos_autoid" value="<?php echo $autoid?>">
	<input type="button" value="Print" class="btn-print" onclick="save_post()"/>
	<input type="button" value="Cancel" class="btn-back" onclick="dosubmit('index')"/>

</div>
</div>
</form>



<br>
<br>
<br>
<center>
<h3 style="margin:3px">SALOKA BAKERY</h3>
<div id="test">AAA</div>
<?php echo $outlet_addr?> <br>
<?php echo $outlet_phone?> <br>
<hr>
</center>
<table border="0" style="font-size:12px;margin-top:10px">
<tr>
	<td style="width:100px">No Nota</td>
    <td><?php echo $transno?> </td>
</tr>
<tr>
	<td>Waktu</td>
    <td><?php echo $transdate?></td>
</tr>
<tr>
	<td>Order</td>
    <td><?php echo $order_type?></td>
</tr>
<tr>
	<td>Meja No</td>
    <td><?php echo $table_no?></td>
</tr>
</table>
<hr>
<table width="100%" border="0" bordercolor="#CCCCCC" style="font-size:12px">
<?php

	$gtotal = 0;
	$i = 0;
	$sql = "select * from posdetail a, mst_product b  WHERE a.pm_autoid = b.pm_autoid AND a.pos_autoid = '$autoid' ORDER BY a.posd_autoid desc";
	$dcon 	= $conn->query($sql) or die($sql);
	while($rs 	= $dcon->fetch_array()){
		$pm_name = $rs['pm_name'];
		$posd_qty = $rs['posd_qty'];
		$posd_price = $rs['posd_price'];
		$subtotal = $posd_price * $posd_qty;
		$_pm_autoid = $rs['pm_autoid'];

?> 

	<tr>
        <td style="width:69%"><?php echo $rs['pm_name']?></td>
    	<td class="tc" style="width:10%"><?php echo $posd_qty?></td>
        <td style="width:30%" class="tr"><?php echo number_format($subtotal)?></td>
	</tr>
<?php 
$i = $i + 1;

$gtotal = $gtotal + $subtotal;

} ?>
<tr>
	<td colspan="3"><hr style="margin:0px"></td>
</tr>
	<tr class="bold">
		<td class="tr">SUBTOTAL</td>
		<td colspan="2" class="tr"><?php echo number_format($gtotal)?></td>
    </tr>
<tr>
	<td colspan="3"><hr style="margin:0px"></td>
</tr>
</table>

</body>

</html>