<?php
require_once ('../include/tc_calendar.php');
	$start = strtotime($_SESSION['invoice_date']);
	$d = date("d", $start );
	$m = date("m", $start );
	$y = date("Y", $start );
	
$table_name = $_SESSION['db_prefix']."_list_names_admin";
$position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
$arrId1 = array ();
$arrName1 = array ();
$position_result = execsql($position_query);
if ($position_result!="") {
$position_num = mysql_num_rows($position_result);
$b = 0;
while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
}
}		

?>
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
</head>

<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">

<div class="wizard_page_middle_frame">
<form action="" method="get" name="form1" id="form1" >
     
        <div class="wizard_frame">
        <table width="600" id="table_details_display">
  <tr>
    <td align="left" valign="middle">Invoice amount:</td>
    <td align="left" valign="middle"><input type="text" name="invoice_amount_text" id="invoice_amount_text" autocomplete="off" autofocus onKeyPress="return isNumberKey(event)" onKeyUp=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" class="text100" value="<?php echo $_SESSION['invoice_amount']?>"></td>
  </tr>
  <tr>
    <td align="left" valign="middle">Invoice number:</td>
    <td align="left" valign="middle"><input type="text" name="invoice_no_text" id="invoice_no_text" onKeyUp="ToUpper(this)" class="text100" value="<?php echo $_SESSION['invoice_no']?>"></td>
  </tr>
  <tr>
    <td width="166" align="left" valign="middle">Invoice  date:</td>
    <td width="422" align="left" valign="middle"><?php

		$myCalendar = new tc_calendar("invoice_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
  </tr>
  <tr>
    <td align="left" valign="middle">Invoiced by:</td>
    <td align="left" valign="middle"><select name="invoiced_by_select" class="select120"  >
      <option value="<?php echo $_SESSION['invoiced_by']?>" selected="selected"><?php echo $_SESSION['invoiced_by'] ?></option>
      <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
    </select></td>
  </tr>
        </table>
    </div>
    
    <div class="wizard_frame">
    <table width="600" id="table_details_display">
  <tr>
    <td width="166" valign="top">Notes:</td>
    <td width="422"><textarea name="invoice_notes_text" id="invoice_notes_text" cols="45" rows="5" class="text_box" maxlength="200"><?php echo $_SESSION['invoice_notes'] ?></textarea></td>
  </tr>
</table>

    </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','m_invoiceJobWizbase.php?s=&amp;p=1');return document.MM_returnValue" /></td>
          <td width="115">&nbsp;</td>
          <td width="99"><input name="p" type="hidden" id="p" value="2" />
            <input name="s" type="hidden" id="s" value="2" />
            </span></td>
          <td width="125" align="right"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton"  onClick="needToConfirm = false; cancel_confirmation(1, '../production/production_main.php');" value="Cancel" /></td>
          <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next"  onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); " /></td>
        </tr>
      </table>
      </div>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("invoice_amount_text","req","- invoice amount.");
  frmvalidator.addValidation("invoice_no_text","req","- invoice no.");
  frmvalidator.addValidation("invoiced_by_select","req","- invoiced by.");
</script>
</body>      