This commit is contained in:
gayathri1990 2018-09-12 18:15:06 +05:30
commit d132ee91f9
3 changed files with 272 additions and 11 deletions

View File

@ -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']);

View File

@ -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');
};
}]);

View File

@ -41,28 +41,64 @@
</div>
</div>
</div>
<div class="row" ng-if="emptyList==false" style="float: left;display: flex;" data-ng-controller="DatepickerDemoCtrl">
<div class="container" style="padding-top: 10%;
padding-bottom: 10%;">
<input type="text"
class="form-control "
ng-click="startOpen = !startOpen"
datepicker-popup="dd-MM-yyyy"
ng-model="paymentVerficationModel.fromDate"
is-open="startOpen"
ng-init="startOpen = false"
name="date1"
datepicker-options="dateOptions"
placeholder="Select From Date"
max-date="paymentVerficationModel.toDate" ng-readonly="true"
close-text="Close">
</div>
</div>
<div class="row" ng-if="emptyList==false" style="float: left;display: flex;" data-ng-controller="DatepickerDemoCtrl">
<div class="container" style="padding-top: 10%;
padding-bottom: 10%; margin-left: 2%">
<input type="text"
class="form-control "
ng-click="startOpen = !startOpen"
datepicker-popup="dd-MM-yyyy"
ng-model="paymentVerficationModel.toDate"
is-open="startOpen"
ng-init="startOpen = false"
name="date2"
datepicker-options="dateOptions"
placeholder="Select To Date"
min-date="paymentVerficationModel.fromDate"
max-date="minStartDate" ng-readonly="true"
close-text="Close" ng-change="filterDate(paymentDataForFilter);">
</div>
</div>
<div class="row" style="float: right;display: flex;">
<div class="container">
<div class="container" style="padding-top: 10%;
padding-bottom: 10%;">
<button type="button" ng-if="emptyList==false" class="btn btn-info btn-o" tooltip="Click to add payment" tabindex="3" ng-click="addUniversityPaymentModal(paymentVerficationModel)">
Add Payment
</button>
<button class="btn btn-success btn-o" ng-if="emptyList==false" ng-click="exportData()">Export to Excel</button>
</div>
</div>
<div class="row" style="position: relative;margin-top:4%;">
<div class="container">
<div ng-if="searchLoader">
<div align="center">
<h3 style="color: blue;">Loading...</h3>
</div>
<div style="color: blue; align: center;" align="center"> Loading...</div>
</div>
<div ng-if="emptyList">
<div align="center">
<h2> {{paymentVerificationData}} </h2>
</div>
<div style="color: red; align: center;" align="center"> {{paymentVerificationData}}</div>
</div>
<div class="table-responsive" ng-if="emptyList==false">
<div class="table-responsive" ng-if="emptyList==false" ng-controller="studentModalDemoCtrl">
<span class="text-bold" style="float: right">University Balance&nbsp;:&nbsp;{{paymentVerificationData[paymentVerificationData.length-1].RunningBalance }}</span>
<table class="table table-hover table-condensed table-bordered" >
<thead>
<tr>
@ -78,7 +114,7 @@
</thead>
<tbody dir-paginate="p in paymentVerificationData|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10| filter:query as results">
<tr ng-class="{universityPaid:p.TypeID==0}">
<td>{{p.FormID}}</td>
<td><a tooltip="View Student" class="text-dark" ng-click="open(p);">{{p.FormID}}</a></td>
<td>{{p.EnrolmentNo}}</td>
<td><span class="spanCursor" tooltip="Click to edit/view bill" ng-click="viewPayment(p)">{{p.BillNo}}</span></td>
<td>{{p.FormatDate}}</td>