<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<?php
include('../include/session.php');
include ("../navigation/header.php");
include ("../navigation/sales_sidebar.php");

	$d="";
	$s = $_GET['s'];
	$p = $_GET['p'];
	//if ($_SESSION['p'] >= 4) {$d=1;}
//	$error = $_SESSION['error'];
	$_SESSION['p']=$p;
	$_SESSION['s']=$s;
	
	
	if (isset($_GET['prev_button']) )
	   {
		 $_SESSION['p']= $_SESSION['p']-1;
	   }
		 
	if (isset($_GET['next_button']) )
	  {
		$_SESSION['p']=$_SESSION['p']+1;
	  }
	
		
	
	if ($s==1) {
	  	$_SESSION['quote_no']	 = $_GET['quote_no'];
		$_SESSION['cust_id']	 = $_GET['cust_id'];
		
	  	$table_name2 = $_SESSION['db_prefix']."_customer";
		$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$_SESSION['cust_id']."' ";
		$customer_result = mySQL_query($customer_query);
		$customer_num = mysql_num_rows($customer_result);	
		$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$_SESSION['company_name'] = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$_SESSION['company_name'] = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
		
		
			
		
	}
		
	if($s==2) {
	 if ($_SESSION['project']=='Electric fencing') {
		
		 $_SESSION['re_text'] = $_GET['re_text'];
		 
		  if (isset($_GET['option_checkbox1'])) {
			   $_SESSION['round_bar'] = $_GET['option_text1'];
			   $_SESSION['option_checkbox1']=1;
		  }
		  else {
			   $_SESSION['round_bar'] = 0;
			   $_SESSION['option_checkbox1']=0;
		  }
		  
		  if (isset($_GET['option_checkbox2'])) {
			   $_SESSION['flat_bar'] = $_GET['option_text2'];
			   $_SESSION['option_checkbox2']=1;
		  }
		  else {
			   $_SESSION['flat_bar'] = 0;
			   $_SESSION['option_checkbox2']=0;
		  }
		  
		  if (isset($_GET['option_checkbox3'])) {
			   $_SESSION['square_tube'] = $_GET['option_text3'];
			   $_SESSION['option_checkbox3']=1;
		  }
		  
		  else {
			   $_SESSION['square_tube'] = 0;
			   $_SESSION['option_checkbox3']=0;
		  }
		  
		  if (isset($_GET['option_checkbox4'])) {
			   $_SESSION['heavy_duty'] = $_GET['option_text4'];
			   $_SESSION['option_checkbox4']=1;
		  }
		  else {
			   $_SESSION['heavy_duty'] = 0;
			   $_SESSION['option_checkbox4']=0;
		  }
		  
		  if (isset($_GET['option_checkbox5'])) {
			   $_SESSION['earth_loops'] = $_GET['option_text5'];
			   $_SESSION['option_checkbox5']=1;
		  }
		  else {
			   $_SESSION['earth_loops'] = 0;
			   $_SESSION['option_checkbox5']=0;
		  }
		  
		  if (isset($_GET['option_checkbox6'])) {
			   $_SESSION['outrigger'] = $_GET['option_text6'];
			   $_SESSION['option_checkbox6']=1;
		  }
		  else {
			   $_SESSION['outrigger'] = 0;
			   $_SESSION['option_checkbox6']=0;
		  }
		  
		  if (isset($_GET['option_checkbox7'])) {
			   $_SESSION['wash_line'] = $_GET['option_text7'];
			   $_SESSION['option_checkbox7']=1;
		  }
		  else {
			   $_SESSION['wash_line'] = 0;
			   $_SESSION['option_checkbox7']=0;
		  }
		  
		  if (isset($_GET['option_checkbox8'])) {
			   $_SESSION['strobe'] = $_GET['option_text8'];
			   $_SESSION['option_checkbox8']=1;
		  }
		  else {
			   $_SESSION['strobe'] = 0;
			   $_SESSION['option_checkbox8']=0;
		  }
		  
		  if (isset($_GET['option_checkbox9'])) {
			   $_SESSION['anti_lift_bar'] = $_GET['option_text9'];
			   $_SESSION['option_checkbox9']=1;
		  }
		  else {
			   $_SESSION['anti_lift_bar'] = 0;
			   $_SESSION['option_checkbox9']=0;
		  }
		  
		  if (isset($_GET['option_checkbox10'])) {
			   $_SESSION['ace_100'] = $_GET['option_text10'];
			   $_SESSION['option_checkbox10']=1;
		  }
		  else {
			   $_SESSION['ace_100'] = 0;
			   $_SESSION['option_checkbox10']=0;
		  }
				 
	 }
	 
 if ( ($_SESSION['project']=='Gate motor') OR ($_SESSION['project']=='Pool fence') ) { 
	  $_SESSION['re_text'] = $_GET['re_text'];	 
	  $_SESSION['line_num6'] = $_GET['line_num6'];
	  $i=0;
	  while ($i<$_SESSION['line_num6']) {
		 if (isset($_GET['line_checkbox6'.$i])) { 
		 		$_SESSION['line_checkbox6'.$i] = 1;
		 		$_SESSION['item_text6'.$i] = $_GET['item_text6'.$i];
				$_SESSION['amount_text6'.$i] = $_GET['amount_text6'.$i];
		 }
		 else {
			    $_SESSION['line_checkbox6'.$i] = 0;
		 		$_SESSION['item_text6'.$i] = '';
				$_SESSION['amount_text6'.$i] = '';
		 }
		 $i++;
	  }
	  
	  $_SESSION['line_num7'] = $_GET['line_num7'];
	  $i=0;
	  while ($i<$_SESSION['line_num7']) {
		 if (isset($_GET['line_checkbox7'.$i])) { 
		 		$_SESSION['line_checkbox7'.$i] = 1;
		 		$_SESSION['item_text7'.$i] = $_GET['item_text7'.$i];
				$_SESSION['amount_text7'.$i] = $_GET['amount_text7'.$i];
		 }
		 else {
			    $_SESSION['line_checkbox7'.$i] = 0;
		 		$_SESSION['item_text7'.$i] = '';
				$_SESSION['amount_text7'.$i] = '';
		 }
		 $i++;
	  }
	 }
	 
if ( ($_SESSION['project']=='Manase 358') OR ($_SESSION['project']=='Gate') OR ($_SESSION['project']=='Razor wire') OR ($_SESSION['project']=='Wall spikes') OR ($_SESSION['project']=='Farm fence') OR ($_SESSION['project']=='Free standing electric fence') OR ($_SESSION['project']=='Miscelaneous') ) { 
      $_SESSION['re_text'] = $_GET['re_text'];
	  $_SESSION['option1_text'] = $_GET['option1_text'];	 
	  $_SESSION['line_num2'] = $_GET['line_num2'];
	  $i=0;
	  while ($i<$_SESSION['line_num2']) {
		 if (isset($_GET['line_checkbox2'.$i])) { 
		 		$_SESSION['line_checkbox2'.$i] = 1;
		 		$_SESSION['item_text2'.$i] = $_GET['item_text2'.$i];
				
						 }
		 else {
			    $_SESSION['line_checkbox2'.$i] = 0;
		 		$_SESSION['item_text2'.$i] = '';
			}
		 $i++;
	  }
	  
	  $_SESSION['line_num3'] = $_GET['line_num3'];
	  $j=0;
	  while ($j<$_SESSION['line_num3']) {
		 if (isset($_GET['line_checkbox3'.$j])) { 
		 		$_SESSION['line_checkbox3'.$j] = 1;
		 		$_SESSION['item_text3'.$j] = $_GET['item_text3'.$j];
				$_SESSION['amount_text3'.$j] = $_GET['amount_text3'.$j];
						 }
		 else {
			    $_SESSION['line_checkbox3'.$j] = 0;
		 		$_SESSION['item_text3'.$j] = '';
				$_SESSION['amount_text3'.$j] = '';
			}
		 $j++;
	  }
	 
	  $_SESSION['option2_text'] = $_GET['option2_text'];
	  if ($_SESSION['option2_text']!='.') {	 
	  $_SESSION['line_num4'] = $_GET['line_num4'];
	  $i=0;
	  while ($i<$_SESSION['line_num4']) {
		 if (isset($_GET['line_checkbox4'.$i])) { 
		 		$_SESSION['line_checkbox4'.$i] = 1;
		 		$_SESSION['item_text4'.$i] = $_GET['item_text4'.$i];
				
						 }
		 else {
			    $_SESSION['line_checkbox4'.$i] = 0;
		 		$_SESSION['item_text4'.$i] = '';
			}
		 $i++;
	  }
	  
	  $_SESSION['line_num5'] = $_GET['line_num5'];
	  $j=0;
	  while ($j<$_SESSION['line_num5']) {
		 if (isset($_GET['line_checkbox5'.$j])) { 
		 		$_SESSION['line_checkbox5'.$j] = 1;
		 		$_SESSION['item_text5'.$j] = $_GET['item_text5'.$j];
				$_SESSION['amount_text5'.$j] = $_GET['amount_text5'.$j];
						 }
		 else {
			    $_SESSION['line_checkbox5'.$j] = 0;
		 		$_SESSION['item_text5'.$j] = '';
				$_SESSION['amount_text5'.$j] = '';
			}
		 $j++;
	  }
	  }
	  
if (($_SESSION['project']=='Manase 358') OR ($_SESSION['project']=='Miscelaneous')) {	  
	  
	  $_SESSION['option3_text'] = $_GET['option3_text'];
	  if ($_SESSION['option3_text']!='.') {
	  $_SESSION['line_num_M4'] = $_GET['line_num_M4'];
	  
	  $i=0;
	  while ($i<$_SESSION['line_num_M4']) {
		 if (isset($_GET['line_checkbox_M4'.$i])) { 
		 		$_SESSION['line_checkbox_M4'.$i] = 1;
		 		$_SESSION['item_text_M4'.$i] = $_GET['item_text_M4'.$i];
				
						 }
		 else {
			    $_SESSION['line_checkbox_M4'.$i] = 0;
		 		$_SESSION['item_text_M4'.$i] = '';
			}
		 $i++;
	  }
	  	  
	  $_SESSION['line_num_M5'] = $_GET['line_num_M5'];
	  $j=0;
	  while ($j<$_SESSION['line_num_M5']) {
		 if (isset($_GET['line_checkbox_M5'.$j])) { 
		 		$_SESSION['line_checkbox_M5'.$j] = 1;
		 		$_SESSION['item_text_M5'.$j] = $_GET['item_text_M5'.$j];
				$_SESSION['amount_text_M5'.$j] = $_GET['amount_text_M5'.$j];
				
						 }
		 else {
			    $_SESSION['line_checkbox_M5'.$j] = 0;
		 		$_SESSION['item_text_M5'.$j] = '';
				$_SESSION['amount_text_M5'.$j] = '';
				
			}
		 $j++;
	  }
	  }
	  
	 $_SESSION['option4_text'] = $_GET['option4_text'];
	  if ($_SESSION['option4_text']!='.') {
	  $_SESSION['line_num_K4'] = $_GET['line_num_K4'];
	  echo '<br>*****line num K4: '.$_SESSION['line_num_M4'];
	  $i=0;
	  while ($i<$_SESSION['line_num_K4']) {
		 if (isset($_GET['line_checkbox_K4'.$i])) { 
		 		$_SESSION['line_checkbox_K4'.$i] = 1;
		 		$_SESSION['item_text_K4'.$i] = $_GET['item_text_K4'.$i];
				
						 }
		 else {
			    $_SESSION['line_checkbox_K4'.$i] = 0;
		 		$_SESSION['item_text_K4'.$i] = '';
			}
		 $i++;
	  }
	  	  
	  $_SESSION['line_num_K5'] = $_GET['line_num_K5'];
	 
	  $j=0;
	  while ($j<$_SESSION['line_num_K5']) {
		 if (isset($_GET['line_checkbox_K5'.$j])) { 
		 		$_SESSION['line_checkbox_K5'.$j] = 1;
		 		$_SESSION['item_text_K5'.$j] = $_GET['item_text_K5'.$j];
				$_SESSION['amount_text_K5'.$j] = $_GET['amount_text_K5'.$j];
				
						 }
		 else {
			    $_SESSION['line_checkbox_K5'.$j] = 0;
		 		$_SESSION['item_text_K5'.$j] = '';
				$_SESSION['amount_text_K5'.$j] = '';
				
			}
		 $j++;
	  }
	  } 
	  
	  $_SESSION['option5_text'] = $_GET['option5_text'];
	  if ($_SESSION['option5_text']!='.') {
	  $_SESSION['line_num_L4'] = $_GET['line_num_L4'];
	  $i=0;
	  while ($i<$_SESSION['line_num_L4']) {
		 if (isset($_GET['line_checkbox_L4'.$i])) { 
		 		$_SESSION['line_checkbox_L4'.$i] = 1;
		 		$_SESSION['item_text_L4'.$i] = $_GET['item_text_L4'.$i];
				
						 }
		 else {
			    $_SESSION['line_checkbox_L4'.$i] = 0;
		 		$_SESSION['item_text_L4'.$i] = '';
			}
		 $i++;
	  }
	  	  
	  $_SESSION['line_num_L5'] = $_GET['line_num_L5'];
	  $j=0;
	  while ($j<$_SESSION['line_num_L5']) {
		 if (isset($_GET['line_checkbox_L5'.$j])) { 
		 		$_SESSION['line_checkbox_L5'.$j] = 1;
		 		$_SESSION['item_text_L5'.$j] = $_GET['item_text_L5'.$j];
				$_SESSION['amount_text_L5'.$j] = $_GET['amount_text_L5'.$j];
						 }
		 else {
			    $_SESSION['line_checkbox_L5'.$j] = 0;
		 		$_SESSION['item_text_L5'.$j] = '';
				$_SESSION['amount_text_L5'.$j] = '';
			}
		 $j++;
	  }
	  } 
	  
	  
	  
}
}

if ($_SESSION['project']=='Diamond mesh') { 
      $_SESSION['re_text'] = $_GET['re_text'];
	  $_SESSION['option8_text'] = $_GET['option8_text'];
	  if (isset($_GET['picture_checkbox'])){ $_SESSION['picture']='yes';} else { $_SESSION['picture']='';}		 
	  
	  $i=0;
	  while ($i<6) {
		 if (isset($_GET['line_checkbox8'.$i])) { 
		 		$_SESSION['line_checkbox8'.$i] = 1;
		 		$_SESSION['item_text8'.$i] = $_GET['item_text8'.$i];
				 }
		 else {
			    $_SESSION['line_checkbox8'.$i] = 0;
		 		$_SESSION['item_text8'.$i] = '';
			}
		 $i++;
	  }
	  
	  $_SESSION['line_num9'] = $_GET['line_num9'];
	  $j=0;
	  while ($j<$_SESSION['line_num9']) {
		 if (isset($_GET['line_checkbox9'.$j])) { 
		 		$_SESSION['line_checkbox9'.$j] = 1;
		 		$_SESSION['item_text9'.$j] = $_GET['item_text9'.$j];
				$_SESSION['amount_text9'.$j] = $_GET['amount_text9'.$j];
						 }
		 else {
			    $_SESSION['line_checkbox9'.$j] = 0;
		 		$_SESSION['item_text9'.$j] = '';
				$_SESSION['amount_text9'.$j] = '';
			}
		 $j++;
	  }
}

if ($_SESSION['project']=='Palisade standard') { 
      $_SESSION['re_text'] = $_GET['re_text'];
	  //$_SESSION['option8_text'] = $_GET['option8_text'];
	  $_SESSION['fence_height'] = $_GET['height_radio_group'];
	  	  
	  $_SESSION['line_num9'] = $_GET['line_num9'];
	  $j=0;
	  while ($j<$_SESSION['line_num9']) {
		 if (isset($_GET['line_checkbox9'.$j])) { 
		 		$_SESSION['line_checkbox9'.$j] = 1;
		 		$_SESSION['item_text9'.$j] = $_GET['item_text9'.$j];
				$_SESSION['amount_text9'.$j] = $_GET['amount_text9'.$j];
						 }
		 else {
			    $_SESSION['line_checkbox9'.$j] = 0;
		 		$_SESSION['item_text9'.$j] = '';
				$_SESSION['amount_text9'.$j] = '';
			}
		 $j++;
	  }
}

if ($_SESSION['project']=='Palisade fencing') {
	$_SESSION['re_text'] = $_GET['re_text'];
	$_SESSION['palisade_text1']=$_GET['palisade_text1'];
	
	$i=6;
	while ($i<9) {
			$_SESSION['palisade_text'.$i]=$_GET['palisade_text'.$i];
			$i++;
		}
	
	
	$i=0;
	while ($i<3) {
			$_SESSION['gate_text'.$i]=$_GET['gate_text'.$i];
			$i++;
		}
	
}


 	};
	
	if($s==3) {
	  
	  $_SESSION['quotation_date'] = $_GET['quotation_date'];
	  $_SESSION['terms'] = $_GET['terms_radio_group'];
	  $_SESSION['VAT'] = $_GET['vat_group'];
	  $_SESSION['valid_days'] = $_GET['valid_days_select'];
	  $_SESSION['delivery_days'] = $_GET['delivery_days_select'];
	  $_SESSION['priority'] = $_GET['priority_group'];
	  $_SESSION['seller'] = $_GET['seller_select'];
	  
	  
	 
	};
	
	if($s==4) {
	 		 
	}
	
	?>

<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />



<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>  
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="JavaScript" src="../jscript/go_to_url.js"  type="text/javascript"></script> 

<div class="main_frame">
<div class="page_head_frame">  
<label class="label_page_head">Capture quote</label>&nbsp;<label class="label_page_head_2"><?php echo $_SESSION['company_name']?> </label>&nbsp;&nbsp;</td>
    <td width="128"><label class="label_quote_no"><?php if ($_SESSION['p']!='1') {echo 'Q'.$_SESSION['quote_no']; } ?></label></div>
      <br /><br /><br /><br />

	  <table >
      <tr>
      <td >
      <div class='wizard_paging_frame'>
        <table align="left">
      <tr>
      <td>
      <?php if ($_SESSION['p']==1) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;1</div></div>
      <div class="active_step_label">
        Enquiries</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;1</div></div>
      <div class="de_active_step_label">
      Enquiries</div>
      <?php } ?>
      
      </td>
      <td>
      <?php if ($_SESSION['p']==2) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;2</div></div>
      <div class="active_step_label">
      Quote items</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;2</div></div>
      <div class="de_active_step_label">
      quote items</div>
      <?php } ?>
     </td>
      <td>
      <?php if ($_SESSION['p']==3) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;3</div></div>
      <div class="active_step_label">
      Quote details</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;3</div></div>
      <div class="de_active_step_label">
      Quote detals</div>
      <?php } ?>
      </td>
      <td>
      <?php if ($_SESSION['p']==4) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;4</div></div>
      <div class="active_step_label">
      Finish</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;4</div></div>
      <div class="de_active_step_label">
        Finish</div>
      <?php } ?>
       </td>
      </tr>
      </table>
      </div>
      </td>
      </tr>
      <tr>
      <td><?php 
	if ($_SESSION['p']==1) { include("quoteWiz1.php"); }
	if ($_SESSION['p']==2) { include("quoteWiz2.php"); }
	if ($_SESSION['p']==3) { include("quoteWiz3.php"); }
	if ($_SESSION['p']==4) { include("quoteWiz5.php"); }
	
    ?></td>
    </tr>
    </table>
    </div>
</div>  
</div> 


<?php include ('../navigation/side_bar.php'); ?>