Merge branch 'master' of https://bitbucket.org/venbainformationtechnology/apollodec
This commit is contained in:
commit
3b7fdd23bf
@ -224,6 +224,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
if(details.ProgramType=='Y001' && details.SNo=='1'){
|
||||
// get session details
|
||||
var found = $filter('getById')($scope.masterSessionDetails, details.SessionName);
|
||||
|
||||
$scope.ExistSessionDate = new Date(found.SessionDate.substring(6,10)+'-'+found.SessionDate.substring(3,5)+'-'+found.SessionDate.substring(0,2));
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
@ -244,7 +245,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
if($scope.feesStructureInfo[0].SessionName!=''){
|
||||
// get session details
|
||||
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[0].SessionName);
|
||||
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[details.SNo-2].SessionName);
|
||||
$scope.ExistSessionDate = new Date(found.SessionDate.substring(6,10)+'-'+found.SessionDate.substring(3,5)+'-'+found.SessionDate.substring(0,2));
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
@ -260,8 +261,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
|
||||
/*else{
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
|
||||
if(svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID){
|
||||
@ -275,7 +275,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
@ -310,6 +310,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
else{
|
||||
|
||||
if(details.ProgramType=='Y001' && details.SNo!='1'){
|
||||
|
||||
$scope.sessionDetails=[];
|
||||
$scope.sessionDetailsTo=[];
|
||||
if(type==1){
|
||||
@ -321,7 +322,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
if($scope.feesStructureInfo[0].SessionName!=''){
|
||||
// get session details
|
||||
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[0].SessionName);
|
||||
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[details.SNo-2].SessionName);
|
||||
$scope.ExistSessionDate = new Date(found.SessionDate.substring(6,10)+'-'+found.SessionDate.substring(3,5)+'-'+found.SessionDate.substring(0,2));
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
@ -337,7 +338,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
/* else{
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
|
||||
@ -352,36 +353,54 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
// get session details
|
||||
var found = $filter('getById')($scope.masterSessionDetails, details.SessionName);
|
||||
$scope.ExistSessionDate = new Date(found.SessionDate.substring(6,10)+'-'+found.SessionDate.substring(3,5)+'-'+found.SessionDate.substring(0,2));
|
||||
if(details.SessionName=='' || details.SessionName==null || details.SessionName==undefined){
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
|
||||
if(svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID || $scope.feesStructureInfo[0].ToSessionName==svalues.SessionID){
|
||||
$scope.sessionDetails.push({
|
||||
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
|
||||
"SessionID":svalues.SessionID,
|
||||
});
|
||||
|
||||
if($scope.ExistSessionDate <= new Date(svalues.SessionDate.substring(6,10)+'-'+svalues.SessionDate.substring(3,5)+'-'+svalues.SessionDate.substring(0,2))){
|
||||
|
||||
|
||||
$scope.sessionDetailsTo.push({
|
||||
if(svalues.IsActive=='1' ){
|
||||
$scope.sessionDetails.push({
|
||||
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
|
||||
"SessionID":svalues.SessionID,
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
else{
|
||||
// get session details
|
||||
var found = $filter('getById')($scope.masterSessionDetails, details.SessionName);
|
||||
$scope.ExistSessionDate = new Date(found.SessionDate.substring(6,10)+'-'+found.SessionDate.substring(3,5)+'-'+found.SessionDate.substring(0,2));
|
||||
|
||||
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
|
||||
|
||||
if(svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID || $scope.feesStructureInfo[0].ToSessionName==svalues.SessionID){
|
||||
$scope.sessionDetails.push({
|
||||
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
|
||||
"SessionID":svalues.SessionID,
|
||||
});
|
||||
|
||||
if($scope.ExistSessionDate <= new Date(svalues.SessionDate.substring(6,10)+'-'+svalues.SessionDate.substring(3,5)+'-'+svalues.SessionDate.substring(0,2))){
|
||||
|
||||
|
||||
$scope.sessionDetailsTo.push({
|
||||
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
|
||||
"SessionID":svalues.SessionID,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -503,7 +522,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
swal("", "Please fill session details/installment details", "warning");
|
||||
swal("", "Please check session details/installment details", "warning");
|
||||
} else {
|
||||
|
||||
/* if(isNaN(installment.date)){
|
||||
@ -848,13 +867,13 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
$scope.changeBatch = function (Details) {
|
||||
|
||||
if(Details.InstallmentDetails != ''){
|
||||
$scope.setFeesTotalAmount(Details,'2','2','1');
|
||||
$scope.setFeesTotalAmount(Details,'2','2','1',Details.STFOrWR);
|
||||
}
|
||||
else{
|
||||
$rootScope.updateMoreItems=[];
|
||||
$scope.setModel.feesType.Others = '';
|
||||
|
||||
$scope.setFeesTotalAmount(Details,'1','1','1');
|
||||
$scope.setFeesTotalAmount(Details,'1','1','1',Details.STFOrWR);
|
||||
|
||||
}
|
||||
|
||||
@ -901,7 +920,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
}
|
||||
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
swal("", "Please fill session details/installment details", "warning");
|
||||
swal("", "Please check session details/installment details", "warning");
|
||||
}
|
||||
|
||||
else {
|
||||
@ -1015,10 +1034,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
$rootScope.lastInstallemtDate="";*/
|
||||
$rootScope.updateMoreItems=[];
|
||||
}
|
||||
$scope.setFeesTotalAmount(model,'1','2','1');
|
||||
$scope.setFeesTotalAmount(model,'1','2','1',model.STFOrWR);
|
||||
}
|
||||
else{
|
||||
$scope.setFeesTotalAmount(model,'3','1','1');
|
||||
$scope.setFeesTotalAmount(model,'3','1','1',model.STFOrWR);
|
||||
|
||||
}
|
||||
|
||||
@ -1030,7 +1049,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
/*
|
||||
* get set fees total amount
|
||||
* */
|
||||
$scope.setFeesTotalAmount = function (values,type,type1,checkPermission) {
|
||||
$scope.setFeesTotalAmount = function (values,type,type1,checkPermission,beforeSTF) {
|
||||
|
||||
if(type==3 || values.Sem_Year=='TC' || values.Sem_Year=='PC' || values.Sem_Year=='DC' || values.Sem_Year=='MC' || values.Sem_Year=='OTHER'){
|
||||
|
||||
@ -1112,11 +1131,13 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
||||
}
|
||||
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
|
||||
|
||||
}
|
||||
else{
|
||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1154,11 +1175,13 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
$scope.calculateInstallemnts(values,$scope.setTotalAmount,$scope.othersFees,type);
|
||||
}
|
||||
else if(values.InstallmentDetails=='' && $rootScope.updateMoreItems.length<=2){
|
||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
//$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
|
||||
|
||||
}
|
||||
else{
|
||||
$scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
// $scope.calculateInstallemntsExist(values,$scope.setTotalAmount,$scope.othersFees,type,type1,checkPermission);
|
||||
$scope.calculateDueAmount(values,$scope.setTotalAmount,$scope.othersFees,$scope.stfFees,'2',beforeSTF);
|
||||
|
||||
}
|
||||
|
||||
@ -1838,13 +1861,10 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
$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){
|
||||
@ -2043,6 +2063,407 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
}
|
||||
$scope.dateValidations();
|
||||
|
||||
}
|
||||
$scope.changeInstallemtAmt = function (old,present,index,values,totAmt,other) {
|
||||
if($rootScope.updateMoreItems[index+1]!=undefined){
|
||||
var currentValue=present;
|
||||
var pastValue=old;
|
||||
if(currentValue==undefined || currentValue==''){
|
||||
var currentValue=0;
|
||||
}
|
||||
if(pastValue==undefined || pastValue==''){
|
||||
pastValue=0;
|
||||
}
|
||||
if(parseInt(currentValue)<=parseInt($scope.setTotalAmount)){
|
||||
|
||||
if(currentValue<=pastValue){
|
||||
var diffVal1=parseInt(pastValue)-parseInt(currentValue);
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt($rootScope.updateMoreItems[index+1].Amount)+parseInt(diffVal1);
|
||||
|
||||
}
|
||||
else if(pastValue<currentValue){
|
||||
var diffVal2=parseInt(currentValue)-parseInt(pastValue);
|
||||
|
||||
if(diffVal2>$rootScope.updateMoreItems[index+1].Amount){
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt(diffVal2)-parseInt($rootScope.updateMoreItems[index+1].Amount);
|
||||
|
||||
}
|
||||
else{
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt($rootScope.updateMoreItems[index+1].Amount)-parseInt(diffVal2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
var diffVal3=parseInt(currentValue)-parseInt(pastValue);
|
||||
// alert(diffVal3);
|
||||
|
||||
if(diffVal3>$rootScope.updateMoreItems[index].Amount){
|
||||
$rootScope.updateMoreItems[index].Amount=parseInt(diffVal3)-parseInt($rootScope.updateMoreItems[index].Amount);
|
||||
|
||||
}
|
||||
else{
|
||||
$rootScope.updateMoreItems[index].Amount=parseInt($rootScope.updateMoreItems[index].Amount)-parseInt(diffVal3);
|
||||
|
||||
}
|
||||
}
|
||||
$scope.calculateDueAmount(values,totAmt,other,values.STFOrWR,'2',values.STFOrWR);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*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))){
|
||||
var gettotAmt = 0;
|
||||
}
|
||||
else{
|
||||
var gettotAmt = values.ActualFees;
|
||||
}
|
||||
if(isNaN(parseInt(other))){
|
||||
var getother = 0;
|
||||
}
|
||||
else{
|
||||
var getother = other;
|
||||
}
|
||||
if(isNaN(parseInt(STFOrWR))){
|
||||
var getSTFOrWR = 0;
|
||||
}
|
||||
else{
|
||||
var getSTFOrWR = STFOrWR;
|
||||
}
|
||||
if(isNaN(parseInt(beforeSTF))){
|
||||
var getBeforeSTFOrWR = 0;
|
||||
}
|
||||
else{
|
||||
var getBeforeSTFOrWR = beforeSTF;
|
||||
}
|
||||
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 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();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* roll back after installment date No
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
$scope.dueDetailsRollup = function (totAmt,other,checkPermission,STFOrWR,lastInstallAmt,beforeSTF) {
|
||||
if(isNaN(parseInt(totAmt))){
|
||||
var gettotAmt = 0;
|
||||
}
|
||||
else{
|
||||
var gettotAmt = totAmt;
|
||||
}
|
||||
if(isNaN(parseInt(other))){
|
||||
var getother = 0;
|
||||
}
|
||||
else{
|
||||
var getother = other;
|
||||
}
|
||||
if(isNaN(parseInt(STFOrWR))){
|
||||
var getSTFOrWR = 0;
|
||||
}
|
||||
else{
|
||||
var getSTFOrWR = STFOrWR;
|
||||
}
|
||||
if(isNaN(parseInt(beforeSTF))){
|
||||
var getBeforeSTFOrWR = 0;
|
||||
}
|
||||
else{
|
||||
var getBeforeSTFOrWR = beforeSTF;
|
||||
}
|
||||
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 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(lastInstallAmt) + parseInt(getSTFOrWR) + parseInt(finalFineAmt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$scope.dateValidations();
|
||||
|
||||
}
|
||||
$scope.getDateArray = [];
|
||||
/*
|
||||
@ -2111,55 +2532,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
|
||||
}, true);*/
|
||||
|
||||
|
||||
$scope.changeInstallemtAmt = function (old,present,index) {
|
||||
if($rootScope.updateMoreItems[index+1]!=undefined){
|
||||
var currentValue=present;
|
||||
var pastValue=old;
|
||||
if(currentValue==undefined || currentValue==''){
|
||||
var currentValue=0;
|
||||
}
|
||||
if(pastValue==undefined || pastValue==''){
|
||||
pastValue=0;
|
||||
}
|
||||
if(parseInt(currentValue)<=parseInt($scope.setTotalAmount)){
|
||||
|
||||
if(currentValue<=pastValue){
|
||||
var diffVal1=parseInt(pastValue)-parseInt(currentValue);
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt($rootScope.updateMoreItems[index+1].Amount)+parseInt(diffVal1);
|
||||
|
||||
}
|
||||
else if(pastValue<currentValue){
|
||||
var diffVal2=parseInt(currentValue)-parseInt(pastValue);
|
||||
|
||||
if(diffVal2>$rootScope.updateMoreItems[index+1].Amount){
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt(diffVal2)-parseInt($rootScope.updateMoreItems[index+1].Amount);
|
||||
|
||||
}
|
||||
else{
|
||||
$rootScope.updateMoreItems[index+1].Amount=parseInt($rootScope.updateMoreItems[index+1].Amount)-parseInt(diffVal2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
var diffVal3=parseInt(currentValue)-parseInt(pastValue);
|
||||
// alert(diffVal3);
|
||||
|
||||
if(diffVal3>$rootScope.updateMoreItems[index].Amount){
|
||||
$rootScope.updateMoreItems[index].Amount=parseInt(diffVal3)-parseInt($rootScope.updateMoreItems[index].Amount);
|
||||
|
||||
}
|
||||
else{
|
||||
$rootScope.updateMoreItems[index].Amount=parseInt($rootScope.updateMoreItems[index].Amount)-parseInt(diffVal3);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -81,7 +81,8 @@
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody dir-paginate="p in data|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
|
||||
<tbody dir-paginate="p in data|filter:search:strict|itemsPerPage:10">
|
||||
<!--|orderBy:sortKey:reverse-->
|
||||
<!-- <pre>p|json</pre> -->
|
||||
<tr>
|
||||
<td>{{p.BatchCode}}</td>
|
||||
@ -153,7 +154,7 @@
|
||||
|
||||
<input type="text" placeholder="Enter Batch Code"
|
||||
tabindex="1" class="form-control" name="batchCode"
|
||||
ng-model="myModel.batchCode" ng-pattern="/^[a-zA-Z0-9\s]*$/" required/>
|
||||
ng-model="myModel.batchCode" ng-pattern="/^[a-zA-Z0-9-\s]*$/" required/>
|
||||
<span class="error text-small block"
|
||||
ng-if="Form.batchCode.$dirty && Form.batchCode.$error.required">Batch code is required</span>
|
||||
<span class="error text-small block"
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
<input type="text" placeholder="Enter Batch Code"
|
||||
tabindex="1" class="form-control" name="batchcode"
|
||||
ng-model="p.BatchCode" ng-pattern="/^[a-zA-Z0-9\s]*$/" readonly required/>
|
||||
ng-model="p.BatchCode" ng-pattern="/^[a-zA-Z0-9-\s]*$/" readonly required/>
|
||||
<span class="error text-small block"
|
||||
ng-if="Form.batchcode.$dirty && Form.batchcode.$error.required">Batch Code is required</span>
|
||||
<span class="error text-small block"
|
||||
|
||||
@ -167,7 +167,10 @@
|
||||
|
||||
<input type="text" placeholder="Enter STF/WR Amount"
|
||||
autofocus tabindex="12" class="form-control" name="STF" id="STF" ng-maxlength="9"
|
||||
ng-model="setModel.feesType.STFOrWR" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','2','2');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'"/>
|
||||
ng-model="setModel.feesType.STFOrWR" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','2','2',{{setModel.feesType.STFOrWR}});" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-if="setModel.feesType.STFOrWR!=''"/>
|
||||
<input type="text" placeholder="Enter STF/WR Amount"
|
||||
autofocus tabindex="12" class="form-control" name="STF" id="STF" ng-maxlength="9"
|
||||
ng-model="setModel.feesType.STFOrWR" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','2','2',0);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-if="setModel.feesType.STFOrWR==''"/>
|
||||
<span class="error text-small block"
|
||||
ng-if="Form.STF.$dirty && Form.STF.$invalid"
|
||||
ng-hide="Form.STF.$error.maxlength || Form.STF.$error.pattern">STF/WR amount is required</span>
|
||||
@ -183,7 +186,7 @@
|
||||
|
||||
<input type="text" placeholder="Enter Other Amount"
|
||||
autofocus tabindex="13" class="form-control" name="others" id="others" ng-maxlength="9"
|
||||
ng-model="setModel.feesType.Others" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','1','2');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" readonly/>
|
||||
ng-model="setModel.feesType.Others" ng-pattern="/^[0-9]*$/" ng-change="setFeesTotalAmount(setModel.feesType,'2','1','2',{{setModel.feesType.STFOrWR}});" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" readonly/>
|
||||
<span class="error text-small block"
|
||||
ng-if="Form.others.$dirty && Form.others.$invalid"
|
||||
ng-hide="Form.others.$error.maxlength || Form.others.$error.pattern">Others amount is required</span>
|
||||
@ -316,7 +319,8 @@
|
||||
|
||||
<input type="text" placeholder="Enter Fees Amount"
|
||||
autofocus class="form-control" name="amount{{$index}}" id="amount{{$index}}" ng-maxlength="8"
|
||||
ng-model="n.Amount" ng-pattern="/^[0-9]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-readonly="updateMoreItems.length==$index+1" ng-change="changeInstallemtAmt('{{n.Amount}}',n.Amount,$index);" required/>
|
||||
ng-model="n.Amount" ng-pattern="/^[0-9]*$/" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-change="changeInstallemtAmt('{{n.Amount}}',n.Amount,$index,setModel.feesType,setTotalAmount,setModel.feesType.Others);" required/>
|
||||
<!--ng-readonly="updateMoreItems.length==$index+1"-->
|
||||
<span class="error text-small block" ng-if="n.Amount==undefined">Enter a valid amount</span>
|
||||
|
||||
</div>
|
||||
@ -351,7 +355,7 @@
|
||||
min-date="getDateArray[$index].Date"
|
||||
max-date="getDateArray[$index+2].Date"
|
||||
show-button-bar="false"
|
||||
close-text="Close" ng-change="setFeesTotalAmount(setModel.feesType,'2','2','1');" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-readonly="true" required="required"/>
|
||||
close-text="Close" ng-change="calculateDueAmount(setModel.feesType,setTotalAmount,setModel.feesType.Others,setModel.feesType.STFOrWR,'1',setModel.feesType.STFOrWR);" ng-disabled="setModel.feesType.ExistValue=='1' && userType=='R002'" ng-readonly="true" required="required"/>
|
||||
<span class="error text-small block"
|
||||
ng-if="n.DueDate==undefined">Date is required.</span>
|
||||
<!--<span class="success text-small block"-->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user