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

if ($permission_num==1) {

$table_name = $_SESSION['db_prefix']."_quotations";
$quote_query = "SELECT quote_no, cust_id, required_date, quote_type, project_no, project_place, project_description, value, designer, seller FROM $table_name WHERE  status = 'quoted' 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 type="text/javascript" src="../jscript/tablesort.js"  ></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');">
<?php include ('../include/tooltip.php'); ?>
<div class="page_middle_frame">
<form id="form1" name="form1" method="get" action="quote_updateWizbase.php">
  <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" valign="top" ><br>
        <label class="label_std">Select quotation:
          &nbsp;&nbsp;(click on quote number to continue)</label>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="../images/round_blue.png" width="8" height="8" />=project&nbsp;&nbsp;<img src="../images/round_purple.png" width="8" height="8" />=cash sale
        <div class="scroll_frame_medium" style="width:620px; height:230px;">
          <table width="559" id="table_list" class="sortable-onload-1r rowstyle-alt no-arrow " >
            <tr>
              <th width="41" style="border-right-style:hidden;">&nbsp;</th>
              <th width="86" align="left" class="sortable-numeric" >Quote no</th>
              <th width="225" align="left" class="sortable-text" >Customer</th>
              <th width="87" align="left" class="sortable-numeric" >Value</th>
              <th width="96" align="left" class="sortable-date-dmy" >Due 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, contact_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, "contact_1");
			$a2g = mysql_result($customer_result, 0, "status");
			}
			
		 $a3 = mysql_result($quote_result, $i, "required_date");
		 $a4 = mysql_result($quote_result, $i, "project_no");
		 $a5 = mysql_result($quote_result, $i, "project_place");
		 $a6 = mysql_result($quote_result, $i, "project_description");
		 $a7 = mysql_result($quote_result, $i, "value");
		 $a8 = mysql_result($quote_result, $i, "designer");
		 $a9 = mysql_result($quote_result, $i, "seller");
		 $a14 = mysql_result($quote_result, $i, "quote_type");
		 
		
		$customerTT ="<table id=table_tool_tip width=250 ><tr><td  width=75>Company:</td><td width=175>".$a2a."</td></tr><tr><td>Address:</td><td>".$a2b."&nbsp;".$a2c."<br>".$a2d."</td></tr><tr><td>Phone:</td><td>".$a2e."</td></tr><tr><td>Contact:</td><td>".$a2f."</td></tr></table><br><b>Click for details</b>";
		
		$jobTT ="<table id=table_tool_tip width=300 ><tr><td  width=100>Quote no:</td><td width=175>".$a1."</td></tr><tr><td valign=top>Project no /place:</td><td>".$a4."&nbsp;".$a5."</td></tr><tr><td>Project description:</td><td>".$a6."</td></tr><tr><td>Designer:</td><td>".$a8."</td></tr><tr><td>Sales assistant:</td><td>".$a9."</td></tr><td>Value:</td><td>".$a7."</td></tr></table><br><b>Click for details</b>";	
	?>
            <tr>
              <td align="right" style="border-right-style:hidden; padding-right:0px;">
              <?php if ($a14=='Project') { ?><img src="../images/round_blue.png" width="8" height="8" /><?php } ?>
              <?php if ($a14=='Cash sale') { ?><img src="../images/round_purple.png" width="8" height="8" /><?php } ?>
              Q</td>
              <td style="padding-left:0px"><a href="quote_updateWizbase.php?quote_no=<?php echo $a1?>&cust_id=<?php echo $a2 ?>&p=2&s=1" onMouseover="ddrivetip('<?php echo $jobTT ?>', 300)"; onMouseout="hideddrivetip()" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');"><?php echo $a1?></a></td>
              <td><a href="" onMouseover="ddrivetip('<?php echo $customerTT ?>', 250)"; onMouseout="hideddrivetip()"><?php echo $a2a?></a></td>
              <td align="right"><?php echo number_format($a7, 2, '.', ',') ?>&nbsp;</td>
              <td><?php if ($a3!='0000-00-00') { 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?date='); " 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 }
?>
