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

$table_name = $_SESSION['db_prefix']."_list_approve_names";
    $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++;
	}
	}	

	
$table_name = $_SESSION['db_prefix']."_list_names_store";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "item_name");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
$table_name = $_SESSION['db_prefix']."_list_company";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId4 = array ();
	$arrName4 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId4[$b] = mysql_result($position_result, $b, "item_name");
		$arrName4[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}			
?>

<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>

</head>

<?php 
$page_name = "Stores-department supply";
include ("../navigation/access.php");

if ($permission_num==1) {
	 
	?>

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

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="wizard_page_middle_frame">
<form id="form1" method="get" action="supply_companyWizbase.php">
  <div class="wizard_frame">
      <label class="label_std" >Supply to company:&nbsp;&nbsp;</label>
      <label class="star">*</label>

      <select name="department_select" id="department_select" class="select160">
        <option value="<?php echo $_SESSION['company']?>" ><selected="selected"><?php echo $_SESSION['company']?></option>
            <?php 
    	for ($w = 0; $w < count($arrId4); $w++) {
		echo "<option value=\"".$arrId4[$w] . "\"" . ">" . $arrName4[$w] . "</option>";	
	    }
     ?>
          </select>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Issued to:<input type="text" name="supplied_to_text" id="supplied_to_text" value="<?php echo $_SESSION['supplied_to'] ?>">
  </div>
        <br />
        <br />
        
    <div class="wizard_frame">
    <table width="600" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="291"> Issued by:&nbsp;
          <label class="star">*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name="issued_by_select" class="select120"  >
  <option value="<?php echo $_SESSION['issued_by'] ?>" selected="selected"><?php echo $_SESSION['issued_by'] ?></option>
  <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
</select>
          </label></td>
        <td>&nbsp;&nbsp;</td>
        <td>Authorised  by:&nbsp;
          <label class="star">*</label></td>
        <td width="144"><select name="authorised_by_select" class="select120"  >
          <option value="<?php echo $_SESSION['authorised_by']?>" selected="selected"><?php echo $_SESSION['authorised_by'] ?></option>
          <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
        </select></td>
      </tr>
  <tr>
    <td>&nbsp;</td>
    <td width="30">&nbsp;</td>
    <td width="135">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>

    </div>    
     
    <div class="wizard_frame">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="97">Issue date:</td>
              <td width="403"><?php

		$myCalendar = new tc_calendar("issue_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2015, 2090);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
            </tr>
          </table>
        </div>
    <div class="wizard_spacer_frame" style="height:130px;"></div>
        <div class="wizard_frame">
        <table width="590" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">
              <input name="s" type="hidden" id="s" value="1" />
              <input name="p" type="hidden" id="p" value="1" />
              </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>
        </div>
</form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("emp_id_select","req","- an employee.");
  frmvalidator.addValidation("issued_by_select","req","- issued by.");
  frmvalidator.addValidation("authorised_by_select","req","- authorised by.");
</script>

<?php } else { 
    $_SESSION['denied_return'] = "store/store_main.php?date=";	?>
	<body onLoad="needToConfirm = false; accessdenied(); return false">
</body>
<?php }
?>

<html>