<script language="javascript" src="../jscript/calendar.js"></script>
 
<?php
require_once('../include/tc_calendar.php');

$table_name = $_SESSION['db_prefix']."_list_petty_cash";
    $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_names_authorise";
    $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_admin";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}	

require_once('../include/tc_calendar.php');
$issue_date = strtotime($_SESSION['issue_date']);
$d1 = date("d", $issue_date ) ;
$m1 = date("m", $issue_date ) ;
$y1 = date("Y", $issue_date ) ;
   
?>

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



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

   
<form id="feedbackform" method="get" action="pettycashWizbase.php">
<div class="wizard_page_middle_frame">
<div class="wizard_frame">         
      <table width="613"  id="table_display_wizard">
          <tr>
            <td width="140"  valign="middle"><label class="label_std">Date of issue:</label>
&nbsp;&nbsp;
<label class="star">*</label></td>
                  <td colspan="3" valign="middle"><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("issue_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d1, $m1, $y1);
		$myCalendar->setYearInterval(2010, 2020);
		//output the calendar
		$myCalendar->writeScript();
?></td>
                  </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Amount:</label>&nbsp;&nbsp;<label class="star">*</label></td>
                  <td colspan="3" valign="middle">
                    <input name="amount_text" type="text" class="text100" id="amount_text" value="<?php echo $_SESSION['amount'] ?>" style="text-align:right" onKeyPress="return isNumberKey(event)"  onchange=" this.value = this.value.replace (/(\...).*/, '$1')"/>
                  </td>
                  </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Issued for:</label>&nbsp;&nbsp;<label class="star">*</label></td>
                  <td colspan="3" valign="middle"><select name="use_select" class="select160"  >
                    <option value="<?php echo  $_SESSION['use'] ?>" selected><?php echo  $_SESSION['use'] ?></option>
                    <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
                  </select></td>
                </tr>
                <tr>
                  <td valign="middle">Authorised by: <label class="star">*</label></td>
                  <td width="172" valign="middle"><select name="authorised_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>
                  <td width="86" valign="middle">Issued by:&nbsp;
                  <label class="star">*</label></td>
                  <td width="195" valign="middle"><select name="issued_select" class="select120"  >
                    <option value="<?php echo $_SESSION['issued_by'] ?>" selected="selected"><?php echo $_SESSION['issued_by'] ?></option>
                    <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                  </select></td>
                </tr>
                <tr>
                  <td valign="middle"><label class="label_std">Notes:</label></td>
                  <td colspan="3" valign="middle"><textarea name="notes_text" cols="60" rows="3" class="text_box" id="notes_text"><?php echo  $_SESSION['notes'] ?> </textarea></td>
                </tr>
              </table>
            </div>
<div class="wizard_spacer_frame" style="height:70px;"></div>
<div class="wizard_frame">            
              <table width="675" 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','pettycashWizbase.php?s=&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" />
                  </td>
                  <td width="125" align="right"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="cancel_confirmation(1, '../hr_module/hr_main.php?date=0');" value="Cancel" /></td>
                  <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
                </tr>
              </table>

<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("amount_text","req","- issued amount.");
  frmvalidator.addValidation("use_select","req","- issued for.");
  frmvalidator.addValidation("authorised_select","req","- authorised by.");
  frmvalidator.addValidation("issued_select","req","- issued by.");
  </script>
</div>
</div>
</form>
</body>