course details changes done

This commit is contained in:
gandhimathi 2018-03-06 18:40:16 +05:30
parent 896b208ab0
commit e17af0c47d

View File

@ -198,6 +198,179 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.updateModel.billAmount = model.BalanceAmount;
}
/*
* change session details
* created by kms
* */
$scope.changeSessions = function (details) {
if(details.SessionName!=undefined && details.SessionName!=''){
$scope.sessionDetails=[];
$scope.sessionDetailsTo=[];
$scope.setModel.feesType.ToSessionName="";
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) {
if((svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID)){
$scope.sessionDetails.push({
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
"SessionID":svalues.SessionID,
});
}
});
}
else if(details.ProgramType=='Y001' && details.SNo!='1'){
if($scope.feesStructureInfo[0].SessionName!=''){
// get session details
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[0].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.ExistSessionDate <= new Date(svalues.SessionDate.substring(6,10)+'-'+svalues.SessionDate.substring(3,5)+'-'+svalues.SessionDate.substring(0,2))){
$scope.sessionDetails.push({
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
"SessionID":svalues.SessionID,
});
}
});
}
else{
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
if(svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID){
$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,
});
}
}
});
}
}
else{
if(details.ProgramType=='Y001' && details.SNo!='1'){
$scope.sessionDetails=[];
$scope.sessionDetailsTo=[];
$scope.setModel.feesType.ToSessionName="";
if($scope.feesStructureInfo[0].SessionName!=''){
// get session details
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[0].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.ExistSessionDate <= new Date(svalues.SessionDate.substring(6,10)+'-'+svalues.SessionDate.substring(3,5)+'-'+svalues.SessionDate.substring(0,2))){
$scope.sessionDetails.push({
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
"SessionID":svalues.SessionID,
});
}
});
}
else{
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
if(svalues.IsActive=='1' || $scope.feesStructureInfo[0].SessionName==svalues.SessionID){
$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,
});
}
}
});
}
}
}
@ -314,6 +487,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
angular.element('.ng-invalid[name=' + firstError + ']').focus();
} else {
/* if(isNaN(installment.date)){
$scope.pushDueDate1= $rootScope.lastInstallemtDate;
}
@ -339,69 +513,103 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
});
}*/
angular.forEach($rootScope.updateMoreItems, function (value, key) {
if(isNaN(value.DueDate)){
$scope.correctDate='';
}
else{
if(updateModel.Sem_Year!='TC' && updateModel.Sem_Year!='PC' && updateModel.Sem_Year!='DC' && updateModel.Sem_Year!='MC' && updateModel.Sem_Year!='OTHER'){
var checkTotamt=0;
$scope.convertGetDate2=new Date(value.DueDate).toDateString();
$scope.pushDueDate2 = $filter('date')(new Date($scope.convertGetDate2), 'dd-MM-yyyy');
$rootScope.updateMoreItems[key].DueDate=$scope.pushDueDate2;
}
});
$scope.ldloading5 = {};
angular.forEach($rootScope.updateMoreItems, function (value, key) {
checkTotamt=parseInt(checkTotamt)+parseInt(value.Amount);
$scope.ldloading5[loading.replace('-', '_')] = true;
if(isNaN(value.DueDate)){
$scope.correctDate='';
}
else{
$scope.convertGetDate2=new Date(value.DueDate).toDateString();
$scope.pushDueDate2 = $filter('date')(new Date($scope.convertGetDate2), 'dd-MM-yyyy');
$rootScope.updateMoreItems[key].DueDate=$scope.pushDueDate2;
}
});
if(parseInt($scope.setTotalAmount)<checkTotamt){
var statusUpdate=false;
swal("Please check total/installment amount ");
}
else if(parseInt($scope.setTotalAmount)>checkTotamt){
var statusUpdate=false;
swal("Please check total/installment amount ");
}
else if(parseInt($scope.setTotalAmount)==checkTotamt){
var statusUpdate=true;
}
}
else{
var statusUpdate=true;
}
if(statusUpdate==true){
$scope.setSessionTo="";
if(updateModel.ProgramType=='P001' || updateModel.ProgramType=='P002'){
$scope.setSessionTo=updateModel.ToSessionName;
}
var updateFees = {
method: 'POST',
url: apiPoint.url + 'setFeesForStudent/',
headers: {
'Content-Type': 'application/json'
},
data: {
studID: myModel.StudentID,
courseID:myModel.CourseID,
courseAmount:updateModel.ActualFees,
feesID: updateModel.ID,
STFWR:updateModel.STFOrWR,
waiver: updateModel.Waiver,
other: updateModel.Others,
session: updateModel.SessionName,
rollNo: updateModel.RollNo,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
installmentItems:$rootScope.updateMoreItems,
batchCode:updateModel.BatchCode,
$scope.ldloading5 = {};
}
};
$http(updateFees).then(function (response) {
if (response.data.status==200 && response.data.setStatus) {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Success!", "Fees set successfully.", "success");
$scope.ldloading5[loading.replace('-', '_')] = true;
$scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
/*$scope.setModel = {
"feesType": "",
};*/
$scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.name="";
$scope.myModelInstallemt.amount="";
$scope.myModelInstallemt.date="";
$rootScope.updateMoreItems=[];
$scope.setTotalAmount='';
form.$setPristine(true);
} else {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$rootScope.updateMoreItems.splice($scope.updateMoreItems.length-1);
// $scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
}
var updateFees = {
method: 'POST',
url: apiPoint.url + 'setFeesForStudent/',
headers: {
'Content-Type': 'application/json'
},
data: {
studID: myModel.StudentID,
courseID:myModel.CourseID,
courseAmount:updateModel.ActualFees,
feesID: updateModel.ID,
STFWR:updateModel.STFOrWR,
waiver: updateModel.Waiver,
other: updateModel.Others,
session: updateModel.SessionName,
sessionTo: $scope.setSessionTo,
rollNo: updateModel.RollNo,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID,
installmentItems:$rootScope.updateMoreItems,
batchCode:updateModel.BatchCode,
}
};
$http(updateFees).then(function (response) {
if (response.data.status==200 && response.data.setStatus) {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Success!", "Fees set successfully.", "success");
$scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
/*$scope.setModel = {
"feesType": "",
};*/
$scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.name="";
$scope.myModelInstallemt.amount="";
$scope.myModelInstallemt.date="";
$rootScope.updateMoreItems=[];
$scope.setTotalAmount='';
form.$setPristine(true);
} else {
$scope.ldloading5[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
$rootScope.updateMoreItems.splice($scope.updateMoreItems.length-1);
// $scope.getStudentSetFees(myModel.ID,myModel.CourseID,myModel.StudentID);
}
});
}
});
}
};
/*
@ -460,9 +668,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */
$scope.feesStructureInfo="";
$scope.BatchDetails=[];
$scope.masterSessionDetails="";
$scope.sessionDetails=[];
$scope.getStudentSetFees = function (ID,courseID,studeID) {
$scope.BatchDetails=[];
$scope.sessionDetails=[];
$scope.sessionDetailsTo=[];
$scope.feesStructureInfo="";
$scope.myModelInstallemt.ID="";
$scope.myModelInstallemt.name="";
@ -486,6 +697,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$http(setFees).then(function (response) {
if (response.data.status==200 && response.data.feesStatus) {
$scope.masterSessionDetails = response.data.sessionDetails;
$scope.feesStructureInfo=response.data.feesDetails;
$scope.setModel = {
"feesType": $scope.feesStructureInfo[0],
@ -507,6 +720,17 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
$scope.calculateInstallemnts($scope.feesStructureInfo[0],$scope.setTotalAmount,0,'1');
// get session details
angular.forEach($scope.masterSessionDetails,function (svalues,skey) {
if(svalues.IsActive=='1'){
$scope.sessionDetails.push({
"SessionName":svalues.SessionName +'('+svalues.SessionDate+')',
"SessionID":svalues.SessionID,
});
}
});
}
@ -532,6 +756,36 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
$scope.setModel.feesType.BatchCode = $scope.feesStructureInfo[0].BatchCode;
$scope.ExistSessionDate="";
// get session details
var found = $filter('getById')($scope.masterSessionDetails, $scope.feesStructureInfo[0].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,
});
}
}
});
$scope.setModel.feesType.SessionName=$scope.feesStructureInfo[0].SessionName;
$scope.setModel.feesType.SessionNameTo=$scope.feesStructureInfo[0].ToSessionName;
}
$scope.dateValidations();
@ -553,8 +807,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
* */
$scope.changeBatch = function (Details) {
if(Details.InstallmentDetails != ''){
$scope.setFeesTotalAmount(Details,'2','2');
}
@ -747,7 +999,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
$scope.setTotalAmount= parseInt($scope.actFees) + parseInt($scope.stfFees) + parseInt($scope.othersFees) - parseInt($scope.wiverFees);
$scope.setModel.feesType.BatchCode = "Nill";
$scope.setModel.feesType.BatchCode = "Not applicable";
$scope.setModel.feesType.SessionName = "Not applicable";
$rootScope.updateMoreItems=[];
}
@ -1009,15 +1262,23 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
var exDatenew1;
var exDatenew2;
var exitPayAmt=parseInt(totAmt-other);
if(isNaN(moment($rootScope.updateMoreItems[position].DueDate))){
/* 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));
@ -1041,7 +1302,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
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;
@ -1182,211 +1445,6 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
});
/* //start
var exDatenew1;
var exDatenew2;
var exitPayAmt=parseInt(totAmt-other);
if(isNaN(moment($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate))){
exDatenew1 = new Date($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(6,10)+'-'+$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(3,5)+'-'+$rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate.substring(0,2));
exDatenew1 = moment(exDatenew1);
}
else{
exDatenew1 = moment($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].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);
$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 if(exDatenew1 > exBatchDate){
var dayDiff = exDatenew1.diff(exBatchDate, 'days');
dayDiff = dayDiff+1;
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++) {
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;
}
}
/!* 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 {
countDays = countDays+1;
if (countDays<30) {
if(countDays==1){
fineAmt11 = parseInt(fineAmt11)+300;
}
// foo++;
}
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(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));
}
}
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;
}
});
}
}
// end*/
}
}
@ -1431,35 +1489,88 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n
}
/*
$scope.$watch('updateMoreItems', function (newValue, oldValue) {
// this is for watch function
/* $scope.$watch('updateMoreItems', function (newValue, oldValue) {
for (var i = 0; i < newValue.length; i++) {
if (newValue[i].Amount != oldValue[i].Amount) {
alert();
var currentValue=0;
var pastValue=0;
if(newValue[i].Amount>oldValue[i].Amount){
if(newValue[i].Amount>oldValue[i].Amount){
currentValue = parseInt(newValue[i].Amount)-oldValue[i].Amount;
}
else if(newValue[i].Amount<oldValue[i].Amount){
pastValue = oldValue[i].Amount-parseInt(newValue[i].Amount);
}
else if(newValue[i].Amount<oldValue[i].Amount){
pastValue = oldValue[i].Amount-parseInt(newValue[i].Amount);
}
else{
currentValue=0
pastValue=0;
}
else{
currentValue=0
pastValue=0;
}
console.log(currentValue);
console.log(pastValue);
}
}
//bla-bla-bla
}
}, true);*/
}, 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(currentValue!=0 && pastValue!=0){
if(parseInt(present)<=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);
}
}
}
}
}
@ -1695,4 +1806,16 @@ app.filter('unique', function() {
return output;
};
});
app.filter('getById', function() {
return function(input, id) {
var i=0, len=input.length;
for (; i<len; i++) {
if (+input[i].SessionID == +id) {
return input[i];
}
}
return null;
}
});