<head>
<?php


$table_name = $_SESSION['db_prefix']."_supply_store_lines_temp";
$delete2_query = "DELETE FROM $table_name WHERE  supply_id > 0  "; 
execsql($delete2_query);

$table_name = $_SESSION['db_prefix']."_captured_jobs";
$jobQuery = "SELECT job_no, cust_id FROM $table_name WHERE captured = 'yes' ORDER BY job_no DESC";
$jobResult = execsql($jobQuery);
$jobNum = mysql_num_rows($jobResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $jobNum-1) {
		$cust_id = mysql_result($jobResult, $w, "cust_id");
		$table_name = $_SESSION['db_prefix']."_customer";
		$name_query = "SELECT comp_name FROM $table_name WHERE cust_id = '".$cust_id."' ";
		$name_result = mySQL_query($name_query);
		$name = mysql_result($name_result, 0, "comp_name");
		$arrId4[$w] = mysql_result($jobResult, $w, 'job_no');
		$arrName4[$w] = "J".mysql_result($jobResult, $w, 'job_no')."&nbsp;&nbsp;&nbsp;".$name;
		$w++;
	}
?>

<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<!--reference to main.css removed-->

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

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

<div class="page_middle_frame">
<form id="form1" method="get" action="additionalOrderWizbase.php">
  <table width=595 border="0" align="left" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" ><div class="wizard_frame" id="job_block">
          <label class="label_std" >Job no:&nbsp;&nbsp;&nbsp;&nbsp;</label>
          <label for="textfield"></label>
          <select name="job_no_select" id="job_no_select" class="selectbox300" >
            <option value="&nbsp;" selected="selected" >&nbsp;</option>
            <?php
    	for ($j = 0; $j < count($arrId4); $j++) {
		echo "<option value=" . "\"" . $arrId4[$j] . "\"" . ">" . $arrName4[$j] . "</option>";
		}
     ?>
          </select>
          <label class="label_std" >&nbsp;</label>
          <!--<select name="job_no_select" id="job_no_select" class="select160">
          <option value="<?php echo $_SESSION['job_no']?>" ><selected="selected"><?php echo $_SESSION['job_no']?></option>
          <?php 
    	for ($w = 0; $w < count($arrId2); $w++) {
		echo "<option value=\"".$arrId2[$w] . "\"" . ">" . $arrName2[$w] . "</option>";	
	    }
     ?>
        </select>--> 
          &nbsp;
          <label class="star">*</label>
          &nbsp;</div>
        <br>
        <br>
        <br>
        <br>
        <br>
        <?php if ($_SESSION['error']==2) { ?>
        <?php 
	    $_SESSION['error']='';	
		
		
		
	   } ?></td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115"><span class="wizard">
              <input name="s" type="hidden" id="s" value="1" />
              <input name="p" type="hidden" id="p" value="1" />
              <input type="hidden" name="job_cash" id="job_cash">
            </span></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php');" value="Cancel"  tabindex="-1"/></td>
            <td width="110" align="left"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("job_no_select","req","Please select a job no.");
  frmvalidator.addValidation("type_group","selone","Please select new or existing customer.");
  frmvalidator.addValidation("sort_group","selone","Please select company or private.");
  frmvalidator.addValidation("comp_name_select","req","Please select customer.");
  frmvalidator.addValidation("comp_name_text","req","Please enter name of customer.");
    
</script>
</body>
