<?php
include("../include/session.php");
if(!$session->isAdmin()){
	header("Location: ../Store/denied2.php");
}else{
	include("../storeHeader.php");
	
	$account_no = mysql_real_escape_string($_GET['account_no']);
	
    $dropDownQuery = "SELECT account_no, name FROM nam_rad_tocotex  ORDER BY name ASC";
	$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$q = 0;
	$arrId = array ();
	$arrName = array ();
	while ($q < $num) {
		$arrId[$q] = mysql_result($dropDownResult, $q, "account_no");
		$arrName[$q] = mysql_result($dropDownResult, $q, "name");
		$q++;
	}
	
	$w=0;
	while ($w < 12) {
	$a = 'a';	
	   ${$a.$w} = '';
	   $w++;
	}
	$repNum='';
	
	
	if ($account_no!='0') {
	$supplierQuery = "SELECT * FROM nam_rad_tocotex WHERE account_no ='". $account_no. "' ";
	$supplierResult = execsql($supplierQuery);
	$a1 = mysql_result($supplierResult, 0, "account_no");
	$a2 = mysql_result($supplierResult, 0, "name");
	$a3 = mysql_result($supplierResult, 0, "phys_address");
	$a4 = mysql_result($supplierResult, 0, "phys_place");
	$a5 = mysql_result($supplierResult, 0, "post_address");
	$a6 = mysql_result($supplierResult, 0, "post_place");
	$a7 = mysql_result($supplierResult, 0, "phone");
	$a8 = mysql_result($supplierResult, 0, "fax");
	$a9 = mysql_result($supplierResult, 0, "notes");
	$a10 = mysql_result($supplierResult, 0, "email");
	$a11 = mysql_result($supplierResult, 0, "vat_no");
	
	$repQuery = "SELECT * FROM nam_rad_representatives WHERE account_no ='". $a1. "' ";
	$repResult = execsql($repQuery);
	$repNum = mysql_num_rows($repResult);
	
	}
	?>
<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>
<script type="text/javascript">
function checkifempty(){
if (document.form2.account_no_text.value==''){
document.getElementById("add_button").disabled=true
}
else {
document.getElementById("add_button").disabled=false	
}
}
if (document.all || document.getElementById)
setInterval("checkifempty()",100)
</script>
<script type="text/javascript" src="../css/tablesort.js"></script>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="headerbox2"> Tocotex Company</div>
      <p class="main"><font size="3"><b><?php echo $a2 ?></b></font> </p></td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
      <table width="600" id="tablePlain">
        <tr>
          <td width="113">account no.:</td>
          <td width="176"><b><?php echo $a1 ?></b></td>
          <td colspan="2"></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 $a3 ?></td>
          <td width="85">place:</td>
          <td width="206"><b><?php echo $a4 ?></b></td>
        </tr>
        <tr>
          <td>postal address:</td>
          <td><b><?php echo $a5 ?></b></td>
          <td>place:</td>
          <td><b><?php echo $a6 ?></b></td>
        </tr>
        <tr>
          <td>phone:</td>
          <td><b><?php echo $a7 ?></b></td>
          <td>fax:</td>
          <td><b><?php echo $a8 ?></b></td>
        </tr>
        <tr>
          <td>e-mail:</td>
          <td colspan="3"><b><?php echo $a10 ?></b></td>
        </tr>
        <tr>
          <td>VAT no.</td>
          <td colspan="3"><b><?php echo $a11 ?></b></td>
        </tr>
        <tr>
          <td>notes:</td>
          <td colspan="3"><b><?php echo $a9 ?></b></td>
        </tr>
      </table></td>
  </tr>
   <tr>
  <td>
    <input name="button7" type="button" class="linkbutton" id="button7" onclick="MM_goToURL('parent','issuesTocotex.php?tocotexNo=<?php echo $a1?>&date=0&fuel=0');return document.MM_returnValue" value="Issues" />
  
  <input name="button8" type="button" class="linkbutton" id="button8" onclick="MM_goToURL('parent','issuesTocotex.php?tocotexNo=<?php echo $a1?>&date=0&fuel=1');return document.MM_returnValue" value="Fuel" />
  
    <p class="main">
    <label class="std">&nbsp;&nbsp;&nbsp;&nbsp;</label>
    <input name="button5" type="button" class="imagebutton" id="button5" onclick="MM_goToURL('parent','showAllProducts.php?cat=Tiles and Accessories&amp;productSelect=All&amp;colorSelect=All');return document.MM_returnValue" value="Done" />
    </p>
  </p>
  </td>
  </tr>
</table>
<!--end of tableMain-->
<?php

	include("../footer.php");
}
?>
