From 1aa8ff87ae91ce426e7492add43a5e77353a3b8b Mon Sep 17 00:00:00 2001 From: rajasekar Date: Tue, 12 Mar 2019 11:31:33 +0530 Subject: [PATCH] dashboard closed count changes --- .../api/application/models/Dashboard_model.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Apollo/api/application/models/Dashboard_model.php b/Apollo/api/application/models/Dashboard_model.php index ffe5ac41..f958fdbd 100755 --- a/Apollo/api/application/models/Dashboard_model.php +++ b/Apollo/api/application/models/Dashboard_model.php @@ -295,7 +295,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and date(ltf.CreatedOn) = date(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and list.ListName like 'CLOSED' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); $sltsql = "select count(InteractionID) as count @@ -307,7 +307,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and date(ltf.CreatedOn) = date(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; + and date(ltf.CreatedOn) = date(now()) and list.ListName like 'CLOSED' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; $sltCount=$this->db->query($sltsql); $slcount = $sltCount->result(); @@ -332,7 +332,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and month(ltf.CreatedOn) = month(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and list.ListName like 'CLOSED' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); $sltsql = "select count(InteractionID) as count @@ -344,7 +344,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and month(ltf.CreatedOn) = month(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; + and month(ltf.CreatedOn) = month(now()) and list.ListName like 'CLOSED' and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; $sltCount=$this->db->query($sltsql); $slcount = $sltCount->result(); if (count($lcount) > 0) { @@ -557,7 +557,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSED' and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //to staff @@ -570,7 +570,7 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSED' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); if (count($tlead) > 0) { @@ -594,10 +594,9 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSED' and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); - // echo $sql; //to staff $ssql = "select InteractionID,ifnull(date_format(ltf.CreatedOn,'%d-%m-%Y'),'-') as date,ltf.TrackingID as TrackingId,ifnull(ltf.FollowupOn,'-') as followUpDate,ld.LeadName as name,ifnull(ld.MobileNumber,'-') as mobileNo,lt.University as university,lt.Course as course,list.ListName as status,ltf.FollowupComments as cmnts,ifnull(am.ActivityName,'-') as activity,sd.FirstName as AssignTo from T_Lead_Tracking_Followup as ltf @@ -608,10 +607,9 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ left join T_ActivityMaster am on am.ActivityID=lt.ActivityStatus join T_PickListDetails list on list.ListCode=ltf.StatusName where InteractionID in (select max(InteractionID) from T_Lead_Tracking_Followup group by TrackingID) - and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and am.ActivityName like 'Adm%' and list.ListName like 'CLOSED' and lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); - if (count($tlead) > 0) { $results['lList'] = true; $results['l_data'] = $tlead;