<head>
<?php
require_once ('../include/tc_calendar.php');
$start = strtotime($_SESSION['receive_date']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );


$table_name = $_SESSION['db_prefix']."_suppliers";
$suppliersQuery = "SELECT supplier_id, account_name FROM $table_name  ORDER BY account_name ASC";
	$suppliersResult = execsql($suppliersQuery);
	$suppliersNum = mysql_num_rows($suppliersResult);
	$w = 0;
	$arrId2 = array ();
	$arrName2 = array ();
	while ($w < $suppliersNum) {
		$arrId2[$w] = mysql_result($suppliersResult, $w, "supplier_id");
		$arrName2[$w] = mysql_result($suppliersResult, $w, "account_name");
		$w++;
	}
?>
<!--style sheets-->
<link href="../css/wait.css" rel="stylesheet" type="text/css">

<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>
</head>
<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<!--reference to main.css removed-->
<div class="page_middle_frame">
<form id="feedbackform" method="POST" action="receivingTimberWizbase.php?p=1&s=1">
  <table width=595 border="0" align="left" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" height="256" valign="top" ><div class="wizard_frame">
          <label class="label_std" >Supplier:&nbsp;&nbsp;&nbsp;&nbsp;</label>
          <select name="supplier_id_select" id="supplier_id_select" class="select160" autofocus>
            <option value="<?php echo $_SESSION['supplier_id']?>" ><selected="selected"><?php echo $_SESSION['sup_name']?></option>
            <?php 
    	for ($w = 0; $w < count($arrId2); $w++) {
		echo "<option value=\"".$arrId2[$w] . "\"" . ">" . $arrName2[$w] . "</option>";	
	    }
     ?>
          </select>
          &nbsp;
          <label class="star">*</label>
          &nbsp;&nbsp;&nbsp;
          <label class="label_std">Del. note / Invoice:</label>
          <input type="text" class="text100" name="del_note_text" id="del_note_text"  value="<?php echo $_SESSION['del_note']?>" onKeyUp="ToUpper(this)"/>
          <label class="star">*</label>
        </div>
        <br />
        <br />
        <br />
        <div class="wizard_frame">
          <label class="label_std" >Total value of this delivery&nbsp;&nbsp;(SAR)&nbsp;:&nbsp;</label>
          &nbsp;&nbsp;&nbsp;
          <input type="text" class="text100" name="value_text" id="value_text"  value="<?php echo $_SESSION['value']?>" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right"/>
          <label class="star">*</label>
          <label class="label_std" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Transport costs:&nbsp;&nbsp;(SAR)&nbsp;:</label>
          &nbsp;&nbsp;
          <input type="text" class="text100" name="transport_text" id="transport_text"  value="<?php echo $_SESSION['transport']?>" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right"/>
          <label class="star">*</label>
        </div>
        <br />
        <br />
        <br />
        <div class="wizard_frame">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="97"><label class="label_std">Receive date:</label></td>
              <td width="403"><?php

		$myCalendar = new tc_calendar("receive_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2014, 2090);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
            </tr>
          </table>
        </div></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" />
              </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>
  </table>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("supplier_id_select","req","Please select a supplier.");
  frmvalidator.addValidation("del_note_text","req","Please enter the delivery note number.");
  frmvalidator.addValidation("value_text","req","Please enter the value of this delivery.");
  frmvalidator.addValidation("transport_text","req","Please enter the transport costs.");
</script> 
