diversen opmerkingen Peter
This commit is contained in:
@@ -23,19 +23,23 @@ $( function () {
|
||||
other_revenue : ko.observable(),
|
||||
hasProject : ko.observable(),
|
||||
|
||||
init: function () {
|
||||
init: function ( callback = false ) {
|
||||
dbo.editOfferModal.refreshCustomers();
|
||||
|
||||
dbo.editOfferModal.refreshUsers();
|
||||
|
||||
if ( typeof(callback) == 'function' ) callback();
|
||||
},
|
||||
|
||||
newEditOffer: function ( offer, projectID = false, customerID = false, hasProject = false, callback ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
vm.callback = typeof(callback) == 'function' ? callback : null;
|
||||
|
||||
vm.showOfferModal();
|
||||
vm.init( function () {
|
||||
vm.showOfferModal();
|
||||
|
||||
vm.setOffer( offer, projectID, customerID, hasProject );
|
||||
vm.setOffer( offer, projectID, customerID, hasProject );
|
||||
} );
|
||||
},
|
||||
|
||||
getCustomerProjects: function () {
|
||||
@@ -77,7 +81,7 @@ $( function () {
|
||||
title : 'project aangemaakt',
|
||||
message : 'er is een project aangemaakt met nummer: ' + data.projectnumber,
|
||||
modalClass: 'modal-success'
|
||||
}, function(){
|
||||
}, function () {
|
||||
vm.hideOfferModal();
|
||||
vm.callback();
|
||||
} );
|
||||
@@ -104,7 +108,7 @@ $( function () {
|
||||
message : errorMessage,
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}else{
|
||||
} else {
|
||||
vm.hideOfferModal();
|
||||
vm.callback();
|
||||
}
|
||||
|
||||
@@ -14,13 +14,15 @@ dbo.outgoinginvoicesInit = function () {
|
||||
} else {
|
||||
dbo.outgoinginvoicesModel = {
|
||||
|
||||
initialize : null,
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
selectedMonthID: ko.observable(),
|
||||
projects : ko.observableArray( [] ),
|
||||
invoiceTab : ko.observable( 'invoice' ),
|
||||
months : ko.observableArray( dbo.monthArray ),
|
||||
initialize : null,
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
selectedMonthID : ko.observable(),
|
||||
projects : ko.observableArray( [] ),
|
||||
invoiceTab : ko.observable( 'invoice' ),
|
||||
months : ko.observableArray( dbo.monthArray ),
|
||||
totalToInvoice : ko.observable(),
|
||||
totalToInvoiceFuture: ko.observable(),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
@@ -56,6 +58,8 @@ dbo.outgoinginvoicesInit = function () {
|
||||
refreshInvoiceDetails: function () {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
|
||||
vm.resetModel();
|
||||
|
||||
if ( vm.initialize ) return;
|
||||
|
||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) {
|
||||
@@ -63,9 +67,17 @@ dbo.outgoinginvoicesInit = function () {
|
||||
_.each( data, function ( p ) {
|
||||
vm.projects.push( new vm.Project( p ) );
|
||||
} );
|
||||
vm.totalToInvoice( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoice() ) ) );
|
||||
vm.totalToInvoiceFuture( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoiceFuture() ) ) );
|
||||
} );
|
||||
},
|
||||
|
||||
resetModel: function () {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
vm.totalToInvoice( 0 );
|
||||
vm.totalToInvoiceFuture( 0 );
|
||||
},
|
||||
|
||||
Project: function ( data ) {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
var self = this;
|
||||
@@ -88,11 +100,12 @@ dbo.outgoinginvoicesInit = function () {
|
||||
self.totalInvoiced = dbo.helpers.numberWithPoints( totalInvoiced );
|
||||
self.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints( Math.round( data.otheryearpayed ) );
|
||||
self.invoicedCurentYearPayed = dbo.helpers.numberWithPoints( Math.round( data.currentyearpayed ) );
|
||||
self.totalInvoicedPayed = dbo.helpers.numberWithPoints( totalInvoicedPayed );
|
||||
self.notPayed = dbo.helpers.numberWithPoints( notPayed );
|
||||
self.toInvoice = dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced );
|
||||
self.currentforecast = dbo.helpers.numberWithPoints( data.currentforecast );
|
||||
self.otherforecast = dbo.helpers.numberWithPoints( data.otherforecast );
|
||||
self.totalInvoicedPayed = dbo.helpers.numberWithPoints( Math.round( totalInvoicedPayed ) );
|
||||
self.notPayed = dbo.helpers.numberWithPoints( Math.round( notPayed ) );
|
||||
self.toInvoice = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced ) );
|
||||
self.toInvoiceFuture = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced - Number( data.currentforecast ) ) );
|
||||
self.currentforecast = dbo.helpers.numberWithPoints( Math.round( data.currentforecast ) );
|
||||
self.otherforecast = dbo.helpers.numberWithPoints( Math.round( data.otherforecast ) );
|
||||
self.missingForecast =
|
||||
dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced - data.otherforecast );
|
||||
|
||||
@@ -106,6 +119,9 @@ dbo.outgoinginvoicesInit = function () {
|
||||
if ( !vm['payment' + p.month] ) vm['payment' + p.month] = ko.observable( 0 );
|
||||
vm['payment' + p.month]( Number( vm['payment' + p.month]() ) + Number( p.paymentamount ) );
|
||||
} );
|
||||
|
||||
vm.totalToInvoice( vm.totalToInvoice() + (totalInvoice - totalInvoiced) );
|
||||
vm.totalToInvoiceFuture( vm.totalToInvoiceFuture() + (totalInvoice - totalInvoiced - Number( data.currentforecast )) );
|
||||
},
|
||||
|
||||
Month: function ( data ) {
|
||||
|
||||
Reference in New Issue
Block a user