<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
$_SESSION['current_page']  = "production";
include ("../navigation/header.php");
$page_name = "Stores-main";
include ("../navigation/access.php");

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

	
	$supplier_id = mysql_real_escape_string($_GET['supplier_id']);
	
	$table_name = $_SESSION['db_prefix']."_suppliers";
	$supplierQuery = "SELECT * FROM $table_name WHERE supplier_id ='". $supplier_id. "' ";
	$supplierResult = execsql($supplierQuery);
	
	$a1 = mysql_result($supplierResult, 0, "supplier_id");
	$a2 = mysql_result($supplierResult, 0, "account_name");
	$a3 = mysql_result($supplierResult, 0, "credit_cash");
	$a4 = mysql_result($supplierResult, 0, "phys_address");
	$a5 = mysql_result($supplierResult, 0, "phys_place");
	$a6 = mysql_result($supplierResult, 0, "post_address");
	$a7 = mysql_result($supplierResult, 0, "post_place");
	$a8 = mysql_result($supplierResult, 0, "phone");
	$a9 = mysql_result($supplierResult, 0, "fax");
	
	$a11 = mysql_result($supplierResult, 0, "contact1");
	$a12 = mysql_result($supplierResult, 0, "cell1");
	$a13 = mysql_result($supplierResult, 0, "email1");
	$a14 = mysql_result($supplierResult, 0, "contact2");
	$a15= mysql_result($supplierResult, 0, "cell2");
	$a16 = mysql_result($supplierResult, 0, "email2");
	$a17 = mysql_result($supplierResult, 0, "notes");
	$a18 = mysql_result($supplierResult, 0, "entered_by");
	$a19 = mysql_result($supplierResult, 0, "entry_date");
	$a20 = mysql_result($supplierResult, 0, "country");	
	
	$table_name2 = $_SESSION['db_prefix']."_store_items";
    $item_query = "SELECT item_name, supplier_id  FROM $table_name2 WHERE supplier_id = '".$a1."'  ";
    $item_result = mySQL_query($item_query);
    $item_num = mysql_num_rows($item_result);
    
	
	?>
<!--reference to main.css removed-->


<script type="text/javascript">
<!--
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>
<body>
<div class="main_frame">
<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="page_head_frame"><label class="label_page_head"> Supplier Account  <?php echo $a2 ?></label></div>
     
      </td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
    <div class="page_middle_frame">
      <table width="600" id="table_display">
        <tr>
          <td width="113">account no.:</td>
          <td width="176"><b><?php echo $a1 ?></b></td>
          <td colspan="2">
        <b><?php echo $a3 ?></b></td>
        </tr>
        <tr>
          <td>name:</td>
          <td colspan="3"><b><?php echo $a2 ?></b></td>
        </tr>
        <tr>
          <td>physical address:</td>
          <td><?php echo $a4 ?></td>
          <td width="85">place:</td>
          <td width="206"><b><?php echo $a5 ?></b></td>
        </tr>
        <tr>
          <td>postal address:</td>
          <td><b><?php echo $a6 ?></b></td>
          <td>place:</td>
          <td><b><?php echo $a7 ?></b></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
          <td>country:</td>
          <td><b><?php echo $a20 ?></b></td>
        </tr>
        <tr>
          <td>phone:</td>
          <td><b><?php echo $a8 ?></b></td>
          <td>fax:</td>
          <td><b><?php echo $a9 ?></b></td>
        </tr>
        <tr>
          <td>contact person 1:</td>
          <td><b><?php echo $a11 ?></b></td>
          <td>cell:</td>
          <td><b><?php echo $a12 ?></b></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
          <td>e-mail:</td>
          <td><b><?php echo $a13 ?></b></td>
        </tr>
        <tr>
          <td>contact person 2:</td>
          <td><b><?php echo $a14 ?></b></td>
          <td>cell:</td>
          <td><b><?php echo $a15 ?></b></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
          <td>e-mail:</td>
          <td><b><?php echo $a16 ?></b></td>
        </tr>
        <tr>
          <td>notes:</td>
          <td colspan="3"><b><?php echo $a17 ?></b></td>
        </tr>
        <tr>
          <td>Suppliers of:</td>
          <td colspan="3">
          <?php 
		  $i=0;
		  while ($i<$item_num) {
			  echo mysql_result($item_result, $i, "item_name").", ";
		  $i++;
		  }
		  ?>
		  </td>
        </tr>
      </table>
      </div>
    <br /></td>
  </tr>
  <tr>
  <td>
  </p></td>
  </tr>
</table>


</div>

</body>
<?php } else {
$_SESSION['denied_return'] = $_SESSION['location'];	
include ("../navigation/store_sidebar.php");?>
	<body onLoad="accessdenied(); return false">
	</body>
<?php }
?>

<?php include ('../navigation/side_bar.php'); ?>


</html>
