<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        	<head>
        	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        	<?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['name'] = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$_SESSION['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($s==3) {
	  $_SESSION['status'] = $_GET['status_group'];
	 
	  if ($_SESSION['status']=="successful" ) {
	    	$_SESSION['entry_date'] = $_GET['entry_date'];
	  		$_SESSION['seller'] = $_GET['seller_select'];
	  		$_SESSION['notes'] = $_GET['notes_text'];
			
			$_SESSION['notes'] = $_SESSION['notes'];
			
			$table_name = $_SESSION['db_prefix']."_quotation_notes";
    		$notes_query = "INSERT INTO $table_name (quote_number, note_date, note_text, seller ) VALUES ( '".trim($_SESSION['quote_no'])."', '".trim($_SESSION['entry_date'])."', '".trim($_SESSION['notes'])."', '".trim($_SESSION['seller'])."' ) ";
    		execsql($notes_query);
			
			if ($_SESSION['status']=="successful") {
				$table_name = $_SESSION['db_prefix']."_quotations";
				$status_query = "UPDATE $table_name SET status = 'quoted' WHERE quote_no = '".$_SESSION['quote_no']."' ";
				execsql($status_query);
			}
			
			?>
        	<script language="javascript" type="text/javascript">
        		window.location="acceptanceWiz0.php?quote_no=<?php echo $_SESSION['quote_no'] ?> ";
        	</script>
        	<?php
	  }
	  else {
		    $_SESSION['entry_date'] = $_GET['entry_date'];
	  		$_SESSION['seller'] = $_GET['seller_select'];
	  		$_SESSION['notes'] = $_GET['notes_text'];
	  }
			
			
	 
	};
	
	
	
	
	
	?>
        	<!--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/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>
            
        	</head>

        	<body>
            <div class="main_frame" style=" height:auto; min-height:550px;" >
              <div class="page_head_frame">
                      <table width="691" height="22" border="0">
                      <tr>
                          <td width="548"><label class="label_page_head">Status Quote</label>
                          &nbsp;&nbsp;&nbsp;&nbsp;
                          <label class="label_page_head_2"><?php echo $_SESSION['name']?></label></td>
                          <td width="122"><label style="font-size:24px; color:#FB6808;">
                              <?php if ($_SESSION['quote_no']!='') { echo "Q".$_SESSION['quote_no']; } ?>
                            </label></td>
                        </tr>
                    </table>
                      <label class="label_page_head_2">&nbsp;&nbsp;</label>
                    </div>
                    
                 
                          <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 class="active_step_label"><br />
                                      <br />
                                      <br />
                                      Select quote</div>
                                </div>
                                  <?php } else { ?>
                                  <div class="de_active_step_frame">
                                  <div class="de_active_step_head_label">&nbsp;1</div>
                                  <div class="de_active_step_label"><br />
                                      <br />
                                      <br />
                                      Select quote</div>
                                </div>
                                  <?php } ?></td>
                              <td><?php if ($_SESSION['p']==2) { ?>
                                  <div class="active_step_frame">
                                  <div class="active_step_head_label">&nbsp;2</div>
                                  <div class="active_step_label"><br />
                                      <br />
                                      <br />
                                      Quote details</div>
                                </div>
                                  <?php } else { ?>
                                  <div class="de_active_step_frame">
                                  <div class="de_active_step_head_label">&nbsp;2</div>
                                  <div class="de_active_step_label"><br />
                                      <br />
                                      <br />
                                      Quote details</div>
                                </div>
                                  <?php } ?></td>
                              <td><?php if ($_SESSION['p']==3) { ?>
                                  <div class="active_step_frame">
                                  <div class="active_step_head_label">&nbsp;3</div>
                                  <div class="active_step_label"><br />
                                      <br />
                                      <br />
                                      Comments</div>
                                </div>
                                  <?php } else { ?>
                                  <div class="de_active_step_frame">
                                  <div class="de_active_step_head_label">&nbsp;3</div>
                                  <div class="de_active_step_label"><br />
                                      <br />
                                      <br />
                                      Comments</div>
                                </div>
                                  <?php } ?></td>
                              <td><?php if ($_SESSION['p']==4) { ?>
                                  <div class="active_step_frame">
                                  <div class="active_step_head_label">&nbsp;4</div>
                                  <div class="active_step_label"><br />
                                      <br />
                                      <br />
                                      Finish</div>
                                </div>
                                  <?php } else { ?>
                                  <div class="de_active_step_frame">
                                  <div class="de_active_step_head_label">&nbsp;4</div>
                                  <div class="de_active_step_label"><br />
                                      <br />
                                      <br />
                                      Finish</div>
                                </div>
                                  <?php } ?></td>
                            </tr>
                            </table>
                            </div>
                            </td>
                        </tr>
                        <tr>
                          <td><?php 
	if ($_SESSION['p']==1) { include("quote_updateWiz1.php"); }
	if ($_SESSION['p']==2) { include("quote_updateWiz2.php"); }
	if ($_SESSION['p']==3) { include("quote_updateWiz3.php"); }
	if ($_SESSION['p']==4) { include("quote_updateWiz5.php"); }
	
    ?></td>
                        </tr>
                      </table>
                    </div>
                
            </div>
</body>
        	<?php include ('../navigation/side_bar.php'); ?>
