changes in course

This commit is contained in:
gandhimathi 2017-11-30 18:15:08 +05:30
parent 26d43b6bd8
commit fa79b6e74b

View File

@ -118,7 +118,7 @@ class Calltracking_model extends CI_Model {
public function getStatus()
{
$this->db->select('ListCode,ListName');
$this->db->where('ListCode !=','S003');
$this->db->where('ListCode !=',REOPEN);
$this->db->where('ListGroup','1');
$this->db->order_by('ListCode','ASC');
$status = $this->db->get(PICK_LIST_DETAILS);
@ -407,7 +407,9 @@ class Calltracking_model extends CI_Model {
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$todayFollowupDate=$now->format('d-m-Y');
$follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,'S001');
$todayDateTime=$now->format('Y-m-d');
$follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1');
if($follouwpDetails){
$result_array['todayStatus']=true;
$result_array['todayFolloupDetails']=$follouwpDetails;
@ -417,8 +419,28 @@ class Calltracking_model extends CI_Model {
$result_array['todayFolloupDetails']="";
}
/* $follouwpPendingDetails=$this->getPendingFollowupDetails($todayFollowupDate,'S001');
print_r($follouwpPendingDetails);die();*/
$follouwpPendingDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'2');
if($follouwpPendingDetails){
$result_array['todayPendingStatus']=true;
$result_array['PendingFolloupDetails']=$follouwpPendingDetails;
}
else{
$result_array['todayPendingStatus']=false;
$result_array['PendingFolloupDetails']="";
}
$todayLeadDetails=$this->todayFollowupDetails($todayDateTime,OPEN,'3');
if($todayLeadDetails){
$result_array['todayLeadStatus']=true;
$result_array['todayLeadDetails']=$todayLeadDetails;
}
else{
$result_array['todayLeadStatus']=false;
$result_array['todayLeadDetails']="";
}
return $result_array;
}
@ -426,19 +448,149 @@ print_r($follouwpPendingDetails);die();*/
* get date wise followup details
* @params date and status and check status
* */
public function todayFollowupDetails($todayDate=null,$status=null)
public function todayFollowupDetails($todayDate=null,$status=null,$check=null)
{
$this->db->distinct();
$this->db->select('LT.TrackingID');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->order_by('LT.TrackingID','ASC');
if($check!='3'){
$this->db->where('LT.StatusCode !=',$status);
}
else if($check=='3'){
$this->db->like('LD.CreatedOn', $todayDate, 'after');
}
$leadDetails=$this->db->get();
if($leadDetails){
$result_array = array();
foreach ($leadDetails->result() as $row){
$this->db->select('LTF.TrackingID,LTF.InteractionId');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->where('LTF.TrackingID',$row->TrackingID);
$lastFollowpID=$this->db->get()->last_row();
// get last followup details date wise
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
// check today date based follwup details
if($check=='1'){
$this->db->where('LTF.FollowupOn',$todayDate);
$this->db->where('LT.StatusCode !=',$status);
}
// check today date based pending followp details
else if($check=='2'){
$this->db->where('LTF.FollowupOn <= ',$todayDate);
$this->db->where('LT.StatusCode !=',$status);
}
else if($check=='3'){
$this->db->like('LD.CreatedOn', $todayDate, 'after');
}
$trackDetails=$this->db->get();
foreach ($trackDetails->result() as $row1)
{
$tracking_array["LeadID"]=$row1->LeadID;
$tracking_array["LeadName"]=$row1->LeadName;
$tracking_array["MobileNumber"]=$row1->MobileNumber;
$tracking_array["TrackingID"]=$row1->TrackingID;
$tracking_array["FollowupOn"]=$row1->FollowupOn;
$tracking_array["StatusCode"]=$row1->StatusCode;
$tracking_array["statusListName"]=$row1->statusListName;
$tracking_array["ListCode"]=$row1->ListCode;
$tracking_array["ListName"]=$row1->ListName;
$result[]=$tracking_array;
}
}
$result_array['trackingDetails']=$result;
return $result_array;
}
else{
return false;
}
}
/*
* get today created lead details for dashboard
* @params today date
* created by kms
* */
public function todayLeadDetails($todayDate=null)
{
/* $this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.FollowupOn',$todayDate);
$this->db->where('LT.StatusCode',$status);
$this->db->order_by('LT.TrackingID','ASC');
return $this->db->get()->result();
$this->db->like('LD.CreatedOn', $todayDate, 'after');
$this->db->order_by('LT.TrackingID','DESC');
return $this->db->get()->result();*/
$this->db->distinct();
$this->db->select('LT.TrackingID,LD.LeadID');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->from(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->order_by('LD.LeadID','DESC');
$this->db->like('LD.CreatedOn', $todayDate, 'after');
$leadDetails=$this->db->get();
if($leadDetails){
foreach ($leadDetails->result() as $row){
$this->db->select('LTF.TrackingID,LTF.InteractionId');
$this->db->from(LEAD_TRACKING_FOLLOWUP.' as LTF');
$this->db->where('LTF.TrackingID',$row->TrackingID);
$lastFollowpID=$this->db->get()->last_row();
// get last followup details date wise
$this->db->distinct();
$this->db->select('LD.LeadName,LD.MobileNumber,LT.TrackingID,LT.LeadID,PLD.ListCode,PLD.ListName,LTF.FollowupOn,LT.StatusCode,PLD1.ListName as statusListName');
$this->db->from(LEAD_DETAILS.' as LD');
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
$this->db->join(LEAD_TRACKING_FOLLOWUP.' as LTF', 'LTF.TrackingID = LT.TrackingID');
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = LT.ActivityStatus');
$this->db->join(PICK_LIST_DETAILS.' as PLD1', 'PLD1.ListCode = LT.StatusCode');
$this->db->where('LTF.InteractionId',$lastFollowpID->InteractionId);
foreach ($trackDetails->result() as $row1)
{
$tracking_array["LeadID"]=$row1->LeadID;
$tracking_array["LeadName"]=$row1->LeadName;
$tracking_array["MobileNumber"]=$row1->MobileNumber;
$tracking_array["TrackingID"]=$row1->TrackingID;
$tracking_array["FollowupOn"]=$row1->FollowupOn;
$tracking_array["StatusCode"]=$row1->StatusCode;
$tracking_array["statusListName"]=$row1->statusListName;
$tracking_array["ListCode"]=$row1->ListCode;
$tracking_array["ListName"]=$row1->ListName;
$result[]=$tracking_array;
}
}
}
else{
return false;
}
}
}