diversen opmerkingen

This commit is contained in:
2018-04-21 21:12:09 +02:00
parent 9187742658
commit e49fa05a9a
13 changed files with 303 additions and 37 deletions
+29 -12
View File
@@ -6,6 +6,7 @@
*/
dbo.employeehoursreportInit = function () {
var timeout;
if ( dbo.employeeHoursreportModel !== undefined ) {
dbo.employeeHoursreportModel.initModule();
@@ -14,7 +15,7 @@ dbo.employeehoursreportInit = function () {
dbo.employeeHoursreportModel = {
months : ko.observableArray( [
{monthID: 0, monthName : 'totaal'},
{monthID: 0, monthName: 'totaal'},
{monthID: 1, monthName: 'jan'},
{monthID: 2, monthName: 'febr'},
{monthID: 3, monthName: 'mrt'},
@@ -44,6 +45,7 @@ dbo.employeehoursreportInit = function () {
revenuesTotaal : ko.observable(),
averageDayRateTotaal : ko.observable(),
initialize : null,
validYear : ko.observable(),
init: function () {
var vm = dbo.employeeHoursreportModel;
@@ -70,6 +72,21 @@ dbo.employeehoursreportInit = function () {
vm.refreshTab();
},
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 );
},
setActivetab: function ( tab ) {
var vm = dbo.employeeHoursreportModel;
@@ -104,10 +121,10 @@ dbo.employeehoursreportInit = function () {
_.each( data, function ( p ) {
vm.employees.push( new vm.Employee( p ) );
vm.profitablehoursTotaal( Math.round(vm.profitablehoursTotaal() + Number( p.profitablehours )) );
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.profitablehoursTotaal( Math.round( vm.profitablehoursTotaal() + Number( p.profitablehours ) ) );
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.revenuesTotaal( Number( vm.revenuesTotaal() ) + Number( p.revenues ) );
@@ -117,14 +134,14 @@ dbo.employeehoursreportInit = function () {
chartData.hours.push( p.totalhours );
} );
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.occupancyRateHoursTotaal( Math.round( (vm.profitablehoursTotaal() / vm.totalhoursTotaal()) * 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() ) );
dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' );
dbo.charts.drawPie( 'hours-per-month', chartData.hours, chartData.labels, 'uren per medewerker' );
dbo.charts.drawHoursChart( 'average-rate', chartData.averageRate, chartData.labels, 'gemiddeld tarief', '#78be4b' );
// dbo.charts.drawPie( 'revenues-per-month', chartData.revenues, chartData.labels, 'omzet per medewerker' );
// dbo.charts.drawPie( 'hours-per-month', chartData.hours, chartData.labels, 'uren per medewerker' );
// dbo.charts.drawHoursChart( 'average-rate', chartData.averageRate, chartData.labels, 'gemiddeld tarief', '#78be4b' );
} );
},
@@ -142,10 +159,10 @@ dbo.employeehoursreportInit = function () {
this.profitablehours = data.profitablehours;
this.nonprofitablehours = data.nonprofitablehours;
this.nonprojecthours = data.nonprojecthours;
this.totalhours = Math.round(data.totalhours);
this.totalhours = Math.round( data.totalhours );
this.target = Math.round( data.targethours / 12 );
this.occupancyRateTotal = Math.round( (data.totalhours / (data.targethours / 12)) * 100 );
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours ) * 100 );
this.occupancyRateHours = Math.round( (data.profitablehours / data.totalhours) * 100 );
this.occupancyRateInvoice = Math.round( (data.profitablehours / (data.targethours / 12)) * 100 );
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
this.averageDayRate = Math.round( (data.revenues / data.profitablehours) * 8 );