<head>
<?php 
$page_name = "Quote-capture";
include ("../navigation/access.php");

if ($permission_num==1) {
 
$table_name = $_SESSION['db_prefix']."_quotations";
$quote_query = "SELECT quote_no, cust_id, request_date, quote_type FROM $table_name WHERE  status = 'request' ORDER BY quote_no DESC ";
$quote_result = mySQL_query($quote_query);
$quote_num = mysql_num_rows($quote_result);
?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/tablesort.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></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="form1" name="form1" method="get" action="quoteWizbase.php">
  <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" valign="top" ><br>
   
    <div class="scroll_frame_medium" style="width:620px; height:230px;">
    <label class="label_std">Select quotation request:
    &nbsp;&nbsp;(click on quote number to continue)</label>
    &nbsp;&nbsp;
<table width="563" id="table_list" class="sortable-onload-1r rowstyle-alt no-arrow ">
  <tr>
      <th width="31" style="border-right-style:hidden;">&nbsp;</th>
      <th width="96" class="sortable-numeric" align="left">Quote no</th>
      <th width="244"class="sortable-text"  align="left">Customer</th>
      <th width="172" class="sortable-date-dmy" align="left">Enquiry date:</th>
    </tr>
    <?php 
	$i=0;
	while ($i<$quote_num) {
		$a1 = mysql_result($quote_result, $i, "quote_no");
		$a2 = mysql_result($quote_result, $i, "cust_id");
			$table_name = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT status, comp_name, bag_box, box_no, postal_place, phone, cell_1  FROM $table_name WHERE cust_id = '".$a2."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);
			if ($customer_num!=0) {
			$a2a = mysql_result($customer_result, 0, "comp_name");
			$a2b = mysql_result($customer_result, 0, "bag_box");
			$a2c = mysql_result($customer_result, 0, "box_no");
			$a2d = mysql_result($customer_result, 0, "postal_place");
			$a2e = mysql_result($customer_result, 0, "phone");
			$a2f = mysql_result($customer_result, 0, "cell_1");
			$a2g = mysql_result($customer_result, 0, "status");
			$a2h="";
			}
			else {
			$a2a='';
			}
		 $a3 = mysql_result($quote_result, $i, "request_date");	
		 $a14 = mysql_result($quote_result, $i, "quote_type");	
			
		$customerTT = $a2h."<br><label class=tip_text_label>".$a2a."<br>".$a2b." ".$a2c."<br>".$a2d."<br>".$a2e." / ".$a2f."<br>";
	?>	
    <tr>
      <td style="border-right-style:hidden; padding-right:opx;">
      Q</td>
      <td style="padding-left:0px;"><a href="quoteWizbase.php?quote_no=<?php echo $a1?>&cust_id=<?php echo $a2 ?>&p=2&s=1" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');"><?php echo $a1?></a></td>
      <td><a href="" onMouseover="ddrivetip('<?php echo $customerTT ?>', 150)"; onMouseout="hideddrivetip()"><?php echo $a2a?></a></td>
      <td><?php echo date("d-m-Y", strtotime($a3)) ?>&nbsp;</td>
    </tr>
    <?php 
	$i++;
	}
	?>
</table><br>
</div>
  

</td>
    </tr>
    <tr>
      <td><table width="675" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115"><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" /></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../sales/sales_main.php'); " value="Cancel" /></td>
            <td width="110" align="right">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
 </form>
</div>
</body>  
<?php } else { 
    $_SESSION['denied_return'] = "sales/sales_main.php";	?>
	<body onLoad="accessdenied(); return false">
	</body>
<?php }
?>