course details changes done
This commit is contained in:
parent
7d731f2334
commit
d7aea5d25d
@ -3,7 +3,7 @@
|
|||||||
* controllers for ng-table
|
* controllers for ng-table
|
||||||
* Simple table with sorting and filtering on AngularJS
|
* Simple table with sorting and filtering on AngularJS
|
||||||
*/
|
*/
|
||||||
app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", "installmentService", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,installmentService) {
|
app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", "installmentService", "SweetAlert", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,installmentService,SweetAlert) {
|
||||||
$scope.myModel = {
|
$scope.myModel = {
|
||||||
"studentName": "",
|
"studentName": "",
|
||||||
"mobileNumber": "",
|
"mobileNumber": "",
|
||||||
@ -31,6 +31,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set model
|
* set model
|
||||||
* */
|
* */
|
||||||
@ -67,6 +68,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
{
|
{
|
||||||
"paymentOn":"WAIVER"
|
"paymentOn":"WAIVER"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"paymentOn":"Credit/Debit Card"
|
||||||
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -196,6 +200,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
* */
|
* */
|
||||||
$scope.changeTotalFees = function (model) {
|
$scope.changeTotalFees = function (model) {
|
||||||
$scope.updateModel.billAmount = model.BalanceAmount;
|
$scope.updateModel.billAmount = model.BalanceAmount;
|
||||||
|
$scope.updateModel.date = $filter('date')(new Date(), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -543,8 +548,16 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
if(updateModel.Valid=='1'){
|
||||||
var statusUpdate=true;
|
var statusUpdate=true;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
var statusUpdate=false;
|
||||||
|
swal("", "Course fees are not paid so unable to set course fees", "warning");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(statusUpdate==true){
|
if(statusUpdate==true){
|
||||||
$scope.setSessionTo="";
|
$scope.setSessionTo="";
|
||||||
@ -646,8 +659,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
$scope.updateModel = {
|
$scope.updateModel = {
|
||||||
"feesType": $scope.studentFeesInfo[0],
|
"feesType": $scope.studentFeesInfo[0],
|
||||||
|
"billAmount":$scope.studentFeesInfo[0].BalanceAmount,
|
||||||
|
"date":$filter('date')(new Date(), 'dd-MM-yyyy')
|
||||||
|
|
||||||
};
|
};
|
||||||
|
/* $scope.billCurrentDate=$filter('date')(new Date(), 'dd-MM-yyyy');
|
||||||
|
alert($scope.billCurrentDate);*/
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -785,10 +802,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
$scope.setModel.feesType.SessionName=$scope.feesStructureInfo[0].SessionName;
|
$scope.setModel.feesType.SessionName=$scope.feesStructureInfo[0].SessionName;
|
||||||
$scope.setModel.feesType.SessionNameTo=$scope.feesStructureInfo[0].ToSessionName;
|
$scope.setModel.feesType.SessionNameTo=$scope.feesStructureInfo[0].ToSessionName;
|
||||||
|
$scope.dateValidations();
|
||||||
|
|
||||||
}
|
}
|
||||||
$scope.dateValidations();
|
|
||||||
} else {
|
} else {
|
||||||
$scope.feesStructureInfo="";
|
$scope.feesStructureInfo="";
|
||||||
$scope.setModel = {
|
$scope.setModel = {
|
||||||
@ -808,13 +824,13 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
$scope.changeBatch = function (Details) {
|
$scope.changeBatch = function (Details) {
|
||||||
|
|
||||||
if(Details.InstallmentDetails != ''){
|
if(Details.InstallmentDetails != ''){
|
||||||
$scope.setFeesTotalAmount(Details,'2','2');
|
$scope.setFeesTotalAmount(Details,'2','2','1');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$rootScope.updateMoreItems=[];
|
$rootScope.updateMoreItems=[];
|
||||||
$scope.setModel.feesType.Others = '';
|
$scope.setModel.feesType.Others = '';
|
||||||
|
|
||||||
$scope.setFeesTotalAmount(Details,'1','1');
|
$scope.setFeesTotalAmount(Details,'1','1','1');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,10 +971,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
$rootScope.lastInstallemtDate="";*/
|
$rootScope.lastInstallemtDate="";*/
|
||||||
$rootScope.updateMoreItems=[];
|
$rootScope.updateMoreItems=[];
|
||||||
}
|
}
|
||||||
$scope.setFeesTotalAmount(model,'1','2');
|
$scope.setFeesTotalAmount(model,'1','2','1');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$scope.setFeesTotalAmount(model,'3','1');
|
$scope.setFeesTotalAmount(model,'3','1','1');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,9 +986,14 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
/*
|
/*
|
||||||
* get set fees total amount
|
* get set fees total amount
|
||||||
* */
|
* */
|
||||||
$scope.setFeesTotalAmount = function (values,type,type1) {
|
$scope.setFeesTotalAmount = function (values,type,type1,checkPermission) {
|
||||||
|
|
||||||
if(type==3 || values.Sem_Year=='TC' || values.Sem_Year=='PC' || values.Sem_Year=='DC' || values.Sem_Year=='MC' || values.Sem_Year=='OTHER'){
|
if(type==3 || values.Sem_Year=='TC' || values.Sem_Year=='PC' || values.Sem_Year=='DC' || values.Sem_Year=='MC' || values.Sem_Year=='OTHER'){
|
||||||
|
|
||||||
|
if(values.Valid=='0'){
|
||||||
|
swal("", "Course fees are not paid so unable to set course fees", "warning");
|
||||||
|
|
||||||
|
}
|
||||||
if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
|
if(values.ActualFees=='' || values.ActualFees==null || values.ActualFees==undefined){
|
||||||
$scope.actFees=0;
|
$scope.actFees=0;
|
||||||
}
|
}
|
||||||
@ -1047,11 +1068,11 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
||||||
}
|
}
|
||||||
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
||||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
|
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
|
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1089,11 +1110,11 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
||||||
}
|
}
|
||||||
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
||||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
|
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1);
|
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,8 +1139,273 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
var cDate = moment();
|
var cDate = moment();
|
||||||
var bDate = moment($scope.BatchDate);
|
var bDate = moment($scope.BatchDate);
|
||||||
|
|
||||||
var startPayableAmt = parseInt(totAmt);
|
var startPayableAmt = parseInt(totAmt);
|
||||||
|
|
||||||
|
|
||||||
|
if(cDate > bDate && moment(cDate).diff(bDate, 'days')>30){
|
||||||
|
SweetAlert.swal({
|
||||||
|
title: "",
|
||||||
|
text: "The selected installment date is crossing the maximum allowed period. Do you want to continue (Yes/No). If yes you need to get approval from the higher authorities",
|
||||||
|
type: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#eea236", confirmButtonText: "Yes",
|
||||||
|
cancelButtonText: "No",
|
||||||
|
closeOnConfirm: true,
|
||||||
|
closeOnCancel: true
|
||||||
|
},
|
||||||
|
function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
for (var i = 1; i <= 2; i++) {
|
||||||
|
if (i == 1) {
|
||||||
|
/* if (cDate <= bDate) {
|
||||||
|
|
||||||
|
|
||||||
|
var percentage = Math.round(startPayableAmt * 70 / 100);
|
||||||
|
percentage = Math.round(percentage / 10) * 10;
|
||||||
|
startPayableAmt = startPayableAmt - percentage;
|
||||||
|
$scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
|
||||||
|
var dayDiff2 = moment(bDate).diff(cDate, 'days');
|
||||||
|
if (dayDiff2 > 30) {
|
||||||
|
$scope.insSecondDate = moment($scope.BatchDate).subtract(30, 'days');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
|
||||||
|
}
|
||||||
|
else if (dayDiff2 > 15 && dayDiff2 <= 30) {
|
||||||
|
$scope.insSecondDate = moment($scope.BatchDate).subtract(15, 'days');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {*/
|
||||||
|
var dayDiff = moment().diff(bDate, 'days');
|
||||||
|
var todatlFineAmt = 0;
|
||||||
|
var fineAmt1 = 0;
|
||||||
|
var fineAmt11 = 0;
|
||||||
|
var countDays = 0;
|
||||||
|
for (var k = 1; k <= dayDiff; k++) {
|
||||||
|
|
||||||
|
if (k <= 90) {
|
||||||
|
|
||||||
|
if (startPayableAmt <= 10000) {
|
||||||
|
fineAmt1 = 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((startPayableAmt > 10000) && (startPayableAmt <= 20000)) {
|
||||||
|
fineAmt1 = 600;
|
||||||
|
}
|
||||||
|
else if (startPayableAmt > 20000) {
|
||||||
|
fineAmt1 = 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
countDays = countDays+1;
|
||||||
|
|
||||||
|
if (countDays<30) {
|
||||||
|
if(countDays==1){
|
||||||
|
fineAmt11 = parseInt(fineAmt11)+300;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
countDays=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11);
|
||||||
|
todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt11);
|
||||||
|
|
||||||
|
if(type=='1'){
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt) + parseInt(todatlFineAmt)-parseInt(other));
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt));
|
||||||
|
if(other==0){
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
startPayableAmt = parseInt($scope.setTotalAmount);
|
||||||
|
var percentage = Math.round(startPayableAmt * 70 / 100);
|
||||||
|
percentage = Math.round(percentage / 10) * 10;
|
||||||
|
startPayableAmt = startPayableAmt - percentage;
|
||||||
|
|
||||||
|
$scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
$scope.updateMoreItems.push({
|
||||||
|
ID: "",
|
||||||
|
Name: installmentService.installmentWords(i),
|
||||||
|
Amount: percentage,
|
||||||
|
DueDate: $scope.insFirstDate
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
startPayableAmt = Math.round(startPayableAmt / 10) * 10;
|
||||||
|
$scope.updateMoreItems.push({
|
||||||
|
ID: "",
|
||||||
|
Name: installmentService.installmentWords(i),
|
||||||
|
Amount: startPayableAmt,
|
||||||
|
DueDate: $scope.insSecondDate
|
||||||
|
});
|
||||||
|
/* $scope.myModelInstallemt.ID = "";
|
||||||
|
$scope.myModelInstallemt.name = installmentService.installmentWords(i);
|
||||||
|
$scope.myModelInstallemt.amount = startPayableAmt;
|
||||||
|
$scope.myModelInstallemt.date = $scope.insSecondDate;
|
||||||
|
$rootScope.lastInstallemtDate = $scope.myModelInstallemt.date;*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$scope.dateValidations();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (var i = 1; i <= 2; i++) {
|
||||||
|
if (i == 1) {
|
||||||
|
/* if (cDate <= bDate) {
|
||||||
|
var percentage = Math.round(startPayableAmt * 70 / 100);
|
||||||
|
percentage = Math.round(percentage / 10) * 10;
|
||||||
|
startPayableAmt = startPayableAmt - percentage;
|
||||||
|
$scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
|
||||||
|
var dayDiff2 = moment(bDate).diff(cDate, 'days');
|
||||||
|
if (dayDiff2 > 30) {
|
||||||
|
$scope.insSecondDate = moment($scope.BatchDate).subtract(30, 'days');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
|
||||||
|
}
|
||||||
|
else if (dayDiff2 > 15 && dayDiff2 <= 30) {
|
||||||
|
$scope.insSecondDate = moment($scope.BatchDate).subtract(15, 'days');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date($scope.insSecondDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {*/
|
||||||
|
var tempCurrentDate = moment(bDate).add(30, 'days');
|
||||||
|
$scope.insSecondDate = moment($scope.BatchDate).subtract(30, 'days');
|
||||||
|
var dayDiff = moment(tempCurrentDate).diff(bDate, 'days');
|
||||||
|
var todatlFineAmt = 0;
|
||||||
|
var fineAmt1 = 0;
|
||||||
|
var fineAmt11 = 0;
|
||||||
|
var countDays = 0;
|
||||||
|
for (var k = 1; k <= dayDiff; k++) {
|
||||||
|
|
||||||
|
if (k <= 90) {
|
||||||
|
|
||||||
|
if (startPayableAmt <= 10000) {
|
||||||
|
fineAmt1 = 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((startPayableAmt > 10000) && (startPayableAmt <= 20000)) {
|
||||||
|
fineAmt1 = 600;
|
||||||
|
}
|
||||||
|
else if (startPayableAmt > 20000) {
|
||||||
|
fineAmt1 = 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
countDays = countDays+1;
|
||||||
|
|
||||||
|
if (countDays<30) {
|
||||||
|
if(countDays==1){
|
||||||
|
fineAmt11 = parseInt(fineAmt11)+300;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
countDays=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11);
|
||||||
|
todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt11);
|
||||||
|
|
||||||
|
if(type=='1'){
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt) + parseInt(todatlFineAmt)-parseInt(other));
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt));
|
||||||
|
if(other==0){
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
startPayableAmt = parseInt($scope.setTotalAmount);
|
||||||
|
var percentage = Math.round(startPayableAmt * 70 / 100);
|
||||||
|
percentage = Math.round(percentage / 10) * 10;
|
||||||
|
startPayableAmt = startPayableAmt - percentage;
|
||||||
|
|
||||||
|
$scope.insFirstDate = $filter('date')(new Date(tempCurrentDate), 'dd-MM-yyyy');
|
||||||
|
$scope.insSecondDate = $filter('date')(new Date(tempCurrentDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
$scope.updateMoreItems.push({
|
||||||
|
ID: "",
|
||||||
|
Name: installmentService.installmentWords(i),
|
||||||
|
Amount: percentage,
|
||||||
|
DueDate: $scope.insFirstDate
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
|
||||||
|
startPayableAmt = Math.round(startPayableAmt / 10) * 10;
|
||||||
|
$scope.updateMoreItems.push({
|
||||||
|
ID: "",
|
||||||
|
Name: installmentService.installmentWords(i),
|
||||||
|
Amount: startPayableAmt,
|
||||||
|
DueDate: $scope.insSecondDate
|
||||||
|
});
|
||||||
|
/* $scope.myModelInstallemt.ID = "";
|
||||||
|
$scope.myModelInstallemt.name = installmentService.installmentWords(i);
|
||||||
|
$scope.myModelInstallemt.amount = startPayableAmt;
|
||||||
|
$scope.myModelInstallemt.date = $scope.insSecondDate;
|
||||||
|
$rootScope.lastInstallemtDate = $scope.myModelInstallemt.date;*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$scope.dateValidations();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
else{
|
||||||
for (var i = 1; i <= 2; i++) {
|
for (var i = 1; i <= 2; i++) {
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
if (cDate <= bDate) {
|
if (cDate <= bDate) {
|
||||||
@ -1240,9 +1526,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.dateValidations();
|
$scope.dateValidations();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1252,7 +1541,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
* calculate exist installment
|
* calculate exist installment
|
||||||
* created by kms
|
* created by kms
|
||||||
* */
|
* */
|
||||||
$scope.calculateInstallemntsExist = function (model,totAmt,other,type,type1) {
|
$scope.calculateInstallemntsExist = function (model,totAmt,other,type,type1,checkPermission) {
|
||||||
var exBatchDate = moment($scope.BatchDate);
|
var exBatchDate = moment($scope.BatchDate);
|
||||||
if(type==2 || type==1){
|
if(type==2 || type==1){
|
||||||
if($rootScope.updateMoreItems.length>0){
|
if($rootScope.updateMoreItems.length>0){
|
||||||
@ -1270,10 +1559,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
if($rootScope.updateMoreItems[position].DueDate.length<=10){
|
if($rootScope.updateMoreItems[position].DueDate.length<=10){
|
||||||
exDatenew1 = new Date($rootScope.updateMoreItems[position].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(0,2));
|
exDatenew1 = new Date($rootScope.updateMoreItems[position].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(0,2));
|
||||||
exDatenew1 = moment(exDatenew1);
|
exDatenew1 = moment(exDatenew1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
exDatenew1 = moment($rootScope.updateMoreItems[position].DueDate);
|
exDatenew1 = moment($rootScope.updateMoreItems[position].DueDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1312,6 +1599,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($rootScope.updateMoreItems.length>2){
|
if($rootScope.updateMoreItems.length>2){
|
||||||
angular.forEach($rootScope.updateMoreItems,function (values,key) {
|
angular.forEach($rootScope.updateMoreItems,function (values,key) {
|
||||||
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
|
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
|
||||||
@ -1441,17 +1729,263 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if(checkPermission=='1'){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// check batch date for confirmation
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (list,keyV) {
|
||||||
|
var inDate;
|
||||||
|
var inBatchDate=moment(exBatchDate).add('30','days')
|
||||||
|
if(list.DueDate.length<=10){
|
||||||
|
inDate = new Date(list.DueDate.substring(6,10)+'-'+list.DueDate.substring(3,5)+'-'+list.DueDate.substring(0,2));
|
||||||
|
inDate = moment(inDate);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
inDate = moment(list.DueDate).add('1','days');
|
||||||
|
}
|
||||||
|
if(exBatchDate<inDate && moment(inDate).diff(exBatchDate, 'days')>30){
|
||||||
|
SweetAlert.swal({
|
||||||
|
title: "",
|
||||||
|
text: "The selected installment date is crossing the maximum allowed period. Do you want to continue (Yes/No). If yes you need to get approval from the higher authorities",
|
||||||
|
type: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#eea236",confirmButtonText: "Yes",
|
||||||
|
cancelButtonText: "No",
|
||||||
|
closeOnConfirm: true,
|
||||||
|
closeOnCancel: true },
|
||||||
|
function(isConfirm) {
|
||||||
|
if (isConfirm==false) {
|
||||||
|
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (updateV,updateK) {
|
||||||
|
$rootScope.updateMoreItems[updateK].DueDate=$filter('date')(new Date(inBatchDate), 'dd-MM-yyyy');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.rollBackFeesDetails(model,totAmt,other,type,type1);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.dateValidations();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this function used to roll back the details if no
|
||||||
|
* */
|
||||||
|
/*
|
||||||
|
* calculate exist installment
|
||||||
|
* created by kms
|
||||||
|
* */
|
||||||
|
$scope.rollBackFeesDetails = function (model,totAmt,other,type,type1) {
|
||||||
|
var exBatchDate = moment($scope.BatchDate);
|
||||||
|
if(type==2 || type==1){
|
||||||
|
if($rootScope.updateMoreItems.length>0){
|
||||||
|
var existLoop=0;
|
||||||
|
var existTotAmt=0
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (item,position) {
|
||||||
|
var exDatenew1;
|
||||||
|
var exitPayAmt=parseInt(totAmt-other);
|
||||||
|
/* if(isNaN(moment($rootScope.updateMoreItems[position].DueDate))){
|
||||||
|
exDatenew1 = new Date($rootScope.updateMoreItems[position].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(0,2));
|
||||||
|
exDatenew1 = moment(exDatenew1);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
if($rootScope.updateMoreItems[position].DueDate.length<=10){
|
||||||
|
exDatenew1 = new Date($rootScope.updateMoreItems[position].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[position].DueDate.substring(0,2));
|
||||||
|
exDatenew1 = moment(exDatenew1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
exDatenew1 = moment($rootScope.updateMoreItems[position].DueDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exDatenew1 <= exBatchDate) {
|
||||||
|
|
||||||
|
if(type=='1'){
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
|
||||||
|
// $scope.setModel.feesType.Others = Math.round(parseInt(other));
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
if(other==0){
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt)-parseInt(other));
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var existPercentage = Math.round($scope.setTotalAmount * 70 / 100);
|
||||||
|
existPercentage = Math.round(existPercentage / 10) * 10;
|
||||||
|
exitPayAmt = parseInt($scope.setTotalAmount)-parseInt(existPercentage);
|
||||||
|
if(position==0){
|
||||||
|
|
||||||
|
$rootScope.updateMoreItems[position].Amount = existPercentage;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(position==1){
|
||||||
|
$rootScope.updateMoreItems[position].Amount = exitPayAmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($rootScope.updateMoreItems.length>2){
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (values,key) {
|
||||||
|
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
|
||||||
|
var currentElementAmt = $rootScope.updateMoreItems[key].Amount;
|
||||||
|
var dividePrevElementAmt = Math.round(currentElementAmt * 50 / 100);
|
||||||
|
var divideNextElementAmt = parseInt(currentElementAmt)-parseInt(dividePrevElementAmt);
|
||||||
|
$rootScope.updateMoreItems[key].Amount = dividePrevElementAmt;
|
||||||
|
$rootScope.updateMoreItems[key+1].Amount = dividePrevElementAmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
existTotAmt = parseInt(existTotAmt)+parseInt($rootScope.updateMoreItems[position].Amount);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(exDatenew1 > exBatchDate && existLoop==0){
|
||||||
|
|
||||||
|
|
||||||
|
exitPayAmt=parseInt(exitPayAmt)-parseInt(existTotAmt);
|
||||||
|
|
||||||
|
var dayDiff = exDatenew1.diff(exBatchDate, 'days');
|
||||||
|
dayDiff = dayDiff+1;
|
||||||
|
|
||||||
|
var todatlFineAmt = 0;
|
||||||
|
var fineAmt1 = 0;
|
||||||
|
var fineAmt11 = 0;
|
||||||
|
var countDays = 0;
|
||||||
|
for (var k = 1; k <= dayDiff; k++) {
|
||||||
|
|
||||||
|
|
||||||
|
if (k <= 90) {
|
||||||
|
|
||||||
|
if (exitPayAmt <= 10000) {
|
||||||
|
fineAmt1 = 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((exitPayAmt > 10000) && (exitPayAmt <= 20000)) {
|
||||||
|
fineAmt1 = 600;
|
||||||
|
}
|
||||||
|
else if (exitPayAmt > 20000) {
|
||||||
|
fineAmt1 = 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
countDays = countDays+1;
|
||||||
|
|
||||||
|
if (countDays<30) {
|
||||||
|
if(countDays==1){
|
||||||
|
fineAmt11 = parseInt(fineAmt11)+300;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
countDays=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt11);
|
||||||
|
if(type1=='2'){
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt) -parseInt(other) + parseInt(todatlFineAmt));
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setTotalAmount = Math.round(parseInt(totAmt));
|
||||||
|
if(other==0){
|
||||||
|
|
||||||
|
$scope.setModel.feesType.Others = '';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.setModel.feesType.Others = Math.round(parseInt(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($rootScope.updateMoreItems[position-1]!=undefined){
|
||||||
|
|
||||||
|
existLoop=1;
|
||||||
|
exitPayAmt = parseInt($scope.setTotalAmount);
|
||||||
|
var existPercentage = Math.round(exitPayAmt * 70 / 100);
|
||||||
|
existPercentage = Math.round(existPercentage / 10) * 10;
|
||||||
|
exitPayAmt = parseInt(exitPayAmt)-parseInt(existPercentage);
|
||||||
|
$rootScope.updateMoreItems[0].Amount = existPercentage;
|
||||||
|
$rootScope.updateMoreItems[1].Amount = exitPayAmt;
|
||||||
|
|
||||||
|
if($rootScope.updateMoreItems.length>2){
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (values,key) {
|
||||||
|
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
|
||||||
|
var currentElementAmt = $rootScope.updateMoreItems[key].Amount;
|
||||||
|
var dividePrevElementAmt = Math.round(currentElementAmt * 50 / 100);
|
||||||
|
var divideNextElementAmt = parseInt(currentElementAmt)-parseInt(dividePrevElementAmt);
|
||||||
|
$rootScope.updateMoreItems[key].Amount = dividePrevElementAmt;
|
||||||
|
$rootScope.updateMoreItems[key+1].Amount = dividePrevElementAmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
existLoop=1;
|
||||||
|
exitPayAmt = parseInt($scope.setTotalAmount);
|
||||||
|
var existPercentage = Math.round(exitPayAmt * 70 / 100);
|
||||||
|
existPercentage = Math.round(existPercentage / 10) * 10;
|
||||||
|
exitPayAmt = parseInt(exitPayAmt)-parseInt(existPercentage);
|
||||||
|
$rootScope.updateMoreItems[0].Amount = existPercentage;
|
||||||
|
$rootScope.updateMoreItems[1].Amount = exitPayAmt;
|
||||||
|
|
||||||
|
if($rootScope.updateMoreItems.length>2){
|
||||||
|
angular.forEach($rootScope.updateMoreItems,function (values,key) {
|
||||||
|
if(key>=1 && $rootScope.updateMoreItems.length-1!=key){
|
||||||
|
var currentElementAmt = $rootScope.updateMoreItems[key].Amount;
|
||||||
|
var dividePrevElementAmt = Math.round(currentElementAmt * 50 / 100);
|
||||||
|
var divideNextElementAmt = parseInt(currentElementAmt)-parseInt(dividePrevElementAmt);
|
||||||
|
$rootScope.updateMoreItems[key].Amount = dividePrevElementAmt;
|
||||||
|
$rootScope.updateMoreItems[key+1].Amount = dividePrevElementAmt;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$scope.dateValidations();
|
$scope.dateValidations();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1488,6 +2022,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
|||||||
|
|
||||||
"Date":''
|
"Date":''
|
||||||
})
|
})
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user