<style>
	.myreceipt0{
		background-color: #FFFFFF;
		width: 98%;
        box-shadow: 5px 5px 10px #888888;
	}
	
	.myreceipt1{
		width: 96%;
		background-color: #FFFFFF;
		font-family: Arial;
		margin: 5px 5px 5px 5px;
		font-size:18px;
	}
    .myreceipt2{
        width: 100%;
        border: thick;
		font-size:16px;
    }
    
    .frmBtn{
		width: 95%;
	}
    
    .btn{
      margin-top: 15px;
      font-family:Arial;
	  font-size: 18px;
	  width: 100px;
	  height: 60px;
      color: #0000FF;
      border-radius: 25px;
      box-shadow: 5px 5px 10px #888888;
      cursor: pointer;
    }
    .btn02{
      box-shadow: 5px 5px 10px #888888;
      cursor: pointer;
	  width:95px;
    }
</style>
<div>
	
<?php
    $mytime = time();
	
	$myprod = new PRODUCT();
	$invno = $myprod->getInvoiceNum();
	
    $mycart = new CART();
    $arrCart = $mycart->getCarts();
	if( count($arrCart)>0 ){
      foreach($arrCart as $tid=>$tcart){
        $arrCartProdid[] = $tcart["productid"];
      }
      $strCartProdid = "'" . implode("','",$arrCartProdid)."'";
    
      $arrProd = $myprod->getProducts(" WHERE id IN ($strCartProdid)");
	}
?>
	
    
<table style=" width: 320px" border="0"><tr><td>
    
<table class="myreceipt0" border="0"><tr><td align="center">
<table class="myreceipt1" border="0">
	<tr>
		<td align="center" colspan="2">
			LiJi FoodStuffs Trading<br>
			Bill No: <?= $invno ?><br><br>
		</td>
	</tr>
	<tr>
		<td align="left"><?= date("h:iA",$mytime) ?></td>
		<td align="right"><?=date("d-m-Y",$mytime) ?></td>
	</tr>
	<tr>
		<td colspan="2"><hr></td>
	</tr>
	
    <?php
    if( count($arrCart)>0 ){
	$ttotal = 0;
    foreach($arrCart as $tid=>$tcart){
    ?>
        <tr>
		<td colspan="2">
            <table class="myreceipt2" border="0">
            <tr>
                <td>
				  <a href="main_receipt_del.php?pid=<?= $tid ?>" style="text-decoration:none"><img src="img/ico_del01.png" width="25px" /></a>
				  </td>
				  <td valign="middle">
				  <a href="main_receipt_del.php?pid=<?= $tid ?>" style="text-decoration:none">				  <span style="text-decoration:none; color:#000000"><?= $arrProd[$tcart["productid"]]["name"] ?></span></a>
				</td>
                <td align="center" width="38px"><?= " X " . $tcart["qtty"] ?></td>
                <td align="right" width="90px">
					<?= $myprod->getRinggit($tcart["qtty"] * $arrProd[$tcart["productid"]]["price"]) ?>	
					<?php
					  $ttotal = $ttotal + $tcart["qtty"] * $arrProd[$tcart["productid"]]["price"];
					?>
				</td>
            </tr>
            </table>
        </td>
	    </tr>
    <?php
    }
    }else{
        ?>
	    <tr>
		<td colspan="2">0 item</td>
	    </tr>
        <?php
    }
    ?>
	
	<tr>
		<td colspan="2"><hr></td>
	</tr>
	<?php
	if( count($arrCart)>0 ){
	?>
	<tr>
	    <td colspan="2" align="right">Total : <?= $myprod->getRinggit($ttotal) ?></td>
	</tr>
	<?php
	}
	?>
	<tr>
		<td colspan="2" align="center">
			<br />Thank You.<br>Please come again.
		</td>
	</tr>
</table>
</td></tr></table>
    
    
</td></tr>
<tr><td>
    
    
<table class="frmBtn" border="0">
<tr align="center">
    
    <?php
    if( $_GET["pid"]==""){
	  if( count($arrCart)>0){
   ?>
    <form id="frmReset" action="main_receipt_reset.php" method="post">
    <td><img src="img/ico_bin.png" class="btn02" onclick="gotoReset()" /></td>
    </form>
    
    <form id="frmCash" action="main_receipt_noprint.php" method="post">
	<input type="hidden" name="ptime" value="<?= $mytime ?>" />
    <td>
       <img src="img/ico_cash.png" class="btn02" onclick="gotoCash()" />
    </td>
    </form>
	
    <form id="frmPrint" action="main_receipt_print.php" method="post">
	<input type="hidden" name="ptime" value="<?= $mytime ?>" />
    <td>
		<img src="img/ico_cashprint.png" class="btn02" onclick="gotoPrint()" />
    </td>
    </form>
    <?php
	  }
	}
    ?>

    
</tr>
</table>
    
</td></tr></table>
    
</div>
<script>
  function gotoReset(){
    document.getElementById("frmReset").submit();
  }
  function gotoCash(){
    document.getElementById("frmCash").submit();
  }
  function gotoPrint(){
    document.getElementById("frmPrint").submit();
  }
</script>