</head>
<?php include('../include/wait.php'); 

$table_name = $_SESSION['db_prefix']."_packaging_design_lines_temp";
$mix_query = "SELECT store_item_id, quantity FROM $table_name WHERE packaging_design = '".$_SESSION['packaging_design']."' AND user_name = '".$_SESSION['username']."' ";
$mix_result = mySQL_query($mix_query);
$mix_num = mysql_num_rows($mix_result);

?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="page_middle_frame">
<form id="feedbackform" method="get" action="packing_designWiz6.php" >
<div class="wizard_frame">
<table id="table_details_display">
  <tr>
    <td width="316">Ingredient</td>
    <td width="76">Quantity</td>
    <td width="46">Unit</td>
    <td width="96">Unit cost</td>
    <td width="112">Packaging cost</td>
  </tr>
<?php
$total=0;
$i=0;
while ($i<$mix_num) {
		$store_item_id = mysql_result($mix_result, $i, "store_item_id");
		$table_name = $_SESSION['db_prefix']."_store_items";
		$name_query = "SELECT item_name, unit, price FROM $table_name WHERE store_item_id = '".$store_item_id."'  ";
		$name_result = mySQL_query($name_query);
		$item_name = mysql_result($name_result, 0, "item_name");
		$unit = mysql_result($name_result, 0, "unit");
		$price = mysql_result($name_result, 0, "price");
		$quantity = mysql_result($mix_result, $i, "quantity");
		$line_total = $quantity * $price;
		$total = $total + $line_total;
		?>
  <tr>
    <td><?php echo $item_name ?></td>
    <td><?php echo $quantity ?></td>
    <td><?php echo $unit ?></td>
    <td align="right"><?php echo number_format($price, 2, '.', ',') ?></td>
    <td align="right"><?php echo number_format($line_total, 2, '.', ',') ?></td>
  </tr>
  <?php
  $i++;
}
?>
<tr>
    <td colspan="4" align="right">Total packaging design cost:&nbsp;&nbsp;</td>
    <td align="right"><?php echo number_format($total, 2, '.', ',') ?> </td>
  </tr>
</table>
</div>
<div class="wizard_frame">
Estimated number of items to be packedd with this packaging design:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <?php echo $_SESSION['number'] ?>
</div>

       <div class="wizard_frame">
          <label class="label_std">If you want to make changes use the 'Prev' button to go back. <br />
            Click 'New' to make a new entry or to finish the wizard click 'Finish'.</label>
    </div><table width="590" height="50" align="left" id="table_button_bar">
          <tr>
            <td width="117" valign="middle"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); MM_goToURL('parent','packing_designWizbase.php?s=&p=2');return document.MM_returnValue" /></td>
            <td width="115" valign="middle"><input name="s" type="hidden" id="s" value="5" />
              <input name="p" type="hidden" id="p" value="5" /></td>
            <td width="99" valign="middle"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php?date=0&subCatSelect=Tiles');;" value="Cancel" /></td>
            <td align="right" valign="middle"><input  name="new_button" type="submit" class="imagebutton" id="new_button" value="New" onClick="needToConfirm = false;MM_showHideLayers('wait','','show'); "    onMouseUp="MM_showHideLayers('buttons','','hide');" /></td>
            <td align="right" valign="middle"><input  name="finish_button" type="submit" class="imagebutton" id="finish_button" value="Finish" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); "    onMouseUp="MM_showHideLayers('buttons','','hide');" /></td>
          </tr>
        </table>
 
</form>
</div>
</body>