<?php 
include('../include/session.php');


date_default_timezone_set('Africa/Gaborone');
$entryDate = date("Y-m-d H:i:s", time());  

		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x38 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");

		$meter_price = $_POST['3838_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x38 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '38' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x38 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
				
		
			
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x50 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['3850_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x50 (S5)' ";
		execsql($meter_query);
				
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '50' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x50 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
	
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x76 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['3876_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x76 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '76' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x76 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x114 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['38114_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x114 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '114' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x114 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x152 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
				
		$meter_price = $_POST['38152_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x152 (S5)' ";
		execsql($meter_query);	
		
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '152' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x152 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
			
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x228 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['38228_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x228 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '38' AND width = '228' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x228 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
					
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '50x76 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['5076_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '50x76 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '50' AND width = '76' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '50x76 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '50x152 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['50152_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '50x152 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '50' AND width = '152' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '50x152 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		
		
		
		
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '50x228 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['50228_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '50x228 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '50' AND width = '228' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '50x228 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		
		
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '70x330 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['70330_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '70x330 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '70' AND width = '330' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '70x330 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}

				
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x114 (S7)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['38114_sale_text2'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x114 (S7)' ";
		execsql($meter_query);
		
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S7' AND depth = '38' AND width = '114' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x114 S7' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
				
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x152 (S7)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['38152_sale_text2'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x152 (S7)' ";
		execsql($meter_query);	
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S7' AND depth = '38' AND width = '152' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x152 S7' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
				
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '38x228 (S7)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['38228_sale_text2'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '38x228 (S7)' ";
		execsql($meter_query);	
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S7' AND depth = '38' AND width = '228' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '38x228 S7' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$saved_query = "SELECT price_2 FROM $table_name WHERE timber = '76x228 (S5)' ";
		$saved_result = mySQL_query($saved_query);
		$saved_meter_price = mysql_result($saved_result, 0, "price_2");
		
		$meter_price = $_POST['70330_sale_text'];
		if ($meter_price!='') {
		$table_name = $_SESSION['db_prefix']."_timber_meter_price";
		$meter_query = "UPDATE $table_name SET price_2 = '".$meter_price."' WHERE timber = '76x228 (S5)' ";
		execsql($meter_query);	
			
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT store_item_id, length FROM $table_name WHERE subCategory = 'Timber' AND class ='S5' AND depth = '76' AND width = '228' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		$i=0;
		while ($i<$item_num) {
		  $store_item_id = mysql_result($item_result, $i, "store_item_id");
		  $length = mysql_result($item_result, $i, "length")/1000;
		
		$price_query = "UPDATE $table_name SET price_2 = '".$meter_price*$length."' WHERE store_item_id = '".$store_item_id."' ";
		execsql($price_query);
		$i++;
		}
		
		if ($saved_meter_price!=$meter_price) {
		$table_name = $_SESSION['db_prefix']."_tracking_sales";
		$trackingQuery = "INSERT INTO $table_name (entry_date, user, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '55', '76x228 S5' ,'','".$saved_meter_price."','".$meter_price."' )";
			$trackingResult = mySQL_query($trackingQuery);
		}
		}
		
		
		
		

	if (isset($_POST['update_close_button']) )
	   { ?>
       <script>
	      window.location="../store/store_main.php";
		</script>
        <?php		 
	   }
	          
       if (isset($_POST['update_button']) )
	   {  ?>
       <script>
	      window.location="timber_sales_price_edit.php?sub_cat=timber"
	   </script>
        <?php		 
	   }
	   ?>

