fine amount calculation removed from fees status

This commit is contained in:
gandhimathi 2018-05-10 10:53:40 +05:30
parent e0c4f686fa
commit ff61a5a786

View File

@ -806,7 +806,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
$scope.calculateInstallemnts($scope.feesStructureInfo[0],$scope.setTotalAmount,0,'1');
$scope.calculateInstallemnts($scope.feesStructureInfo[0],$scope.setTotalAmount);
// get session details
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
@ -893,14 +893,21 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */
$scope.changeBatch = function (Details) {
if(Details.InstallmentDetails != ''){
$scope.setFeesTotalAmount(Details,'2','2','1',Details.STFOrWR);
$scope.setFeesTotalAmount(Details,'2',Details);
}
else{
$rootScope.updateMoreItems=[];
$scope.setModel.feesType.Others = '';
/*$scope.$watch('setModel.feesType.BatchCode', function(newValue, oldValue) {
if(newValue!=oldValue){
$rootScope.updateMoreItems=[];
$scope.setFeesTotalAmount(Details,'1',Details);
}
});*/
$scope.setFeesTotalAmount(Details,'1',Details);
$scope.setFeesTotalAmount(Details,'1','1','1',Details.STFOrWR);
}
@ -1061,14 +1068,14 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$rootScope.lastInstallemtDate="";*/
$rootScope.updateMoreItems=[];
}
$scope.setFeesTotalAmount(model,'1','2','1',model.STFOrWR);
$scope.setFeesTotalAmount(model,'1',model);
}
else{
$scope.setFeesTotalAmount(model,'3','1','1',model.STFOrWR);
$scope.setFeesTotalAmount(model,'3',model);
}
// form.$setPristine(true);
// form.$setPristine(true);
}
@ -1076,8 +1083,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
/*
* get set fees total amount
* */
$scope.setFeesTotalAmount = function (values,type,type1,checkPermission,beforeSTF) {
$scope.setFeesTotalAmount = function (values,type,beforeValues) {
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'){
@ -1155,16 +1161,14 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length==0){
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
$scope.calculateInstallemnts(values,$scope.setTotalAmount);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
$scope.calculateDueAmount(values,beforeValues);
}
else{
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
$scope.calculateDueAmount(values,beforeValues);
}
}
@ -1199,16 +1203,14 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length==0){
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
$scope.calculateInstallemnts(values,$scope.setTotalAmount);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
//$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
$scope.calculateDueAmount(values,beforeValues);
}
else{
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
$scope.calculateDueAmount(values,beforeValues);
}
@ -1225,7 +1227,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* calculate installments
* created by kms
* */
$scope.calculateInstallemnts =function (model,totAmt,other,type) {
$scope.calculateInstallemnts =function (model,totAmt) {
// $scope.setTotalAmount=totAmt;
$rootScope.updateMoreItems=[];
@ -1234,364 +1236,16 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
var cDate = moment();
var bDate = moment($scope.BatchDate);
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++) {
if (i == 1) {
if (cDate <= bDate) {
startPayableAmt = parseInt(totAmt);
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');
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: "",
@ -1602,8 +1256,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
else {
startPayableAmt = Math.round(startPayableAmt / 10) * 10;
$scope.updateMoreItems.push({
ID: "",
@ -1611,23 +1263,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
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();
}
$scope.dateValidations();
}
@ -2091,7 +1730,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.dateValidations();
}
$scope.changeInstallemtAmt = function (old,present,index,values,totAmt,other) {
$scope.changeInstallemtAmt = function (old,present,index,values) {
if($rootScope.updateMoreItems[index+1]!=undefined){
var currentValue=present;
var pastValue=old;
@ -2135,7 +1774,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
}
$scope.calculateDueAmount(values,totAmt,other,values.STFOrWR,'2',values.STFOrWR);
$scope.calculateDueAmount(values,values);
}
@ -2146,199 +1785,56 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
/*while changing installment date/amount calculate fine amount
* created by kms
* */
$scope.calculateDueAmount = function (values,totAmt,other,STFOrWR,checkPermission,beforeSTF) {
angular.forEach(values.batchDetails,function (values1,key) {
if(values1.BatchCode==values.BatchCode){
$scope.BatchDate = new Date(values1.BatchDate.substring(6,10)+'-'+values1.BatchDate.substring(3,5)+'-'+values1.BatchDate.substring(0,2));
}
});
if(isNaN(parseInt(values.ActualFees))){
$scope.calculateDueAmount = function (values,beforeValues) {
if(values.ActualFees=='' || values.ActualFees==undefined){
var gettotAmt = 0;
}
else{
var gettotAmt = values.ActualFees;
}
if(isNaN(parseInt(other))){
if(values.Others=='' || values.Others==undefined){
var getother = 0;
}
else{
var getother = other;
var getother = values.Others;
}
if(isNaN(parseInt(STFOrWR))){
if(values.STFOrWR=='' || values.STFOrWR==undefined){
var getSTFOrWR = 0;
}
else{
var getSTFOrWR = STFOrWR;
var getSTFOrWR = values.STFOrWR;
}
if(isNaN(parseInt(beforeSTF))){
if(beforeValues.STFOrWR=='' || beforeValues.STFOrWR==undefined){
var getBeforeSTFOrWR = 0;
}
else{
var getBeforeSTFOrWR = beforeSTF;
var getBeforeSTFOrWR = beforeValues.STFOrWR;
}
if(beforeValues.Others=='' || beforeValues.Others==undefined){
var getBeforeother = 0;
}
var lastInstallAmt;
if(parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) > parseInt(getBeforeSTFOrWR)){
lastInstallAmt = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) - parseInt(getBeforeSTFOrWR);
}
else{
lastInstallAmt = parseInt(getBeforeSTFOrWR) - parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount);
}
if(parseInt(lastInstallAmt) > parseInt(getother)){
lastInstallAmt = parseInt(lastInstallAmt) - parseInt(getother); }
else{
lastInstallAmt = parseInt(getother) - parseInt(lastInstallAmt);
var getBeforeother = beforeValues.Others;
}
var lastInstallAmt;
if(parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) > parseInt(getBeforeSTFOrWR)){
lastInstallAmt = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) - parseInt(getBeforeSTFOrWR);
}
else{
lastInstallAmt = parseInt(getBeforeSTFOrWR) - parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount);
}
if(parseInt(lastInstallAmt) > parseInt(getBeforeother)){
lastInstallAmt = parseInt(lastInstallAmt) - parseInt(getBeforeother); }
else{
lastInstallAmt = parseInt(getBeforeother) - parseInt(lastInstallAmt);
}
if($rootScope.updateMoreItems.length>0){
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = parseInt(lastInstallAmt) + parseInt(getSTFOrWR) + parseInt(getother);
var exBatchDate = moment($scope.BatchDate);
if($rootScope.updateMoreItems.length>0){
var existLoop=0;
var exitPayAmt=0;
var finalFineAmt=0;
angular.forEach($rootScope.updateMoreItems,function (item,position) {
var exDatenew1;
var exDatenew2;
// var exitPayAmt=parseInt(totAmt-other);
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) {
$scope.setTotalAmount = Math.round(parseInt(gettotAmt) + parseInt(getSTFOrWR));
$scope.setModel.feesType.Others = 0;
finalFineAmt=0;
}
else if(exDatenew1 > exBatchDate && existLoop==0){
// exitPayAmt=parseInt(exitPayAmt)-parseInt(existTotAmt);
angular.forEach($rootScope.updateMoreItems,function (listVal,listKey) {
if(listKey>=position){
exitPayAmt = parseInt(exitPayAmt)+parseInt($rootScope.updateMoreItems[listKey].Amount);
}
})
if(exitPayAmt>getBeforeSTFOrWR){
exitPayAmt = parseInt(exitPayAmt) - parseInt(getBeforeSTFOrWR);
}
else{
exitPayAmt = parseInt(getBeforeSTFOrWR) - parseInt(exitPayAmt);
}
if(exitPayAmt>getother){
exitPayAmt = parseInt(exitPayAmt) - parseInt(getother) + parseInt(getSTFOrWR);
}
else{
exitPayAmt = parseInt(getother) - parseInt(exitPayAmt) + parseInt(getSTFOrWR);
}
existLoop=1;
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);
finalFineAmt = parseInt(fineAmt1) + parseInt(fineAmt11);
$scope.setTotalAmount = Math.round(parseInt(gettotAmt) + parseInt(getSTFOrWR) + parseInt(todatlFineAmt));
$scope.setModel.feesType.Others = Math.round(parseInt(todatlFineAmt));
}
});
// $rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) + parseInt(finalFineAmt) - parseInt(getother);
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = parseInt(lastInstallAmt) + parseInt(getSTFOrWR) + parseInt(finalFineAmt);
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.dueDetailsRollup(gettotAmt,other,checkPermission,STFOrWR,lastInstallAmt,beforeSTF);
}
})
}
});
}
}
}
$scope.dateValidations();