
<?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']."_receive_store_temp";
$delete_query = "DELETE FROM $table_name WHERE   receive_id > 0  "; 
$delete_result = $con->query($delete_query);

$table_name = $_SESSION['db_prefix']."_receive_store_lines_temp";
$delete2_query = "DELETE FROM $table_name WHERE  receive_id > 0 "; 
$delete2_result = $con->query($delete2_query);

$table_name = $_SESSION['db_prefix']."_suppliers";
$suppliers_query = "SELECT supplier_id, account_name FROM $table_name  ORDER BY account_name ASC";
	$suppliers_result = $con->query($suppliers_query);
	$suppliers_num = mysqli_num_rows($suppliers_result);
	$w = 0;
	$arrId2 = array ();
	$arrName2 = array ();
	while ($w < $suppliers_num) {
	while($row = $suppliers_result->fetch_assoc()) {
		$arrId2[$w] = $row["supplier_id"];
		$arrName2[$w] = $row["account_name"];	
		$w++;
	}
	}
?>
<script language="javascript" src="../jscript/calendar.js"></script>
</head>
<?php 
$page_name = "Stores-receive";
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="receivingWizbase.php">
<div class="wizard_frame">
          <label class="label_std" >Supplier:&nbsp;&nbsp;</label>
      <label class="star">*</label>

      <select name="supplier_id_select" id="supplier_id_select" class="select160">
        <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;&nbsp;&nbsp;&nbsp;&nbsp;Delivery note no:&nbsp;&nbsp;<label class="star">*</label>&nbsp;<input name="delivery_note_text" type="text" value="<?php echo $_SESSION['delivery_note_no'] ?>" class="text70"></div>
        <br />
        <br />
    
     
        <div class="wizard_frame">
        Transport costs:&nbsp;&nbsp;<input name="transport_cost_text" type="text" value="<?php echo $_SESSION['transport_cost'] ?>" onKeyPress="return isNumberKey(event); this.value = parseFloat(this.value).toFixed(2);" class="text60" style="text-align:right" autocomplete="off" onfocus = "this.select();"> 
  </div>   
        <div class="wizard_frame">      
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="97">Receive date:</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(2018, 2025);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
            </tr>
          </table>
        </div>
    <div class="wizard_spacer_frame" style="height:50
    px;"></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?date=0&subCatSelect=Tiles');" 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("supplier_id_select","req","- select a supplier.");
  frmvalidator.addValidation("delivery_note_text","req","- delivery note no.");
  frmvalidator.addValidation("category_group","selone","- select production or store items.");
</script>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/store_main.php?date=&subCatSelect=Tiles";	?>
	<body onLoad="needToConfirm = false; accessdenied(); return false">
</body>
<?php }
?>

<html>