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


$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']."_permissions";
$permission_query = "SELECT access_id  FROM  $table_name  WHERE access_id ='". $_SESSION['access_id']."' AND page_name = 'Sales-discount' ";
$permission_result = mySQL_query($permission_query);
$permission_num = mysql_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 type="text/javascript">
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</script>
</head>
<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<form id="feedbackform" method="get" action="newQuoteWizbase.php">
<div class="page_middle_frame">
    <div class="wizard_frame">
                <table width="649" border="0">
                  <tr>
                    <td width="144"><label class="label_std">Production date:</label></td>
                    <td width="495"><?php

		$myCalendar = new tc_calendar("quote_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="656" border="0">
                  <tr>
                    <td width="144"><label class="label_std">Contact person:&nbsp;&nbsp;</label>
                      <label class="star">*</label></td>
                    <td width="502"><input name="comp_contact_text" type="text" class="text200" id="comp_contact_text" onBlur="capitalize(this)" onKeyUp="ToLower(this)" value="<?php echo $_SESSION['comp_contact']?>" autofocus tabindex="1"></td>
                  </tr>
                  <tr>
                    <td><label class="label_std">Cell/phone no: </label>
                      <label class="star">&nbsp;*</label></td>
                    <td><input name="contact_phone_text" type="text" class="text100" id="contact_phone_text" onKeyPress="return numbersonly(this, event)" value="<?php echo $_SESSION['contact_phone']?>" tabindex="2"></td>
                  </tr>
                </table>
              </div>
              
              <div class="wizard_frame">
                <table width="656" border="0">
                  <tr>
                    <td width="144" ><label class="label_std">Project or plot no:&nbsp;</label></td>
                    <td width="225"><input name="project_no_text" type="text" class="text200" id="project_no_text" onKeyUp="ToLower(this)" onBlur="capitalize(this)" value="<?php echo $_SESSION['project_no']?>" tabindex="3"></td>
                    <td width="55"><label class="label_std">Place: 
                    </label></td>
                    <td width="214"><select name="project_place_select" class="select120" tabindex="4" >
                        <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"><label class="label_std">Additional info:</label></td>
                    <td colspan="3"><textarea name="description_text" cols="70" rows="3" class="text_box" id="textarea" tabindex="5"><?php echo $_SESSION['description']?></textarea></td>
                  </tr>
                </table>
              </div>
                          
              <br>
              <div class="wizard_frame">
                <table width="654" border="0">
                  <tr>
                    <td width="144"><label class="label_std">Sales person:</label>
                      &nbsp;&nbsp;<label class="star">&nbsp;*</label>
                      </td>
                    <td width="173"><span class="label_std">
                      <select name="seller_select" id="seller_select" class="select160" tabindex="6">
                        <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>
                    </span></td>
                    <td width="85">&nbsp;</td>
                    <td width="234">&nbsp;</td>
                  </tr>
                </table>
              </div>
              
              <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','newQuoteWizbase.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, '../sales/sales_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>
<!--form validation--> 
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("comp_contact_text","req","- contact person.");
  frmvalidator.addValidation("contact_phone_text","req","- contact phone.");
  frmvalidator.addValidation("seller_select","req","- sales rep.");
</script>
</body>
