diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index 7bafcf44..94b381ed 100644 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -415,6 +415,9 @@ class Calltracking_model extends CI_Model { $todayFollowupDate=$now->format('d-m-Y'); $todayDateTime=$now->format('Y-m-d'); + + + $follouwpDetails=$this->todayFollowupDetails($todayFollowupDate,CLOSE,'1'); if($follouwpDetails){ $result_array['todayStatus']=true; @@ -535,4 +538,52 @@ class Calltracking_model extends CI_Model { } } + + + /* + * get all followup details + * created by kms + * */ + + public function getDashboardFollowupDetails($search=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'); + $leadDetails=$this->db->get(); + if($leadDetails->result()){ + 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('DATE_FORMAT(LTF.CreatedOn, "%d-%m-%Y") AS CreatedOn,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); + + $result[]=$this->db->get()->result(); + + } + $result_array['details']=$result; + $result_array['followupStatus']=true; + + return $result_array; + + } + + else{ + $result_array['details']=""; + $result_array['followupStatus']=false; + } + return $result_array; + + } } \ No newline at end of file