From c0dd606851c6b7a9c5318fe3c81cd795d277f28b Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 24 Oct 2018 17:53:54 +0530 Subject: [PATCH] dashboard issues --- .../controllers/Dashboard_Controller.php | 15 +++--- .../application/models/Calltracking_model.php | 2 + .../application/models/Dashboard_model.php | 48 +++++++++---------- .../api/application/models/Reports_model.php | 12 ++--- .../report_markcard_certificateCtrl.js | 3 +- Apollo/assets/views/dashboard_tile3.html | 2 +- 6 files changed, 43 insertions(+), 39 deletions(-) diff --git a/Apollo/api/application/controllers/Dashboard_Controller.php b/Apollo/api/application/controllers/Dashboard_Controller.php index 1afff7ba..1eeb9c46 100755 --- a/Apollo/api/application/controllers/Dashboard_Controller.php +++ b/Apollo/api/application/controllers/Dashboard_Controller.php @@ -183,8 +183,8 @@ class Dashboard_Controller extends REST_Controller { } } public function getadmimssionMonth_post(){ - $data = $this->post('data'); - $getadmimssionMonth = $this->dashboard_model->admissionCountMonth(); + $branchId = $this->post('branchId'); + $getadmimssionMonth = $this->dashboard_model->admissionCountMonth($branchId); if ($getadmimssionMonth) { $getadmimssionMonth['status'] = REST_Controller::HTTP_OK; // Set the response and exit @@ -200,8 +200,9 @@ class Dashboard_Controller extends REST_Controller { } } public function getadmimssionYear_post(){ + $branchId = $this->post('branchId'); $data = $this->post('data'); - $getadmimssionYear = $this->dashboard_model->admissionCountYear(); + $getadmimssionYear = $this->dashboard_model->admissionCountYear($branchId); if ($getadmimssionYear) { $getadmimssionYear['status'] = REST_Controller::HTTP_OK; // Set the response and exit @@ -217,8 +218,8 @@ class Dashboard_Controller extends REST_Controller { } } public function getfupToday_post(){ - $data = $this->post('data'); - $getfupToday = $this->dashboard_model->followupsCountToday(); + $branchId = $this->post('branchId'); + $getfupToday = $this->dashboard_model->followupsCountToday($branchId); if ($getfupToday) { $getfupToday['status'] = REST_Controller::HTTP_OK; // Set the response and exit @@ -234,8 +235,8 @@ class Dashboard_Controller extends REST_Controller { } } public function getfupMonth_post(){ - $data = $this->post('data'); - $getfupMonth = $this->dashboard_model->followupsCountMonth(); + $branchId = $this->post('branchId'); + $getfupMonth = $this->dashboard_model->followupsCountMonth($branchId); if ($getfupMonth) { $getfupMonth['status'] = REST_Controller::HTTP_OK; // Set the response and exit diff --git a/Apollo/api/application/models/Calltracking_model.php b/Apollo/api/application/models/Calltracking_model.php index f94ce9e0..68a00287 100755 --- a/Apollo/api/application/models/Calltracking_model.php +++ b/Apollo/api/application/models/Calltracking_model.php @@ -1569,6 +1569,8 @@ class Calltracking_model extends CI_Model { $this->db->insert(LEAD_DETAILS, $lead_Details); // this if for insert lead details + print_r($track_Details); + print_r($followup_Details); if($this->db->affected_rows() == '1'){ // get and store insert id from db $track_Details['LeadID']=$this->db->insert_id(); diff --git a/Apollo/api/application/models/Dashboard_model.php b/Apollo/api/application/models/Dashboard_model.php index 619082aa..02fa5524 100755 --- a/Apollo/api/application/models/Dashboard_model.php +++ b/Apollo/api/application/models/Dashboard_model.php @@ -222,7 +222,7 @@ from T_Lead_Tracking_Followup as ltf 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 sd.BranchCode = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); @@ -247,7 +247,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); @@ -271,7 +271,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); @@ -296,7 +296,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and list.ListName like 'CLOSE' and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltCount=$this->db->query($ltsql); $lcount = $ltCount->result(); @@ -310,7 +310,7 @@ public function leadCountMonth($branchId){ return $results; } - public function admissionCountMonth(){ + public function admissionCountMonth($branchId = null){ $sql = "select sum(total) as total from admission_month"; $admissionCount=$this->db->query($sql); $acount = $admissionCount->result(); @@ -324,7 +324,7 @@ public function leadCountMonth($branchId){ return $results; } - public function admissionCountYear(){ + public function admissionCountYear($branchId = null){ $sql = "select sum(tot_cnt) as total from admission_year"; $admissionCount=$this->db->query($sql); $acount = $admissionCount->result(); @@ -338,7 +338,7 @@ public function leadCountMonth($branchId){ return $results; } - public function followupsCountToday(){ + public function followupsCountToday($branchId = null){ $sql = "select count(ltf.TrackingID) as count from T_Lead_Tracking_Followup as ltf left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID @@ -348,7 +348,7 @@ public function leadCountMonth($branchId){ 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 STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and ltf.IsActive = 1 "; + and STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $followupsCount=$this->db->query($sql); $fcount = $followupsCount->result(); if (count($fcount) > 0) { @@ -361,7 +361,7 @@ public function leadCountMonth($branchId){ return $results; } - public function followupsCountMonth(){ + public function followupsCountMonth($branchId = null){ $sql = "select count(ltf.TrackingID) as count from T_Lead_Tracking_Followup as ltf left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID @@ -371,7 +371,7 @@ public function leadCountMonth($branchId){ 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(STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y')) = month(now()) and ltf.IsActive = 1 "; + and month(STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y')) = month(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $followupsCount=$this->db->query($sql); $fcount = $followupsCount->result(); if (count($fcount) > 0) { @@ -395,7 +395,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //print_r($sql); @@ -409,7 +409,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); // print_r($ssql); @@ -434,7 +434,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //to staff/trainee @@ -447,7 +447,7 @@ public function leadCountMonth($branchId){ 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 sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); if (count($tlead) > 0) { @@ -471,7 +471,7 @@ public function leadCountMonth($branchId){ 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 list.ListName like 'CLOSE' and sd.BranchCode = '".$branchId."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //to staff @@ -484,7 +484,7 @@ public function leadCountMonth($branchId){ 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 list.ListName like 'CLOSE' and sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and date(ltf.CreatedOn) = date(now()) and ltf.IsActive = 1 and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); if (count($tlead) > 0) { @@ -508,7 +508,7 @@ public function leadCountMonth($branchId){ 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 list.ListName like 'CLOSE' and sd.BranchCode = '".$branchId."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //to staff @@ -521,7 +521,7 @@ public function leadCountMonth($branchId){ 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 list.ListName like 'CLOSE' and sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and month(ltf.CreatedOn) = month(now()) and ltf.IsActive = 1 and list.ListName like 'CLOSE' and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); @@ -775,7 +775,7 @@ public function leadCountMonth($branchId){ 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 STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and sd.BranchCode = '".$branchId."' "; + and STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //to staff @@ -788,7 +788,7 @@ public function leadCountMonth($branchId){ 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 STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y') = date(now()) and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); @@ -813,7 +813,7 @@ public function leadCountMonth($branchId){ 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 list.ListName not like 'CLOSE' and list.ListName like 'PENDING' and sd.BranchCode = '".$branchId."' "; + and list.ListName not like 'CLOSE' and list.ListName like 'PENDING' and lt.CreatedBranch = '".$branchId."' "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); //To staff @@ -826,7 +826,7 @@ public function leadCountMonth($branchId){ 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 list.ListName not like 'CLOSE' and list.ListName like 'PENDING' and sd.BranchCode = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; + and list.ListName not like 'CLOSE' and list.ListName like 'PENDING' and lt.CreatedBranch = '".$branchId."' and sd.StaffID = '".$requestedBy."' "; $sltd=$this->db->query($ssql); $stlead = $sltd->result(); @@ -871,7 +871,7 @@ public function leadCountMonth($branchId){ } //To Filters public function getYear($branch = null){ - $sql = "select year(CreatedOn) as year from T_StudentDetails group by year "; + $sql = "select year(CreatedOn) as year from T_StudentDetails where year(CreatedOn) != 0 group by year "; $ltd=$this->db->query($sql); $year = $ltd->result(); //get batch @@ -879,7 +879,7 @@ public function leadCountMonth($branchId){ $brf=$this->db->query($brsql); $branchf = $brf->result(); //get university - $usql = "select UniversityID,UniversityName from T_UniversityMaster "; + $usql = "select UniversityID,UniversityName from T_UniversityMaster group by UniversityID "; $uf=$this->db->query($usql); $univf = $uf->result(); //get fiscal diff --git a/Apollo/api/application/models/Reports_model.php b/Apollo/api/application/models/Reports_model.php index 192f9e1b..9245e94e 100755 --- a/Apollo/api/application/models/Reports_model.php +++ b/Apollo/api/application/models/Reports_model.php @@ -285,8 +285,8 @@ left join ifnull(sms.rcvedate,'-') as rdate,ifnull(sms.rstatus,'-') as rstatus,sms.acmts,ifnull(sms.balance,0) as Balance_fee,std.name as Student_name,std.father as Father_name,std.phone as Phone_number,cm.course as Course_name,cm.uname as University,mdate,ifnull(std.address,'-') as address,ifnull(std.AlternateNumber,'') as AlternateNumber from (select c.ID,c.StudentID as sid,sfs.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,Sem as sem,c.CertificationType as certname,c.CertificationType as ctype,CDate as mdate,balpayable as balance, - max(if(ListName = 'ISSUED TO STUDENT', CDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus, - max(if(ListName = 'RECEIVED', CDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,c.Comments as acmts + if(ListName = 'ISSUED TO STUDENT', CDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus, + if(ListName = 'RECEIVED', CDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,c.Comments as acmts from T_CertificationStatus c left join T_Students_Fees_Status sfs on sfs.FeesType=c.CourseID and sfs.StudentID=c.StudentID left join T_PickListDetails list on list.ListCode=c.ListCode @@ -295,8 +295,8 @@ left join group by sid,cid,sem,ctype union select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,ifnull(cm.CertificateName,a.CertificationType) as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance, - max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus, - max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts + if(ListName = 'ISSUED TO STUDENT', AppDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus, + if(ListName = 'RECEIVED', AppDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,a.Comments as acmts from T_ApplicationStatus a left join T_Students_Fees_Status sfs on sfs.StudentID=a.StudentID and sfs.CourseID=a.CourseID @@ -309,8 +309,8 @@ left join group by sid,cid,ctype union select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,ifnull(cm.CertificateName,a.CertificationType) as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance, - max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus, - max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts + if(ListName = 'ISSUED TO STUDENT', AppDate,'-') as issuedate,if(ListName = 'ISSUED TO STUDENT', ListName,'-') as istatus, + if(ListName = 'RECEIVED', AppDate,'-') as rcvedate,if(ListName = 'RECEIVED', ListName,'-') as rstatus,a.Comments as acmts from T_ApplicationStatus a left join T_Students_Fees_Status sfs on sfs.StudentID=a.StudentID and sfs.CourseID=a.CourseID diff --git a/Apollo/assets/js/controllers/report_markcard_certificateCtrl.js b/Apollo/assets/js/controllers/report_markcard_certificateCtrl.js index 8211a9b2..345e8b31 100755 --- a/Apollo/assets/js/controllers/report_markcard_certificateCtrl.js +++ b/Apollo/assets/js/controllers/report_markcard_certificateCtrl.js @@ -310,9 +310,10 @@ app.controller('report_markcard_certificateCtrl', ["$scope", "$filter","$rootSco $scope.trackForm = { submit: function (form, myModel,loading,selectedStudents) { - //console.log(selectedStudents); + var comments = []; for(var stuid=0;stuid<=selectedStudents.length-1;stuid++){ + console.log(selectedStudents[stuid].rdate); comments [stuid] ="Call Tracking For Report Markcard/Certificate Status - SemYear:"+selectedStudents[stuid].Sem_year + " - Balance:" +selectedStudents[stuid].Balance_fee + " - CertificateName:" +selectedStudents[stuid].Certificate_name + " - ReceivedStatus:" +selectedStudents[stuid].rstatus + " - ReceivedDate:" +selectedStudents[stuid].rdate; } if(isNaN(myModel.date)){ diff --git a/Apollo/assets/views/dashboard_tile3.html b/Apollo/assets/views/dashboard_tile3.html index 38d46980..81daab5b 100644 --- a/Apollo/assets/views/dashboard_tile3.html +++ b/Apollo/assets/views/dashboard_tile3.html @@ -43,7 +43,7 @@