Invoice report
This commit is contained in:
@@ -195,10 +195,10 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
|
||||
drawCharts: function ( self ) {
|
||||
if ( self.hourView() ) {
|
||||
dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.monthLabels, 'uren per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'hours-per-project-' + self.slug, self.totalHoursChart, self.projectChart, 'uren per project', '#0daef0' );
|
||||
} else {
|
||||
dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.charts.monthLabels, 'omzet per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.monthLabels, 'omzet per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
|
||||
}
|
||||
},
|
||||
|
||||
@@ -19,6 +19,8 @@ dbo.outgoinginvoicesInit = function () {
|
||||
selectedYear : ko.observable(),
|
||||
selectedMonthID: ko.observable(),
|
||||
projects : ko.observableArray( [] ),
|
||||
invoiceTab : ko.observable( 'invoice' ),
|
||||
months : ko.observableArray( dbo.monthArray ),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
@@ -39,11 +41,16 @@ dbo.outgoinginvoicesInit = function () {
|
||||
} );
|
||||
},
|
||||
|
||||
setActivetab: function ( tab ) {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
|
||||
vm.invoiceTab( tab );
|
||||
},
|
||||
|
||||
initModule: function () {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
|
||||
vm.refreshInvoiceDetails();
|
||||
|
||||
},
|
||||
|
||||
refreshInvoiceDetails: function () {
|
||||
@@ -56,27 +63,55 @@ dbo.outgoinginvoicesInit = function () {
|
||||
_.each( data, function ( p ) {
|
||||
vm.projects.push( new vm.Project( p ) );
|
||||
} );
|
||||
|
||||
} );
|
||||
},
|
||||
|
||||
Project: function ( data ) {
|
||||
var vm = dbo.outgoinginvoicesModel;
|
||||
var self = this;
|
||||
var openstaand = data.revenues - (Number( data.currentyear ) + Number( data.otheryear ));
|
||||
this.projectnumber = data.projectnumber;
|
||||
this.customername = data.customername;
|
||||
this.statusProject = Math.abs( openstaand ) > 2 ? 'OPEN' : 'CLOSED';
|
||||
this.fullname = data.fullname;
|
||||
this.openstaand = dbo.helpers.numberWithPoints(Math.round(openstaand));
|
||||
this.openstaandIncl = dbo.helpers.numberWithPoints(Math.round(openstaand * 1.21));
|
||||
this.invoicedOtherYears = dbo.helpers.numberWithPoints(Math.round(data.otheryear));
|
||||
this.invoicedCurentYear = dbo.helpers.numberWithPoints(Math.round(data.currentyear));
|
||||
this.totalInvoiced = dbo.helpers.numberWithPoints(Math.round(data.currentyear) + Math.round(data.otheryear));
|
||||
this.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints(Math.round(data.otheryearpayed));
|
||||
this.invoicedCurentYearPayed = dbo.helpers.numberWithPoints(Math.round(data.currentyearpayed));
|
||||
this.totalInvoicedPayed = dbo.helpers.numberWithPoints(Math.round(data.currentyearpayed) + Math.round(data.otheryearpayed));
|
||||
var totalInvoice = data.revenues * (1 + (data.vatrate / 100));
|
||||
var totalInvoiced = Math.round( data.currentyear ) + Math.round( data.otheryear );
|
||||
var totalInvoicedPayed = Math.round( data.currentyearpayed ) + Math.round( data.otheryearpayed );
|
||||
var notPayed = totalInvoiced - totalInvoicedPayed;
|
||||
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.customername = data.customername;
|
||||
self.statusProject = Math.abs( openstaand ) > 2 ? 'OPEN' : 'CLOSED';
|
||||
self.fullname = data.fullname;
|
||||
self.revenues = dbo.helpers.numberWithPoints( data.revenues );
|
||||
self.totalInvoice = dbo.helpers.numberWithPoints( totalInvoice );
|
||||
self.openstaand = dbo.helpers.numberWithPoints( Math.round( openstaand ) );
|
||||
self.openstaandIncl = dbo.helpers.numberWithPoints( Math.round( openstaand * 1.21 ) );
|
||||
self.invoicedOtherYears = dbo.helpers.numberWithPoints( Math.round( data.otheryear ) );
|
||||
self.invoicedCurentYear = dbo.helpers.numberWithPoints( Math.round( data.currentyear ) );
|
||||
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.missingForecast =
|
||||
dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced - data.otherforecast );
|
||||
|
||||
self.months = ko.observableArray( [] );
|
||||
_.each( data.months, function ( p ) {
|
||||
self.months.push( new vm.Month( p ) );
|
||||
|
||||
if ( !vm['forecast' + p.month] ) vm['forecast' + p.month] = ko.observable( 0 );
|
||||
vm['forecast' + p.month]( Number( vm['forecast' + p.month]() ) + Number( p.forecastamount ) );
|
||||
|
||||
if ( !vm['payment' + p.month] ) vm['payment' + p.month] = ko.observable( 0 );
|
||||
vm['payment' + p.month]( Number( vm['payment' + p.month]() ) + Number( p.paymentamount ) );
|
||||
} );
|
||||
},
|
||||
|
||||
Month: function ( data ) {
|
||||
this.forecastamount = dbo.helpers.numberWithPoints( Number( data.forecastamount ).toFixed( 0 ) );
|
||||
this.paymentamount = dbo.helpers.numberWithPoints( Number( data.paymentamount ).toFixed( 0 ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
dbo.outgoinginvoicesModel.init();
|
||||
|
||||
Reference in New Issue
Block a user