diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index 30cf6788..55e706a7 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -898,15 +898,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n var dayDiff = moment().diff(bDate, 'days'); var todatlFineAmt = 0; var fineAmt1 = 0; - // var fineAmt2 = 0; - // var fineAmt3 = 0; - // var fineAmt4 = 0; - // var fineAmt5 = 0; - // var fineAmt6 = 0; - // var fineAmt7 = 0; - // var fineAmt8 = 0; - // var fineAmt9 = 0; - // var fineAmt10 = 0; var fineAmt11 = 0; var countDays = 0; for (var k = 1; k <= dayDiff; k++) { @@ -939,50 +930,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } } - /*else if (k > 90) { - if (k > 90 && k <= 120) { - fineAmt2 = 300; - - } - else if (k > 120 && k <= 150) { - fineAmt3 = 300; - - } - else if (k > 150 && k <= 180) { - fineAmt4 = 300; - - } - else if (k > 180 && k <= 210) { - fineAmt5 = 300; - - } - else if (k > 210 && k <= 240) { - fineAmt6 = 300; - - } - else if (k > 240 && k <= 270) { - fineAmt7 = 300; - - } - else if (k > 270 && k <= 300) { - fineAmt8 = 300; - - } - else if (k > 300 && k <= 330) { - fineAmt9 = 300; - - } - else if (k > 330 && k <= 360) { - fineAmt10 = 300; - - } - - else { - fineAmt11 = 300; - } - - - }*/ } // todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11); @@ -1056,6 +1003,187 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n 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 exDatenew2; + 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); + + } + 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 > 30000) { + 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; + } + + }); + + } + + } + + + + } + + }); + /* //start + var exDatenew1; var exDatenew2; var exitPayAmt=parseInt(totAmt-other); @@ -1158,7 +1286,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } } - /* else if (k > 90) { + /!* else if (k > 90) { if (k > 90 && k <= 120) { fineAmt2 = 300; @@ -1214,7 +1342,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } - }*/ + }*!/ } // todatlFineAmt = parseInt(fineAmt1) + parseInt(fineAmt2) + parseInt(fineAmt3) + parseInt(fineAmt4) + parseInt(fineAmt5) + parseInt(fineAmt6) + parseInt(fineAmt7) + parseInt(fineAmt8) + parseInt(fineAmt9) + parseInt(fineAmt10) + parseInt(fineAmt11); @@ -1257,6 +1385,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } } + + // end*/ + } }