<?php
     include('../include/session.php');
         
	 $_SESSION['job_no']="";
	 	 
	 $_SESSION['job_no']=$_GET['job_no'];
	 $_SESSION['name']="";
	 $_SESSION['deliver_date']=date("Y-m-d");
	 $_SESSION['cust_id']='';
	 
	 $_SESSION['roof_cover']="";
	 $_SESSION['roof_pitch']="";
	 $_SESSION['overhang']="";
	 $_SESSION['roof_area']="";
	 $_SESSION['floor_area']="";
	 
	 $_SESSION['S5']="";
	 $_SESSION['S7']="";
	 $_SESSION['plate_area']="";
	 $_SESSION['press_points']="";
	 
	 $_SESSION['S5_tot']="";
	 $_SESSION['S7_tot']="";
	 $_SESSION['plate_area_tot']="";
	 
	 $table_name = $_SESSION['db_prefix']."_store_items";
	 $timber_query = "SELECT store_item_id, item_name, class, width, depth, length FROM $table_name WHERE subCategory='Timber' AND class='S5' AND width > '75' GROUP BY width";
	 $timber_result = mySQL_query($timber_query);
	 $timber_num = mysql_num_rows($timber_result);
	 $a=0;
	 while($a<$timber_num) {
		  $_SESSION['type_'.$a]="";
		  $_SESSION['timber_depth_'.$a]="";
		  $_SESSION['timber_width_'.$a]="";
		  $_SESSION['timber_class_'.$a]="";
		  $_SESSION['length_qty_'.$a]="";
		  $_SESSION['meter_price_'.$a]='0';
		  $a++;
	 }
	 

	 $table_name = $_SESSION['db_prefix']."_store_items";
	 $timber2_query = "SELECT store_item_id, item_name, class, width, depth, length FROM $table_name WHERE subCategory='Timber' AND class='S7' GROUP BY width";
	 $timber2_result = mySQL_query($timber2_query);
	 $timber2_num = mysql_num_rows($timber2_result);
	 $b=0;
	 while($b<$timber2_num) {
		  $_SESSION['type2_'.$b]="";
		  $_SESSION['timber2_depth_'.$b]="";
		  $_SESSION['timber2_width_'.$b]="";
		  $_SESSION['timber2e_class_'.$b]="";
		  $_SESSION['length2_qty_'.$b]="";
		  $_SESSION['meter_price2_'.$b]='0';
		  $b++;
	 }
	 
	 $table_name = $_SESSION['db_prefix']."_store_items";
	 $mitek_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory='Mitek' AND class='' ORDER BY item_name";
	 $mitek_result = mySQL_query($mitek_query);
	 $mitek_num = mysql_num_rows($mitek_result);
	 $i=0;
	 while ($i<$mitek_num) {
		 $_SESSION['length_'.$i]="";
		 $_SESSION['length2_'.$i]="";
		 $_SESSION['type'.$i]="";
		 $_SESSION['type2'.$i]="";
		 $_SESSION['quantity_'.$i]="";
		 $_SESSION['mitek_price'.$i]='0';
		 $i++;
	 }
	 
	 $table_name = $_SESSION['db_prefix']."_list_bracing";
	 $bracing_query = "SELECT * FROM $table_name ORDER BY item_name  ";
	 $bracing_result = mySQL_query($bracing_query);
	 $bracing_num = mysql_num_rows($bracing_result);
	 $j=0;
	 while($j<$bracing_num) {
		  $_SESSION['bracing_name_'.$j]="";
		  $_SESSION['bracing_depth_'.$j]="";
		  $_SESSION['bracing_width_'.$j]="";
		  $_SESSION['bracing_class_'.$j]="";
		  $_SESSION['bracing_qty_'.$j]="";
		  $_SESSION['bracing_type_'.$j]="";
		  $_SESSION['bracing_meter_price_'.$j]='0';
		  $j++;
	 }
	 
	 $table_name = $_SESSION['db_prefix']."_list_sundries";
	 $sundries_query = "SELECT * FROM $table_name ORDER BY item_name  ";
	 $sundries_result = mySQL_query($sundries_query);
	 $sundries_num = mysql_num_rows($sundries_result);
	 $k=0;
	 while($k<$sundries_num) {
		  $_SESSION['sundries_name_'.$k]="";
		  $_SESSION['sundries_depth_'.$k]="";
		  $_SESSION['sundries_width_'.$k]="";
		  $_SESSION['sundries_class_'.$k]="";
		  $_SESSION['sundries_qty_'.$k]="";
		  $_SESSION['sundries_type_'.$k]="";
		  $_SESSION['sundries_meter_price_'.$k]='0';
		  $k++;
	 }

	 $table_name = $_SESSION['db_prefix']."_list_sundries";
	 $sundries_query = "SELECT * FROM $table_name ORDER BY item_name  ";
	 $sundries_result = mySQL_query($sundries_query);
	 $sundries_num = mysql_num_rows($sundries_result);
	 $k=0;
	 while($k<$sundries_num) {
		  $_SESSION['sundries_name_'.$k]="";
		  $_SESSION['sundries_price'.$k]='0';
		  $k++;
	 }
	 
	 $table_name = $_SESSION['db_prefix']."_store_items";
	 $additional_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory='Sundries' AND class='' ORDER BY item_name";
	 $additional_result = mySQL_query($additional_query);
	 $additional_num = mysql_num_rows($additional_result);
	 $m=0;
	 while ($m<$additional_num) {
		 $_SESSION['additional_item_id'.$m]="";
		 $_SESSION['additional_quantity_'.$m]="";
		 $m++;
	 } 
	 
	 $_SESSION['plate']=""; 
	 $_SESSION['list_5a']='';
	 $_SESSION['list_5b']='';  
	 $_SESSION['p'] = 1;
	 $_SESSION['error']=0;
	 
	
     
?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="captureJobWizbase.php?error=0&p=1&s=0";
        -->
       </script>