course fees edit changes in fees status

This commit is contained in:
gandhimathi 2018-06-13 11:35:03 +05:30
parent 016a05d9b4
commit d561f6dd2c

View File

@ -957,17 +957,17 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
if(Details.InstallmentDetails != ''){
$scope.setFeesTotalAmount(Details,'2',Details);
$scope.setFeesTotalAmount(Details,'2',Details,'1');
}
else{
/*$scope.$watch('setModel.feesType.BatchCode', function(newValue, oldValue) {
if(newValue!=oldValue){
$rootScope.updateMoreItems=[];
$scope.setFeesTotalAmount(Details,'1',Details);
$scope.setFeesTotalAmount(Details,'1',Details,'1');
}
});*/
$scope.setFeesTotalAmount(Details,'1',Details);
$scope.setFeesTotalAmount(Details,'1',Details,'1');
}
@ -1134,10 +1134,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$rootScope.lastInstallemtDate="";*/
$rootScope.updateMoreItems=[];
}
$scope.setFeesTotalAmount(model,'1',model);
$scope.setFeesTotalAmount(model,'1',model,'1');
}
else{
$scope.setFeesTotalAmount(model,'3',model);
$scope.setFeesTotalAmount(model,'3',model,'1');
}
@ -1149,7 +1149,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
/*
* get set fees total amount
* */
$scope.setFeesTotalAmount = function (values,type,beforeValues) {
$scope.setFeesTotalAmount = function (values,type,beforeValues,from) {
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'){
@ -1189,6 +1189,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
else{
if($scope.setTotalAmount=='' || $scope.setTotalAmount==null || $scope.setTotalAmount==0){
$scope.beforeSetTotalAmount=0;
}
else{
$scope.beforeSetTotalAmount=$scope.setTotalAmount;
}
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));
@ -1225,16 +1231,25 @@ 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);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
$scope.calculateDueAmount(values,beforeValues);
if(from=='1'){
$scope.calculateDueAmount($scope.setTotalAmount,$scope.setTotalAmount);
}
else{
$scope.calculateDueAmount($scope.beforeSetTotalAmount,$scope.setTotalAmount);
}
}
else{
$scope.calculateDueAmount(values,beforeValues);
if(from=='1'){
$scope.calculateDueAmount($scope.setTotalAmount,$scope.setTotalAmount);
}
else{
$scope.calculateDueAmount($scope.beforeSetTotalAmount,$scope.setTotalAmount);
}
}
}
@ -1266,17 +1281,26 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
else{
$scope.wiverFees=values.Waiver;
}
$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);
}
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
$scope.calculateDueAmount(values,beforeValues);
if(from=='1'){
$scope.calculateDueAmount($scope.setTotalAmount,$scope.setTotalAmount);
}
else{
$scope.calculateDueAmount($scope.beforeSetTotalAmount,$scope.setTotalAmount);
}
}
else{
$scope.calculateDueAmount(values,beforeValues);
if(from=='1'){
$scope.calculateDueAmount($scope.setTotalAmount,$scope.setTotalAmount);
}
else{
$scope.calculateDueAmount($scope.beforeSetTotalAmount,$scope.setTotalAmount);
}
}
@ -1840,7 +1864,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
}
$scope.calculateDueAmount(values,values);
$scope.calculateDueAmount($scope.setTotalAmount,$scope.setTotalAmount);
}
@ -1851,8 +1875,31 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
/*while changing installment date/amount calculate fine amount
* created by kms
* */
$scope.calculateDueAmount = function (values,beforeValues) {
if(values.ActualFees=='' || values.ActualFees==undefined){
$scope.calculateDueAmount = function (beforeTot,afterTot) {
if(parseInt(beforeTot)<parseInt(afterTot)){
$scope.finalTotAmt=parseInt(afterTot)-parseInt(beforeTot);
}
else{
$scope.finalTotAmt=parseInt(afterTot)-parseInt(beforeTot);
}
if($rootScope.updateMoreItems.length>0){
if(parseInt($scope.finalTotAmt)>0){
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) + parseInt($scope.finalTotAmt);
}
else{
if(parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount)<parseInt($scope.finalTotAmt)){
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount=0;
}
else{
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount=parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount) + parseInt($scope.finalTotAmt);
}
}
}
/* if(values.ActualFees=='' || values.ActualFees==undefined){
var gettotAmt = 0;
}
else{
@ -1900,7 +1947,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = parseInt(lastInstallAmt) + parseInt(getSTFOrWR) + parseInt(getother);
}
}*/
$scope.dateValidations();