<head>
<?php
$page_name = "Stores-cash delivery";
include ("../navigation/access.php");
if ($permission_num==1) {
	
$e=$_GET['e'];

$sale_date = strtotime(date("Y-m-d"));
$d = date("d", $sale_date );
$m = date("m", $sale_date );
$y = date("Y", $sale_date );


require_once ('../include/tc_calendar.php');
	
$table_name = $_SESSION['db_prefix']."_list_places";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = $con->query($position_query);
	$position_num = mysqli_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
	while($row = $position_result->fetch_assoc()) {
		$arrId3[$b] = $row["item_name"];
		$arrName3[$b] = $row["item_name"];
		$b++;
	}
	}
		

$table_name = $_SESSION['db_prefix']."_permissions";
$permission_query = "SELECT access_id  FROM  $table_name  WHERE access_id ='". $_SESSION['access_id']."' AND page_name = 'Sales-discount' ";
$permission_result = $con->query($permission_query);
$permission_num = mysqli_num_rows($permission_result);
if ($permission_num>0) { 
		$discount_limit = 'no'; 
}
else {
	$discount_limit = 'yes'; 
}
?>
<!--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/capitalize_textbox.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/go_to_url.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');">

<div class="page_middle_frame">
<form id="form1" method="get" action="newCashWizbase.php">

    <div class="wizard_frame">
      <table width="660" border="0">
  <tr>
    <td width="151" height="36">
    <input type="hidden" name="val_check" id="val_check" value="yes">    Cash sale no:
    </td>
    <td width="180"><?php echo $_SESSION['cash_sale_no'] ?></td>
    <td width="70">Date:</td>
    <td width="259"><?php

		$myCalendar = new tc_calendar("sale_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>
                <tr>
                  <td valign="middle" >Receipt no:&nbsp;&nbsp;<label class="star">*</label></td>
                  <td valign="middle"><input type="text" name="receipt_no_text" id="receipt_no_text" class="text200" onKeyUp="ToUpper(this)" value="<?php echo $_SESSION['receipt_no']?>"></td>
                  <td valign="middle">&nbsp;</td>
                  <td valign="middle">&nbsp;</td>
                </tr>
                <tr>
                    <td valign="middle" >Customer:&nbsp;&nbsp;<label class="star">*</label></td>
                    <td valign="middle"><input type="text" name="cust_name_text" id="cust_name_text" class="text200" onBlur="capitalize(this)" value="<?php echo $_SESSION['cust_name']?>"></td>
                    <td valign="middle">Tel:</td>
                    <td valign="middle"><input type="text" name="phone_no_text" id="phone_no_text" class="text200" onKeyPress="return numbersonly(this, event)" value="<?php echo $_SESSION['phone_no']?>"></td>
                  </tr>
                  <tr>
                    <td width="142" valign="middle" >Address:</td>
                    <td width="227" valign="middle"><input name="cust_address_text" type="text" class="text200" id="cust_address_text" onKeyUp="ToLower(this)" onBlur="capitalize(this)" value="<?php echo $_SESSION['cust_address']?>"  autocomplete="off"></td>
                    <td width="55" valign="middle">Place:</td>
                    <td width="214" valign="middle"><select name="cust_place_select" id="cust_place_select" class="select120" tabindex="4" >
                        <option value="<?php echo $_SESSION['cust_place']?>" selected><?php echo $_SESSION['cust_place']?></option>
                        <?php
        					for ($j = 0; $j < count($arrId3); $j++) {
    						echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
						}
						?>
                      </select></td>
                  </tr>
                  <tr>
                    <td valign="middle" >VAT registration no:</td>
                    <td colspan="3" valign="middle"><input name="cust_vat_number_text" type="text" class="text300" id="cust_vat_number_text" onKeyUp="ToLower(this)" onBlur="capitalize(this)" value="<?php echo $_SESSION['cust_vat_number']?>"  autocomplete="off"></td>
                  </tr>
                </table>  
                 </div> 
                 
      <table width="656" border="0">
                  <tr>
                    <td width="142" valign="top">Additional info:</td>
                    <td width="504" colspan="3"><textarea name="additional_info_text" cols="70" rows="3" class="text_box" id="textarea" tabindex="5" ><?php echo $_SESSION['additional_info']?></textarea></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td colspan="3">&nbsp;</td>
                  </tr>
                </table>
             
              
              <br>
                        
              <table  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','newCashWizbase.php?s=&amp;p=1');return document.MM_returnValue" tabindex="9" /></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, '../store/store_main.php?date='); " value="Cancel" tabindex="10"/></td>
                  <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false;  MM_showHideLayers('wait','','show');" tabindex="8"/></td>
                </tr>
              </table>
 
  
</form>
</div>
<!--form validation--> 
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("receipt_no_text","req","- receipt number.");
  frmvalidator.addValidation("cust_name_text","req","- customer name.");
</script>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "store/new_select_store.php?date=";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>