<?php 
$PageSecurity = 11;
$title = _('View Client details');
include('includes/SQL_CommonFunctions.inc');
if($_GET['action'] == 'view' && isset($_GET['id']))
{
	$query = "select * from clientmaster where id='".$_GET['id']."' ";
	$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='".$myrow['client_code']."' and master_prefix='C'";
	$contact_res=DB_query($contact_query,$db);
}
?>
<style type="text/css">
<!--
.mandatory { color:#FF0000;
}
-->
</style>
<div align="center">
<fieldset style="width:600px">
<legend align="center"><h2><strong>CLIENT DETAILS</strong></h2></legend>
<table width="100%" cellpadding="5">
<tr>
<td>
<table width="100%" border="0" cellpadding="5">
  <tr>
    <th><strong>Client  Name</strong></th>
    <td><input name="text" type="text" value="<?php echo $myrow['c_name']; ?>" size="30" readonly="true" /></td>
    <th><strong>Client Code</strong></th>
    <td><input type="text" name="Input2" value="<?php echo $myrow['client_code']; ?>" readonly="true" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>Short Name</strong></th>
    <td><input name="Input" type="text" value="<?php echo $myrow['short_name']; ?>" size="30" readonly="true" /></td>
    <th><strong>Client Category</strong></th>
    <td><input type="text" name="Input3" value="<?php echo $myrow['ccategory']; ?>" readonly="true" /></td>
  </tr>
  <tr>
    <th scope="row"><strong>Tax</strong></th>
    <td>
     <?php
   $tax_sql=DB_query("Select salestax_id,tax_code from sales_tax_master where salestax_id='".$myrow['tax']."'",$db);
 $tax_row=DB_fetch_array($tax_sql);
  
   ?>
    <input name="tax" id="tax" type="text" value=" <?php echo $tax_row['tax_code'];?>" readonly>
     
    </td>
    <th>Branch</th>
    <td>
   <?php 
   $SiteName=DB_query("Select locationname from locations where loccode='".$myrow['Site']."'",$db);  
   $Siteres=DB_fetch_array($SiteName);   
   ?> 	
    	
    	<input name="Site" id="Site" type="text" value=" <?php echo $Siteres['locationname'];?>" readonly></td>
  </tr>
  
    <tr>
    <th scope="row"><strong>Client  Limit</strong></th>
    <td>
    <input name="client_limit" id="client_limit" type="text" value=" <?php echo $myrow['credit_limit'];?>" readonly>  
    </td>
    <th>Client  Days</th>
    <td> 	
    	<input name="client_days" id="client_days" type="text" value=" <?php echo $myrow['credit_days'];?>" readonly></td>
  </tr>
  
</table>
</td>
</tr>

<tr>
<td>
<table width="100%" border="0" cellpadding="5">
      <tr>
        <th rowspan="3"><strong>Address</strong></th>
        <td><input name="Input4" type="text" value="<?php echo $myrow['pre_address1']; ?>" size="30" readonly="true"></td>
        <th><strong>Pincode</strong></th>
        <td><input name="Input11" type="text" value="<?php echo $myrow['pre_pincode']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <td><input name="Input5" type="text" value="<?php echo $myrow['pre_address2']; ?>" size="30" readonly="true"></td>
        <th><strong>Extension</strong></th>
        <td><input name="Input12" type="text" value="<?php echo $myrow['Extension']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <td><input name="Input6" type="text" value="<?php echo $myrow['pre_address3']; ?>" size="30" readonly="true"></td>
        <th><strong>Phone1</strong></th>
        <td><input name="Input13" type="text" value="<?php echo $myrow['pre_phone1']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th><strong>Area</strong></th>
        <td><input name="Input7" type="text" value="<?php echo $myrow['pre_area']; ?>" size="30" readonly="true"></td>
        <th><strong>Phone2</strong></th>
        <td><input name="Input14" type="text" value="<?php echo $myrow['pre_phone2']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th><strong>Country</strong></th>
		<?php 
			$country_sql = "select country from country_master where id='".$myrow['pre_country']."'";
			$country_result = DB_query($country_sql,$db);
			$country_row = DB_fetch_array($country_result);
		?>
        <td><input name="Input8" type="text" value="<?php echo $country_row['country']; ?>" size="30" readonly="true"></td>
        <th><strong>Fax</strong></th>
        <td><input name="Input15" type="text" value="<?php echo $myrow['fax']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th><strong>State</strong></th>
		<?php	
			$state_sql = "select state from state_master where id='".$myrow['pre_state']."'";
			$state_result = DB_query($state_sql,$db);
			$state_row = DB_fetch_array($state_result);
		?>
        <td><input name="Input9" type="text" value="<?php echo $state_row['state']; ?>" size="30" readonly="true"></td>
        <th><strong>Mobile</strong></th>
        <td><input name="Input16" type="text" value="<?php echo $myrow['pre_mobile']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th><strong>City</strong></th>
	    <?php	
			$city_sql = "select city from city_master where id='".$myrow['pre_city']."'";
			$city_result = DB_query($city_sql,$db);
			$city_row = DB_fetch_array($city_result);
		?>
        <td><input name="Input10" type="text" value="<?php echo $city_row['city']; ?>" size="30" readonly="true"></td>
        <th><strong>E-mail</strong></th>
        <td><input name="Input17" type="text" value="<?php echo $myrow['per_email']; ?>" size="20" readonly="true"></td>
      </tr>
    </table>
</td>
</tr>

<tr>
<td>
<table width="85%" 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" name="" value="<?php echo $contact_row['person'];?>" size="20" readonly="true"/></td>
<td><input type="text" name="Input18" value="<?php echo $contact_row['designation'];?>" size="20" 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="5">
      <tr>
        <th><strong>Payment Terms </strong></th>
        <td><select name="payment_terms" id="payment_terms" style="width:120px">
          <option value="000">---Select---</option>
          <?php
   $pay_sql=DB_query("select * from paymentterms",$db); 
   while($pay_row=DB_fetch_array($pay_sql))
   {
   ?>
          <option value="<?php echo $pay_row['termsindicator'];?>"<?php echo($myrow['payment_terms']==$pay_row['termsindicator']?'selected':'');?>><?php echo $pay_row['terms'];?></option>
          <?php } ?>
        </select></td>
        <th><strong>Excise No.</strong></th>
        <td><input name="Input334" type="text" value="<?php echo $myrow['excies_no']; ?>" size="20" readonly="true" /></td>
      </tr>
      <tr>
        <th><strong>PAN No.</strong></th>
        <td><input name="Input32" type="text" value="<?php echo $myrow['pan_no']; ?>" size="20" readonly="true" /></td>
        <th><strong>Tin No. </strong></th>
        <td><input name="Input33" type="text" value="<?php echo $myrow['tin_no']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th><strong>LST No.</strong></th>
        <td><input name="Input26" type="text" value="<?php echo $myrow['lst_no']; ?>" size="20" readonly="true"></td>
        <th><strong>Range</strong></th>
        <td><input name="Input332" type="text" value="<?php echo $myrow['cl_range']; ?>" size="20" readonly="true"></td>
      </tr>
      <tr>
        <th scope="row"><strong>CST No.</strong></th>
        <td><input name="Input28" type="text" value="<?php echo $myrow['cst_no']; ?>" size="20" readonly="true"></td>
        <th><strong>Division</strong></th>
        <td><input name="Input333" type="text" value="<?php echo $myrow['cl_division']; ?>" size="20" readonly="true"></td>
      </tr>
    </table>
</td>
</tr>


</table>




</fieldset>
</div>
<?php 
include('includes/footer.inc');
?>
