<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include ("../navigation/header.php");

$page_name = "Stores-main";
include ("../navigation/access.php");

if ($permission_num==1) {

include ("../navigation/store_sidebar.php");

$receive_no = $_GET['receive_no'];

   
		$table_name = $_SESSION['db_prefix']."_tile_receive";
		$quote_query = "SELECT *  FROM $table_name WHERE receive_no = '".$receive_no."'";
		$quote_result = mySQL_query($quote_query);
		$cust_id=mysql_result($quote_result, 0, "cust_id");
		$branch=mysql_result($quote_result, 0, "branch");
		$order_no = mysql_result($quote_result, 0, "order_no");	
		$receive_date = mysql_result($quote_result, 0, "receive_date");		 
		
		$quote='no';
		
		//$job_no=$order_no;
		 		
		
		
		$table_name = $_SESSION['db_prefix']."_tile_receive_lines";
		$line_query = "SELECT *  FROM $table_name WHERE receive_no = '".$receive_no."' ";
		$line_result = mySQL_query($line_query);
		$line_num = mysql_num_rows($line_result);
	
?>

<!--jscript-->

</head>

<body>

<div class="main_frame" >
  <div class="page_head_frame">
        <table width="650" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="483"><label class="label_page_head">Tiles received</label></td>
            <td width="167" align="right"><label class="label_page_head_2">Receive no <?php echo $receive_no?><br>
<?php echo $branch ?> branch</label></td>
          </tr>
        </table>
  </div><br />
<div class="page_middle_frame">
   <div class="wizard_frame">
   <div style="float:left; margin-left:0px;">Items received are from order no <?php echo $order_no ?> for:</div>
   <div style="float:left; margin-left:125px;">Date received:&nbsp;<?php echo date("d-m-Y", strtotime($receive_date))?></div><br>

        <?php 
		include ('../include/customer_block.php');
		?>
         </div><br>
<br>
<div class="wizard_frame">
         <table width="650" id="table_display" >
           <tr>
             <td height="26" colspan="2" align="left" valign="top">Item</td>
             <td width="116" align="left" valign="top">Group</td>
             <td width="71" align="left" valign="top">Unit</td>
             <td width="56" align="left" valign="top">Quantity</td>
             <td width="85" align="left" valign="top">Price</td>
             <td width="73" align="left" valign="top">Total</td>
           </tr>
           <?php
				$i=0;
				$sub_tot=0;
				$a5_total=0;
				 while ($i<$line_num){
					 $a0 = mysql_result($line_result, $i, "receive_line_id");
					 $a1 = mysql_result($line_result, $i, "store_item_id");
					 $table_name = $_SESSION['db_prefix']."_store_items";
						$item_query = "SELECT item_name, unit, subCategory FROM $table_name WHERE store_item_id = '".$a1."' ";
						$item_result = mySQL_query($item_query);
						$a1a = mysql_result($item_result, 0, "item_name");
						$a3a = mysql_result($item_result, 0, "unit");
						$a4a = mysql_result($item_result, 0, "subCategory");
					 $a2 = mysql_result($line_result, $i, "quantity");
					 $a3 = mysql_result($line_result, $i, "purchase_price");
					 
					$a5=$a2*$a3;
					$a5_total=$a5_total+$a5;
					 
				 ?>
           <tr>
             <td colspan="2" valign="top"><?php echo $a1a ?></td>
             <td valign="top"><?php echo $a4a ?></td>
             <td valign="top"><?php echo $a3a ?></td>
             <td valign="top"><?php echo $a2 ?></td>
             <td align="right" valign="top"><?php echo $a3. "  /" .$a3a ?>&nbsp;</td>
             <td align="right" valign="top"><?php echo number_format($a5, 2, '.', ',')?></td>
           </tr>
           <?php 
			   // $a6_total=$a6_total+$a6;
				$i++;
				 }
				 ?>
           <tr>
             <td colspan="2" align="left" valign="top">&nbsp;</td>
             <td align="left" valign="top">&nbsp;</td>
             <td align="left" valign="top">&nbsp;</td>
             <td align="left" valign="top">&nbsp;</td>
             <td align="left" valign="top">Total:</td>
             <td align="right" valign="top"><?php echo number_format($a5_total, 2, '.', ',') ?></td>
           </tr>
         </table>
         </div>
         <br>
<br>


    <table width="642" height="50" align="left" id="table_button_bar">
        <tr>
          <td width="108"><a href="tile_receive_print.php?receive_no=<?php echo $receive_no ?>" target="_blank"><input type="button" name="print_button" id="print_button" value="Print" class="imagebutton"></a></td>
          <td width="101">&nbsp;</td>
          <td width="191" align="right"></td>
          <td width="106" align="right">&nbsp;</td>
          <td width="112" align="right"><input type="button" name="close_button" id="close_button" value="Close" class="imagebutton" onClick="MM_goToURL('parent','store_main.php?date=&branch=&subCatSelect=Tiles');return document.MM_returnValue" ></td>
        </tr>
      </table>

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


</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/store_main.php?date=0&branch=&subCatSelect=Tiles";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>
<?php include ('../navigation/side_bar.php'); ?>