<?php session_name('CAKEPHP'); session_start();
$PageSecurity = 4;
include('includes/session.inc');
include('includes/function_lib.php');
if($_REQUEST['site']!='new')
{
$SQLClient=DB_query("select * from clientmaster where id='".$_REQUEST['site']."'",$db);
$ClientDetails=DB_fetch_array($SQLClient);

$ChkAccLedger="Select * from  accountledger where ";

//$ChkAccLedger=$s->GetFieldValue('accountledger',"AccountName='".$_REQUEST['site']."'",'ledgertype');
//if($ChkAccLedger='leads')
//{
	//$ConSQL="Select * from crm_leads where "
//}

$ContactSQL=DB_query("Select * from contact_information_master where master_code='".$_REQUEST['site']."'",$db);
$Contact=DB_fetch_array($ContactSQL);
$data1="";
$data1.="<input type='text' name='contact_name' id='contact_name' style='width:150px;' value='".$Contact['person']."' />";
$data2="";
$data2.="<input type='text' name='fname' id='fname' style='width:150px;' value='' />";


$data3="";
$data3.="<input type='text' name='mname' id='mname' style='width:150px;' value='' />";


$data4="";
$data4.="<input type='text' name='lname' id='lname' style='width:150px;' value='' />";


$data5="";
$data5.="<input type='text' name='address1' id='address1' style='width:150px;' value='".$ClientDetails['pre_address1']."' />";


$data6="";
$data6.="<input type='text' name='address2' id='address2' style='width:150px;' value='".$ClientDetails['pre_address2']."' />";


$data7="";
$data7.="<input type='text' name='address3' id='address3' style='width:150px;' value='".$ClientDetails['pre_address3']."' />";


$data8="";
$data8.="<input type='text' name='email' id='email' style='width:150px;' value='".$ClientDetails['per_email']."' />";


$data9="";
$data9.="<input type='text' name='phone' id='phone' style='width:150px;' value='".$ClientDetails['pre_phone1']."' />";


$data10="";
$data10.="<input type='text' name='mobile' id='mobile' style='width:150px;' value='".$ClientDetails['pre_mobile']."' />";


$data11="";
$data11.="<input type='text' name='fax' id='fax' style='width:150px;' value='".$ClientDetails['fax']."' />";


$data12="";
$data12.="<input type='text' name='zipcode' id='zipcode' style='width:150px;' value='".$ClientDetails['pre_pincode']."' />";

 $sh="ShowDiv(this.value,'show_state','emp_state.php')";
$data13="";
$data13.="<select name='country' id='country' style='width:150px;' onchange=".$sh.">";
$data13.="<option value='0'>Select</option>";
$sql_country=DB_query("select * from country_master",$db);
	while ($country_row=DB_fetch_array($sql_country)) {
$sel='';
if($country_row['id']==$ClientDetails['pre_country'])
$sel='selected';
$data13.="<option value='".$country_row['id']."' ".$sel.">".$country_row['country']."</option>";
 }
$data13.="</select>";


$data14="";

$sh1="ShowDiv(this.value,'show_city','emp_city.php')";
$data14.="<select name='state' onchange=".$sh1." id='state' style='width:150px;'>";
$data14.="<option value='0'>Select</option>";
 $sql_po= "select * from state_master";
$result=DB_query($sql_po,$db);
while($myrow=DB_fetch_array($result))
{
$sel1='';
if($myrow['id']==$ClientDetails['pre_state'])	
$sel1='selected';	
$data14.="<option value='".$myrow['id']."' ".$sel1.">".$myrow['state']."</option>";
}
$data14.="</select>";



$data15="";
$data15.="<select name='city'  id='city' style='width:150px;'>";
$data15.="<option value='0'>Select</option>";
$city_sql=DB_query("select * from city_master",$db);
while($city_row=DB_fetch_array($city_sql))
{
$sewl2='';
if($city_row['id']==$ClientDetails['pre_city'])
$sewl2='selected';
$data15.="<option value='".$city_row['id']."' ".$sewl2.">".$city_row['city']."</option>";
}
$data15.="</select>";


$data16="";


$Destination=$s->GetFieldValue('contact_information_master',"master_code='".$_REQUEST['site']."'",'designation');
$data16.="<select name='designation'  id='designation' style='width:150px;'>";
$data16.="<option value='0'>Select</option>";
$sql_po= "select * from desigmaster";
$result=DB_query($sql_po,$db);
while($myrow=DB_fetch_array($result))
{
$sel13='';
if($myrow['id']==$Destination)
$sel13='selected';
$data16.="<option value='".$myrow['id']."' ".$sel13.">".$myrow['designame']."</option>";
}
$data16.="</select>";










echo $data=$data1."__".$data2."__".$data3."__".$data4."__".$data5."__".$data6."__".$data7."__".$data8."__".$data9."__".$data10."__".$data11."__".$data12."__".$data13."__".$data14."__".$data15."__".$data16;
}
