<head>
<?php 
require_once ('../include/tc_calendar.php');

$start = strtotime($_SESSION['entry_date']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );


$table_name = $_SESSION['db_prefix']."_presets";
$follow_up_query = "SELECT  preset_value FROM $table_name WHERE preset_name = 'follow_up' ";
$follow_up_result = mySQL_query($follow_up_query);
$follow_up = mysql_result($follow_up_result, 0, "preset_value");

if ($_SESSION['check_date']=='0000-00-00') {
$_SESSION['check_date'] = (date("Y-m-d", strtotime($_SESSION['entry_date'])) . " +".$follow_up." day");
}
		
//$check_date = date("Y-m-d", strtotime(date("Y-m-d", strtotime($entry_date)) . " +".$follow_up." day"));
	
if (date("l", strtotime($_SESSION['check_date'])) == "Sunday") {$_SESSION['check_date'] = date("Y-m-d", strtotime(date("Y-m-d", strtotime($_SESSION['check_date'])) . " +1 day")); }
if (date("l", strtotime($_SESSION['check_date'])) == "Saturday") {$_SESSION['check_date'] = date("Y-m-d", strtotime(date("Y-m-d", strtotime($_SESSION['check_date'])) . " +2 day")); }


$check = strtotime($_SESSION['check_date']); 
$d1 = date("d", $check );
$m1 = date("m", $check );
$y1 = date("Y", $check );

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

$table_name = $_SESSION['db_prefix']."_list_quote_validity";
    $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);
	$k = 0;
	while ($k < $position_num) {
		$arrId3[$k] = mysql_result($position_result, $k, "item_name");
		$arrName3[$k] = mysql_result($position_result, $k, "item_name");
		$k++;
	}
	}
	?>
    
<!--style sheets-->


<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
   
</head>
<?php include('../include/wait.php') ?>

<body onLoad="<?php if ($_SESSION['status']!='quoted') {?>document.getElementById('date_check').hidden=true;<?php } ?> MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');" onBlur="MM_showHideLayers('wait','','hide');">


<div class="page_middle_frame">
<form id="feedbackform" method="get" >
<table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
        <td width="525"  >
        <div class="wizard_frame">
           <table width="633" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="136" height="44"><label class="label_std">Entry date:</label>
              </td>
              <td colspan="3"><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("entry_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setYearInterval(2014, 2090);
		//output the calendar
		$myCalendar->writeScript();
?>
                <br /></td>
              </tr>
            <tr>
              <td height="50"><label class="label_std">Status:</label></td>
              <td colspan="3"><p>
                <label class="label_std">
                  <input type="radio" name="status_group" value="quoted" id="status_group_0" <?php if ($_SESSION['status']=="quoted") { ?> checked="checked" <?php } ?> onClick="document.getElementById('date_check').hidden=false" />
                  Pending</label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <label class="label_std">
                  <input type="radio" name="status_group" value="unsuccessful" id="status_group_1" <?php if ($_SESSION['status']=="unsuccessful") { ?> checked="checked" <?php } ?> onClick="document.getElementById('date_check').hidden=true"/>
                  Unsuccessful</label>
                  &nbsp;&nbsp;&nbsp;&nbsp;
                <label class="label_std">
                  <input name="status_group" type="radio" id="status_group_2" onClick="alertMessage(2, '../quote_updateWizbase.php?p=3&s=', 'You have set this quote to successful. You need to complete the -Create job wizard- (which follows when you click next) to set it successful.<br><br>If this wizard is not completed, the quotation will stay listed as pending.'); document.getElementById('date_check').hidden=true; " value="successful"  <?php if ($_SESSION['status']=="successful") { ?>checked="checked" <?php } ?> />
                  Successful</label>
                <br />
              </p>                <label for="radio"></label></td>
             </tr>
            <tr>
              <td height="50"><label class="label_std">Sales rep:&nbsp;&nbsp;
                <label class="star">*</label></label></td>
              <td width="173"><select name="seller_select" id="seller_select" class="select160">
                <option value="<?php echo $_SESSION['seller']?>" selected="selected"><?php echo $_SESSION['seller']?></option>
                <?php 
    	for ($w = 0; $w < count($arrId2); $w++) {
		echo "<option value=\"".$arrId2[$w] . "\"" . ">" . $arrName2[$w] . "</option>";	
	    }
     ?>
              </select>
              <br /></td>
              <td width="100">Next check on:</td>
              <td width="224"><div id="date_check" ><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("check_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d1, $m1, $y1);
		$myCalendar->setYearInterval(2014, 2090);
		//output the calendar
		$myCalendar->writeScript();
?></div></td>
            </tr>
          </table>
          </div>
        <br />
        <br />
        <br /><br /><br />



<br />

<div class="wizard_frame">
  <table width="635" border="0">
    <tr>
      <td width="129" valign="top"><label class="label_std">Notes: &nbsp;&nbsp;</label>
        <label class="star">*</label></td>
      <td width="496" valign="top"><label for="textarea"></label>
        <textarea name="notes_text" cols="90" rows="5" class="text_box" id="notes_text"><?php echo  $_SESSION['notes'];  ?></textarea></td>
    </tr>
</table>
</div>
<br />
<br />
<br /></td>
    </tr>
          <tr>
            <td>
              <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','quote_updateWizbase.php?s=&amp;p=2');return document.MM_returnValue" /></td>
                  <td width="115">&nbsp;</td>
                  <td width="99"><span class="wizard">
                    <input name="s" type="hidden" id="s" value="3" />
                    <input name="p" type="hidden" id="p" value="3" />
                  </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" /></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></td>
          </tr>
        </table>
  
  </form>
  </div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("status_group","selone","Please select status.");
  frmvalidator.addValidation("seller_select","req","Please select the name of the sales person.");
  frmvalidator.addValidation("notes_text","req","Please enter a note.");
      
</script>

</body>

