<!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/maintenance_sidebar.php");

	$d="";
	$s = $_GET['s'];
	$p = $_GET['p'];
	
	$_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['maintenance_no'];
	 $_SESSION['option1_text']=''; 	 
	 
	$_SESSION['item_text30'] = 'Call out (call out, labor and transport)';
	$_SESSION['line_num3'] = 0;
	$_SESSION['line_checkbox30'] = '1';
	 
	$table_name = $_SESSION['db_prefix']."_maintenance_quotations";
	$project_query = "SELECT project FROM $table_name WHERE quote_no = '".$_SESSION['quote_no']."' ";
	$project_result = mySQL_query($project_query);
	$_SESSION['project'] = mysql_result($project_result, 0, "project");
		
	if ($_SESSION['project']=='Maintenance Fence (Residential)') {
		$table_name = $_SESSION['db_prefix']."_presets";
		$preset_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out residential' ";
		$preset_result = mySQL_query($preset_query);
		$_SESSION['amount_text30'] = mysql_result($preset_result, 0, "preset_value");
	}

	if ($_SESSION['project']=='Maintenance Fence (Commercial)') {
		$table_name = $_SESSION['db_prefix']."_presets";
		$preset_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out residential' ";
		$preset_result = mySQL_query($preset_query);
		$_SESSION['amount_text30'] = mysql_result($preset_result, 0, "preset_value");
	}
	
	if ($_SESSION['project']=='Maintenance Gate Motor') {
		$table_name = $_SESSION['db_prefix']."_presets";
		$preset_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Call out gate motor' ";
		$preset_result = mySQL_query($preset_query);
		$_SESSION['amount_text30'] = mysql_result($preset_result, 0, "preset_value");
	}
	
	if ($_SESSION['project']=='Maintenance miscellaneous') {
	    	$_SESSION['amount_text30'] = 0;
	}
	
	if ($_SESSION['project']=='Monthly maintenance') {
		
		
		$table_name = $_SESSION['db_prefix']."_presets";
		$preset_query = "SELECT preset_value FROM $table_name WHERE preset_name = 'Maintenance year' ";
		$preset_result = mySQL_query($preset_query);
		$_SESSION['amount_text31'] = mysql_result($preset_result, 0, "preset_value");
		$_SESSION['amount_text31'] =number_format($_SESSION['amount_text31'], 2, '.', '');
	}
		
		 
	$_SESSION['quote_no'] =$_GET['maintenance_no'];
	 if (($_SESSION['project']=='Maintenance Fence (Residential)') OR ($_SESSION['project']=='Maintenance Fence (Commercial)')) { 
	 			$_SESSION['option1_text'] = 'Maintenance of E/fence';
	 }
	 if ($_SESSION['project']=='Maintenance Gate Motor') { 
	 			$_SESSION['option1_text'] = 'Maintenance of gate motor';
	 } 
	 if ($_SESSION['project']=='Maintenance miscellaneous') { 
	 			$_SESSION['option1_text'] = 'Maintenance';
	 } 
	 if ($_SESSION['project']=='Monthly maintenance') { 
	 			$_SESSION['option1_text'] = 'Monthly maintenance';
	 } 
			
	}
		
	if($s==2) {
	 $_SESSION['option1_text'] = $_GET['option1_text'];
if ( ($_SESSION['project']=='Maintenance Fence (Residential)') OR ($_SESSION['project']=='Maintenance Fence (Commercial)') OR ($_SESSION['project']=='Maintenance Gate Motor')  OR ($_SESSION['project']=='Maintenance miscellaneous')) { 
      $_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] = number_format($_GET['amount_text3'.$j], 2, '.', '');
						 }
		 else {
			    $_SESSION['line_checkbox3'.$j] = 0;
		 		$_SESSION['item_text3'.$j] = '';
				$_SESSION['amount_text3'.$j] = '';
			}
		 $j++;
	  }
	  
}	 

if ($_SESSION['project']=='Monthly maintenance') {
	      $_SESSION['amount_text31'] = number_format($_GET['amount_text31'], 2, '.', '');
			  
}
			  
	



	};
	
	if($s==3) {
	  
	  $_SESSION['quotation_date'] = $_GET['quotation_date'];
	  $_SESSION['valid_days'] = $_GET['valid_days_select'];
	  $_SESSION['delivery_days'] = $_GET['delivery_days_select'];
	  
	  
	 
	};
	
	
	?>

<!--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> 
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  

<div class="main_frame">
<div class="page_head_frame">  
<table width="712" border="0">
  <tr>
    <td width="574"><label class="label_page_head">Maintenance quote</label>&nbsp;<label class="label_page_head_2"><?php echo $_SESSION['company_name']?> </label>&nbsp;&nbsp;</td>
    <td width="128"></td>
  </tr>
</table>
</div><br>
<br>
<br>
<br>

	  <table >
      <tr>
      <td >
      <div class='wizard_paging_frame'>
        <table align="left">
      <tr>
      <td>
            
      </td>
      <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">
      Select quote</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">
      Select quote</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 details</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("maintenance_quoteWiz1.php"); }
	if ($_SESSION['p']==2) { include("maintenance_quoteWiz2.php"); }
	if ($_SESSION['p']==3) { include("maintenance_quoteWiz3.php"); }
	if ($_SESSION['p']==4) { include("maintenance_quoteWiz5.php"); }
	
    ?></td>
    </tr>
    </table>
    </div>
</div>  
</div> 


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