Diversen nav opmerkingen

This commit is contained in:
2018-05-03 19:54:32 +02:00
parent 6bc0b37f06
commit 860c5db95a
18 changed files with 405 additions and 143 deletions
+17 -27
View File
@@ -51,19 +51,14 @@ dbo.employeehoursreportInit = function () {
var vm = dbo.employeeHoursreportModel;
vm.initialize = true;
dbo.reportsDataService.getUsedYears( function ( data ) {
vm.years.removeAll();
_.each( data, function ( p ) {
vm.years.push( {id: p.year, year: p.year} );
} );
vm.selectedYear( (new Date()).getFullYear() );
vm.selectedMonthID( 0 );
vm.selectedYear( (new Date()).getFullYear() );
vm.selectedMonthID( 0 );
vm.validYear( true );
vm.initialize = false;
vm.initialize = false;
vm.initModule();
} );
vm.initModule();
},
initModule: function () {
@@ -73,18 +68,13 @@ dbo.employeehoursreportInit = function () {
},
checkYear: function () {
var vm = dbo.monthlyEmployeeHoursModel;
if ( timeout ) {
clearTimeout( timeout );
timeout = null;
}
timeout = setTimeout( function () {
vm.validYear( true );
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
vm.initModule();
}, 700 );
var vm = dbo.employeeHoursreportModel;
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
vm.validYear( true );
vm.initModule();
},
setActivetab: function ( tab ) {
@@ -125,7 +115,7 @@ dbo.employeehoursreportInit = function () {
vm.nonprofitablehoursTotaal( Math.round( vm.nonprofitablehoursTotaal() + Number( p.nonprofitablehours ) ) );
vm.nonprojecthoursTotaal( Math.round( vm.nonprojecthoursTotaal() + Number( p.nonprojecthours ) ) );
vm.totalhoursTotaal( Math.round( vm.totalhoursTotaal() + Number( p.totalhours ) ) );
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours / 12 ) ) );
vm.targetTotaal( Math.round( vm.targetTotaal() + Number( p.targethours ) ) );
vm.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
chartData.labels.push( p.fullname );
@@ -135,7 +125,7 @@ dbo.employeehoursreportInit = function () {
} );
vm.occupancyRateTotalTotaal( Math.round( (vm.totalhoursTotaal() / vm.targetTotaal()) * 100 ) );
vm.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 100 ) );
vm.occupancyRateInvoiceTotaal(Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ));
vm.occupancyRateInvoiceTotaal( Math.round( (vm.profitablehoursTotaal() / vm.targetTotaal()) * 100 ) );
vm.averageDayRateTotaal( Math.round( Number( vm.revenuesTotaal() ) / Number( vm.profitablehoursTotaal() ) ) * 8 );
vm.revenuesTotaal( dbo.helpers.thousandSeparator( vm.revenuesTotaal() ) );
@@ -160,10 +150,10 @@ dbo.employeehoursreportInit = function () {
this.nonprofitablehours = data.nonprofitablehours;
this.nonprojecthours = data.nonprojecthours;
this.totalhours = Math.round( data.totalhours );
this.target = Math.round( data.targethours / 12 );
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 );
this.target = dbo.helpers.numberWithPoints( Math.round( data.targethours ) );
this.occupancyRateTotal = Math.round( (data.totalhours / data.targethours) * 100 );
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours) * 100 );
this.occupancyRateInvoice = Math.round( (data.profitablehours / (data.targethours / 12)) * 100 );
this.occupancyRateInvoice = Math.round( (data.profitablehours / data.targethours) * 100 );
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );
}
@@ -23,24 +23,17 @@ dbo.outgoinginvoicesInit = function () {
months : ko.observableArray( dbo.monthArray ),
totalToInvoice : ko.observable(),
totalToInvoiceFuture: ko.observable(),
initialize : null,
validYear : ko.observable(),
init: function () {
var vm = dbo.outgoinginvoicesModel;
vm.initialize = true;
dbo.reportsDataService.getUsedYears( function ( data ) {
vm.years.removeAll();
_.each( data, function ( p ) {
vm.years.push( {id: p.year, year: p.year} );
} );
vm.selectedYear( (new Date()).getFullYear() );
vm.selectedMonthID( 0 );
vm.validYear(true);
vm.selectedYear( (new Date()).getFullYear() );
vm.selectedMonthID( 0 );
vm.initialize = false;
vm.initModule();
} );
vm.initModule();
},
setActivetab: function ( tab ) {
@@ -55,6 +48,16 @@ dbo.outgoinginvoicesInit = function () {
vm.refreshInvoiceDetails();
},
checkYear: function () {
var vm = dbo.outgoinginvoicesModel;
if ( !Number.isInteger( Number( vm.selectedYear() ) ) ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) > 2100 ) return vm.validYear( false );
if ( Number( vm.selectedYear() ) < 2000 ) return vm.validYear( false );
vm.validYear( true );
vm.initModule();
},
refreshInvoiceDetails: function () {
var vm = dbo.outgoinginvoicesModel;
+26 -4
View File
@@ -12,10 +12,14 @@ dbo.reservationsInit = function () {
} else {
dbo.reservationsModel = {
projects : ko.observableArray( [] ),
reservation: ko.observable(),
payed : ko.observable(),
saldo : ko.observable(),
projects : ko.observableArray( [] ),
costs : ko.observable(),
reservation : ko.observable(),
payed : ko.observable(),
saldo : ko.observable(),
saldoToPay : ko.observable(),
otherRevenue : ko.observable(),
saldoInvoices: ko.observable(),
init: function () {
var vm = dbo.reservationsModel;
@@ -29,17 +33,25 @@ dbo.reservationsInit = function () {
dbo.reservationsDataservice.getReservations( function ( data ) {
vm.projects.removeAll();
vm.costs( 0 );
vm.reservation( 0 );
vm.payed( 0 );
vm.saldo( 0 );
vm.saldoToPay( 0 );
vm.otherRevenue( 0 );
vm.saldoInvoices( 0 );
_.each( data, function ( p ) {
vm.projects.push( new vm.Project( p ) );
} );
vm.costs( dbo.helpers.numberWithPoints( vm.costs() ) );
vm.reservation( dbo.helpers.numberWithPoints( vm.reservation() ) );
vm.payed( dbo.helpers.numberWithPoints( vm.payed() ) );
vm.saldo( dbo.helpers.numberWithPoints( vm.saldo() ) );
vm.saldoToPay( dbo.helpers.numberWithPoints( vm.saldoToPay() ) );
vm.otherRevenue( dbo.helpers.numberWithPoints( vm.otherRevenue() ) );
vm.saldoInvoices( dbo.helpers.numberWithPoints( vm.saldoInvoices() ) );
} );
},
@@ -52,14 +64,22 @@ dbo.reservationsInit = function () {
var self = this;
self.projectnumber = data.projectnumber;
self.costs = dbo.helpers.numberWithPoints( data.costs );
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
self.payed = dbo.helpers.numberWithPoints( data.payed );
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
self.otherRevenue = dbo.helpers.numberWithPoints( data.other_revenue );
self.saldoInvoices = dbo.helpers.numberWithPoints( data.other_revenue - data.costs );
self.showExternals = ko.observable( false );
vm.costs( Number( vm.costs() ) + Number( data.costs ) );
vm.reservation( Number( vm.reservation() ) + Number( data.reservation ) );
vm.payed( Number( vm.payed() ) + Number( data.payed ) );
vm.saldo( Number( vm.saldo() ) + Number( data.saldo ) );
vm.saldoToPay( Number( vm.saldoToPay() ) + Number( data.saldoToPay ) );
vm.otherRevenue( Number( vm.otherRevenue() ) + Number( data.other_revenue ) );
vm.saldoInvoices( Number( vm.saldoInvoices() ) + Number( data.other_revenue - data.costs ) )
self.externals = ko.observableArray( [] );
_.each( data.externals, function ( p ) {
@@ -71,9 +91,11 @@ dbo.reservationsInit = function () {
var self = this;
self.externalName = data.external;
self.costs = dbo.helpers.numberWithPoints( data.costs );
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
self.payed = dbo.helpers.numberWithPoints( data.payed );
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
}