diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 5262aff2..c8dae92c 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -177,6 +177,8 @@ $route['admissionYear'] = 'Dashboard_Controller/admissionYear'; $route['feeOutstanding'] = 'Dashboard_Controller/feeOutstanding'; $route['followupsToday'] = 'Dashboard_Controller/followupsToday'; $route['followupsPending'] = 'Dashboard_Controller/followupsPending'; +$route['admissionBatch'] = 'Dashboard_Controller/admissionBatch'; +$route['filterYear'] = 'Dashboard_Controller/filterYear'; /*login page announcement*/ $route['getLoginAnnouncementDetails'] = 'Login_Controller/getLoginAnnouncementDetails'; diff --git a/Apollo/api/application/controllers/Dashboard_Controller.php b/Apollo/api/application/controllers/Dashboard_Controller.php index b0a53be2..0ccbc312 100755 --- a/Apollo/api/application/controllers/Dashboard_Controller.php +++ b/Apollo/api/application/controllers/Dashboard_Controller.php @@ -319,8 +319,9 @@ class Dashboard_Controller extends REST_Controller { } } public function admissionMonth_post(){ - $data = $this->post('data'); - $admissionMonth = $this->dashboard_model->admissionMonth(); + $year = $this->post('year'); + $month = $this->post('month'); + $admissionMonth = $this->dashboard_model->admissionMonth($year,$month); if ($admissionMonth) { $admissionMonth['status'] = REST_Controller::HTTP_OK; // Set the response and exit @@ -403,4 +404,39 @@ class Dashboard_Controller extends REST_Controller { ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } + public function admissionBatch_post(){ + $univ = $this->post('univ'); + $admissionBatch = $this->dashboard_model->admissionBatch($univ); + if ($admissionBatch) { + $admissionBatch['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($admissionBatch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + //To filters + public function filterYear_post(){ + $branch = $this->post('branchId'); + $filterYear = $this->dashboard_model->getYear($branch); + if ($filterYear) { + $filterYear['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($filterYear, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } } diff --git a/Apollo/api/application/models/Dashboard_model.php b/Apollo/api/application/models/Dashboard_model.php index 765c0671..bb6bbc12 100755 --- a/Apollo/api/application/models/Dashboard_model.php +++ b/Apollo/api/application/models/Dashboard_model.php @@ -311,9 +311,16 @@ public function leadCountMonth(){ return $results; } public function followupsCountToday(){ - $sql = "select count(distinct TrackingID) as count from T_Lead_Tracking_Followup ltf - join T_PickListDetails list on list.ListCode=ltf.StatusName - where day(STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y')) = day(now()) and ltf.IsActive = 1 "; + $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 + join T_Login l on l.ID=lt.AssignedTo + join T_StaffDetails sd on sd.StaffID=l.StaffID + left join T_Lead_Details ld on ld.LeadID=lt.LeadID + 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 "; $followupsCount=$this->db->query($sql); $fcount = $followupsCount->result(); if (count($fcount) > 0) { @@ -327,9 +334,16 @@ public function leadCountMonth(){ return $results; } public function followupsCountMonth(){ - $sql = "select count(distinct TrackingID) as count from T_Lead_Tracking_Followup ltf - join T_PickListDetails list on list.ListCode=ltf.StatusName - where month(STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y')) = month(now()) and ltf.IsActive = 1 "; + $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 + join T_Login l on l.ID=lt.AssignedTo + join T_StaffDetails sd on sd.StaffID=l.StaffID + left join T_Lead_Details ld on ld.LeadID=lt.LeadID + 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 "; $followupsCount=$this->db->query($sql); $fcount = $followupsCount->result(); if (count($fcount) > 0) { @@ -499,12 +513,12 @@ public function leadCountMonth(){ return $results; } public function feeOutstanding(){ - $sql = "select b.bcode,bm.BatchName as Batches,sum(b.totalpayable) as TotalPayableFee,sum(b.totalpaid) as TotalPaidFee,sum(b.balpayable) as TotalBalance,round(ifnull(((sum(b.balpayable)/sum(b.totalpayable))*100),0),2) as BalancePercentage, - group_concat(scb.staff,'-',bal_percentage) as BalancePercentageByStaff + $sql = "select b.bcode,b.Batches,sum(b.totalpayable) as TotalPayableFee,sum(b.totalpaid) as TotalPaidFee,sum(b.balpayable) as TotalBalance,round(ifnull(((sum(b.balpayable)/sum(b.totalpayable))*100),0),2) as BalancePercentage, + scb.staff as BalancePercentageByStaff from BalFees b - left join staff_count_batch scb on scb.bcode = b.bcode - left join T_BatchMaster bm on bm.BatchCode = b.bcode - group by b.bcode "; + left join (select bcode,sum(totalpayable) as tot,sum(totalpaid) as paid,sum(balpayable) as balance,((sum(balpayable)/sum(totalpayable)) * 100) as balPercentage,group_concat(staff,'-',bal_percentage) as staff from staff_count_batch +group by bcode) scb on scb.bcode = b.bcode + group by b.bcode; "; $ltd=$this->db->query($sql); $tlead = $ltd->result(); if (count($tlead) > 0) { @@ -563,6 +577,61 @@ public function leadCountMonth(){ return $results; } + public function admissionBatch($univ = null){ + $sql = "SELECT sfs.BatchCode as bcode,scd.UniversityID as uid,ifnull(bm.BatchName,'-') as Batches,month(std.CreatedOn),ifnull(concat(sd.Firstname,' ',sd.Lastname),'-') as Staff,ifnull(std.AdmittedBy,'-') as admittedby,count(distinct std.StudentID) as TotalNoOfAdmissions + FROM T_StudentDetails std + join T_Student_CourseDetails scd on scd.StudentID = std.StudentID + left join T_Students_Fees_Status sfs on sfs.StudentID =scd.StudentID and sfs.CourseID = scd.CourseID + left join T_BatchMaster bm on bm.BatchCode = sfs.BatchCode + left join T_StaffDetails sd on sd.StaffID = std.AdmittedBy + where year(std.CreatedOn) = year(now()) + "; + + if($univ != ''){ + $sql.= " and scd.UniversityID = '".$univ."'"; + } + + $sql.= " group by bcode,admittedby"; + + $ltd=$this->db->query($sql); + $tlead = $ltd->result(); + if (count($tlead) > 0) { + $results['lList'] = true; + $results['l_data'] = $tlead; + } else { + $results['lList'] = false; + $results['message'] = 'No record found'; + } + + return $results; + } + //To Filters + public function getYear($branch = null){ + $sql = "select year(CreatedOn) as year from T_StudentDetails group by year "; + $ltd=$this->db->query($sql); + $year = $ltd->result(); + //get batch + $brsql = "select BatchCode,BatchName from T_BatchMaster "; + $brf=$this->db->query($brsql); + $branchf = $brf->result(); + //get university + $usql = "select UniversityID,UniversityName from T_UniversityMaster "; + $uf=$this->db->query($usql); + $univf = $uf->result(); + + if (count($year) > 0) { + $results['yearList'] = true; + $results['year'] = $year; + $results['branch'] = $branchf; + $results['univ'] = $univf; + } else { + $results['yearList'] = false; + $results['message'] = 'No record found'; + } + + return $results; + } + //End of filters } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index 10f00315..4410606f 100755 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -105,15 +105,56 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " }; /*For dashboard tab*/ - $scope.l_dataToday = 0; - $scope.l_dataMonth = 0; - $scope.l_dataDayClosed = 0; - $scope.l_dataMonthClosed = 0; - $scope.adMonth = 0; - $scope.adYear = 0; - $scope.fout = 0; - $scope.ftoday = 0; - $scope.fpending = 0; + //To filters + //Fees outstanding + $scope.filters = { + "year" : "", + "month" : "", + "batch" : "", + "univ" : "" + } + $scope.year = ''; + $scope.branch = ''; + $scope.univ = ''; + + var fYear = { + method: 'POST', + url: apiPoint.url + 'filterYear/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + requestedDept: JSON.parse(localStorage.getItem('localObj')).localType + + } + }; + $http(fYear).then(function (response) { + if (response.data.yearList == true) { + $scope.year = response.data.year; + $scope.branch = response.data.branch; + $scope.univ = response.data.univ; + + console.log($scope.branch); + } else { + + $scope.message = response.data.message; + } + }); + + //End of filters + $scope.l_dataToday = ''; + $scope.l_dataMonth = ''; + $scope.l_dataDayClosed = ''; + $scope.l_dataMonthClosed = ''; + $scope.adMonth = ''; + $scope.adYear = ''; + $scope.fout = ''; + $scope.ftoday = ''; + $scope.fpending = ''; + $scope.adBatch = ''; + $scope.adBatchfilter = ''; $scope.initDashboardDetails = function () { //lead today var leadToday = { @@ -352,7 +393,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " for(var i=0;i<$scope.adMonth.length;i++) $scope.adMonth[i].Sl_No = i+1; $scope.ad = false; - console.log($scope.adMonth); + // console.log($scope.adMonth); } else { $scope.ad = true; $scope.message = response.data.message; @@ -422,7 +463,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " for(var i=0;i<$scope.adYear.length;i++) $scope.adYear[i].Sl_No = i+1; $scope.ady = false; - console.log($scope.adYear); + //console.log($scope.adYear); } else { $scope.ady = true; $scope.message = response.data.message; @@ -431,13 +472,17 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " //Data grid + $scope.filterRow = { + visible: true, + applyFilter: "auto" + }; $scope.showColumnLines = true; $scope.showRowLines = true; $scope.rowAlternationEnabled = true; $scope.adYeargrid = { showBorders: true, columnAutoWidth: true, - columnWidth: 100, + //columnWidth: 100, "export": { enabled: true, @@ -453,51 +498,65 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " showInfo: true }, bindingOptions: { + //filterRow: "filterRow", showColumnLines: "showColumnLines", showRowLines: "showRowLines", rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'adYear' }, - columns: ['Sl_No', 'university', { + columns: [{ dataField: 'Sl_No', width:50 }, { dataField: 'university', width:200 }, { dataField: "June", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "July", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "August", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "September", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "October", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "November", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "December", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "January", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "February", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "March", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "April", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "May", - dataType: "number" + dataType: "number", + width:60 }, { dataField: "total", - dataType: "number" - }, 'AdmissionTakenBy'] + dataType: "number", + width:60 + }, { dataField: 'AdmissionTakenBy', cssClass: 'WrappedColumnClass', width:300 }] }; //Fees outstanding var fOut = { @@ -519,7 +578,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " for(var i=0;i<$scope.fout.length;i++) $scope.fout[i].Sl_No = i+1; $scope.fo = false; - console.log($scope.fo); + //console.log($scope.fo); } else { $scope.fo = true; $scope.message = response.data.message; @@ -551,19 +610,35 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'fout' }, - columns: ['Sl_No', 'Batches', { + columns: [ { + dataField: "Sl_No", + dataType: "number", + //width:50 + }, { + dataField: "Batches", + dataType: "number", + // width:100 + }, { dataField: "TotalPayableFee", - dataType: "number" + dataType: "number", + // width:80 }, { dataField: "TotalPaidFee", - dataType: "number" + dataType: "number", + // width:80 }, { dataField: "TotalBalance", - dataType: "number" + dataType: "number", + // width:80 }, { dataField: "BalancePercentage", - dataType: "number" - },'BalancePercentageByStaff'] + dataType: "number", + // width:80 + }, { + dataField: "BalancePercentageByStaff", + cssClass: 'WrappedColumnClass', + width:300 + }] }; //Follow ups today var ftoday = { @@ -585,7 +660,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " for(var i=0;i<$scope.ftoday.length;i++) $scope.ftoday[i].Sl_No = i+1; $scope.fut = false; - console.log($scope.ftoday); + // console.log($scope.ftoday); } else { $scope.fut = true; $scope.message = response.data.message; @@ -639,7 +714,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " for(var i=0;i<$scope.fpending.length;i++) $scope.fpending[i].Sl_No = i+1; $scope.fp = false; - console.log($scope.fpending); + //console.log($scope.fpending); } else { $scope.fp = true; $scope.message = response.data.message; @@ -673,10 +748,166 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " }, columns: ['TrackingId', 'name', 'mobileNo', 'course', 'university', 'activity', 'AssignTo', 'FollowUpDate', 'status'] }; + //Admissions batch + var AdmissionsBatch = { + method: 'POST', + url: apiPoint.url + 'admissionBatch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + univ: $scope.filters.univ + } + }; + //var gridData = 0; + $http(AdmissionsBatch).then(function (response) { + if (response.data.lList == true) { + $scope.fbselect = false; + $scope.adBatch = response.data.l_data; + for(var i=0;i<$scope.adBatch.length;i++) + $scope.adBatch[i].Sl_No = i+1; + // var gridData = $scope.adBatch; + $scope.adb = false; + console.log($scope.adBatch); + $scope.adBatchgrid = { + + allowSortingBySummary: true, + allowSorting: true, + allowFiltering: true, + allowExpandAll: true, + height: 440, + showBorders: true, + fieldChooser: { + enabled: false + }, + "export": { + enabled: true, + fileName: "AdmissionsBatch" + }, + dataSource: { + fields: [{ + caption: "Batches", + width: 100, + dataField: "Batches", + area: "row" + }, { + caption: "Staff", + dataField: "Staff", + area: "column" + }, { + caption: "TotalNoOfAdmissions", + dataField: "TotalNoOfAdmissions", + dataType: "number", + summaryType: "sum", + area: "data" + }], + store: $scope.adBatch + } + }; + } else { + $scope.adb = true; + $scope.message = response.data.message; + } + }); + }; + + //function for batch filter + $scope.buttonOptions = { + text: "Test", + onClick: function(){ + $scope.adBatchfilter = $scope.adBatchfilter; + + $scope.pivot.getDataSource().reload(); + + } + + }; + $scope.batchFilter = function(){ + $scope.adBatchgrid1 = ''; + //Admissions batch + var AdmissionsBatch = { + method: 'POST', + url: apiPoint.url + 'admissionBatch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + univ: $scope.filters.univ + + } + }; + //var gridData = 0; + $http(AdmissionsBatch).then(function (response) { + if (response.data.lList == true) { + $scope.adBatch = ''; + + $scope.adBatchfilter = ''; + $scope.fbselect = true; + $scope.adb = false; + $scope.adBatchfilter = response.data.l_data; + for(var i=0;i<$scope.adBatchfilter.length;i++) + $scope.adBatchfilter[i].Sl_No = i+1; + // var gridData = $scope.adBatch; + + $scope.adb = false; + console.log($scope.adBatchfilter); + + $scope.adBatchgrid1 = { + + + allowSortingBySummary: true, + allowSorting: true, + allowFiltering: true, + allowExpandAll: true, + height: 440, + showBorders: true, + fieldChooser: { + enabled: false + }, + + "export": { + enabled: true, + fileName: "AdmissionsBatch" + }, + dataSource: { + + fields: [{ + caption: "Batches", + width: 100, + dataField: "Batches", + area: "row" + }, { + caption: "Staff", + dataField: "Staff", + area: "column" + }, { + caption: "TotalNoOfAdmissions", + dataField: "TotalNoOfAdmissions", + dataType: "number", + summaryType: "sum", + area: "data" + }], + store: new DevExpress.data.CustomStore({ + load: function(loadOptions) { + var d = $.Deferred(); + setTimeout(function() { + d.resolve($scope.adBatchfilter); + }, 500); + return d.promise(); + } + }) + } + }; + } else { + $scope.fbselect = false; + $scope.message = response.data.message; + } + }); + } /*end dashboard tab*/ /*For dashboard tiles*/ $scope.lead_dataToday = 0; @@ -787,10 +1018,8 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " 'Content-Type': 'application/json' }, data: { - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, - requestedDept: JSON.parse(localStorage.getItem('localObj')).localType - + year: $scope.filters.year, + month: $scope.filters.month } }; $http(monthAdmission).then(function (response) { diff --git a/Apollo/assets/views/dashboard_tile1.html b/Apollo/assets/views/dashboard_tile1.html index 8d6b5525..6fdb77a5 100644 --- a/Apollo/assets/views/dashboard_tile1.html +++ b/Apollo/assets/views/dashboard_tile1.html @@ -28,6 +28,7 @@
+
No Leads!
diff --git a/Apollo/assets/views/dashboard_tile3.html b/Apollo/assets/views/dashboard_tile3.html index 097fba59..98844019 100644 --- a/Apollo/assets/views/dashboard_tile3.html +++ b/Apollo/assets/views/dashboard_tile3.html @@ -2,8 +2,12 @@ a { color: #5b5b60; } + .WrappedColumnClass { + white-space: normal; + word-wrap: break-word; +} - +
+
No Admissions!
@@ -118,23 +171,51 @@ - + -
-
+
+ +
No Pending Followup!
-
+ +
+
+
+ - + ID Name @@ -163,9 +244,9 @@ - + -->
-
+