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

$d = date("d");
$m = date("m");
$y = date("Y");


$table_name = $_SESSION['db_prefix']."_list_sellers";
$sellers_query = "SELECT item_name FROM $table_name  ORDER BY item_name ASC";
	$sellers_result = execsql($sellers_query);
	$sellers_num = mysql_num_rows($sellers_result);
	$w = 0;
	$arrId2 = array ();
	$arrName2 = array ();
	while ($w < $sellers_num) {
		$arrId2[$w] = mysql_result($sellers_result, $w, "item_name");
		$arrName2[$w] = mysql_result($sellers_result, $w, "item_name");
		$w++;
	}

$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 = 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_quotation_subjects";
    $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++;
	}
	}

$table_name = $_SESSION['db_prefix']."_list_area";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId5 = array ();
	$arrName5 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId5[$b] = mysql_result($position_result, $b, "item_name");
		$arrName5[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
?>
<?php include('../include/wait.php') ?> 
</head>





<?php 
$page_name = "Sales-bill of quantity";
include ("../navigation/access.php");
if ($permission_num==1) {
	?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');">    
<div class="wizard_page_middle_frame">
<form id="form1" name="form1" method="get" action="qbillWizbase.php">
     <div class="wizard_frame">
     <table width="649" border="0">
                  <tr>
                    <td width="152"><label class="label_std">Date received:</label></td>
                    <td width="487"><?php

		$myCalendar = new tc_calendar("receive_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2012, 2020);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
                  </tr>
                </table>
    </div>
<div class="wizard_frame">
     <table width="649" border="0">
                  <tr>
                    <td width="152"><label class="label_std">Title:</label></td>
                    <td width="487"><input type="text" name="title_text" id="title_text" class="text300" value="<?php echo $_SESSION['title'] ?>" ></td>
                  </tr>
                </table>
    </div>                
                <div class="wizard_frame">
                <table width="656" border="0">
                  <tr>
                    <td >Project: 
                      <label class="star">*</label></td>
                    <td colspan="5"><select name="project_select" id="project_select" class="select160" tabindex="3">
                      <option value="<?php echo $_SESSION['project']?>"><?php echo $_SESSION['project']?></option>
                      <option value="Manase 358">Manase 358</option>
                      <option value="Diamond mesh">Diamond mesh</option>
                      <option value="Electric fencing">Electric fencing</option>
                      <option value="Farm fence">Farm fence</option>
                      <option value="Free standing electric fence">Free standing electric fence</option>
                      <option value="Gate">Gate</option>
                      <option value="Gate motor">Gate motor</option>
                      <option value="Miscelaneous">Miscelaneous</option>
                      <option value="Palisade fencing">Palisade fencing</option>
                      <option value="Pool fence">Pool fence</option>
                      <option value="Razor wire">Razor wire</option>
                      <option value="Wall spikes">Wall spikes</option>
                    </select></td>
                  </tr>
                  <tr>
                    <td width="167" >Project or plot no:&nbsp;&nbsp;
                      <label class="star">*</label></td>
                    <td width="146"><input name="project_no_text" type="text" class="text60" id="project_no_text" onKeyUp="ToLower(this)" onBlur="capitalize(this)" value="<?php echo $_SESSION['project_no']?>" tabindex="4"></td>
                    <td width="41">Area:</td>
                    <td width="86"><select name="project_area_select" class="select120" tabindex="5" >
                      <option value="<?php echo $_SESSION['project_area']?>" selected><?php echo $_SESSION['project_area']?></option>
                      <?php
        	for ($j = 0; $j < count($arrId5); $j++) {
    		echo "<option value=" . "\"" . $arrId5[$j] . "\"" . ">" . $arrName5[$j] . "</option>";
	}
?>
                    </select></td>
                    <td width="54" align="right"><label class="label_std">Place:</label></td>
                    <td width="136"><select name="project_place_select" class="select120" tabindex="6" >
                        <option value="<?php echo $_SESSION['project_place']?>" selected><?php echo $_SESSION['project_place']?></option>
                        <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
                      </select></td>
                  </tr>
                  <tr>
                    <td valign="top">Short description:</td>
                    <td colspan="5"><textarea name="description_text" cols="70" rows="3" class="text_box" id="textarea" tabindex="7"><?php echo $_SESSION['description']?></textarea></td>
                  </tr>
                </table>
              </div>
    <div class="wizard_frame">
                <table width="654" border="0">
                  <tr>
                    <td width="149">Sales representative:
                      &nbsp;&nbsp;
                      <label class="star">*</label></td>
                    <td width="495"><select name="seller_select" id="seller_select" class="select300" tabindex="8">
                        <option value="<?php echo $_SESSION['seller']?>" selected><?php echo $_SESSION['seller']?></option>
                        <?php 
    	for ($w = 0; $w < count($arrId2); $w++) {
		echo "<option value=\"".$arrId2[$w] . "\"" . ">" . $arrName2[$w] . "</option>";	
	    }
     ?>
                      </select></td>
                  </tr>
                </table>
    </div>          
              
     
    <div class="wizard_spacer_frame" style="height:100px;"></div>
     <div class="wizard_frame">
     <table width="675" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">&nbsp;</td>
            <td width="99"><span class="wizard">
              <input name="p" type="hidden" id="p" value="1" />
              <input name="error" type="hidden" id="error" value="0" />
              <input name="s" type="hidden" id="s" value="1" />
            </span></td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="cancel_confirmation(1, '../sales/sales_main.php?date=');" 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>
        </div>
 </form>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("project_select","req","- type of work.");
  frmvalidator.addValidation("project_no_text","req","- plot no.");
  frmvalidator.addValidation("project_place_select","req","- place.");
  frmvalidator.addValidation("seller_select","req","- sales representative.");
  </script>
</div>  
<?php } 
else { 
    $_SESSION['denied_return'] = "sales/sales_main.php?date=";	
	?>
	<body onLoad="needToConfirm = false; accessdenied(); return false;">
</body>
<?php }
?>