<?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_suppliers SET $field = '".  $editText ."' WHERE account_no = '$account_no' ";
        $editResult = mySQL_query($editQuery);
	}
	
	
	$supplierQuery = "SELECT * FROM rad_suppliers WHERE account_no ='". $account_no. "' ";
	$supplierResult = execsql($supplierQuery);
	
	$a1 = mysql_result($supplierResult, 0, "account_no");
	$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");
	$a10 = "";
	$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");	
	
	
	$w=1;
	while ($w < 21) {
	$a = 'a';	
	   if (${$a.$w} == '') { ${$a.$w}="?"; }
	   $w++;
	}
	
	
	?>
<link href="../css/main.css" rel="stylesheet" type="text/css" />

<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 Supplier Account</div>
      <p class="edit"><font size="3"><b><font size="3"><b><?php echo $a2 ?></b></font></b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Click on the line you want to edit.</p></td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
      <table width="600" id="tablePlain">
        <tr>
          <td width="113">&nbsp;</td>
          <td width="176">&nbsp;</td>
          <td colspan="2"><b><?php echo $a3 ?></b></td>
        </tr>
        <tr>
          
<td>name:</td>
<td colspan="3"><b><a href="" onclick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'account_name' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"></a><a href="" onclick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'account_name' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"></a><a href="" onclick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'account_name' ?>&Type=T ', 'Edit supplier', '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', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phys_address' ?>&Type=T ', 'Edit supplier', '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>

<td width="85">place:</td>
<td width="206"> <b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phys_place' ?>&Type=T ', 'Edit supplier', '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>
</tr>

<tr>
<td>postal address:</td>
<td> <b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'post_address' ?>&Type=T ', 'Edit supplier', '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>

<td>place:</td>
<td><b><a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'post_place' ?>&Type=T ', 'Edit supplier', '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>
</tr>

<tr>
<td colspan="2">&nbsp;</td>
<td>country:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'country' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a20 ?></a>
</b></td>
</tr>

<tr>
<td>phone:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'phone' ?>&Type=N ', 'Edit supplier', '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>

<td>fax:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'fax' ?>&Type=N ', 'Edit supplier', '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>

<tr>
<td>contact person 1:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'contact1' ?>&Type=T ', 'Edit supplier', '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>

<td>cell:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'cell1' ?>&Type=N ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a12 ?></a>
</b></td>
</tr>

<tr>
<td colspan="2">&nbsp;</td>
<td>e-mail:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'email1' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a13 ?></a>
</b></td>
</tr>

<tr>
<td>contact person 2:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'contact2' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a14 ?></a>
</b></td>

<td>cell:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'cell2' ?>&Type=N ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a15 ?></a>
</b></td>
</tr>

<tr>
<td colspan="2">&nbsp;</td>
<td>e-mail:</td>
<td><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'email2' ?>&Type=T ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a16 ?></a>
</b></td>
</tr>

<tr>
<td>notes:</td>
<td colspan="3"><b>
<a href="" onClick="editwindow=dhtmlmodal.open('editBox', 'iframe', 'editLine.php?account_no=<?php echo $a1?>&field=<?php echo 'notes' ?>&Type=B ', 'Edit supplier', 'width=330px,height=170px,center=1,resize=0,scrolling=0')
needToConfirm = false;
editwindow.onclose=function(){return window}; return false"><?php echo $a17 ?></a>
</b></td>
</tr>
</table>

</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");
}
?>
