<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 
<?php
include('../include/session.php');
include ("../navigation/header.php");
include ("../navigation/sales_sidebar.php");
	
	$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['receive_date']  = $_GET['receive_date'];
		$_SESSION['project']  = $_GET['project_select'];
		$_SESSION['title']  = $_GET['title_text'];
		$_SESSION['project_no']  = $_GET['project_no_text'];
		$_SESSION['project_area']  = $_GET['project_area_select'];
		$_SESSION['project_place']  = $_GET['project_place_select'];
		$_SESSION['description']  = $_GET['description_text'];
		$_SESSION['seller']  = $_GET['seller_select']; 			
	}
		
	if($s==2) {
	$table_name = $_SESSION['db_prefix']."_qbill_lines_temp";
	$delete_query = "DELETE FROM $table_name WHERE user_name = '".$_SESSION['username']."'  "; 
	execsql($delete_query);	
	
	 $line_num = $_POST['line_num'];
	 
	 $i=0;
	 while ($i<$line_num) {
		  
		  if (isset($_POST['line_checkbox'.$i]) ) {
			$cust_id = $_POST['comp_name_select'.$i];
		  	$ref_no_text = $_POST['ref_no_text'.$i];
		  	$amount = $_POST['amount_text'.$i]; 
		  	$table_name = $_SESSION['db_prefix']."_qbill_lines_temp";
			$bill_query = "INSERT INTO $table_name (cust_id, reference, amount, user_name) VALUES ('".$cust_id."', '".$ref_no_text."', '".$amount."', '".$_SESSION['username']."'  ) ";
			execsql($bill_query);
		  }
		  $i++;
		 
	};
	}
	?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<!--jscript-->
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></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 language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>   
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/capitalize_textbox.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">
<label class="label_page_head">Bill of quantity</label><label class="label_page_head_2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $_SESSION['employee_name']?></label>
</div>
<br />
<br />
<br />
     
      <table  align="left">
      <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">
      Bill of qty details</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">
      Bill of qty details</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">
      Customers</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">
      Customers</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">
      Finish</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">
      Finish</div>
      <?php } ?>
      </td>
     
      </tr>
      </table>
      </div>
      </td>
      
      </tr>
      <tr>
      <td>
	  <?php 
	if ($_SESSION['p']==1) { include("qbillWiz1.php"); }
	if ($_SESSION['p']==2) { include("qbillWiz2.php"); }
	if ($_SESSION['p']==3) { include("qbillWiz5.php"); }
	
    ?>
   </td>
    </tr>
    </table>
    </div>
    





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