// $SalesRepresentativename ='';
for($i=0;$i<$rowcount;$i++)
{
$leadid = $leadslist[$i]['leadid'];
$userid = $leadslist[$i]['userid'];
$companyid = $leadslist[$i]['companyid'];
$clientid = $leadslist[$i]['clientid'];
$Companyname = $leadslist[$i]['Company_Name'];
$Clientcompany = $leadslist[$i]['Client_Company_Name'];
$Leads_description = $leadslist[$i]['leaddesc'];
$FirstContact_date = $leadslist[$i]['firstcontactdate'];
$NextContact_date = $leadslist[$i]['nextcontactdate'];
if($NextContact_date == "1970-01-01")
{
$Contact_date = date("j M Y",strtotime($leadslist[$i]['firstcontactdate']));
}
else
{
$Contact_date = date("j M Y",strtotime($leadslist[$i]['nextcontactdate']));
}
$name = $leadslist[$i]['name'];
$leadscore = $leadslist[$i]['leadscore'];
$leadForRepid = $leadslist[$i]['leadForRepid'];
if($leadscore == '1')
{
$score = "Hot";
}
elseif($leadscore == '2')
{
$score = "Cold";
}
elseif($leadscore == '3')
{
$score = "Medium";
}
$leadtype = $leadslist[$i]['leadtype'];
$LeadSource = $leadslist[$i]['LeadSource'];
$sql ="select userid,name as representative_name from mstusers where userid=$leadForRepid ORDER BY userid";
$representativelist = $obj_Leads-> getLeads('','',$sql);
$SalesRepresentativename = $representativelist[0]['representative_name'];
?>
:  =$Companyname?>
:  =$Clientcompany?>
:  =$SalesRepresentativename?>
:  =$Leads_description?>
:  =$leadforname?>
:  =$leadsourcename?>
:  =$Contact_date?>
:  =$score?>
} ?>