<?php session_name('CAKEPHP'); session_start();

 
$PageSecurity = 4;
include('includes/session.inc');
include('includes/function_lib.php');

//$user_id = $_SESSION['ACG_DashBoard_User'];
if($_SESSION['dealerid'])
	{
$sql="Select * from crm_leads where Convert_IntoAccountStatus='Y' and Quotes_Status='N' and mst_branchid='".$_REQUEST['site']."' and CompanyId='".$_SESSION['ACGCompanyId']."' and dealerid='".$_SESSION['dealerid']."' and company_name='".$_REQUEST['str']."' order by leadid";
        }
 else {
     $sql="Select * from crm_leads where Convert_IntoAccountStatus='Y' and Quotes_Status='N' and mst_branchid='".$_REQUEST['site']."' and CompanyId='".$_SESSION['ACGCompanyId']."' and dealerid='0' and company_name='".$_REQUEST['str']."' order by leadid";
 }
 //echo $sql;
$result=DB_query($sql,$db);
$data1='';
$data1.="<select name='leadid' id='leadid' style='width:150px;' onchange='GetLeadRecord(this.value)' >
<option value='0'>Select Lead</option>";

while($myrow=DB_fetch_array($result))
{

$data1.="<option value=".$myrow['leadid'].">".$myrow['leadcode']."</option>";
}
 $data1.="</select>";
 
 $data2='';
 
 $sql1="Select * from clientmaster where  id='".$_REQUEST['str']."'";
 $result1=DB_query($sql1,$db);
 $mbile=DB_fetch_array($result1);
 $mobile=$mbile['pre_mobile'];
 $data2.="<input type='text' name='partyContact2' value=".$mobile.">";
 
 
 echo $data=$data1."__".$data2."__".$mbile['pre_address1']."__".$mbile['pre_country']."__".$mbile['pre_state']."__".$mbile['pre_city']."__".$mbile['pre_pincode'];
 
 
 
 
 
 
 