<head>

<?php
    $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");
$a5 = mysql_result($quote_result, 0, "quotation_date");


$a7 = mysql_result($quote_result, 0, "quote_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, "quotation_date");
$cust_id =$a1;

//$table_name = $_SESSION['db_prefix']."_quotation_lines";
//	$line_query = "SELECT  quote_item_text   FROM $table_name WHERE quote_no = '".$_SESSION['quote_no']."' ";
//	echo '<br>*****'.$line_query;
//	$line_result = mySQL_query($line_query);
//	$line_num = mysql_num_rows($line_result);
//	
//	$l=0;
//	$line_text="";
//	$products=mysql_result($line_result, 0, "quote_item_text");;
//	
//	while($l<$line_num) {
//	   $line = mysql_result($line_result, $l, "quote_item_text");
//	   $line_text = $line_text."&nbsp;-&nbsp;".$line;
//	   $l++;
//	}

//   $products = $line_text;

$table_name = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT comp_name, contact_1, cell_1, status  FROM $table_name WHERE cust_id='".$a1."'  ";
$customer_result = mySQL_query($customer_query);
$b1 = mysql_result($customer_result, 0, "comp_name");
$b2 = mysql_result($customer_result, 0, "contact_1");
$b3 = mysql_result($customer_result, 0, "cell_1");
$b4 = mysql_result($customer_result, 0, "status");

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

<!--jscript-->




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

<div class="page_middle_frame">
<form id="feedbackform" method="get" action="quote_updateWiz6.php" >
 <div class="wizard_frame">
              <?php 
				include ('../include/customer_block.php');
				echo '<br>';
		
		?>
            </div>
              <br>
            <div class="wizard_frame">
              <div align="left">Quotation details:</div>
              <table width="650" id="table_details_display">
                <tr>
                  <td height="25">Quotation for:</td>
                  <td><?php echo $_SESSION['quote_type'] ?></td>
                  <td>&nbsp;</td>
                  <td valign="top">&nbsp;</td>
                  <td valign="top">&nbsp;</td>
                </tr>
                <tr>
                  <td width="134" height="25">Project no:</td>
                  <td width="118"><?php echo $a8 ?>&nbsp;</td>
                  <td>Project description:</td>
                  <td valign="top"><?php echo $a9 ?>&nbsp;</td>
                  <td valign="top">&nbsp;</td>
                  </tr>
                <tr>
                  <td height="25">Quotation date:</td>
                  <td><?php echo date("d-m-Y", strtotime($a13 )) ?>&nbsp;</td>
                  <td>Next check date:</td>
                  <td colspan="2"><?php if ($_SESSION['status']=='quoted') { echo date("d-m-Y", strtotime($_SESSION['check_date'])); } else { echo 'n/a' ; } ?></td>
                </tr>
                <tr>
                  <td height="25">Quote amount:</td>
                  <td><?php echo number_format($a7, 2, '.', ',') ?></td>
                  <td width="128">&nbsp;</td>
                  <td colspan="2" valign="top">&nbsp;</td>
                  </tr>
                <tr>
                  <td height="25">Sales person:</td>
                  <td><?php echo $a6 ?></td>
                  <td>&nbsp;</td>
                  <td width="113">&nbsp;</td>
                  <td width="141">&nbsp;</td>
                </tr>
              </table>
            </div>
            <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 $c1?></td>
                  <td><?php echo $c3 ?></td>
                  <td><?php echo $c2 ?></td>
                  </tr>
                  <?php 
				  $i++;
			   }?>
                </table>
            </div>
            <div class="wizard_frame" >
              <div align="left">Note to add:</div>
              <table width="650" id="table_details_display">
                <tr>
                  <td width="81" height="25">Date:</td>
                  <td width="475"><?php echo date("d-m-Y", strtotime($_SESSION['entry_date'])); ?></td>
                </tr>
                <tr>
                  <td height="25">Entry by:</td>
                  <td><?php echo $_SESSION['seller']; ?></td>
                </tr>
                <tr>
                  <td height="25">Status:</td>
                  <td>This quotation is <?php echo $_SESSION['status']; ?></td>
                </tr>
                <tr>
                  <td height="25">Note:&nbsp;</td>
                  <td><?php echo $_SESSION['notes']; ?></td>
                </tr>
              </table>
            </div>
           
              <div class="wizard_frame">
                <label class="label_std">If you want to make changes use the 'Prev' button to go back. <br />
                  Click 'New' to make a new entry or to finish the wizard click 'Finish'.</label>
            </div>
            
            <table width="675" height="50" align="center" id="table_button_bar">
              <tr>
                <td width="117" valign="middle"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;MM_showHideLayers('wait','','show');MM_goToURL('parent','quote_updateWizbase.php?s=6&amp;p=3');return document.MM_returnValue" /></td>
                <td width="115" valign="middle"><input name="s" type="hidden" id="s" value="5" />
                  <input name="p" type="hidden" id="p" value="5" /></td>
                <td width="99" valign="middle"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../sales/sales_main.php?date=&branch='); " value="Cancel" /></td>
                <td width="269" align="right" valign="middle"><input type="submit" name="new_button" class="imagebutton" id="new_button" value="New" onClick="needToConfirm = false;  MM_showHideLayers('wait','','show');" /></td>
                <td width="51" align="right" valign="middle"><input  name="finish_button" type="submit" class="imagebutton" id="finish_button" value="Finish" onClick="needToConfirm = false;MM_showHideLayers('wait','','show'); "  /></td>
                </tr>
            </table>
           

  
</form>
</div>
