<?php

include("../include/session.php");
if( !$session->isAdmin()  ){
	//header("Location: ../Store/storeMenu.php");?>
	<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script> <?php
}else{
//	include("../include/db.php");
	include("../productionHeader.php");

	$recipieId = mysql_real_escape_string($_REQUEST['id']);
	$q = "SELECT * FROM nam_recipie WHERE recipieId = '$recipieId'";
	$result = execsql($q);
	$row = mysql_fetch_assoc($result);
//	print_r($row);

	$rName = mysql_result($result, 0, "recipieName");
	$q1 = "SELECT * FROM nam_perproductprice WHERE recipieName = '$rName'";
	$r1 = execsql($q1);
	$row1 = mysql_fetch_array($r1, MYSQL_ASSOC);
	$n1 = mysql_num_rows;
	
//	
//	print_r($row1);
//	echo $row1[OPC_Cement];

	?>


<h3>Edit Skip Ratios</h3>
<form action="manipulation/updateRecipies.php" method="POST">
<table>
<tr><td>Quantity / Skip</td><td>Cost Per Unit</td></tr>
	<?php
	//array for looping through recipie objects
	foreach($row as $key => $value){
		if($value != ""){
			if($key == "recipieId"){
				echo "<tr><td>$key: <input name=\"$key\" value=\"$value\" readonly=\"readonly\" /></td></tr>";
			}elseif($key == "recipieName"){
				echo "<tr><td>$key: <input name=\"$key\" value=\"$value\" readonly=\"readonly\" /></td></tr>";
			}
			else{
				echo "<tr><td>$key: <input name=\"$key\" value=\"$value\" /> </td>" .
						"<td><input name=\"$key-Price\" value=\"$row1[$key]\" /></tr>";
			}
		}
	}


	?>
</table>
<input name="perPriceId" type="hidden" value="<?php echo $row1[priceId]?>" />
<input type="reset" value="Reset Form" />
    	<input type="submit" name="submitok" value="   OK   " />
</form>
	<?php
	include("../footer.php");
}
?>
