diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index 2f7a686a..1eec9e85 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -1357,11 +1357,13 @@ $result['updatedraftStatus'] = false; * created by kms * */ public function getPaymentVerificationDetails($search){ - $this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,DATE_FORMAT(UNCD.ApprovedDate, "%d-%m-%Y") as FormatDate,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID,UNP.Amount,UNP.ReceiptNo,UNP.Remarks'); + $this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,DATE_FORMAT(UNCD.ApprovedDate, "%d-%m-%Y") as FormatDate,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID,UNP.Amount,UNP.ReceiptNo,UNP.Remarks,ST.MobileNumber'); $this->db->from(UNIVERSITYCREDITDEBIY.' as UNCD'); $this->db->join(FORMFEESRECEIVEDFROMUNIV.' as UNFR', 'UNFR.ID = UNCD.FormMapID','left'); $this->db->join(UNIVERSITYPAYMENT.' as UNP', 'UNP.PID = UNCD.PaymentMapID','left'); $this->db->join(ENROLMENTRECEIVEDFROMUNIV.' as ENU', 'ENU.FormID = UNFR.FormID','left'); + $this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo','left'); + $this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID','left'); $this->db->order_by('UNCD.ApprovedDate','ASC'); $this->db->where('UNCD.UniversityCode',$search['UniversityCode']); $this->db->order_by('UNCD.UniversityName',$search['UniversityName']); diff --git a/Apollo/assets/js/controllers/univFormPaymentCtrl.js b/Apollo/assets/js/controllers/univFormPaymentCtrl.js index 0f3bb313..c1a2bebb 100644 --- a/Apollo/assets/js/controllers/univFormPaymentCtrl.js +++ b/Apollo/assets/js/controllers/univFormPaymentCtrl.js @@ -7,6 +7,8 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable // ng-model object for payment search $scope.paymentVerficationModel= { 'universitySearch':"", + 'fromDate':"", + 'toDate':"", }; // load when html page load var localDetail = JSON.parse(localStorage.getItem('localObj')); @@ -331,10 +333,13 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable $scope.paymentVerificationData=""; $scope.emptyList=true; $scope.searchLoader = false; + $scope.paymentDataForFilter=""; + $rootScope.getPaymentVerificationDetails = function (searchData) { $scope.paymentVerificationData=""; $scope.emptyList=true; $scope.searchLoader = true; + $scope.paymentDataForFilter=""; var paymentVerification = { method: 'POST', url: apiPoint.url + 'paymentVerficationDetails/', @@ -352,24 +357,56 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable $scope.searchLoader = false; $scope.emptyList=false; $scope.paymentVerificationData=response.data.details; + var tagMap = $scope.paymentVerificationData.reduce(function(map, tag,key) { if(map.RunningBalance==undefined){ map['RunningBalance'] = parseInt(tag.CreditAmount)-parseInt(tag.DebitAmount); - tag['RunningBalance']=parseInt(tag.CreditAmount)-parseInt(tag.DebitAmount);; + tag['RunningBalance']=parseInt(tag.CreditAmount)-parseInt(tag.DebitAmount); + if(tag.TypeID==0){ + tag['FormID']=""; + tag['EnrolmentNo']=""; + } + else{ + tag['BillNo']=""; + } + } else{ if(parseInt(tag.DebitAmount)<=0){ map['RunningBalance'] = parseInt(map.RunningBalance)+parseInt(tag.CreditAmount); tag['RunningBalance']=parseInt(map.RunningBalance); + if(tag.TypeID==0){ + tag['FormID']=""; + tag['EnrolmentNo']=""; + } + else{ + tag['BillNo']=""; + } } else{ map['RunningBalance'] = parseInt(map.RunningBalance)-parseInt(tag.DebitAmount); tag['RunningBalance']=parseInt(map.RunningBalance); + if(tag.TypeID==0){ + tag['FormID']=""; + tag['EnrolmentNo']=""; + } + else{ + tag['BillNo']=""; + } } } return map; }, {}); + $scope.paymentDataForFilter=$scope.paymentVerificationData; + + // serach date format changes + if(searchData.fromDate !='' && searchData.fromDate !=null && searchData.fromDate !=undefined){ + $scope.paymentVerficationModel.fromDate=$filter('date')(new Date(searchData.fromDate), 'yyyy-MM-dd'); + } + if(searchData.toDate !='' && searchData.toDate !=null && searchData.toDate !=undefined){ + $scope.paymentVerficationModel.toDate=$filter('date')(new Date(searchData.toDate), 'yyyy-MM-dd'); + } } else { $scope.searchLoader = false; @@ -377,7 +414,39 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable $scope.paymentVerificationData=response.data.details; } }); + }; + /* + * filter payment details based on date + * created by kms + * */ + $scope.$watchCollection('paymentVerficationModel', function(current,old){ + $scope.paymentVerificationData=[]; + if((current.fromDate!='' && current.fromDate!=null && current.fromDate!=undefined) && (current.toDate=='' || current.toDate==null || current.toDate==undefined)){ + var searchFromDate1=new Date($scope.paymentVerficationModel.fromDate).toDateString(); + $scope.from=$filter('date')(new Date(searchFromDate1), 'yyyy-MM-dd'); + angular.forEach($scope.paymentDataForFilter,function (values,key) { + if($scope.from==values.ApprovedDate){ + $scope.paymentVerificationData.push(values); + } + }); + } + else if((current.fromDate!='' && current.fromDate!=null && current.fromDate!=undefined) && (current.toDate!='' && current.toDate!=null && current.toDate!=undefined)){ + var searchFromDate1=new Date($scope.paymentVerficationModel.fromDate).toDateString(); + $scope.from=$filter('date')(new Date(searchFromDate1), 'yyyy-MM-dd'); + var searchToDate2=new Date($scope.paymentVerficationModel.toDate).toDateString(); + $scope.to=$filter('date')(new Date(searchToDate2), 'yyyy-MM-dd'); + angular.forEach($scope.paymentDataForFilter,function (values,key) { + if($scope.from<=values.ApprovedDate && values.ApprovedDate <=$scope.to){ + $scope.paymentVerificationData.push(values); + } + }); + } + else{ + $scope.paymentVerficationModel.toDate=""; + $scope.paymentVerificationData=$scope.paymentDataForFilter; + } + }); /* * cancel update modal @@ -398,5 +467,159 @@ app.controller('univFormPaymentCtrl', ["$scope","$rootScope","$filter", "ngTable };*/ $rootScope.updateError=""; }; + //Export excel + var mystyle1 = { + sheetid: 'University Payment Details', + headers: true, + caption: { + title:'UNIVERSITY PAYMENT DETAILS', + width: '300px', + style:'font-size:50px;' + }, + // style:'background:#00FF00', + column: { + style:'font-size:16px' + }, + + }; + + + + $scope.exportData = function () { + alasql('SELECT FormID,EnrolmentNo as EnrollmentID,BillNo as BillNo,FormatDate as Date,CAST(CreditAmount as NUMBER) as Payable,CAST(DebitAmount as NUMBER) as Paid,CAST(RunningBalance as NUMBER) as Balance INTO XLS("UniversityPaymentDetails.xls",?) FROM ?',[mystyle1,$scope.paymentVerificationData]); + }; + //End of export excel + + +}]); +/*modal controller + * */ +app.controller('studentModalDemoCtrl', ["$scope", "$rootScope", "$modal", "$log", "API_POINTS", "$http", function ($scope, $rootScope, $modal, $log,apiPoint,$http) { + //Tooltip for print button + $scope.dynamicTooltip = 'Student View'; + + + + // $scope.items = ['item1', 'item2', 'item3']; + + $scope.open = function (studentDetails) { + // get student view details + var getcourse = { + method: 'POST', + url: apiPoint.url + 'getStudentBasicInfo/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy :studentDetails.MobileNumber, + requestedFrom: 4, + branchCode : JSON.parse(localStorage.getItem('localObj')).localBranchID + + } + }; + $http(getcourse).then(function (response) { + + if (response.data.status == 200 && response.data.studentStatus== true) { + $scope.courseEditLoading = false; + // $scope.studentDetails = response.data.studentDetails; + $scope.studentDetails = response.data; + // $scope.courseDetails = response.data.courseDetails; + var modalInstance = $modal.open({ + templateUrl: 'assets/views/student/studentDetailsModal.html', + controller: 'ModalInstanceCtrl', + // size: size, + resolve: { + items: function () { + return $scope.studentDetails; + } + } + }); + + modalInstance.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + modalInstance.close(); + }); + + } else { + swal("Failed!", "This student is not registerd", "warning"); + $scope.courseEditLoading = false; + $scope.studentDetails = ""; + $scope.courseDetails = ""; + + } + }); + }; + $scope.open1 = function (values,type) { + + var modalInstance1 = $modal.open({ + templateUrl: 'assets/views/student/studentPaymentModal.html', + controller: 'ModalInstanceCtrl1', + // size: size, + resolve: { + items1: function () { + var myvalues = + { + "values":values, + "type":type + }; + return myvalues; + } + + } + }); + + modalInstance1.result.then(function (selectedItem) { + $scope.selected = selectedItem; + }, function () { + modalInstance1.close(); + }); + }; + $scope.printStudentDetails = function (details) { + $rootScope.pdfItems = details; + + var printInstance = $modal.open({ + templateUrl: 'assets/views/student/studentPdf.html', + controller: 'studentModalDemoCtrl', + }); + }; + // generate pdf for student view + $scope.export = function(getName) { + kendo.drawing.drawDOM($("#exportthis")).then(function(group) { + kendo.drawing.pdf.saveAs(group, getName+".pdf"); + }); + } + +}]); +// Please note that $modalInstance represents a modal window (instance) dependency. +// It is not the same as the $modal service used above. + +app.controller('ModalInstanceCtrl', ["$scope", "$modalInstance", "items","WordsService", function ($scope, $modalInstance, items,WordsService) { + + $scope.items = items; + $scope.selected = { + item: $scope.items[0] + }; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; +}]); +app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1","WordsService", function ($scope, $modalInstance, items1,WordsService) { + + $scope.items1 = items1.values; + $scope.selectedtype = items1.type; + + $scope.ok = function () { + $modalInstance.close($scope.selected.item); + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }]); \ No newline at end of file diff --git a/Apollo/assets/views/student/UnivFormPaymentDetails.html b/Apollo/assets/views/student/UnivFormPaymentDetails.html index c1fcd875..d09e9741 100644 --- a/Apollo/assets/views/student/UnivFormPaymentDetails.html +++ b/Apollo/assets/views/student/UnivFormPaymentDetails.html @@ -41,28 +41,64 @@ +
| {{p.FormID}} | +{{p.FormID}} | {{p.EnrolmentNo}} | {{p.BillNo}} | {{p.FormatDate}} |