<?php
include("../include/session.php");
if(!$session->isAdmin()){
	header("Location: ../Store/denied2.php");
}else{
	include("../storeHeader.php");
	
		
	$account_no = $_GET['account_no'];
	$edit = $_GET['edit'];
	
	if ($edit=="1") {
		$field = $_GET['field'];
		$editText = $_GET['editText'];
		
		$editQuery = "UPDATE rad_tocotex SET $field = '".  $editText ."' WHERE account_no = '$account_no' ";
        $editResult = mySQL_query($editQuery);
	}
	
    $dropDownQuery = "SELECT account_no, name FROM 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++;
	}
	
		
	
	if ($account_no!='0') {
	$supplierQuery = "SELECT * FROM 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");
	}
	
	$w=1;
	while ($w < 12) {
	$a = 'a';	
	   if (${$a.$w} == '') { ${$a.$w}="?"; }
	   $w++;
	}
	?>
<script type="text/javascript" src="../css/tablesort.js"></script>

<link rel="stylesheet" href="../css/dhtmlwindow.css" type="text/css" />
<script type="text/javascript" src="../css/dhtmlwindow.js"></script>
<link rel="stylesheet" href="../css/modal.css" type="text/css" />
<script type="text/javascript" src="../css/modal.js"></script>
<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>
<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="headerbox2"> Edit Inter Company</div>
       <p class="edit"><font size="3"> <b><?php echo $a2 ?></a></b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click on the line you want to edit.</p></td></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>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'name' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a2 ?></a></b></td>
        </tr>
        <tr>
          <td>physical address:</td>
          <td><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phys_address' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a3 ?></a></b></td>
          <td width="85">place:</td>
          <td width="206"><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phys_place' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a4 ?></a></b></td>
        </tr>
        <tr>
          <td>postal address:</td>
          <td><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'post_address' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a5 ?></a></b></td>
          <td>place:</td>
          <td><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'post_place' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a6 ?></a></b></td>
        </tr>
        <tr>
          <td>phone:</td>
          <td><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phone' ?>&Type=N ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a7 ?></a></b></td>
          <td>fax:</td>
          <td><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'fax' ?>&Type=N ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a8 ?></a></b></td>
        </tr>
        <tr>
          <td>e-mail:</td>
          <td colspan="3"><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'email' ?>&Type=N ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a10 ?></a></b></td>
        </tr>
        <tr>
          <td>VAT no.</td>
          <td colspan="3"><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'vat_no' ?>&Type=N ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a11 ?></a></b></td>
        </tr>
        <tr>
          <td>notes:</td>
          <td colspan="3"><b>
		  <a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editTocotexLine.php?account_no=<?php echo $a1?>&field=<?php echo 'notes' ?>&Type=T ', 'Edit Tocotex account', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a9 ?></a></b></td>
        </tr>
      </table>
    <br /></td>
  </tr>
   <tr>
  <td><p class="main">
    <label class="std">&nbsp;&nbsp;&nbsp;&nbsp;</label>
    <input name="button" type="button" class="imagebutton" id="button" 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");
}
?>
