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

?>
<script language="javascript" type="text/javascript">
          needToConfirm = false;
             window.location="store_no_return.php";
</script>
<?php
}
else {
	
$table_name = $_SESSION['db_prefix']."_orders";
$check_query = "SELECT order_no FROM $table_name WHERE order_no = '".$_SESSION['order_no']."' AND  cust_id = '".$_SESSION['cust_id']."' ";
$check_result = mySQL_query($check_query);
$check_num = mysql_num_rows($check_result);
if ($check_num>0) {
?>
<script language="javascript" type="text/javascript">
          needToConfirm = false;
          window.location="newOrderWizbase.php?p=2&s=&e=1";
</script>
<?php
} else {


$table_name = $_SESSION['db_prefix']."_order_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']."_order_lines_temp";
include('../include/store_item_select_header_tiles.php');

?>


<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(); " onFocus="MM_showHideLayers('wait','','hide');" >
<form id="form1" name="form1" method="POST" action="newOrderWizbase.php?p=4&s=3">
<div class="wizard_page_middle_frame">
<?php 
include('../include/store_item_select_table_tiles.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>
  
</div>


 
<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','newOrderWizbase.php?s=&amp;p=2&amp;e=0'); 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, '../store/store_main.php?date=');" 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-->


<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>

</body>

<?php
}
}
?>