<?php
$PageSecurity = 2;
$title = _('Vendors');
include('includes/SQL_CommonFunctions.inc');
if($_GET['action'] == 'view' && isset($_GET['vendorcode']))
{
	$query = "Select * from suppliers where vendor_code='".$_GET['vendorcode']."' ";
	$result = DB_query($query,$db);
	$myrow = DB_fetch_array($result);
	//echo "<pre>";
	//print_r($myrow);
	
	$contact_query="Select * from contact_information_master where master_code='".$_GET['vendorcode']."' and master_prefix='S'";
	$contact_res=DB_query($contact_query,$db);
}
?>
<div align="center">
<fieldset style="width:600px">
<legend align="center"><h2><strong>VENDOR DETAILS</strong></h2></legend>
<table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr>
    <td><table width="100%" border="0" cellspacing="1" cellpadding="2">
      <tr>
        <th width="23%" scope="row"><strong>VENDOR NAME </strong></th>
        <td width="24%"><input type="text" value="<?php echo $myrow['vendor_name']; ?>" size="30" readonly="true" /></td>
        <th width="30%"><strong>VENDOR CODE </strong></th>
        <td width="23%"><input name="Input5" type="text" value="<?php echo $myrow['vendor_code']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>CATEGORY</strong></th>
		<?php 
		$cat_sql=DB_query("Select * from category_master where id='".$myrow['category']."'",$db);
		$cat_row=DB_fetch_array($cat_sql);
		?>
        <td><input name="Input" type="text" value="<?php echo $cat_row['name']; ?>" size="30" readonly="true" /></td>
        <th><strong>SHORT NAME </strong></th>
        <td><input name="Input6" type="text" value="<?php echo $myrow['short_name']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>ACCOUNT GROUP </strong></th>
		<?php 
			$account_sql = "select groupname from accountgroups where id='".$myrow['account_group']."'";
			$account_result = DB_query($account_sql,$db);
			$account_row = DB_fetch_array($account_result);
		?>
        <td><input name="Input2" type="text" value="<?php echo $account_row['groupname']; ?>" size="30" readonly="true" /></td>
        <th><strong>AVAILABLE BRANCH </strong></th>
		<?php 
		$site_sql = "Select locationname from locations where loccode='".$myrow['site']."'";
		$site_result = DB_query($site_sql,$db);
		$site_row = DB_fetch_array($site_result);
		?>
        <td><input name="Input4" type="text" value="<?php echo $site_row['locationname']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>VENDOR TYPE </strong></th>
        <td><input name="Input3" type="text" value="<?php echo $myrow['vendor_type']; ?>" size="30" readonly="true" /></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="3">
      <tr>
        <th width="23%" rowspan="3"><strong>ADDRESS</strong></th>
        <td width="24%"><input name="Input9" type="text" value="<?php echo $myrow['adrress1']; ?>" size="30" readonly="true" /></td>
        <th width="30%"><strong>EXTENSION</strong></th>
        <td width="23%"><input name="Input34" type="text" value="<?php echo $myrow['extension']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <td><input name="Input28" type="text" value="<?php echo $myrow['adrress2']; ?>" size="30" readonly="true" /></td>
        <th><strong>PHONE 1 </strong></th>
        <td><input name="Input35" type="text" value="<?php echo $myrow['phone1']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <td><input name="Input29" type="text" value="<?php echo $myrow['address3']; ?>" size="30" readonly="true" /></td>
        <th><strong>PHONE 2 </strong></th>
        <td><input name="Input36" type="text" value="<?php echo $myrow['phone2']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th><strong>COUNTRY</strong></th>
        <?php 
			$country_sql = "select country from country_master where id='".$myrow['country']."'";
			$country_result = DB_query($country_sql,$db);
			$country_row = DB_fetch_array($country_result);
		?>
        <td><input name="Input30" type="text" value="<?php echo $country_row['country']; ?>" size="30" readonly="true" /></td>
        <th><strong>MOBILE</strong></th>
        <td><input name="Input37" type="text" value="<?php echo $myrow['mobile']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th><strong>STATE</strong></th>
        <?php	
			$state_sql = "select state from state_master where id='".$myrow['state']."'";
			$state_result = DB_query($state_sql,$db);
			$state_row = DB_fetch_array($state_result);
		?>
        <td><input name="Input31" type="text" value="<?php echo $state_row['state']; ?>" size="30" readonly="true" /></td>
        <th><strong>FAX</strong></th>
        <td><input name="Input38" type="text" value="<?php echo $myrow['fax']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th><strong>CITY</strong></th>
        <?php	
			$city_sql = "select city from city_master where id='".$myrow['city']."'";
			$city_result = DB_query($city_sql,$db);
			$city_row = DB_fetch_array($city_result);
		?>
        <td><input name="Input32" type="text" value="<?php echo $city_row['city']; ?>" size="30" readonly="true" /></td>
        <th><strong>E MAIL </strong></th>
        <td><input name="Input39" type="text" value="<?php echo $myrow['email']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th><strong>PIN CODE </strong></th>
        <td><input name="Input33" type="text" value="<?php echo $myrow['pincode']; ?>" size="30" readonly="true" /></td>
        <td></td>
        <td></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" cellpadding="5">
<tr>
<th><strong>Contact Name</strong></th>
<th><strong>Designation</strong></th>
<th><strong>Phone/Mobile</strong></th>
<th><strong>Email</strong></th>
</tr>
<?php 
while($contact_row=DB_fetch_array($contact_res)){
//echo "<pre>";
//print_r($contact_row); 
?>
<tr>
<td><input type="text" value="<?php echo $contact_row['person'];?>" size="30" readonly="true"/></td>
<td><input type="text" name="Input18" value="<?php echo $contact_row['designation'];?>" size="30" readonly="true"/></td>
<td><input type="text" name="Input19" value="<?php echo $contact_row['phone'];?>" size="20" readonly="true"/></td>
<td><input type="text" name="Input20" value="<?php echo $contact_row['email'];?>" size="20" readonly="true"/></td>
</tr>       
<?php 
}
?>
<tr><th colspan="4"></th></tr>
</table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="1" cellpadding="2">
      <tr>
        <th><strong>PAN. NO. </strong></th>
        <td><input name="Input13" type="text" value="<?php echo $myrow['pan_no']; ?>" size="30" readonly="true" /></td>
        <th><strong>PAY TERMS </strong></th>
        <td>
		<?php 
		$pay_sql = "select terms from paymentterms where termsindicator='".$myrow['payterms']."'";
	  $pay_result = DB_query($pay_sql,$db);
	  $pay_row = DB_fetch_array($pay_result);
		?>
		<input name="Input122" type="text" value="<?php echo $pay_row['terms']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>TIN. NO. </strong></th>
        <td><input name="Input14" type="text" value="<?php echo $myrow['tin_no']; ?>" size="30" readonly="true" /></td>
        <th><strong>TAX GROUP </strong></th>
		<?php 
	  		$tax_sql = "select taxgroupdescription from taxgroups where taxgroupid='".$myrow['tax_group']."' ";
			$tax_result = DB_query($tax_sql,$db);
			$tax_row = DB_fetch_array($tax_result);
	  ?>
        <td><input name="Input127" type="text" value="<?php echo $tax_row['taxgroupdescription']; ?>" size="30" maxlength="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>LST. NO. </strong></th>
        <td><input name="Input15" type="text" value="<?php echo $myrow['lst_no']; ?>" size="30" readonly="true" /></td>
        <th><strong>RANGE</strong></th>
        <td><input name="Input1272" type="text" value="<?php echo $myrow['sup_range']; ?>" size="30" readonly="true" /></td>
      </tr>
      <tr>
        <th scope="row"><strong>CST. NO. </strong></th>
        <td><input name="Input17" type="text" value="<?php echo $myrow['cst_no']; ?>" size="30" readonly="true" /></td>
        <th><strong>DIVISION</strong></th>
        <td><input name="Input1273" type="text" value="<?php echo $myrow['sup_division']; ?>" size="30" readonly="true" /></td>
      </tr>  
      <tr>
        <th scope="row"><strong>EXCISE NO. </strong></th>
        <td><input name="Input18" type="text" value="<?php echo $myrow['excise_no']; ?>" size="30" readonly="true" /></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</fieldset>
</div>
<?php
include('includes/footer.inc');
?>