<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
include ("../navigation/header.php");
$page_name = "Sales-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/sales_sidebar.php");

$table_name2 = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT cust_id, comp_name, name_2, bag_box, box_no, postal_place, contact_1, cell_1, email_1, phone, account, status FROM $table_name2 ";
$customer_result = mySQL_query($customer_query);
$customer_num = mysql_num_rows($customer_result);	

?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />

<!--jscript-->
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "450px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
                              	{"bSortable": true},
                             	{"bSortable": true}
								
								 ]
				} );
			} );
		</script>

</head>

<body>

<div class="main_frame">
  <div class="page_head_frame" >
          <table width="590" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="385"><label class="label_page_head">Customers</label></td>
              <td width="253">&nbsp;</td>
              <td width="171" align="right">&nbsp;</td>
            </tr>
          </table>
       </div></td>
             
        <div class="page_middle_frame" style="height:500px;">
          <table width="685" id="scroll_table" class="data_display"   >
            <thead>
            <tr>
              <th>Company</th>
              <th>Postal Address</th>
              <th>Phone</th>
              <th>Contact</th>
              <th>Cell</th>
              <th>e-mail</th>
            </tr>
          </thead>
            <?php 
$i=0;
while ($i<$customer_num) {
	$a =  mysql_result($customer_result, $i, "cust_id");
	$a0 = mysql_result($customer_result, $i, "comp_name");
	$a0a = mysql_result($customer_result, $i, "name_2");
	$a1 = mysql_result($customer_result, $i, "bag_box");
	$a2 = mysql_result($customer_result, $i, "box_no");
	$a3 = mysql_result($customer_result, $i, "postal_place");
	
	$a5 = mysql_result($customer_result, $i, "phone");
	$a6 = mysql_result($customer_result, $i, "account");
	$a7 = mysql_result($customer_result, $i, "status");
	$a8 = mysql_result($customer_result, $i, "contact_1");
	$a9 = mysql_result($customer_result, $i, "cell_1");
	$a10 = mysql_result($customer_result, $i, "email_1");
	
	$customerTT = "<label class=tip_click_label>Click for details</label>";
	?>
            <tr>
              <td width="141" align="left" valign="top"><a href="customer_details.php?cust_id=<?php echo $a?>" onMouseover="ddrivetip('<?php echo $customerTT ?>  ', 100)"; onMouseout="hideddrivetip()"><?php echo $a0 ?>&nbsp;&nbsp;<?php echo $a0a ?></a></td>
              <td width="113" align="left" valign="top"><?php echo $a1." ".$a2 ?><br />
                <?php echo $a3 ?></td>
              <td width="68" align="left" valign="top"><?php echo $a5 ?></td>
              <td width="66" align="left" valign="top"><?php echo $a8 ?></td>
              <td width="70" align="left" valign="top"><?php echo $a9 ?></td>
              <td width="174" align="left" valign="top"><?php echo $a10 ?></td>
            </tr>
            <?php
  $i++;
}
?>
          </table>
          
        </div>
  
</div>
<?php include ('../navigation/side_bar.php'); ?>
</body>
<?php } else {
$_SESSION['denied_return'] = $_SESSION['location'];	
include ("../navigation/sales_sidebar.php");?>
<body onload="accessdenied(); return false">
</body>
<?php }
?>
</html>