From 8c562cc05bfad500280161e76bb144f446f9d316 Mon Sep 17 00:00:00 2001 From: sriramv Date: Wed, 26 Dec 2018 19:10:00 +0530 Subject: [PATCH] dashboard issue changes --- Apollo/api/application/config/database.php | 12 +- Apollo/api/application/config/routes.php | 1 + .../controllers/Dashboard_Controller.php | 24 ++ .../application/models/Dashboard_model.php | 334 ++++++++---------- Apollo/assets/js/config.router.js | 8 + Apollo/assets/js/controllers/dashboardCtrl.js | 171 +++++++-- Apollo/assets/views/dashboard.html | 258 ++++++++------ Apollo/assets/views/dashboard_tile3.html | 68 ++-- Apollo/assets/views/dashboard_tile5.html | 92 +++++ 9 files changed, 598 insertions(+), 370 deletions(-) create mode 100644 Apollo/assets/views/dashboard_tile5.html diff --git a/Apollo/api/application/config/database.php b/Apollo/api/application/config/database.php index 2d33a761..64156240 100755 --- a/Apollo/api/application/config/database.php +++ b/Apollo/api/application/config/database.php @@ -76,13 +76,13 @@ $query_builder = TRUE; $db['default'] = array( 'dsn' => '', 'hostname' => 'apollodec.com', - 'username' => 'apollod4_DEV', - 'password' => 'apollo1234', - 'database' => 'apollod4_ApolloDECDev', + // 'username' => 'apollod4_DEV', + // 'password' => 'apollo1234', + // 'database' => 'apollod4_ApolloDECDev', - // 'username' => 'apollod4_SIT', - // 'password' => 'apollosit1234', - // 'database' => 'apollod4_ApolloDECNEWSIT', + 'username' => 'apollod4_SIT', + 'password' => 'apollosit1234', + 'database' => 'apollod4_ApolloDECNEWSIT', 'dbdriver' => 'mysqli', 'dbprefix' => '', diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 1fa23c48..79bdc963 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -173,6 +173,7 @@ $route['getadmimssionMonth'] = 'Dashboard_Controller/getadmimssionMonth'; $route['getadmimssionYear'] = 'Dashboard_Controller/getadmimssionYear'; $route['getfupToday'] = 'Dashboard_Controller/getfupToday'; $route['getfupMonth'] = 'Dashboard_Controller/getfupMonth'; +$route['feeOutstandingtotal']= 'Dashboard_Controller/feeOutstandingtotal'; $route['leadToday'] = 'Dashboard_Controller/leadToday'; $route['leadMonth'] = 'Dashboard_Controller/leadMonth'; $route['leadTodayClosed'] = 'Dashboard_Controller/leadTodayClosed'; diff --git a/Apollo/api/application/controllers/Dashboard_Controller.php b/Apollo/api/application/controllers/Dashboard_Controller.php index 18f773bc..0f2c974c 100755 --- a/Apollo/api/application/controllers/Dashboard_Controller.php +++ b/Apollo/api/application/controllers/Dashboard_Controller.php @@ -188,6 +188,7 @@ class Dashboard_Controller extends REST_Controller { } public function getadmimssionMonth_post(){ $branchId = $this->post('branchId'); + //print_r($branchId); die(); $getadmimssionMonth = $this->dashboard_model->admissionCountMonth($branchId); if ($getadmimssionMonth) { $getadmimssionMonth['status'] = REST_Controller::HTTP_OK; @@ -205,6 +206,7 @@ class Dashboard_Controller extends REST_Controller { } public function getadmimssionYear_post(){ $branchId = $this->post('branchId'); + //print_r( $branchId); die(); $requestedBy = $this->post('requestedBy'); $getadmimssionYear = $this->dashboard_model->admissionCountYear($branchId); if ($getadmimssionYear) { @@ -239,9 +241,30 @@ class Dashboard_Controller extends REST_Controller { ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } + public function feeOutstandingtotal_post() + { + $branchId = $this->post('branchId'); + // $requestedBy = $this->post('requestedBy'); + $gettotalbal = $this->dashboard_model->feeOutstandingtotal($branchId); + if ($gettotalbal) { + $gettotalbal['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($gettotalbal, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } public function getfupMonth_post(){ $branchId = $this->post('branchId'); $requestedBy = $this->post('requestedBy'); + // print_r($requestedBy); + // die(); $getfupMonth = $this->dashboard_model->followupsCountMonth($branchId,$requestedBy); if ($getfupMonth) { $getfupMonth['status'] = REST_Controller::HTTP_OK; @@ -354,6 +377,7 @@ class Dashboard_Controller extends REST_Controller { } public function admissionYear_post(){ $fyear = $this->post('fyear'); + //print_r($fyear); $univ = $this->post('univ'); $branchId = $this->post('branchId'); $admissionYear = $this->dashboard_model->admissionYear( $fyear, $univ, $branchId); diff --git a/Apollo/api/application/models/Dashboard_model.php b/Apollo/api/application/models/Dashboard_model.php index 8e4e0b50..4c0d6dbe 100755 --- a/Apollo/api/application/models/Dashboard_model.php +++ b/Apollo/api/application/models/Dashboard_model.php @@ -359,29 +359,34 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ return $results; } public function admissionCountMonth($branchId = null){ - $sql = "select sum(total) as total from admission_month"; + $sql = "select tot_cnt as total from admission_month where BranchCode ='".$branchId."'"; + // $sql = " Select tot_cnt as total from admission_month where BranchCode = '".$branchId."'"; $admissionCount=$this->db->query($sql); $acount = $admissionCount->result(); if (count($acount) > 0) { - $results['ad_List'] = true; + $results['ad_List'] = true; $results['ad_data'] = $acount; } else { $results['ad_List'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } return $results; } public function admissionCountYear($branchId = null){ - $sql = "select sum(tot_cnt) as total from admission_year"; + //$sql = "select sum(tot_cnt) as total from admission_year "; + + $sql = "select tot_cnt as total from admission_year where BranchCode ='".$branchId."'" ; + $admissionCount=$this->db->query($sql); + //print_r($sql); die(); $acount = $admissionCount->result(); if (count($acount) > 0) { - $results['ad_List'] = true; + $results['ad_List'] = true; $results['ad_data'] = $acount; } else { $results['ad_List'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } return $results; @@ -432,10 +437,10 @@ 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(STR_TO_DATE(ltf.FollowupOn,'%d-%m-%Y')) = month(now()) and ltf.IsActive = 1 and lt.CreatedBranch = '".$branchId."' "; + 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(); - //to staff + //to staff ltf.StatusName ='S020' $ssql = "select count(ltf.TrackingID) as count from T_Lead_Tracking_Followup as ltf left join T_Lead_Tracking lt on lt.TrackingID=ltf.TrackingID @@ -447,14 +452,17 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ 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 lt.CreatedBranch = '".$branchId."' and ltf.AssignedStaff = '".$requestedBy."' "; $sfollowupsCount=$this->db->query($ssql); + + //print_r($sql);die(); + $sfcount = $sfollowupsCount->result(); if (count($fcount) > 0) { - $results['fUpList'] = true; + $results['fUpList'] = true; $results['fUp_data'] = $fcount; $results['sfUp_data'] = $sfcount; } else { $results['fUpList'] = false; - $results['message'] = 'No record found'; + $results['message'] = 'No record found'; } return $results; @@ -613,64 +621,41 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ return $results; } public function admissionMonth($year = null,$month = null, $branchId = null){ - $sql = "select UniversityID as uid,university, - SUM(IF((wc.week_of_month = 1), wc.tot_cnt,0)) AS week1, - SUM(IF((wc.week_of_month = 2), wc.tot_cnt,0)) AS week2, - SUM(IF((wc.week_of_month = 3), wc.tot_cnt,0)) AS week3, - SUM(IF((wc.week_of_month = 4), wc.tot_cnt,0)) AS week4, - SUM(IF((wc.week_of_month = 5), wc.tot_cnt,0)) AS week5, - sum(tot_cnt) as total, - group_concat(name,'-',tot_cnt separator ',') as AdmissionTakenBy - from (SELECT - scd.UniversityID AS UniversityID, - um.UniversityName as university, - std.CreatedOn AS cdate, - std.AdmittedBy AS AdmittedBy, - concat(sd.Firstname,'',sd.Lastname) as name, - (FLOOR(((DAYOFMONTH(std.CreatedOn) - 1) / 7)) + 1) AS week_of_month, - COUNT(scd.StudentID) AS tot_cnt - FROM - T_StudentDetails std - JOIN getUniv scd ON scd.StudentID = std.StudentID - left join T_UniversityMaster um on um.UniversityID = scd.UniversityID - left join T_StaffDetails sd on sd.StaffID = std.AdmittedBy - WHERE - std.AdmittedBy IS NOT NULL - AND YEAR(std.CreatedOn) = YEAR(NOW()) - AND MONTH(std.CreatedOn) = MONTH(NOW()) - GROUP BY scd.UniversityID , std.AdmittedBy) wc - group by uid "; + + $sql="SELECT + wc.UniversityID AS university, + SUM(IF((wc.week_of_month = 1), + wc.tot_cnt, + 0)) AS week1, + SUM(IF((wc.week_of_month = 2), + wc.tot_cnt, + 0)) AS week2, + SUM(IF((wc.week_of_month = 3), + wc.tot_cnt, + 0)) AS week3, + SUM(IF((wc.week_of_month = 4), + wc.tot_cnt, + 0)) AS week4, + SUM(IF((wc.week_of_month = 5), + wc.tot_cnt, + 0)) AS week5, + SUM(wc.tot_cnt) AS Total, + GROUP_CONCAT(DISTINCT wc.AdmittedBy, '-', wc.tot_cnt + SEPARATOR ',') AS AdmissionTakenBy + FROM + week_child wc + + where BranchCode ='".$branchId."' + AND CreatedYear = '".$year."' + AND CreatedMonth = '".$month."' + GROUP BY wc.UniversityID"; + - if ($year != '' and $month != '') { - $sql = "select UniversityID as uid,university, - SUM(IF((wc.week_of_month = 1), wc.tot_cnt,0)) AS week1, - SUM(IF((wc.week_of_month = 2), wc.tot_cnt,0)) AS week2, - SUM(IF((wc.week_of_month = 3), wc.tot_cnt,0)) AS week3, - SUM(IF((wc.week_of_month = 4), wc.tot_cnt,0)) AS week4, - SUM(IF((wc.week_of_month = 5), wc.tot_cnt,0)) AS week5, - sum(tot_cnt) as total, - group_concat(name,'-',tot_cnt separator ',') as AdmissionTakenBy - from (SELECT - scd.UniversityID AS UniversityID, - um.UniversityName as university, - std.CreatedOn AS cdate, - std.AdmittedBy AS AdmittedBy, - concat(sd.Firstname,'',sd.Lastname) as name, - (FLOOR(((DAYOFMONTH(std.CreatedOn) - 1) / 7)) + 1) AS week_of_month, - COUNT(scd.StudentID) AS tot_cnt - FROM - T_StudentDetails std - JOIN getUniv scd ON scd.StudentID = std.StudentID - left join T_UniversityMaster um on um.UniversityID = scd.UniversityID - left join T_StaffDetails sd on sd.StaffID = std.AdmittedBy - WHERE - std.AdmittedBy IS NOT NULL - AND YEAR(std.CreatedOn) = '".$year."' - AND MONTH(std.CreatedOn) = '".$month."' - GROUP BY scd.UniversityID , std.AdmittedBy) wc - group by uid "; - } + + + $ltd=$this->db->query($sql); + print_r($sql); $tlead = $ltd->result(); if (count($tlead) > 0) { $results['lList'] = true; @@ -683,107 +668,88 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ return $results; } public function admissionYear( $fyear = null, $univ = null, $branchId = null){ - if (date('m') >= 4) { - $yearl = date('Y').'-'.(date('Y')+1); - } else { - $yearl = (date('Y')-1).'-'.date('Y'); - } - $ab=$yearl; + + + $ab=$fyear; $fa=substr($ab,0,-5); $aa=substr($ab,5,5); - $sql = " SELECT month(std.CreatedOn), - std.AdmittedBy AS AdmittedBy, - um.UniversityName AS university, - SUM(IF((MONTH(std.CreatedOn) = 6), 1, 0)) AS June, - SUM(IF((MONTH(std.CreatedOn) = 7), 1, 0)) AS July, - SUM(IF((MONTH(std.CreatedOn) = 8), 1, 0)) AS August, - SUM(IF((MONTH(std.CreatedOn) = 9), 1, 0)) AS September, - SUM(IF((MONTH(std.CreatedOn) = 10), 1, 0)) AS October, - SUM(IF((MONTH(std.CreatedOn) = 11), 1, 0)) AS November, - SUM(IF((MONTH(std.CreatedOn) = 12), 1, 0)) AS December, - SUM(IF((MONTH(std.CreatedOn) = 1), 1, 0)) AS January, - SUM(IF((MONTH(std.CreatedOn) = 2), 1, 0)) AS February, - SUM(IF((MONTH(std.CreatedOn) = 3), 1, 0)) AS March, - SUM(IF((MONTH(std.CreatedOn) = 4), 1, 0)) AS April, - SUM(IF((MONTH(std.CreatedOn) = 5), 1, 0)) AS May, - COUNT( std.StudentID) AS total, - GROUP_CONCAT(DISTINCT sc.sname, '-', sc.cnt SEPARATOR ';') AS AdmissionTakenBy - FROM - T_StudentDetails std - JOIN T_Student_CourseDetails scd ON scd.StudentID = std.StudentID - JOIN (select UniversityID,AdmittedBy,cnt,sname,group_concat(sname,'-',cnt) as staf from (SELECT scd.UniversityID AS UniversityID, - std.BranchCode, - std.CreatedOn, - COUNT(std.StudentID) AS cnt, - IFNULL(std.AdmittedBy, '-') AS AdmittedBy, - CONCAT(sd.Firstname, sd.Lastname) AS sname + + $sql="SELECT + std.University AS university, + SUM(IF((std.CreatedMonth = 6), 1, 0)) AS June, + SUM(IF((std.CreatedMonth = 7), 1, 0)) AS July, + SUM(IF((std.CreatedMonth = 8), 1, 0)) AS August, + SUM(IF((std.CreatedMonth = 9), 1, 0)) AS September, + SUM(IF((std.CreatedMonth = 10), 1, 0)) AS October, + SUM(IF((std.CreatedMonth = 11), 1, 0)) AS November, + SUM(IF((std.CreatedMonth = 12), 1, 0)) AS December, + SUM(IF((std.CreatedMonth = 1), 1, 0)) AS January, + SUM(IF((std.CreatedMonth = 2), 1, 0)) AS February, + SUM(IF((std.CreatedMonth = 3), 1, 0)) AS March, + SUM(IF((std.CreatedMonth = 4), 1, 0)) AS April, + SUM(IF((std.CreatedMonth = 5), 1, 0)) AS May, + COUNT(std.StudentID) AS Total,gad as AdmittedBy + FROM - T_StudentDetails std - left JOIN T_Student_CourseDetails scd ON scd.StudentID = std.StudentID - JOIN T_StaffDetails sd ON sd.StaffID = std.AdmittedBy - WHERE - std.AdmittedBy IS NOT NULL and std.BranchCode = '".$branchId."' and (date(std.CreatedOn) >= '".$fa."-06-01' and date(std.CreatedOn) <= '".$aa."-05-31') - GROUP BY std.AdmittedBy , scd.UniversityID) a group by UniversityID,AdmittedBy ) sc ON sc.UniversityID = scd.UniversityID - AND sc.AdmittedBy = std.AdmittedBy - LEFT JOIN T_UniversityMaster um ON um.UniversityID = scd.UniversityID - WHERE - std.AdmittedBy IS NOT NULL and std.BranchCode = '".$branchId."' and (date(std.CreatedOn) >= '".$fa."-06-01' and date(std.CreatedOn) <= '".$aa."-05-31') - GROUP BY scd.UniversityID "; - - if($fyear != ''){ - // print_r($fyear); - $ab=$fyear; - $fa1 = substr($ab,0,-5); - $aa1 = substr($ab,5,5); + admissions std + LEFT JOIN (SELECT sc.cyear,sc.University,sc.BranchCode, group_concat(sc.AdmittedBy,'-',sc.cnt SEPARATOR ',') AS gad FROM staff_count_year sc GROUP BY sc.cyear,sc.University,sc.BranchCode) ssc ON ssc.University = std.University and ssc.cyear = std.CreatedYear and ssc.BranchCode = std.BranchCode + where + std.AdmittedBy IS NOT NULL + AND + std.CreatedOn between '".$fa."-06-01' + and '".$aa."-05-31' and std.BranchCode ='".$branchId."' + + GROUP BY std.University"; - $sql =" SELECT month(std.CreatedOn), - std.AdmittedBy AS AdmittedBy, - um.UniversityName AS university, - SUM(IF((MONTH(std.CreatedOn) = 6), 1, 0)) AS June, - SUM(IF((MONTH(std.CreatedOn) = 7), 1, 0)) AS July, - SUM(IF((MONTH(std.CreatedOn) = 8), 1, 0)) AS August, - SUM(IF((MONTH(std.CreatedOn) = 9), 1, 0)) AS September, - SUM(IF((MONTH(std.CreatedOn) = 10), 1, 0)) AS October, - SUM(IF((MONTH(std.CreatedOn) = 11), 1, 0)) AS November, - SUM(IF((MONTH(std.CreatedOn) = 12), 1, 0)) AS December, - SUM(IF((MONTH(std.CreatedOn) = 1), 1, 0)) AS January, - SUM(IF((MONTH(std.CreatedOn) = 2), 1, 0)) AS February, - SUM(IF((MONTH(std.CreatedOn) = 3), 1, 0)) AS March, - SUM(IF((MONTH(std.CreatedOn) = 4), 1, 0)) AS April, - SUM(IF((MONTH(std.CreatedOn) = 5), 1, 0)) AS May, - COUNT( std.StudentID) AS total, - GROUP_CONCAT(DISTINCT sc.sname, '-', sc.cnt SEPARATOR ';') AS AdmissionTakenBy - FROM - T_StudentDetails std - JOIN T_Student_CourseDetails scd ON scd.StudentID = std.StudentID - JOIN (select UniversityID,AdmittedBy,cnt,sname,group_concat(sname,'-',cnt) as staf from (SELECT scd.UniversityID AS UniversityID, - std.BranchCode, - std.CreatedOn, - COUNT( distinct std.StudentID) AS cnt, - IFNULL(std.AdmittedBy, '-') AS AdmittedBy, - CONCAT(sd.Firstname, sd.Lastname) AS sname - FROM - T_StudentDetails std - left JOIN T_Student_CourseDetails scd ON scd.StudentID = std.StudentID - JOIN T_StaffDetails sd ON sd.StaffID = std.AdmittedBy - WHERE - std.AdmittedBy IS NOT NULL and std.BranchCode = '".$branchId."' and (date(std.CreatedOn) >= '".$fa1."-06-01' and date(std.CreatedOn) <= '".$aa1."-05-31') - GROUP BY std.AdmittedBy , scd.UniversityID) a group by UniversityID,AdmittedBy ) sc ON sc.UniversityID = scd.UniversityID - AND sc.AdmittedBy = std.AdmittedBy - LEFT JOIN T_UniversityMaster um ON um.UniversityID = scd.UniversityID - WHERE - std.AdmittedBy IS NOT NULL and std.BranchCode = '".$branchId."' and (date(std.CreatedOn) >= '".$fa1."-06-01' and date(std.CreatedOn) <= '".$aa1."-05-31') - GROUP BY scd.UniversityID "; - } + - // print_r($fa); - // print_r($aa); - //print_r($sql); + + //print_r($sql); $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; + } + + public function feeOutstandingtotal($branchId = null) + { + +$sql="select sum(TotalBalance) as total FROM (select (sum(totalpayable) - sum(totalpaid)) as TotalBalance + from + (SELECT + a.BatchCode AS bcode,str_to_date(bm.BatchDate,'%d-%m-%Y') as BDate, + bm.UniversityID AS uid, + bm.BatchName as Batches, + IFNULL(std.AdmittedBy, '-') AS admittedby, + IFNULL(CONCAT(sd.Firstname, sd.Lastname), + '-') AS staff, + SUM((((a.CourseFees + a.STFOrWR) + a.Waiver) + a.Others)) AS totalpayable, + IFNULL(SUM(bb.BillAmount), 0) AS totalpaid, + (SUM((((a.CourseFees + a.STFOrWR) + a.Waiver) + a.Others)) - IFNULL(SUM(bb.BillAmount), 0)) AS balpayable, + ROUND((((SUM((((a.CourseFees + a.STFOrWR) + a.Waiver) + a.Others)) - IFNULL(SUM(bb.BillAmount), 0)) / SUM((((a.CourseFees + a.STFOrWR) + a.Waiver) + a.Others))) * 100), + 0) AS bal_percentage + FROM + T_Students_Fees_Status a + LEFT JOIN BalFeesChild bb ON a.FeesID = bb.FeesId + LEFT JOIN T_Course_Fees_Details c ON c.ID = a.FeesType + LEFT JOIN T_StudentDetails std ON std.StudentID = a.StudentID + LEFT JOIN T_StaffDetails sd ON sd.StaffID = std.AdmittedBy + LEFT JOIN T_BatchMaster bm ON bm.BatchCode = a.BatchCode + where a.BranchCode = '".$branchId."' and a.BatchCode != 'Not applicable' + GROUP BY std.AdmittedBy , bcode) b group by bcode ORDER BY BDate DESC) final"; + + $ltd=$this->db->query($sql); + $tlead = $ltd->result(); if (count($tlead) > 0) { $results['lList'] = true; $results['l_data'] = $tlead; @@ -793,17 +759,16 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ } return $results; - } - - + + } public function feeOutstanding($branchId = null, $univ = null){ - $sql = "select bcode,Batches,uid,staff,admittedby,sum(totalpayable) as TotalPayableFee,sum(totalpaid) as TotalPaidFee,(sum(totalpayable) - sum(totalpaid)) as TotalBalance, + $sql = "select bcode,BDate,Batches,uid,staff,admittedby,sum(totalpayable) as TotalPayableFee,sum(totalpaid) as TotalPaidFee,(sum(totalpayable) - sum(totalpaid)) as TotalBalance, concat(round((((sum(totalpayable) - sum(totalpaid)) / sum(totalpayable)) * 100),0),'%') as BalancePercentage, GROUP_CONCAT(staff,'-',CONCAT_WS('',bal_percentage, '%') separator ',') as BalancePercentageByStaff from (SELECT - a.BatchCode AS bcode, + a.BatchCode AS bcode,str_to_date(bm.BatchDate,'%d-%m-%Y') as BDate, bm.UniversityID AS uid, bm.BatchName as Batches, IFNULL(std.AdmittedBy, '-') AS admittedby, @@ -822,17 +787,16 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ LEFT JOIN T_StaffDetails sd ON sd.StaffID = std.AdmittedBy LEFT JOIN T_BatchMaster bm ON bm.BatchCode = a.BatchCode where a.BranchCode = '".$branchId."' and a.BatchCode != 'Not applicable' - GROUP BY std.AdmittedBy , bcode) b - - - "; + GROUP BY std.AdmittedBy , bcode) b where uid = '".$univ."' "; - if($univ != ''){ - $sql.= " where uid = '".$univ."' "; - } + // if($univ != ''){ + // $sql.= " where uid = '".$univ."' "; + // } - $sql.= " group by bcode "; - //print_r($sql); + $sql.= " group by bcode "; + + $sql.=" ORDER BY BDate DESC"; + // print_r($sql); die(); $ltd=$this->db->query($sql); $tlead = $ltd->result(); if (count($tlead) > 0) { @@ -922,21 +886,25 @@ public function leadCountMonth($branchId = null, $requestedBy = null){ return $results; } public function admissionBatch($univ = null, $branchId = 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()) and sfs.BatchCode != 'Not applicable' and std.BranchCode = '".$branchId."' - "; + - if($univ != ''){ - $sql.= " and scd.UniversityID = '".$univ."'"; - } + $sql="SELECT BatchName, BatchDate,University,AdmittedBy,count(*)as count FROM admissions +WHERE CASE WHEN MONTH(curdate()) >= 6 THEN CreatedYear = YEAR(curdate()) +ELSE (CreatedYear = YEAR(curdate()) - 1 AND CreatedMonth >= 6) OR CreatedYear = YEAR(curdate()) END +and BranchCode ='".$branchId."' and UniversityID ='".$univ."'"; + + // if($univ != ''){ + // $sql.= " and UniversityID ='".$univ."'"; + // } - $sql.= " group by bcode,admittedby"; + $sql.= " GROUP BY BatchName,AdmittedBy"; + + + $sql.= " ORDER BY BatchDate DESC"; + // print_r($sql); //die(); + + $ltd=$this->db->query($sql); $tlead = $ltd->result(); if (count($tlead) > 0) { diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 5f7efbab..8040b6c5 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -99,6 +99,14 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com templateUrl: "assets/views/dashboard_tile4.html", resolve: loadSequence('spin', 'ladda', 'angular-ladda', 'dashboardCtrl','ngTable'), title: 'Dashboard', + ncyBreadcrumb: { + label: 'Dashboard' + } + }).state('app.dashboard_tile5', { + url: "/dashboard_tile5", + templateUrl: "assets/views/dashboard_tile5.html", + resolve: loadSequence('spin', 'ladda', 'angular-ladda', 'dashboardCtrl','ngTable'), + title: 'Dashboard', ncyBreadcrumb: { label: 'Dashboard' } diff --git a/Apollo/assets/js/controllers/dashboardCtrl.js b/Apollo/assets/js/controllers/dashboardCtrl.js index fece2006..96f22ed0 100755 --- a/Apollo/assets/js/controllers/dashboardCtrl.js +++ b/Apollo/assets/js/controllers/dashboardCtrl.js @@ -526,9 +526,16 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataField: "week5", dataType: "number" }, { - dataField: "total", + dataField: "Total", dataType: "number" - }, 'AdmissionTakenBy'] + }, 'AdmissionTakenBy'], + summary: { + totalItems: [ { + summaryType: "sum", + displayFormat: "{0}", + column: "Total" + }] + }, }; //Admissions Year-wise @@ -644,7 +651,8 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataField: "total", dataType: "number", width: 60 - }, { dataField: 'AdmissionTakenBy', cssClass: 'WrappedColumnClass', width: 300 }] + }, { dataField: 'gad', cssClass: 'WrappedColumnClass', width: 300 }], + }; //Fees outstanding var fOut = { @@ -727,7 +735,22 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataField: "BalancePercentageByStaff", cssClass: 'WrappedColumnClass', width: 300 + }], + summary: { + totalItems: [ { + summaryType: "sum", + displayFormat: "{0}", + column: "TotalPayableFee" + },{ + summaryType: "sum", + displayFormat: "{0}", + column: "TotalPaidFee" + }, { + summaryType: "sum", + displayFormat: "{0}", + column: "TotalBalance" }] + }, }; //Follow ups today var ftoday = { @@ -917,19 +940,20 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " }, dataSource: { fields: [{ - caption: "Batches", + caption: "BatchName", width: 100, - dataField: "Batches", + dataField: "BatchName", area: "row" - }, { - caption: "staff", - dataField: "Staff", + }, + { + caption: "AdmittedBy", + dataField: "AdmittedBy", area: "column" }, { - caption: "TotalNoOfAdmissions", - dataField: "TotalNoOfAdmissions", + caption: "count", + dataField: "count", dataType: "number", - summaryType: "sum", + //summaryType: "sum", width: 100, area: "data" }], @@ -1004,19 +1028,19 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataSource: { fields: [{ - caption: "Batches", + caption: "BatchName", width: 100, - dataField: "Batches", + dataField: "BatchName", area: "row" }, { - caption: "Staff", - dataField: "Staff", + caption: "AdmittedBy", + dataField: "AdmittedBy", area: "column" }, { - caption: "TotalNoOfAdmissions", - dataField: "TotalNoOfAdmissions", + caption: "count", + dataField: "count", dataType: "number", - summaryType: "sum", + //summaryType: "sum", area: "data" }], @@ -1036,19 +1060,19 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $scope.batchFilterClick = function () { $scope.grid.option('dataSource', { fields: [{ - caption: "Batches", + caption: "BatchName", width: 100, - dataField: "Batches", + dataField: "BatchName", area: "row" }, { - caption: "staff", - dataField: "Staff", + caption: "AdmittedBy", + dataField: "AdmittedBy", // dataType: "string", // width: 200, area: "column" }, { - caption: "TotalNoOfAdmissions", - dataField: "TotalNoOfAdmissions", + caption: "AdmittedBy", + dataField: "AdmittedBy", dataType: "number", summaryType: "sum", // width: 100, @@ -1080,8 +1104,9 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $http(fOut).then(function (response) { if (response.data.lList == true) { $scope.fout = response.data.l_data; + for (var i = 0; i < $scope.fout.length; i++) - $scope.fout[i].Sl_No = i + 1; + // $scope.fout[i].Sl_No = i + 1; $scope.fo = false; console.log($scope.fout); } else { @@ -1115,11 +1140,13 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " rowAlternationEnabled: "rowAlternationEnabled", dataSource: 'fout' }, - columns: [{ - dataField: "Sl_No", - dataType: "number", - //width:50 - }, { + columns: [ + //{ + // dataField: "Sl_No", + // dataType: "number", + // //width:50 + // }, + { dataField: "Batches", dataType: "number", // width:100 @@ -1143,7 +1170,23 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataField: "BalancePercentageByStaff", cssClass: 'WrappedColumnClass', width: 300 + }], + summary: { + totalItems: [ { + summaryType: "sum", + displayFormat: "{0}", + column: "TotalPayableFee" + },{ + summaryType: "sum", + displayFormat: "{0}", + column: "TotalPaidFee" + }, { + summaryType: "sum", + displayFormat: "{0}", + column: "TotalBalance" }] + }, + }; } $scope.fyearFilter = function(){ @@ -1259,10 +1302,17 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataType: "number", width: 60 }, { - dataField: "total", + dataField: "Total", dataType: "number", width: 60 - }, { dataField: 'AdmissionTakenBy', cssClass: 'WrappedColumnClass', width: 300 }] + }, { dataField: 'AdmittedBy', cssClass: 'WrappedColumnClass', width: 300 }], + summary: { + totalItems: [ { + summaryType: "sum", + displayFormat: "{0}", + column: "Total" + }] + } }; } $scope.fbwFilter = function(){ @@ -1337,9 +1387,18 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " dataField: "week5", dataType: "number" }, { - dataField: "total", + dataField: "Total", dataType: "number" - }, 'AdmissionTakenBy'] + }, 'AdmissionTakenBy'], + summary: { + totalItems: [ { + summaryType: "sum", + displayFormat: "{0}", + column: "Total" + }] + }, + + }; } /*end dashboard tab*/ @@ -1352,6 +1411,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $scope.ad_dataYear = ''; $scope.fup_today = ''; $scope.fup_month = ''; + $scope.ft_balance =''; //to staff $scope.slead_dataToday = ''; $scope.slead_dataMonth = ''; @@ -1359,6 +1419,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $scope.sleadCountMonthClosed = ''; $scope.sfup_today = ''; $scope.sfup_month = ''; + $scope.sft_balance =''; //common variable $scope.cslead_dataToday = ''; $scope.cslead_dataMonth = ''; @@ -1366,6 +1427,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $scope.csleadCountMonthClosed = ''; $scope.csfup_today = ''; $scope.csfup_month = ''; + $scope.csft_balance =''; //1st tile for lead created today var todayCount = { method: 'POST', @@ -1510,6 +1572,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " 'Content-Type': 'application/json' }, data: { + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, year: $scope.filters.year, month: $scope.filters.month } @@ -1518,7 +1581,7 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " if (response.data.ad_List == true) { $scope.ad_data = response.data.ad_data[0].total; - //console.log($scope.ad_data); + console.log($scope.ad_data); } else { $scope.message = response.data.message; } @@ -1614,6 +1677,44 @@ app.controller('dashboardCtrl', ["$scope", "$rootScope", "toaster", "$filter", " $scope.message = response.data.message; } }); + + //get the totalbalance + var ftbala = { + method: 'POST', + url: apiPoint.url + 'feeOutstandingtotal/', + 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(ftbala).then(function (response) { + // console.log('res',response); + if (response.data.lList == true) { + // console.log('ifres'); + $scope.ft_balance = response.data.l_data[0].total; + $scope.sft_balance = response.data.l_data[0].total; + if ($scope.getLoginType == 'R002' || $scope.getLoginType == 'R005' ) { + $scope.csft_balance = $scope.sft_balance; + // // console.log($scope.Dt_dataMonthClosed); + // console.log('if'); + } + else { + $scope.csft_balance = $scope.ft_balance; + // //console.log($scope.Dt_fpending); + // console.log('else'); + } + + console.log($scope.ft_balance); + } else { + $scope.message = response.data.message; + } + }); }]); diff --git a/Apollo/assets/views/dashboard.html b/Apollo/assets/views/dashboard.html index 7a03c6be..e6fe0ab0 100755 --- a/Apollo/assets/views/dashboard.html +++ b/Apollo/assets/views/dashboard.html @@ -134,6 +134,35 @@ +
+
+
+ +

Fees Outstanding

+
+
+

+ Total Balance +

{{csft_balance||0}} +
+ + + + + +
+ +
+
+
+ @@ -227,6 +256,8 @@ + + @@ -245,130 +276,133 @@ - -
- + + + + + + + - + + + + + - - - - - - + + + + + + + + + + + + + + + - - -
- University ID - {{registration.UniversityID}} - - University Name - {{registration.UniversityName | uppercase}} - - No of Registration - {{registration.StudentCounts}} -
-
-
+ + + + + - -
- + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
- University ID - {{univFees.UniversityID}} - - University Name - {{univFees.UniversityName}} - - Payable Fees - {{univFees.PayableFees}} - - Paid Fees - {{univFees.PaidFees}} - - Balance Fees - {{univFees.PayableFees-univFees.PaidFees}} -
-
-
+ + + + + + - -
- + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
- Batch Code - {{batchFees.BatchCode}} - - Batch Name - {{batchFees.BatchName}} - - Payable Fees - {{batchFees.PayableFees}} - - Paid Fees - {{batchFees.PaidFees}} - - Balance Fees - {{batchFees.PayableFees-batchFees.PaidFees}} -
-
-
+ + + + + + +
diff --git a/Apollo/assets/views/dashboard_tile3.html b/Apollo/assets/views/dashboard_tile3.html index 7f8d1f7b..44def162 100644 --- a/Apollo/assets/views/dashboard_tile3.html +++ b/Apollo/assets/views/dashboard_tile3.html @@ -197,50 +197,50 @@ - -
-
-
-
+ + + + + + + + - + -
+ -
-
+ + - + + + -
-
-

-
-
-
No Outstanding Fee!
-
-
- -
+ + + + + + + + + + + + + + -
+ -
+ diff --git a/Apollo/assets/views/dashboard_tile5.html b/Apollo/assets/views/dashboard_tile5.html new file mode 100644 index 00000000..f5348a7f --- /dev/null +++ b/Apollo/assets/views/dashboard_tile5.html @@ -0,0 +1,92 @@ + + + + + +
+
+
+
+
+ +
+ + +
+ + + + +
+
+
+
+ + + +
+ + +
+
+ + + +
+
+

+
+
+
No Outstanding Fee!
+
+
+ +
+ +
+ +
+ +
+
+ + +
+
+
+
+
+
\ No newline at end of file