<?php 
if ($_SESSION['company_name']=='') {

?>
<script language="javascript" type="text/javascript">
          needToConfirm = false;
             window.location="store_no_return.php";
</script>
<?php
}
else {

$table_name = $_SESSION['db_prefix']."_quotation_lines_temp ";
$line_query = "SELECT * FROM $table_name  WHERE user_name = '".$_SESSION['username']."'";
$line_result = mySQL_query($line_query);
$line_num = mysql_num_rows($line_result);


$page = 'quote';
$temp_table_name = $_SESSION['db_prefix']."_quotation_lines_temp";
include('../include/store_item_select_header_no_price.php');

$table_name = $_SESSION['db_prefix']."_permissions";
$permission_query = "SELECT access_id  FROM  $table_name  WHERE access_id ='". $_SESSION['access_id']."' AND page_name = 'Sales-discount' ";
$permission_result = mySQL_query($permission_query);
$permission_num = mysql_num_rows($permission_result);
if ($permission_num>0) { 
		$discount_limit = 'no'; 
}
else {
	$discount_limit = 'yes'; 
}

?>


<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  

</head>

<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide'); initCS(); calc_M();" onFocus="MM_showHideLayers('wait','','hide');" >

<form id="form1" name="form1" method="get" action="newQuoteWizbase.php">
<div class="wizard_page_middle_frame">
<?php 
if ($_SESSION['quote_type']=='Tiles & accessories') {
include('../include/store_item_select_table_no_price.php');
?>
<div class="wizard_frame">
  <p>Estimated number of pallets: 
    <input name="pallets_text" type="text" class="text60" autocomplete="off" onKeyPress="return numbersonly(this, event)" style="text-align:right" onfocus = "this.select();"  value="<?php echo $_SESSION['pallets'] ?>">
  </p>
  <p>Transport costs:&nbsp;&nbsp;&nbsp;<input name="transport_text" type="text" class="text60" autocomplete="off" onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" onfocus = "this.select();"  value="<?php echo $_SESSION['transport'] ?>">
  </p>
</div>
<?php
}
?>


<?php 
if ($_SESSION['quote_type']=='Truss installation') { 

if ($_SESSION['userbranch']=='Gaborone') {$branch = 'gab';}
if ($_SESSION['userbranch']=='Francistown') {$branch = 'ftw';}

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote truss m1 low' ";
$preset_result = mySQL_query($preset_query);
$install_quote_truss_m1_low = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote truss m1 high' ";
$preset_result = mySQL_query($preset_query);
$install_quote_truss_m1_high = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote truss m2 low' ";
$preset_result = mySQL_query($preset_query);
$install_quote_truss_m2_low = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote truss m2 high' ";
$preset_result = mySQL_query($preset_query);
$install_quote_truss_m2_high = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote truss no' ";
$preset_result = mySQL_query($preset_query);
$install_quote_truss_no = mysql_result($preset_result, 0, "preset_value");


$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote tiles m2 low' ";
$preset_result = mySQL_query($preset_query);
$install_quote_tiles_m2_low = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote tiles m2 high' ";
$preset_result = mySQL_query($preset_query);
$install_quote_tiles_m2_high = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote tiles m1' ";
$preset_result = mySQL_query($preset_query);
$install_quote_tiles_m1 = mysql_result($preset_result, 0, "preset_value");

$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote tiles m3' ";
$preset_result = mySQL_query($preset_query);
$install_quote_tiles_m3 = mysql_result($preset_result, 0, "preset_value");


$table_name = $_SESSION['db_prefix']."_presets";
$preset_query = "SELECT  preset_value  FROM $table_name WHERE preset_name = '$branch install quote inspection' ";
$preset_result = mySQL_query($preset_query);
$install_quote_inspection = mysql_result($preset_result, 0, "preset_value");

?>

<input name="install_quote_truss_m1_low" id="install_quote_truss_m1_low" type="hidden" value="<?php echo $install_quote_truss_m1_low ?>">
<input name="install_quote_truss_m1_high" id="install_quote_truss_m1_high" type="hidden" value="<?php echo $install_quote_truss_m1_high ?>">
<input name="install_quote_truss_m2_low" id="install_quote_truss_m2_low" type="hidden" value="<?php echo $install_quote_truss_m2_low ?>">
<input name="install_quote_truss_m2_high" id="install_quote_truss_m2_high" type="hidden" value="<?php echo $install_quote_truss_m2_high ?>">
<input name="install_quote_truss_no" id="install_quote_truss_no" type="hidden" value="<?php echo $install_quote_truss_no ?>">
<input name="install_quote_tiles_m2_high" id="install_quote_tiles_m2_high" type="hidden" value="<?php echo $install_quote_tiles_m2_high ?>">
<input name="install_quote_tiles_m2_low" id="install_quote_tiles_m2_low" type="hidden" value="<?php echo $install_quote_tiles_m2_low ?>">
<input name="install_quote_tiles_m1" id="install_quote_tiles_m1" type="hidden" value="<?php echo $install_quote_tiles_m1 ?>">
<input name="install_quote_tiles_m3" id="install_quote_tiles_m3" type="hidden" value="<?php echo $install_quote_tiles_m3 ?>">
<input name="install_quote_inspection" id="install_quote_inspection" type="hidden" value="<?php echo $install_quote_inspection ?>">

<input name="VAT" id="VAT" type="hidden" value="<?php echo $_SESSION['vat'] ?>">


<script>
function calc_M() {
	
	if (document.getElementById('double_select').value == 'yes' ) { 
	        document.getElementById('truss_M2_text').value = parseFloat(document.getElementById('install_quote_truss_m2_high').value * document.getElementById('cplx_select').value ).toFixed(2) ;
			document.getElementById('tile_M2_text').value = parseFloat(document.getElementById('install_quote_tiles_m2_high').value ).toFixed(2) ;
			document.getElementById('truss_M1_text').value = parseFloat(document.getElementById('install_quote_truss_m1_high').value).toFixed(2) ;
	}
	else { 
			document.getElementById('truss_M2_text').value =  parseFloat(document.getElementById('install_quote_truss_m2_low').value * document.getElementById('cplx_select').value ).toFixed(2) ;
			document.getElementById('tile_M2_text').value =  parseFloat(document.getElementById('install_quote_tiles_m2_low').value ).toFixed(2) ;
			document.getElementById('truss_M1_text').value =  parseFloat(document.getElementById('install_quote_truss_m1_low').value).toFixed(2) ;
	}

document.getElementById('truss_No_text').value = parseFloat(document.getElementById('install_quote_truss_no').value).toFixed(2) ;
document.getElementById('tile_M1_text').value = parseFloat(document.getElementById('install_quote_tiles_m1').value).toFixed(2) ;
document.getElementById('tile_M3_text').value = parseFloat(document.getElementById('install_quote_tiles_m3').value).toFixed(2) ;
document.getElementById('inspection_text').value = parseFloat(document.getElementById('install_quote_inspection').value).toFixed(2) ;

	
document.getElementById('total_text_1').value = parseFloat(document.getElementById('truss_M2_text').value * document.getElementById('quantity_text_1').value).toFixed(2) ;
document.getElementById('total_text_2').value = parseFloat(document.getElementById('truss_M1_text').value * document.getElementById('quantity_text_2').value).toFixed(2) ;
document.getElementById('total_text_3').value = parseFloat(document.getElementById('truss_No_text').value * document.getElementById('quantity_text_3').value).toFixed(2) ;
document.getElementById('total_text_4').value = parseFloat(document.getElementById('tile_M2_text').value * document.getElementById('quantity_text_4').value).toFixed(2) ;
document.getElementById('total_text_5').value = parseFloat(document.getElementById('tile_M1_text').value * document.getElementById('quantity_text_5').value).toFixed(2) ;
document.getElementById('total_text_6').value = parseFloat(document.getElementById('tile_M3_text').value * document.getElementById('quantity_text_6').value).toFixed(2) ;
document.getElementById('total_text_7').value = parseFloat(document.getElementById('inspection_text').value * document.getElementById('quantity_text_7').value).toFixed(2) ;

document.getElementById('total_text_8').value = parseFloat(document.getElementById('add_unit_text_8').value * document.getElementById('quantity_text_8').value).toFixed(2) ;
document.getElementById('total_text_9').value = parseFloat(document.getElementById('add_unit_text_9').value * document.getElementById('quantity_text_9').value).toFixed(2) ;



var sub_total_var =	
	document.getElementById('truss_M2_text').value * document.getElementById('quantity_text_1').value + 
	document.getElementById('truss_M1_text').value * document.getElementById('quantity_text_2').value +
	document.getElementById('truss_No_text').value * document.getElementById('quantity_text_3').value +
	document.getElementById('tile_M2_text').value * document.getElementById('quantity_text_4').value +
	document.getElementById('tile_M1_text').value * document.getElementById('quantity_text_5').value +
	document.getElementById('tile_M3_text').value * document.getElementById('quantity_text_6').value +
	document.getElementById('inspection_text').value * document.getElementById('quantity_text_7').value +
	document.getElementById('add_unit_text_8').value * document.getElementById('quantity_text_8').value +
	document.getElementById('add_unit_text_9').value * document.getElementById('quantity_text_9').value ;
	
var discount_var =	sub_total_var * (document.getElementById('discount').value / 100) ;	

var sub_total2_var = sub_total_var - discount_var; 

var transport_var = parseFloat(document.getElementById('transport_text').value);

var sub_total3_var = sub_total2_var + transport_var; 	
	
var vat_var =	sub_total3_var * (document.getElementById('VAT').value / 100) ;


var all_total_var = sub_total3_var + vat_var ;

document.getElementById('sub_total_text').value = parseFloat( sub_total_var ).toFixed(2) ;
document.getElementById('discount_text').value = parseFloat(	discount_var ).toFixed(2) ;
document.getElementById('sub_total2_text').value = parseFloat( sub_total2_var ).toFixed(2) ;

document.getElementById('sub_total3_text').value = parseFloat( sub_total3_var ).toFixed(2) ;
document.getElementById('vat_text').value = parseFloat(	vat_var ).toFixed(2) ;
document.getElementById('all_total_text').value = parseFloat( all_total_var ).toFixed(2) ;

}



</script>



<div class="wizard_frame" style="width:675px;">
  <div class="wizard_frame">
  <table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="71">CPLX</td>
      <td width="110"><select name="cplx_select" id="cplx_select" class="select50" onChange="calc_M();">
        <option value=0.8>1</option>
        <option value=1>2</option>
        <option value=1.2>3</option>
        <option value="<?php echo $_SESSION['cplx'] ?>" selected="selected"><?php echo $_SESSION['cplx_display'] ?></option>
      </select></td>
      <td width="100">Double story:</td>
      <td width="319"><select name="double_select" id="double_select" class="select50" onChange="calc_M();">
        <option value="yes">yes</option>
        <option value="no">no</option>
        <option value="<?php echo $_SESSION['double'] ?>" selected="selected"><?php echo $_SESSION['double'] ?></option>
      </select></td>
      
    </tr>
  </table>
</div>
<div class="wizard_frame">
Installation of Trusses and loose timbers
<table width="650" id="table_details_display">
  <tr>
    <td width="426">Description</td>
    <td width="56">Quantity</td>
    <td width="46">Unit</td>
    <td width="60">Price/Unit</td>
    <td width="58">Total</td>
  </tr>
  <tr>
    <td>Installation of trusses, inclusive of wall plates, bracing, runners, battens,underlay and valley linings, all as indicated on roof layouts.</td>
    <td><input type="text" name="quantity_text_1" id="quantity_text_1" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50"  value="<?php echo $_SESSION['quantity_1']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">M2</td>
    <td align="right"><input name="truss_M2_text" id="truss_M2_text" type="text"  style="border:hidden; text-align:right;" size="10px;" readonly></td>
    <td><input type="text" name="total_text_1" id="total_text_1" class="text50" style="border:hidden; text-align:right" readonly value="<?php echo $_SESSION['total_1']?>"></td>
  </tr>
  <tr>
    <td>Install fascia and barge boards.</td>
    <td><input type="text" name="quantity_text_2" id="quantity_text_2" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50"  value="<?php echo $_SESSION['quantity_2']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">M1</td>
    <td align="right"><input name="truss_M1_text" id="truss_M1_text" type="text"  style="border:hidden; text-align:right;" size="10px;" readonly></td>
    <td><input type="text" name="total_text_2" id="total_text_2" class="text50" style="border:hidden; text-align:right" readonly value="<?php echo $_SESSION['total_2']?>"></td>
  </tr>
  <tr>
    <td>Supply and install truss hangers and rawbolts for trusses fixed to brickwork or concrete.</td>
    <td><input type="text" name="quantity_text_3" id="quantity_text_3" onfocus = "this.select();" onKeyPress="return isNumberKey(event);)" class="text50"  value="<?php echo $_SESSION['quantity_3']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">NO</td>
    <td align="right"><input name="truss_No_text" id="truss_No_text" type="text"  style="border:hidden; text-align:right;" size="10px;" readonly></td>
    <td><input type="text" name="total_text_3" id="total_text_3" class="text50" style="border:hidden; text-align:right" readonly value="<?php echo $_SESSION['total_3']?>"></td>
  </tr>
</table>
<br>
Installation of concrete roof tiles<br>
<table width="650" id="table_details_display">
  <tr>
    <td width="426">Description</td>
    <td width="56">Quantity</td>
    <td width="46">Unit</td>
    <td width="60">Price/Unit</td>
    <td width="58">Total</td>
  </tr>
  <tr>
    <td>Installation of concrete roof tiles, incl of cutting for valley- and hip tiles, all as indicated on roof layout</td>
    <td><input type="text" name="quantity_text_4" id="quantity_text_4" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50"  value="<?php echo $_SESSION['quantity_4']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">M2</td>
    <td align="right"><input name="tile_M2_text" id="tile_M2_text" type="text"  style="border:hidden; text-align:right;" size="10px; readonly="readonly""></td>
    <td><input type="text" name="total_text_4" id="total_text_4" class="text50" style="border:hidden; text-align:right" readonly value="<?php echo $_SESSION['total_4']?>"></td>
  </tr>
  <tr>
    <td>Installation of ridge, hip and rake verge tiles (incl. of paint and dpc)</td>
    <td><input type="text" name="quantity_text_5" id="quantity_text_5" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50"  value="<?php echo $_SESSION['quantity_5']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">M1</td>
    <td align="right"><input name="tile_M1_text" id="tile_M1_text" type="text"  style="border:hidden; text-align:right;" size="10px; readonly="readonly""></td>
    <td><input type="text" name="total_text_5" id="total_text_5" class="text50" style="border:hidden; text-align:right" readonly  value="<?php echo $_SESSION['total_5']?>"></td>
  </tr>
  <tr>
    <td>Installation of valley gutters</td>
    <td><input type="text" name="quantity_text_6" id="quantity_text_6" onfocus = "this.select();" onKeyPress="return isNumberKey(event);)" class="text50"  value="<?php echo $_SESSION['quantity_6']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">M3</td>
    <td align="right"><input name="tile_M3_text" id="tile_M3_text" type="text"  style="border:hidden; text-align:right;" size="10px; readonly="readonly""></td>
    <td><input type="text" name="total_text_6" id="total_text_6" class="text50" style="border:hidden; text-align:right" readonly  value="<?php echo $_SESSION['total_6']?>"></td>
  </tr>
</table><br>
Engineering inspection
<br>
<table width="650" id="table_details_display">
  <tr>
    <td width="426">Description</td>
    <td width="56">Quantity</td>
    <td width="46">Unit</td>
    <td width="60">Price/Unit</td>
    <td width="58">Total</td>
  </tr>
  <tr>
    <td>Engineering inspection</td>
    <td><input type="text" name="quantity_text_7" id="quantity_text_7" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50" value="<?php echo $_SESSION['quantity_7']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off">
    <td align="center">NO</td>
    <td align="right"><input name="inspection_text" id="inspection_text" type="text"  style="border:hidden; text-align:right;" size="10px; readonly="readonly""></td>
    <td><input type="text" name="total_text_7" id="total_text_7" class="text50" style="border:hidden; text-align:right" readonly  value="<?php echo $_SESSION['total_7']?>"></td>
  </tr>
</table>
<br>
Additional work <br>
<table width="650" id="table_details_display">
  <tr>
    <td width="426">Description</td>
    <td width="56">Quantity</td>
    <td width="46">Unit</td>
    <td width="60">Price/Unit</td>
    <td width="58">Total</td>
  </tr>
  <tr>
    <td><input name="add_description_text_8" type="text" id="add_description_text_8"  maxlength="50" class="text300" value="<?php echo $_SESSION['description_8']?>" ></td>
    <td><input type="text" name="quantity_text_8" id="quantity_text_8" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50" value="<?php echo $_SESSION['quantity_8']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">.</td>
    <td><input name="add_unit_text_8" id="add_unit_text_8" type="text"  style="text-align:right;" size="10px;" class="text50" onfocus = "this.select();"  onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" onKeyPress="return isNumberKey(event);" value="<?php echo $_SESSION['unit_8'];?>" autocomplete="off"></td>
    <td><input type="text" name="total_text_8" id="total_text_8" class="text50" style="border:hidden; text-align:right" readonly  value="<?php echo $_SESSION['total_8']?>"></td>
  </tr>
  <tr>
    <td><input name="add_description_text_9" type="text" id="add_description_text_9"  maxlength="50" class="text300" value="<?php echo $_SESSION['description_9']?>"></td>
    <td><input type="text" name="quantity_text_9" id="quantity_text_9" onfocus = "this.select();" onKeyPress="return isNumberKey(event);" class="text50" value="<?php echo $_SESSION['quantity_9']?>" onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off"></td>
    <td align="center">.</td>
    <td><input name="add_unit_text_9" id="add_unit_text_9" type="text"  style="text-align:right;" size="10px;" class="text50" onfocus = "this.select();"  onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" value="<?php echo $_SESSION['unit_9'];?>" autocomplete="off"></td>
    <td><input type="text" name="total_text_9" id="total_text_9" class="text50" style="border:hidden; text-align:right" readonly  value="<?php echo $_SESSION['total_9']?>"></td>
  </tr>
</table>
<br>
<table width="650" id="table_details_display">
  <tr>
    <td width="346" valign="middle">&nbsp;</td>
    <td width="144" valign="middle">Sub total:</td>
    <td width="144" align="right" valign="middle"><input type="text" name="sub_total_text" id="sub_total_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
    <td valign="middle">discount: 
      <select name="discount" id="discount" class="select50" onChange="calc_M()">
        <option value="0">0</option>
        <option value="0.5">0.5</option>
        <option value="1.0">1.0</option>
        <option value="1.5">1.5</option>
        <option value="2.0">2.0</option>
        <option value="2.5">2.5</option>
        <option value="3.0">3.0</option>
        <option value="3.5">3.5</option>
        <option value="4.0">4.0</option>
        <option value="4.5">4.5</option>
        <option value="5.0">5.0</option>
        <?php if ($discount_limit=='no') { ?>
        <option value="5.5">5.5</option>
        <option value="6.0">6.0</option>
        <option value="6.5">6.5</option>
        <option value="7.0">7.0</option>
        <option value="7.5">7.5</option>
        <option value="<?php echo $_SESSION['discount'] ?>" selected="selected"><?php echo $_SESSION['discount'] ?></option>
        <?php } ?>
</select>
      %</td>
    <td align="right" valign="middle"><input type="text" name="discount_text" id="discount_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
    <td valign="middle">Sub total:</td>
    <td align="right" valign="middle"><input type="text" name="sub_total2_text" id="sub_total2_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
    <td valign="middle">Transport:</td>
    <td align="right" valign="middle"><input type="text" name="transport_text" id="transport_text" class="text50"  style="text-align:right"   value="<?php echo $_SESSION['transport'] ?>"  onKeyUp="this.value = this.value.replace (/(\...).*/, '$1'); calc_M();" autocomplete="off" onfocus = "this.select();"></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
    <td valign="middle">Sub total:</td>
    <td align="right" valign="middle"><input type="text" name="sub_total3_text" id="sub_total3_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
    <td valign="middle">VAT @ <?php echo $_SESSION['vat'] ?>%</td>
    <td align="right" valign="middle"><input type="text" name="vat_text" id="vat_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
  <tr>
    <td valign="middle"><input type="hidden" name="pallets_text" id="pallets_text"></td>
    <td valign="middle">Total:</td>
    <td align="right" valign="middle"><input type="text" name="all_total_text" id="all_total_text" class="text50" style="border:hidden; text-align:right" readonly  value=""></td>
  </tr>
</table>
<p>&nbsp;</p>
</div>
</div>
<?php } ?>
 
<div class="wizard_frame">
  <table width="590" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;MM_showHideLayers('wait','','show');MM_goToURL('parent','newQuoteWizbase.php?s=&amp;p=2'); return document.MM_returnValue; ;return document.MM_returnValue"/></td>
            <td width="115">&nbsp;</td>
            <td width="99"><span class="wizard">
              <input name="error" type="hidden" id="error" value="0" />
              <input name="p" type="hidden" id="p" value="3" />
              <input name="s" type="hidden" id="s" value="3" />
            </span></td>
            <td width="125" align="left"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false;  cancel_confirmation(1, '../sales/sales_main.php?date=&branch=');" value="Cancel" /></td>
            <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          </tr>
      </table>
    </div>
  </div>
</form>
</div>

<!--form validation-->
<?php if ($_SESSION['quote_type']=='Tiles & accessories') { ?>
check here.
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
     
  for (i = 0; i < 50; i++) {
	frmvalidator.addValidation("store_item_id"+i,"req","- store item on store line "+(i+1)+".");
	frmvalidator.addValidation("quantity_text"+i,"req","- quantity  on store line "+(i+1)+".");
  }
  </script>
  <?php } ?>
</body>

<?php 
}
?>