<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--reference to main.css removed-->
<?php
include ("../navigation/header.php");
$page_name = "Stores-main";
include ("../navigation/access.php");

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


$table_name2 = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT cust_id, account, account_type, comp_name, bag_box, box_no,  postal_place, phone, contact_1, cell_1, email_1 FROM $table_name2 WHERE account_type != 'closed' ";
$customer_result = $con->query($customer_query);
$customer_num = mysqli_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/go_to_url.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></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">Customer accounts</label></td>
              <td width="253">&nbsp;</td>
              <td width="171" align="right">&nbsp;</td>
            </tr>
          </table>
        </div>
        
        <div class="page_middle_frame">
        <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": "500px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "asc" ]],
					"aoColumns": [
								{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true}
								
								 ]
				} );
			} );
		</script> 
          <table width="690" id="scroll_table" class="data_display">
            <thead>
            <tr>
              <th >Customer</th>
              <th >Postal Address</th>
              <th >Phone</th>
              <th >Contact</th>
              <th >Cell</th>
              <th >e-mail</th>
            </tr>
            </thead>
            <?php 
while($row = $customer_result->fetch_assoc()) {
    $a = $row["cust_id"];
	$a0 = $row["comp_name"];
	$a1 = $row["bag_box"].' '.$row["box_no"];
	$a3 = $row["postal_place"];
	$a5 = $row["phone"];
	$a6 = $row["account_type"];
	$a8 = $row["contact_1"];
	$a9 = $row["cell_1"];
	$a10 = $row["email_1"];
	
	$customerTT = "<label class=tip_click_label>Click for details</label>";
	?>
            <tr>
              <td width="141" align="left" valign="top"><a href="../store/account_details.php?cust_id=<?php echo $a ?>" onMouseover="ddrivetip('<?php echo $customerTT ?>  ', 100)"; onMouseout="hideddrivetip()"><?php echo $a0 ?></a></td>
              <td width="113" align="left" valign="top"><?php echo $a1?><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
}
?>
          </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>