<?php
$PageSecurity = 11;
include('includes/SQL_CommonFunctions.inc');
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/Class_Client.php');

	    
	    $q=$_GET['q'];
	  	$branch=$_REQUEST['branch'];
		
		
		
	 	$site_code=$s->GetFieldValue('locations',"prefix='".$branch."'",'loccode');
		
		 $AccountSQL=DB_query("select * from accountledger where AccountsId='".$_REQUEST['q']."'",$db);
		$AccountSQLRow=DB_fetch_array($AccountSQL);
		if($AccountSQLRow['ledgertype']=='client')
		{
		$getclient_mstid=$AccountSQLRow['vender_client'];;
	 	 }
		 else
		{
		$getclient_mstid=$AccountSQLRow['AccountName'];
		} 
	    $sql="Select client_code,pre_address1,pre_address2,pre_address3,pre_country,pre_mobile,pre_state,pre_city from clientmaster Where id ='".$getclient_mstid."'";
		$result = DB_query($sql,$db);
		$myrow=DB_Fetch_array($result);
		
		$countryName=$s->getField('country_master','id',$myrow['pre_country'],'country');
		$stateName=$s->getField('state_master','id',$myrow['pre_state'],'state');
		$cityName=$s->getField('city_master','id',$myrow['pre_city'],'city');
		
		
		
		?> 
  
  

  
  
<table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
<tr>
<td class="tabledata" style="width:146px;" rowspan="4">Address</td>
<td style="width:258px;"><input type="text" name="address1" id="" value="<?php echo $myrow['pre_address1']?>"  style="width:100%" /></td>
<td class="tabledata" style="width:146px;">Dispatch AD No.</td>
<td>
<?php
//echo $_REQUEST['dispatchNo'];
  //echo "Select id,adviceNo from dispatch where party='".$q."' and site='".$site_code."' and status='0'";?>
<select  name="dispatchNo" id="dispatchNo" style="width:100%; height:20px;" onchange="showDispatchDetails(this.value)">
	
<option value="0">Select</option>
  <?php
  $party_code=$s->GetFieldValue('accountledger',"AccountsID='".$q."'",'vender_client');
 $dispatch_Sql=DB_query("Select id,adviceNo from dispatch where party='".$party_code."' and site='".$site_code."' and status='0'",$db);
while($dispatchRow=DB_fetch_array($dispatch_Sql))
{
?>
<option value="<?php  echo $dispatchRow['id']?>"><?php  echo $dispatchRow['adviceNo']?></option>
<?php }?>
</select></td>
</tr>
<tr>
<td scope="row"><input type="text" name="address2" value="<?php echo $myrow['pre_address2']?>" id="address2"  style="width:100%" /></td>
<td class="tabledata">Current Balance</td>
<td><input type="text" name="cuurentBalance" id="cuurentBalance"  style="width:100%" /></td>
</tr>
<tr>
<td><input type="text" name="address3" id="address3" value="<?php echo $myrow['pre_address3'];?>"  style="width:100%" /></td>
<td class="tabledata">Credit Limit</td>
<td><input type="text" name="creditLimit" id="creditLimit"  style="width:100%" /></td>
</tr>
<tr>
<td scope="row"><input type="text" name="address4" id="address4" value="<?php echo $cityName." ".$stateName." ".$countryName;?>"  style="width:100%" /></td>
<td class="tabledata">Form No.</td>
<td>
<?php //echo "Select * from party_form_master where party='".$getclient_mstid."'"; ?>
<select name="formNo" style="width:100%">
	<?php
	
	$formSql=DB_query("Select * from party_form_master where party='".$getclient_mstid."'",$db);
	while($formRow=DB_fetch_array($formSql))
	{?>
		<option value="<?php echo $formRow['id']?>"><?php echo $formRow['formNo']?></option>
	<?php 
	}
	?>
</select>	
</td>
</tr>
</table> 
  
  