<head>
<?php 	
require_once('../include/tc_calendar.php');
$_SESSION['entry_date'] = date('Y-m-d');
$_SESSION['status'] = "";
$_SESSION['notes'] = "";

$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");

$_SESSION['check_date'] = date("Y-m-d", strtotime(date("Y-m-d", strtotime($_SESSION['entry_date'])) . " +".$follow_up." day"));


$table_name = $_SESSION['db_prefix']."_quotations";
$quote_query = "SELECT * FROM $table_name WHERE quote_no ='".$_SESSION['quote_no']."' ";
$quote_result = mySQL_query($quote_query);


$a1 = mysql_result($quote_result, 0, "cust_id");
$a2 = mysql_result($quote_result, 0, "company_contact");
$a3 = mysql_result($quote_result, 0, "contact_phone");
$a6 = mysql_result($quote_result, 0, "seller");
$_SESSION['seller'] = $a6;
$a5 = mysql_result($quote_result, 0, "quotation_date");
$a4 = mysql_result($quote_result, 0, "designer");
$a7 = mysql_result($quote_result, 0, "value");
$a8 = mysql_result($quote_result, 0, "project_no");
$a9 = mysql_result($quote_result, 0, "project_description");
$a10 = mysql_result($quote_result, 0, "finalised");
$a11 = mysql_result($quote_result, 0, "result");
$a12 = mysql_result($quote_result, 0, "notes");
$a13 = mysql_result($quote_result, 0, "project_place");
$a14 = mysql_result($quote_result, 0, "quote_type");
$cust_id = $a1;
$quote_no = $_SESSION['quote_no'];
$job_no='';

$table_name = $_SESSION['db_prefix']."_quotation_notes";	
$notes_query = "SELECT  *   FROM $table_name WHERE quote_number = '".$_SESSION['quote_no']."' ORDER BY line_id DESC";
$notes_result = mySQL_query($notes_query);
$notes_num = mysql_num_rows($notes_result);
	




$table_name = $_SESSION['db_prefix']."_quotation_lines";
$value_query = "SELECT SUM(quote_item_price) AS total_value FROM $table_name WHERE quote_number = '".$_SESSION['quote_no']."' GROUP BY quote_number ";
$value_result = mySQL_query($value_query);
$value_num = mysql_num_rows($value_result);
if ($value_num>0) {
$a7 = mysql_result($value_result, 0, "total_value");
}
else
{
	$a7='0.00';
}
?>


</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');">

<div class="page_middle_frame">
<form id="feedbackform" method="get" action="quote_updateWizbase.php" >
   <div class="wizard_frame">
             <?php 
				include ('../include/customer_block.php');
				echo '<br>';
				include ('../include/job_block.php');
			?>
         </div>
              <br>
            
            <br />
            <div class="wizard_frame">
              <div align="left">Notes:</div>
              <table width="650" id="table_details_display">
                <tr>
                  <td width="81" height="25">Date:</td>
                  <td width="86">&nbsp;Entry by:</td>
                  <td width="475">Note:&nbsp;</td>
                  </tr>
               <?php
			   $i=0;
			   while ($i<$notes_num) {
				   $c1 = mysql_result($notes_result, $i, "note_date");  
				   $c2 = mysql_result($notes_result, $i, "note_text");  
				   $c3 = mysql_result($notes_result, $i, "seller"); 
				   ?>  
                <tr>
                  <td height="25"><?php echo date("d-m-Y", strtotime($c1 ))?></td>
                  <td><?php echo $c3 ?></td>
                  <td><?php echo $c2 ?></td>
                  </tr>
                  <?php 
				  $i++;
			   }?>
                </table>
            </div>
            <div class="wizard_frame">
            <div align="center"><label class="label_std">To add notes, click "Next".</label></div></div>
            
            <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','quote_updateWizbase.php?s=&amp;p=1');return document.MM_returnValue" tabindex="2"/></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="3"/></td>
                  <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); " tabindex="1"/></td>
                </tr>
              </table>
 
</form>
</div>
<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  //frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("quote_line_1_text","req","At least one item is required. Use the top box for the first item");
  frmvalidator.addValidation("quote_price_1_text","req","At least one quote price is required. Use the top box for the first pricing");
  </script>


	
    </body>