<!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");

	$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) {
		    
	};
	
	if($s==2) {
				
		$table_name = $_SESSION['db_prefix']."_cash_sales_lines_temp";
		$delete_query = "DELETE FROM $table_name WHERE  user_name = '".$_SESSION['username']."'   "; 
		execsql($delete_query);
		
$line_num = $_GET['line_num'];
$i=0;
while ($i<$line_num) {
if (isset($_GET['line_checkbox'.$i])) {
$_SESSION['category'.$i] =	$_GET['category'.$i];
$_SESSION['index'.$i] =	$_GET['index'.$i];
$store_item_id = $_GET['store_item_id'.$i];
	

				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name, subCategory, price FROM $table_name WHERE store_item_id = '".$store_item_id."'  ";
				$name_result = mySQL_query($name_query);
				$_SESSION['store_item_name'] = mysql_result($name_result, 0, "item_name");
				$price = mysql_result($name_result, 0, "price");
				$sub_category = mysql_result($name_result, 0, "subCategory");
				$_SESSION['store_item_id'] = $store_item_id;
				
$quantity = $_GET['quantity_text'.$i];

$table_name = $_SESSION['db_prefix']."_cash_sales_lines_temp";
$receive_query = "INSERT INTO $table_name ( store_item_id, sub_category, quantity,  price, purchase_price, user_name) VALUES ('".$store_item_id."', '".$sub_category."', '".$quantity."', '".$price."', '".$purchase_price."', '".$_SESSION['username']."' ) ";
execsql($receive_query);

};
$i++;
}
	}
	 
?>
		<!--style sheets-->
		<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
		<!--reference to main.css removed-->
		<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 type="text/javascript" src="../window/dhtmlwindow.js"></script>
		<script type="text/javascript" src="../window/modal.js"></script>
		<script language="JavaScript" src="../jscript/jquery1.4.2.js"  type="text/javascript"></script>
		<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>
		<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script>
		<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>

		<body>
<div class="main_frame" style="height:auto; min-height:550px;">
          <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
              <td ><div class="page_head_frame">
                  <label class="label_page_head">Cash sale </label>
                  &nbsp;&nbsp;
                  <label class="label_page_head_2"><?php echo $_SESSION['cust_name'] ?></label>
                </div>
        <br />
        <br />
        <br />
        <br />
        <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 />
                          Customer</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 />
                          Customer</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 />
                          Items</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 />
                          Items</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 />
                          Finish</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 />
                          Finish</div>
              </div>
                      <?php } ?></td>
          </tr>
                </table>
                </div>
                </td>
              <!--center of tableMain--> 
            </tr>
    <tr>
              <td><!--center of tableMain-->
        
        <?php 
	if ($_SESSION['p']==1) { include("capture_cash_saleWiz1.php"); }
	if ($_SESSION['p']==2) { include("capture_cash_saleWiz2.php"); }
	if ($_SESSION['p']==3) { include("capture_cash_saleWiz4.php"); }
	//if ($_SESSION['p']==4) { include("capture_cash_saleWiz4.php"); }
//	if ($_SESSION['p']==5) { include("capture_cash_saleWiz5.php"); }
    ?></td>
            </tr>
  </table>
        </div>
<?php include ('../navigation/side_bar.php'); ?>

		</body>
