Diverse wijzigingen nav word document
This commit is contained in:
@@ -103,6 +103,10 @@ th.rotate > div > span {
|
||||
border-right: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
th.sorting-field:hover{
|
||||
cursor: pointer;
|
||||
color:#222;
|
||||
}
|
||||
.pie-test{
|
||||
width:20px;
|
||||
height:20px;
|
||||
|
||||
@@ -8,32 +8,36 @@
|
||||
|
||||
dbo.reportsDataService = {
|
||||
|
||||
getUsedYears: function ( callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsdefaultController/getUsedYears' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
getUsedYears: function ( callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsdefaultController/getUsedYears' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
getRecapProjects: function(archive, callback){
|
||||
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
getRecapProjects: function ( field, direction, archive, callback ) {
|
||||
var submitDATA = {
|
||||
field : field,
|
||||
direction: direction
|
||||
};
|
||||
$.post( 'index.php/reports/reportsController/recapProjects/' + archive, submitDATA )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
}, 'JSON' );
|
||||
},
|
||||
|
||||
getEmployeeHours: function ( employeeID, year, callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsController/getMonthlyEmployeeHoursPerProject/' + employeeID + '/' + year )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
getEmployeeHours: function ( employeeID, year, callback ) {
|
||||
$.getJSON( 'index.php/reports/reportsController/getMonthlyEmployeeHoursPerProject/' + employeeID + '/' + year )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
saveCurrentFinnacialYear: function(projectID, amount, callback){
|
||||
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount:amount} )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
}, 'json' );
|
||||
}
|
||||
saveCurrentFinnacialYear: function ( projectID, amount, callback ) {
|
||||
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount: amount} )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
}, 'json' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,19 @@ dbo.userDataService = {
|
||||
} );
|
||||
},
|
||||
|
||||
getUniqueProjectEmployees: function ( callback ) {
|
||||
$.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
getUniqueProjectEmployees: function ( callback ) {
|
||||
$.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
getUniqueEmployeesWithActivity: function ( archive, callback ) {
|
||||
$.post( 'index.php/beheer/usersController/getUniqueEmployeesWithActivity/' + archive, 'json' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
checkUsername: function ( username, callback ) {
|
||||
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
||||
|
||||
+1117
-1088
File diff suppressed because it is too large
Load Diff
@@ -8,251 +8,252 @@
|
||||
|
||||
dbo.invoicereportInit = function () {
|
||||
|
||||
if ( dbo.invoicereport !== undefined ) {
|
||||
if ( dbo.invoicereport !== undefined ) {
|
||||
|
||||
dbo.invoicereport.initModule();
|
||||
dbo.invoicereport.initModule();
|
||||
|
||||
} else {
|
||||
dbo.invoicereport = {
|
||||
} else {
|
||||
dbo.invoicereport = {
|
||||
|
||||
selectedYear : ko.observable(),
|
||||
invoiceOverview : ko.observableArray( [] ),
|
||||
forecasts : ko.observableArray( [] ),
|
||||
monthForecasts : ko.observableArray( [] ),
|
||||
monthPayments : ko.observableArray( [] ),
|
||||
months : ko.observableArray( [] ),
|
||||
monthTotals : ko.observableArray( [] ),
|
||||
monthPaymentTotals : ko.observableArray( [] ),
|
||||
validYear : ko.observable(),
|
||||
invoiceTab : ko.observable(),
|
||||
totalToInvoicingExcl : ko.observable(),
|
||||
totalToInvoicingIncl : ko.observable(),
|
||||
totalInvoicedOtherYears: ko.observable(),
|
||||
totalInvoicedThisYear : ko.observable(),
|
||||
totalPayment : ko.observable(),
|
||||
totalToPay : ko.observable(),
|
||||
invoicesTotal : ko.observable(),
|
||||
needInvoice : ko.observable(),
|
||||
forecastThisYear : ko.observable(),
|
||||
forecastOtherYears : ko.observable(),
|
||||
forecastRemaining : ko.observable(),
|
||||
totalProjectPayments : ko.observable(),
|
||||
orderType : 'projectnumber',
|
||||
orderDirection : false,
|
||||
archive : ko.observable( false ),
|
||||
selectedYear : ko.observable(),
|
||||
invoiceOverview : ko.observableArray( [] ),
|
||||
forecasts : ko.observableArray( [] ),
|
||||
monthForecasts : ko.observableArray( [] ),
|
||||
monthPayments : ko.observableArray( [] ),
|
||||
months : ko.observableArray( [] ),
|
||||
monthTotals : ko.observableArray( [] ),
|
||||
monthPaymentTotals : ko.observableArray( [] ),
|
||||
validYear : ko.observable(),
|
||||
invoiceTab : ko.observable(),
|
||||
totalToInvoicingExcl : ko.observable(),
|
||||
totalToInvoicingIncl : ko.observable(),
|
||||
totalInvoicedOtherYears: ko.observable(),
|
||||
totalInvoicedThisYear : ko.observable(),
|
||||
totalPayment : ko.observable(),
|
||||
totalToPay : ko.observable(),
|
||||
invoicesTotal : ko.observable(),
|
||||
needInvoice : ko.observable(),
|
||||
forecastThisYear : ko.observable(),
|
||||
forecastOtherYears : ko.observable(),
|
||||
forecastRemaining : ko.observable(),
|
||||
totalProjectPayments : ko.observable(),
|
||||
orderType : 'projectnumber',
|
||||
orderDirection : false,
|
||||
archive : ko.observable( false ),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
init: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.selectedYear( (new Date()).getFullYear() );
|
||||
vm.invoiceTab( 'invoice' );
|
||||
vm.validYear( true );
|
||||
vm.months( dbo.monthArray );
|
||||
vm.selectedYear( (new Date()).getFullYear() );
|
||||
vm.invoiceTab( 'invoice' );
|
||||
vm.validYear( true );
|
||||
vm.months( dbo.monthArray );
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
initModule: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
initModule: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.resetTotals();
|
||||
vm.resetTotals();
|
||||
|
||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
|
||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
|
||||
vm.invoiceOverview( data.invoiceOverview );
|
||||
vm.setInvoiceOverviewTotals( data.invoiceOverview );
|
||||
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), vm.orderType, orderDirection, archive, function ( data ) {
|
||||
vm.invoiceOverview( data.invoiceOverview );
|
||||
vm.setInvoiceOverviewTotals( data.invoiceOverview );
|
||||
|
||||
vm.forecasts( data.forecasts );
|
||||
vm.setForecastsTotals( data.forecasts );
|
||||
vm.forecasts( data.forecasts );
|
||||
vm.setForecastsTotals( data.forecasts );
|
||||
|
||||
vm.monthForecasts.removeAll();
|
||||
_.each( data.monthForecasts, function ( p ) {
|
||||
vm.monthForecasts.push( new vm.Monthforecast( p ) );
|
||||
} );
|
||||
_.each( vm.monthTotals(), function ( p ) {
|
||||
p.forecastamount( dbo.helpers.thousandSeparator( p.forecastamount() ) );
|
||||
} );
|
||||
vm.monthForecasts.removeAll();
|
||||
_.each( data.monthForecasts, function ( p ) {
|
||||
vm.monthForecasts.push( new vm.Monthforecast( p ) );
|
||||
} );
|
||||
_.each( vm.monthTotals(), function ( p ) {
|
||||
p.forecastamount( dbo.helpers.thousandSeparator( p.forecastamount() ) );
|
||||
} );
|
||||
|
||||
vm.monthPayments.removeAll();
|
||||
_.each( data.monthPayments, function ( p ) {
|
||||
vm.monthPayments.push( new vm.Monthpayment( p ) );
|
||||
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
|
||||
console.log( vm.totalProjectPayments() );
|
||||
} );
|
||||
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
|
||||
_.each( vm.monthPaymentTotals(), function ( p ) {
|
||||
p.paymentamount( dbo.helpers.thousandSeparator( p.paymentamount() ) );
|
||||
} );
|
||||
vm.monthPayments.removeAll();
|
||||
_.each( data.monthPayments, function ( p ) {
|
||||
vm.monthPayments.push( new vm.Monthpayment( p ) );
|
||||
vm.totalProjectPayments( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
|
||||
} );
|
||||
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
|
||||
_.each( vm.monthPaymentTotals(), function ( p ) {
|
||||
p.paymentamount( dbo.helpers.thousandSeparator( p.paymentamount() ) );
|
||||
} );
|
||||
|
||||
} );
|
||||
},
|
||||
} );
|
||||
},
|
||||
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
vm.archive( !vm.archive() );
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
vm.archive( !vm.archive() );
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
sortList: function ( orderType ) {
|
||||
var vm = dbo.invoicereport;
|
||||
sortList: function ( orderType ) {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.orderType = orderType;
|
||||
vm.orderDirection = !vm.orderDirection;
|
||||
vm.orderType = orderType;
|
||||
vm.orderDirection = !vm.orderDirection;
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
resetTotals: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
resetTotals: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.totalToInvoicingExcl( 0 );
|
||||
vm.totalToInvoicingIncl( 0 );
|
||||
vm.totalInvoicedOtherYears( 0 );
|
||||
vm.totalInvoicedThisYear( 0 );
|
||||
vm.invoicesTotal( 0 );
|
||||
vm.totalPayment( 0 );
|
||||
vm.totalToPay( 0 );
|
||||
vm.needInvoice( 0 );
|
||||
vm.forecastThisYear( 0 );
|
||||
vm.forecastOtherYears( 0 );
|
||||
vm.forecastRemaining( 0 );
|
||||
vm.totalProjectPayments( 0 );
|
||||
vm.totalToInvoicingExcl( 0 );
|
||||
vm.totalToInvoicingIncl( 0 );
|
||||
vm.totalInvoicedOtherYears( 0 );
|
||||
vm.totalInvoicedThisYear( 0 );
|
||||
vm.invoicesTotal( 0 );
|
||||
vm.totalPayment( 0 );
|
||||
vm.totalToPay( 0 );
|
||||
vm.needInvoice( Number( 0 ) );
|
||||
vm.forecastThisYear( 0 );
|
||||
vm.forecastOtherYears( 0 );
|
||||
vm.forecastRemaining( 0 );
|
||||
vm.totalProjectPayments( 0 );
|
||||
|
||||
vm.monthTotals.removeAll();
|
||||
vm.monthPaymentTotals.removeAll();
|
||||
for ( var i = 1; i <= 12; i++ ) {
|
||||
vm.monthTotals.push( {monthID: i, forecastamount: ko.observable( 0 )} );
|
||||
vm.monthPaymentTotals.push( {monthID: i, paymentamount: ko.observable( 0 )} );
|
||||
}
|
||||
},
|
||||
vm.monthTotals.removeAll();
|
||||
vm.monthPaymentTotals.removeAll();
|
||||
for ( var i = 1; i <= 12; i++ ) {
|
||||
vm.monthTotals.push( {monthID: i, forecastamount: ko.observable( 0 )} );
|
||||
vm.monthPaymentTotals.push( {monthID: i, paymentamount: ko.observable( 0 )} );
|
||||
}
|
||||
},
|
||||
|
||||
setInvoiceOverviewTotals: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
setInvoiceOverviewTotals: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
vm.totalToInvoicingExcl( vm.totalToInvoicingExcl() + Number( p.totalToInvoicingExcl.replace( '.', '' ) ) );
|
||||
vm.totalToInvoicingIncl( vm.totalToInvoicingIncl() + Number( p.totalToInvoicingIncl.replace( '.', '' ) ) );
|
||||
vm.totalInvoicedOtherYears( vm.totalInvoicedOtherYears() + Number( p.totalInvoicedOtherYears.replace( '.', '' ) ) );
|
||||
vm.totalInvoicedThisYear( vm.totalInvoicedThisYear() + Number( p.totalInvoicedThisYear.replace( '.', '' ) ) );
|
||||
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
|
||||
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
|
||||
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
|
||||
vm.needInvoice( vm.needInvoice() + Number( p.needInvoice.replace( '.', '' ) ) );
|
||||
} );
|
||||
_.each( data, function ( p ) {
|
||||
vm.totalToInvoicingExcl( vm.totalToInvoicingExcl() + Number( p.totalToInvoicingExcl.replace( '.', '' ) ) );
|
||||
vm.totalToInvoicingIncl( vm.totalToInvoicingIncl() + Number( p.totalToInvoicingIncl.replace( '.', '' ) ) );
|
||||
vm.totalInvoicedOtherYears( vm.totalInvoicedOtherYears() + Number( p.totalInvoicedOtherYears.replace( '.', '' ) ) );
|
||||
vm.totalInvoicedThisYear( vm.totalInvoicedThisYear() + Number( p.totalInvoicedThisYear.replace( '.', '' ) ) );
|
||||
vm.invoicesTotal( vm.invoicesTotal() + Number( p.invoicesTotal.replace( '.', '' ) ) );
|
||||
vm.totalPayment( vm.totalPayment() + Number( p.projectPayment.replace( '.', '' ) ) );
|
||||
vm.totalToPay( vm.totalToPay() + Number( p.invoiceToPay.replace( '.', '' ) ) );
|
||||
vm.needInvoice( Number( vm.needInvoice() ) + Number( p.needInvoice.replace( '.', '' ) ) );
|
||||
} );
|
||||
|
||||
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
||||
vm.totalToInvoicingIncl( dbo.helpers.thousandSeparator( vm.totalToInvoicingIncl() ) );
|
||||
vm.totalInvoicedOtherYears( dbo.helpers.thousandSeparator( vm.totalInvoicedOtherYears() ) );
|
||||
vm.totalInvoicedThisYear( dbo.helpers.thousandSeparator( vm.totalInvoicedThisYear() ) );
|
||||
vm.invoicesTotal( dbo.helpers.thousandSeparator( vm.invoicesTotal() ) );
|
||||
vm.totalPayment( dbo.helpers.thousandSeparator( vm.totalPayment() ) );
|
||||
vm.totalToPay( dbo.helpers.thousandSeparator( vm.totalToPay() ) );
|
||||
vm.needInvoice( dbo.helpers.thousandSeparator( vm.needInvoice() ) );
|
||||
},
|
||||
vm.totalToInvoicingExcl( dbo.helpers.thousandSeparator( vm.totalToInvoicingExcl() ) );
|
||||
vm.totalToInvoicingIncl( dbo.helpers.thousandSeparator( vm.totalToInvoicingIncl() ) );
|
||||
vm.totalInvoicedOtherYears( dbo.helpers.thousandSeparator( vm.totalInvoicedOtherYears() ) );
|
||||
vm.totalInvoicedThisYear( dbo.helpers.thousandSeparator( vm.totalInvoicedThisYear() ) );
|
||||
vm.invoicesTotal( dbo.helpers.thousandSeparator( vm.invoicesTotal() ) );
|
||||
vm.totalPayment( dbo.helpers.thousandSeparator( vm.totalPayment() ) );
|
||||
vm.totalToPay( dbo.helpers.thousandSeparator( vm.totalToPay() ) );
|
||||
vm.needInvoice( dbo.helpers.thousandSeparator( vm.needInvoice() ) );
|
||||
},
|
||||
|
||||
setForecastsTotals: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
setForecastsTotals: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
vm.forecastThisYear( vm.forecastThisYear() + Number( p.forecastThisYear.replace( '.', '' ) ) );
|
||||
vm.forecastOtherYears( vm.forecastOtherYears() + Number( p.forecastOtherYears.replace( '.', '' ) ) );
|
||||
vm.forecastRemaining( vm.forecastRemaining() + Number( p.forecastRemaining.replace( '.', '' ) ) );
|
||||
} );
|
||||
vm.forecastThisYear( dbo.helpers.thousandSeparator( vm.forecastThisYear() ) );
|
||||
vm.forecastOtherYears( dbo.helpers.thousandSeparator( vm.forecastOtherYears() ) );
|
||||
vm.forecastRemaining( dbo.helpers.thousandSeparator( vm.forecastRemaining() ) );
|
||||
},
|
||||
_.each( data, function ( p ) {
|
||||
vm.forecastThisYear( vm.forecastThisYear() + Number( p.forecastThisYear.replace( '.', '' ) ) );
|
||||
vm.forecastOtherYears( vm.forecastOtherYears() + Number( p.forecastOtherYears.replace( '.', '' ) ) );
|
||||
vm.forecastRemaining( vm.forecastRemaining() + Number( p.forecastRemaining.replace( '.', '' ) ) );
|
||||
} );
|
||||
vm.forecastThisYear( dbo.helpers.thousandSeparator( vm.forecastThisYear() ) );
|
||||
vm.forecastOtherYears( dbo.helpers.thousandSeparator( vm.forecastOtherYears() ) );
|
||||
vm.forecastRemaining( dbo.helpers.thousandSeparator( vm.forecastRemaining() ) );
|
||||
},
|
||||
|
||||
setForecastMonthsTotals: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
setForecastMonthsTotals: function ( data ) {
|
||||
console.log( data );
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
_.each( data, function ( p ) {
|
||||
_.each( p.forecastMonths(), function ( q ) {
|
||||
vm.forecastMonths( vm.forecastMonths() + q );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
_.each( data, function ( p ) {
|
||||
_.each( p.forecastMonths(), function ( q ) {
|
||||
vm.forecastMonths( vm.forecastMonths() + q );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
checkYear: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
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 );
|
||||
checkYear: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
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();
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
setActivetab: function ( page ) {
|
||||
var vm = dbo.invoicereport;
|
||||
setActivetab: function ( page ) {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
vm.invoiceTab( page );
|
||||
},
|
||||
vm.invoiceTab( page );
|
||||
},
|
||||
|
||||
Monthforecast: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer;
|
||||
self.needInvoice = data.needInvoice;
|
||||
self.forecastOtherYears = data.forecastOtherYears;
|
||||
self.forecastRemaining = data.forecastRemaining;
|
||||
Monthforecast: function ( data ) {
|
||||
console.log( data );
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer;
|
||||
self.needInvoice = data.needInvoice;
|
||||
self.forecastOtherYears = data.forecastOtherYears;
|
||||
self.forecastRemaining = data.forecastRemaining;
|
||||
|
||||
self.forecastMonths = ko.observableArray( [] );
|
||||
_.each( data.forecastMonths, function ( p, i ) {
|
||||
self.forecastMonths.push( new vm.ForecastMonth( p ) );
|
||||
_.each( vm.monthTotals(), function ( q ) {
|
||||
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
self.forecastMonths = ko.observableArray( [] );
|
||||
_.each( data.forecastMonths, function ( p, i ) {
|
||||
self.forecastMonths.push( new vm.ForecastMonth( p ) );
|
||||
_.each( vm.monthTotals(), function ( q ) {
|
||||
if ( q.monthID == (i + 1) ) q.forecastamount( Math.round( Number( q.forecastamount() ) ) + Math.round( Number( p.forecastamount ) ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
ForecastMonth: function ( data ) {
|
||||
this.forecastamount = dbo.helpers.thousandSeparator( data.forecastamount );
|
||||
},
|
||||
ForecastMonth: function ( data ) {
|
||||
this.forecastamount = dbo.helpers.thousandSeparator( Math.round( data.forecastamount ) );
|
||||
},
|
||||
|
||||
Monthpayment: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer;
|
||||
self.totalProjectPayments = data.totalProjectPayments;
|
||||
Monthpayment: function ( data ) {
|
||||
var vm = dbo.invoicereport;
|
||||
var self = this;
|
||||
self.projectname = data.projectname;
|
||||
self.customer = data.customer;
|
||||
self.totalProjectPayments = data.totalProjectPayments;
|
||||
|
||||
self.paymentMonths = ko.observableArray( [] );
|
||||
_.each( data.monthPayments, function ( p, i ) {
|
||||
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
||||
_.each( vm.monthPaymentTotals(), function ( q ) {
|
||||
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
self.paymentMonths = ko.observableArray( [] );
|
||||
_.each( data.monthPayments, function ( p, i ) {
|
||||
self.paymentMonths.push( new vm.PaymentMonth( p ) );
|
||||
_.each( vm.monthPaymentTotals(), function ( q ) {
|
||||
if ( q.monthID == i ) q.paymentamount( Math.round(Number( q.paymentamount()) ) + Math.round(Number( p.paymentamount ) ));
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
PaymentMonth: function ( data ) {
|
||||
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
|
||||
},
|
||||
PaymentMonth: function ( data ) {
|
||||
this.paymentamount = dbo.helpers.thousandSeparator( Math.round(data.paymentamount) );
|
||||
},
|
||||
|
||||
createSpreadsheet: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
createSpreadsheet: function () {
|
||||
var vm = dbo.invoicereport;
|
||||
|
||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
var orderDirection = vm.orderDirection ? 'ASC' : 'DESC';
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
|
||||
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive;
|
||||
window.open( url, '_blank' );
|
||||
}
|
||||
}
|
||||
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear() + '/' + vm.orderType + '/' + orderDirection + '/' + archive;
|
||||
window.open( url, '_blank' );
|
||||
}
|
||||
}
|
||||
|
||||
dbo.invoicereport.init();
|
||||
dbo.invoicereport.init();
|
||||
|
||||
ko.applyBindings(
|
||||
dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) );
|
||||
ko.applyBindings(
|
||||
dbo.invoicereport, document.getElementById( "INVOICEREPORT" ) );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,462 +6,478 @@
|
||||
*/
|
||||
|
||||
dbo.monthlyemployeehoursInit = function () {
|
||||
var timeout;
|
||||
var timeout;
|
||||
|
||||
if ( dbo.monthlyEmployeeHoursModel !== undefined ) {
|
||||
if ( dbo.monthlyEmployeeHoursModel !== undefined ) {
|
||||
|
||||
dbo.monthlyEmployeeHoursModel.initModule();
|
||||
dbo.monthlyEmployeeHoursModel.initModule();
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
dbo.monthlyEmployeeHoursModel = {
|
||||
dbo.monthlyEmployeeHoursModel = {
|
||||
|
||||
uniqueEmployees : ko.observableArray( [] ),
|
||||
uniqueYears : ko.observableArray( [] ),
|
||||
sluggy : ko.observable( 'euro' ),
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
currentTab : false,
|
||||
recap : ko.observableArray( [] ),
|
||||
totalPerEmployee : ko.observableArray( [] ),
|
||||
totalEmployeeRevenues : ko.observable(),
|
||||
totalAvailableRevenues : ko.observable(),
|
||||
totalEmployeeHours : ko.observable(),
|
||||
totalEmployeeAvailableHours: ko.observable(),
|
||||
totalBudget : ko.observable(),
|
||||
totalOwnRevenue : ko.observable(),
|
||||
totalCosts : ko.observable(),
|
||||
totalAvailableBudget : ko.observable(),
|
||||
totalSaldo : ko.observable(),
|
||||
totalOwp : ko.observable(),
|
||||
totalWorkInProgress : ko.observable(),
|
||||
totalCurrentFinancialYear : ko.observable(),
|
||||
totalNextFinancialYear : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
validYear : ko.observable( true ),
|
||||
archive : ko.observable(),
|
||||
uniqueEmployees : ko.observableArray( [] ),
|
||||
uniqueYears : ko.observableArray( [] ),
|
||||
sluggy : ko.observable( 'euro' ),
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
currentTab : false,
|
||||
recap : ko.observableArray( [] ),
|
||||
totalPerEmployee : ko.observableArray( [] ),
|
||||
totalEmployeeRevenues : ko.observable(),
|
||||
totalAvailableRevenues : ko.observable(),
|
||||
totalEmployeeHours : ko.observable(),
|
||||
totalEmployeeAvailableHours: ko.observable(),
|
||||
totalBudget : ko.observable(),
|
||||
totalOwnRevenue : ko.observable(),
|
||||
totalCosts : ko.observable(),
|
||||
totalAvailableBudget : ko.observable(),
|
||||
totalSaldo : ko.observable(),
|
||||
totalOwp : ko.observable(),
|
||||
totalWorkInProgress : ko.observable(),
|
||||
totalCurrentFinancialYear : ko.observable(),
|
||||
totalNextFinancialYear : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
validYear : ko.observable( true ),
|
||||
archive : ko.observable(),
|
||||
field : 'projectnumber',
|
||||
direction : 'asc',
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
||||
vm.years( dbo.years )
|
||||
vm.selectedYear( dbo.currentYear );
|
||||
} );
|
||||
dbo.reportsDataService.getUsedYears( function ( data ) {
|
||||
vm.years( dbo.years )
|
||||
vm.selectedYear( dbo.currentYear );
|
||||
} );
|
||||
|
||||
vm.initModule();
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
initModule: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
vm.totalBudget( 0 );
|
||||
vm.totalOwnRevenue( 0 );
|
||||
vm.totalCosts( 0 );
|
||||
vm.totalAvailableBudget( 0 );
|
||||
vm.totalSaldo( 0 );
|
||||
vm.totalWorkInProgress( 0 );
|
||||
vm.totalEmployeeRevenues( 0 );
|
||||
vm.totalAvailableRevenues( 0 )
|
||||
vm.totalEmployeeHours( 0 );
|
||||
vm.totalEmployeeAvailableHours( 0 );
|
||||
vm.totalOwp( 0 );
|
||||
vm.totalPerEmployee.removeAll();
|
||||
vm.totalInvoicedYear.removeAll();
|
||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||
vm.uniqueEmployees.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||
} );
|
||||
} );
|
||||
initModule: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
|
||||
var archive = vm.archive() ? 'T' : 'F';
|
||||
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
|
||||
vm.recap.removeAll();
|
||||
vm.uniqueYears.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
if ( i == 0 ) {
|
||||
$.each( p.invoiced, function ( y, q ) {
|
||||
vm.uniqueYears.push( {year: q.year} );
|
||||
} );
|
||||
}
|
||||
vm.recap.push( new vm.Project( p ) )
|
||||
} );
|
||||
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
||||
vm.totalOwnRevenue( dbo.helpers.thousandSeparator( vm.totalOwnRevenue() ) );
|
||||
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
||||
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
||||
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
||||
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
||||
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
||||
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
|
||||
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
|
||||
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
||||
} );
|
||||
_.each( vm.totalInvoicedYear(), function ( p ) {
|
||||
p.totalInvoiced( dbo.helpers.thousandSeparator( p.totalInvoiced() ) );
|
||||
} );
|
||||
var chartData = [];
|
||||
var chartLabels = [];
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
chartData.push( Number( p.totalRevenue().replace( '.', '' ) ) );
|
||||
chartLabels.push( p.fullname );
|
||||
} );
|
||||
var chartDataProjects = [];
|
||||
var chartLabelsProjects = [];
|
||||
var chartDataOwh = [];
|
||||
var chartColorOwh = [];
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
chartDataProjects.push( Number( p.totalEmployeeRevenues.replace( '.', '' ) ) );
|
||||
chartLabelsProjects.push( p.projectname );
|
||||
chartDataOwh.push( Number( p.workInProgress.replace( '.', '' ) ) );
|
||||
chartColorOwh.push( Number( p.workInProgress.replace( '.', '' ) ) < 0 ? '#d53d24' : '#78be4b' );
|
||||
} );
|
||||
vm.totalBudget( 0 );
|
||||
vm.totalOwnRevenue( 0 );
|
||||
vm.totalCosts( 0 );
|
||||
vm.totalAvailableBudget( 0 );
|
||||
vm.totalSaldo( 0 );
|
||||
vm.totalWorkInProgress( 0 );
|
||||
vm.totalEmployeeRevenues( 0 );
|
||||
vm.totalAvailableRevenues( 0 )
|
||||
vm.totalEmployeeHours( 0 );
|
||||
vm.totalEmployeeAvailableHours( 0 );
|
||||
vm.totalOwp( 0 );
|
||||
vm.totalPerEmployee.removeAll();
|
||||
vm.totalInvoicedYear.removeAll();
|
||||
dbo.userDataService.getUniqueEmployeesWithActivity( archive, function ( data ) {
|
||||
vm.uniqueEmployees.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
|
||||
} );
|
||||
} );
|
||||
|
||||
dbo.reportsDataService.getRecapProjects( vm.field, vm.direction, archive, function ( data ) {
|
||||
vm.recap.removeAll();
|
||||
vm.uniqueYears.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
if ( i == 0 ) {
|
||||
$.each( p.invoiced, function ( y, q ) {
|
||||
vm.uniqueYears.push( {year: q.year} );
|
||||
} );
|
||||
}
|
||||
vm.recap.push( new vm.Project( p ) )
|
||||
} );
|
||||
vm.totalBudget( dbo.helpers.thousandSeparator( vm.totalBudget() ) );
|
||||
vm.totalOwnRevenue( dbo.helpers.thousandSeparator( vm.totalOwnRevenue() ) );
|
||||
vm.totalCosts( dbo.helpers.thousandSeparator( vm.totalCosts() ) );
|
||||
vm.totalAvailableBudget( dbo.helpers.thousandSeparator( vm.totalAvailableBudget() ) );
|
||||
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
||||
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
||||
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
||||
vm.totalAvailableRevenues( dbo.helpers.thousandSeparator( vm.totalAvailableRevenues() ) );
|
||||
vm.totalOwp( dbo.helpers.thousandSeparator( vm.totalOwp() ) );
|
||||
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
||||
} );
|
||||
_.each( vm.totalInvoicedYear(), function ( p ) {
|
||||
p.totalInvoiced( dbo.helpers.thousandSeparator( p.totalInvoiced() ) );
|
||||
} );
|
||||
var chartData = [];
|
||||
var chartLabels = [];
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
chartData.push( Number( p.totalRevenue().replace( '.', '' ) ) );
|
||||
chartLabels.push( p.fullname );
|
||||
} );
|
||||
var chartDataProjects = [];
|
||||
var chartLabelsProjects = [];
|
||||
var chartDataOwh = [];
|
||||
var chartColorOwh = [];
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
chartDataProjects.push( Number( p.totalEmployeeRevenues.replace( '.', '' ) ) );
|
||||
chartLabelsProjects.push( p.projectname );
|
||||
chartDataOwh.push( Number( p.workInProgress.replace( '.', '' ) ) );
|
||||
chartColorOwh.push( Number( p.workInProgress.replace( '.', '' ) ) < 0 ? '#d53d24' : '#78be4b' );
|
||||
} );
|
||||
// dbo.charts.drawPie( 'recap-revenues', chartData, chartLabels, 'omzet per medewerker' );
|
||||
// dbo.charts.drawPie( 'recap-revenues-project', chartDataProjects, chartLabelsProjects, 'omzet per project' );
|
||||
// dbo.charts.drawHoursChart( 'recap-owh', chartDataOwh, chartLabelsProjects, 'onderhandenwerk per project', chartColorOwh );
|
||||
} );
|
||||
},
|
||||
} );
|
||||
},
|
||||
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
setSorting: function ( field ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
if ( vm.field == field ) {
|
||||
vm.direction = vm.direction == 'desc' ? 'asc' : 'desc';
|
||||
} else {
|
||||
vm.direction = 'asc';
|
||||
}
|
||||
|
||||
vm.archive( !vm.archive() );
|
||||
vm.initModule();
|
||||
},
|
||||
vm.field = field;
|
||||
|
||||
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 );
|
||||
},
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
refreshTab: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
toggleArchive: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
if ( vm.currentTab == false ) return;
|
||||
vm.archive( !vm.archive() );
|
||||
vm.initModule();
|
||||
},
|
||||
|
||||
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
||||
vm.currentTab.myData( data );
|
||||
vm.currentTab.totalJanuari( 0 );
|
||||
vm.currentTab.totalFebruari( 0 );
|
||||
vm.currentTab.totalMaart( 0 );
|
||||
vm.currentTab.totalApril( 0 );
|
||||
vm.currentTab.totalMei( 0 );
|
||||
vm.currentTab.totalJuni( 0 );
|
||||
vm.currentTab.totalJuli( 0 );
|
||||
vm.currentTab.totalAugustus( 0 );
|
||||
vm.currentTab.totalSeptember( 0 );
|
||||
vm.currentTab.totalOktober( 0 );
|
||||
vm.currentTab.totalNovember( 0 );
|
||||
vm.currentTab.totalDecember( 0 );
|
||||
vm.currentTab.totalTotal( 0 );
|
||||
vm.currentTab.totalTotalOtheryears( 0 );
|
||||
vm.currentTab.totalJanuariRevenue( 0 );
|
||||
vm.currentTab.totalFebruariRevenue( 0 );
|
||||
vm.currentTab.totalMaartRevenue( 0 );
|
||||
vm.currentTab.totalAprilRevenue( 0 );
|
||||
vm.currentTab.totalMeiRevenue( 0 );
|
||||
vm.currentTab.totalJuniRevenue( 0 );
|
||||
vm.currentTab.totalJuliRevenue( 0 );
|
||||
vm.currentTab.totalAugustusRevenue( 0 );
|
||||
vm.currentTab.totalSeptemberRevenue( 0 );
|
||||
vm.currentTab.totalOktoberRevenue( 0 );
|
||||
vm.currentTab.totalNovemberRevenue( 0 );
|
||||
vm.currentTab.totalDecemberRevenue( 0 );
|
||||
vm.currentTab.totalTotalRevenue( 0 );
|
||||
vm.currentTab.totalTotalOtheryearsRevenue( 0 );
|
||||
vm.currentTab.totalHoursChart = [];
|
||||
vm.currentTab.totalHoursRevenueChart = [];
|
||||
vm.currentTab.projectChart = [];
|
||||
$.each( vm.currentTab.myData(), function ( i, q ) {
|
||||
vm.currentTab.tarif( q.tarif );
|
||||
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
|
||||
vm.currentTab.totalFebruari( vm.currentTab.totalFebruari() + q.februari );
|
||||
vm.currentTab.totalMaart( vm.currentTab.totalMaart() + q.maart );
|
||||
vm.currentTab.totalApril( vm.currentTab.totalApril() + q.april );
|
||||
vm.currentTab.totalMei( vm.currentTab.totalMei() + q.mei );
|
||||
vm.currentTab.totalJuni( vm.currentTab.totalJuni() + q.juni );
|
||||
vm.currentTab.totalJuli( vm.currentTab.totalJuli() + q.juli );
|
||||
vm.currentTab.totalAugustus( vm.currentTab.totalAugustus() + q.augustus );
|
||||
vm.currentTab.totalSeptember( vm.currentTab.totalSeptember() + q.september );
|
||||
vm.currentTab.totalOktober( vm.currentTab.totalOktober() + q.oktober );
|
||||
vm.currentTab.totalNovember( vm.currentTab.totalNovember() + q.november );
|
||||
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
|
||||
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
|
||||
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
|
||||
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 );
|
||||
},
|
||||
|
||||
vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue );
|
||||
vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue );
|
||||
vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue );
|
||||
vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue );
|
||||
vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue );
|
||||
vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue );
|
||||
vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue );
|
||||
vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue );
|
||||
vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue );
|
||||
vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue );
|
||||
vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue );
|
||||
vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue );
|
||||
vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue );
|
||||
vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue );
|
||||
refreshTab: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
vm.currentTab.projectChart.push( q.projectname );
|
||||
vm.currentTab.totalHoursChart.push( q.totalhours );
|
||||
vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue );
|
||||
} );
|
||||
vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()];
|
||||
vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()];
|
||||
if ( vm.currentTab == false ) return;
|
||||
|
||||
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
||||
vm.currentTab.myData( data );
|
||||
vm.currentTab.totalJanuari( 0 );
|
||||
vm.currentTab.totalFebruari( 0 );
|
||||
vm.currentTab.totalMaart( 0 );
|
||||
vm.currentTab.totalApril( 0 );
|
||||
vm.currentTab.totalMei( 0 );
|
||||
vm.currentTab.totalJuni( 0 );
|
||||
vm.currentTab.totalJuli( 0 );
|
||||
vm.currentTab.totalAugustus( 0 );
|
||||
vm.currentTab.totalSeptember( 0 );
|
||||
vm.currentTab.totalOktober( 0 );
|
||||
vm.currentTab.totalNovember( 0 );
|
||||
vm.currentTab.totalDecember( 0 );
|
||||
vm.currentTab.totalTotal( 0 );
|
||||
vm.currentTab.totalTotalOtheryears( 0 );
|
||||
vm.currentTab.totalJanuariRevenue( 0 );
|
||||
vm.currentTab.totalFebruariRevenue( 0 );
|
||||
vm.currentTab.totalMaartRevenue( 0 );
|
||||
vm.currentTab.totalAprilRevenue( 0 );
|
||||
vm.currentTab.totalMeiRevenue( 0 );
|
||||
vm.currentTab.totalJuniRevenue( 0 );
|
||||
vm.currentTab.totalJuliRevenue( 0 );
|
||||
vm.currentTab.totalAugustusRevenue( 0 );
|
||||
vm.currentTab.totalSeptemberRevenue( 0 );
|
||||
vm.currentTab.totalOktoberRevenue( 0 );
|
||||
vm.currentTab.totalNovemberRevenue( 0 );
|
||||
vm.currentTab.totalDecemberRevenue( 0 );
|
||||
vm.currentTab.totalTotalRevenue( 0 );
|
||||
vm.currentTab.totalTotalOtheryearsRevenue( 0 );
|
||||
vm.currentTab.totalHoursChart = [];
|
||||
vm.currentTab.totalHoursRevenueChart = [];
|
||||
vm.currentTab.projectChart = [];
|
||||
$.each( vm.currentTab.myData(), function ( i, q ) {
|
||||
vm.currentTab.tarif( q.tarif );
|
||||
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
|
||||
vm.currentTab.totalFebruari( vm.currentTab.totalFebruari() + q.februari );
|
||||
vm.currentTab.totalMaart( vm.currentTab.totalMaart() + q.maart );
|
||||
vm.currentTab.totalApril( vm.currentTab.totalApril() + q.april );
|
||||
vm.currentTab.totalMei( vm.currentTab.totalMei() + q.mei );
|
||||
vm.currentTab.totalJuni( vm.currentTab.totalJuni() + q.juni );
|
||||
vm.currentTab.totalJuli( vm.currentTab.totalJuli() + q.juli );
|
||||
vm.currentTab.totalAugustus( vm.currentTab.totalAugustus() + q.augustus );
|
||||
vm.currentTab.totalSeptember( vm.currentTab.totalSeptember() + q.september );
|
||||
vm.currentTab.totalOktober( vm.currentTab.totalOktober() + q.oktober );
|
||||
vm.currentTab.totalNovember( vm.currentTab.totalNovember() + q.november );
|
||||
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
|
||||
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
|
||||
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
|
||||
|
||||
vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue );
|
||||
vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue );
|
||||
vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue );
|
||||
vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue );
|
||||
vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue );
|
||||
vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue );
|
||||
vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue );
|
||||
vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue );
|
||||
vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue );
|
||||
vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue );
|
||||
vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue );
|
||||
vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue );
|
||||
vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue );
|
||||
vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue );
|
||||
|
||||
vm.currentTab.projectChart.push( q.projectname );
|
||||
vm.currentTab.totalHoursChart.push( q.totalhours );
|
||||
vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue );
|
||||
} );
|
||||
vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()];
|
||||
vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()];
|
||||
|
||||
// vm.drawCharts( vm.currentTab );
|
||||
} );
|
||||
},
|
||||
} );
|
||||
},
|
||||
|
||||
drawCharts: function ( self ) {
|
||||
if ( self.hourView() ) {
|
||||
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.monthLabels, 'omzet per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
|
||||
}
|
||||
},
|
||||
drawCharts: function ( self ) {
|
||||
if ( self.hourView() ) {
|
||||
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.monthLabels, 'omzet per maand', '#f28f25' );
|
||||
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
|
||||
}
|
||||
},
|
||||
|
||||
toggleHourView: function () {
|
||||
this.hourView( !this.hourView() );
|
||||
toggleHourView: function () {
|
||||
this.hourView( !this.hourView() );
|
||||
|
||||
dbo.monthlyEmployeeHoursModel.drawCharts( this );
|
||||
},
|
||||
dbo.monthlyEmployeeHoursModel.drawCharts( this );
|
||||
},
|
||||
|
||||
setActivetab: function ( tab ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
setActivetab: function ( tab ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
$.each( vm.uniqueEmployees(), function ( i, p ) {
|
||||
if ( tab == p.slug ) {
|
||||
vm.currentTab = p;
|
||||
vm.refreshTab();
|
||||
}
|
||||
} )
|
||||
$.each( vm.uniqueEmployees(), function ( i, p ) {
|
||||
if ( tab == p.slug ) {
|
||||
vm.currentTab = p;
|
||||
vm.refreshTab();
|
||||
}
|
||||
} )
|
||||
|
||||
vm.sluggy( tab );
|
||||
},
|
||||
vm.sluggy( tab );
|
||||
},
|
||||
|
||||
UniqueEmployee: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
UniqueEmployee: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
|
||||
self.id = data.id;
|
||||
self.fullname = data.fullname;
|
||||
self.slug = data.slug;
|
||||
self.id = data.id;
|
||||
self.fullname = data.fullname;
|
||||
self.slug = data.slug;
|
||||
|
||||
self.tarif = ko.observable( 0 );
|
||||
self.tarif = ko.observable( 0 );
|
||||
|
||||
self.totalJanuari = ko.observable( 0 );
|
||||
self.totalFebruari = ko.observable( 0 );
|
||||
self.totalMaart = ko.observable( 0 );
|
||||
self.totalApril = ko.observable( 0 );
|
||||
self.totalMei = ko.observable( 0 );
|
||||
self.totalJuni = ko.observable( 0 );
|
||||
self.totalJuli = ko.observable( 0 );
|
||||
self.totalAugustus = ko.observable( 0 );
|
||||
self.totalSeptember = ko.observable( 0 );
|
||||
self.totalOktober = ko.observable( 0 );
|
||||
self.totalNovember = ko.observable( 0 );
|
||||
self.totalDecember = ko.observable( 0 );
|
||||
self.totalTotal = ko.observable( 0 );
|
||||
self.totalOtheryears = ko.observable( 0 );
|
||||
self.totalTotalOtheryears = ko.observable( 0 );
|
||||
self.totalJanuari = ko.observable( 0 );
|
||||
self.totalFebruari = ko.observable( 0 );
|
||||
self.totalMaart = ko.observable( 0 );
|
||||
self.totalApril = ko.observable( 0 );
|
||||
self.totalMei = ko.observable( 0 );
|
||||
self.totalJuni = ko.observable( 0 );
|
||||
self.totalJuli = ko.observable( 0 );
|
||||
self.totalAugustus = ko.observable( 0 );
|
||||
self.totalSeptember = ko.observable( 0 );
|
||||
self.totalOktober = ko.observable( 0 );
|
||||
self.totalNovember = ko.observable( 0 );
|
||||
self.totalDecember = ko.observable( 0 );
|
||||
self.totalTotal = ko.observable( 0 );
|
||||
self.totalOtheryears = ko.observable( 0 );
|
||||
self.totalTotalOtheryears = ko.observable( 0 );
|
||||
|
||||
|
||||
self.totalJanuariRevenue = ko.observable( 0 );
|
||||
self.totalFebruariRevenue = ko.observable( 0 );
|
||||
self.totalMaartRevenue = ko.observable( 0 );
|
||||
self.totalAprilRevenue = ko.observable( 0 );
|
||||
self.totalMeiRevenue = ko.observable( 0 );
|
||||
self.totalJuniRevenue = ko.observable( 0 );
|
||||
self.totalJuliRevenue = ko.observable( 0 );
|
||||
self.totalAugustusRevenue = ko.observable( 0 );
|
||||
self.totalSeptemberRevenue = ko.observable( 0 );
|
||||
self.totalOktoberRevenue = ko.observable( 0 );
|
||||
self.totalNovemberRevenue = ko.observable( 0 );
|
||||
self.totalDecemberRevenue = ko.observable( 0 );
|
||||
self.totalTotalRevenue = ko.observable( 0 );
|
||||
self.totalOtheryearsRevenue = ko.observable( 0 );
|
||||
self.totalTotalOtheryearsRevenue = ko.observable( 0 );
|
||||
self.totalJanuariRevenue = ko.observable( 0 );
|
||||
self.totalFebruariRevenue = ko.observable( 0 );
|
||||
self.totalMaartRevenue = ko.observable( 0 );
|
||||
self.totalAprilRevenue = ko.observable( 0 );
|
||||
self.totalMeiRevenue = ko.observable( 0 );
|
||||
self.totalJuniRevenue = ko.observable( 0 );
|
||||
self.totalJuliRevenue = ko.observable( 0 );
|
||||
self.totalAugustusRevenue = ko.observable( 0 );
|
||||
self.totalSeptemberRevenue = ko.observable( 0 );
|
||||
self.totalOktoberRevenue = ko.observable( 0 );
|
||||
self.totalNovemberRevenue = ko.observable( 0 );
|
||||
self.totalDecemberRevenue = ko.observable( 0 );
|
||||
self.totalTotalRevenue = ko.observable( 0 );
|
||||
self.totalOtheryearsRevenue = ko.observable( 0 );
|
||||
self.totalTotalOtheryearsRevenue = ko.observable( 0 );
|
||||
|
||||
self.hourView = ko.observable( true );
|
||||
self.hourView = ko.observable( true );
|
||||
|
||||
self.myData = ko.observableArray( [] );
|
||||
},
|
||||
self.myData = ko.observableArray( [] );
|
||||
},
|
||||
|
||||
Detail: function ( data ) {
|
||||
this.test = data;
|
||||
},
|
||||
Detail: function ( data ) {
|
||||
this.test = data;
|
||||
},
|
||||
|
||||
Project: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
Project: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
|
||||
self.projectID = data.id
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.instroom = data.instroom;
|
||||
self.uitstroom = data.uitstroom;
|
||||
self.projectname = data.projectname;
|
||||
self.name = data.name;
|
||||
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
||||
self.hours = data.hours;
|
||||
self.totalEmpoloyeeRevenues = 0;
|
||||
self.availableRevenue = data.own_revenue - data.projectEuros;
|
||||
self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue;
|
||||
self.owp = self.owpNumber;
|
||||
self.currentFinancialYear = ko.observable( data.current_financial_year );
|
||||
self.pristine = ko.observable( true );
|
||||
self.projectID = data.id
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.instroom = data.instroom;
|
||||
self.uitstroom = data.uitstroom;
|
||||
self.projectname = data.projectname;
|
||||
self.name = data.name;
|
||||
self.revenues = dbo.helpers.thousandSeparator( data.budget );
|
||||
self.hours = data.hours;
|
||||
self.totalEmpoloyeeRevenues = 0;
|
||||
self.availableRevenue = data.own_revenue - data.projectEuros;
|
||||
self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue;
|
||||
self.owp = self.owpNumber;
|
||||
self.currentFinancialYear = ko.observable( data.current_financial_year );
|
||||
self.pristine = ko.observable( true );
|
||||
|
||||
self.nextFinancialYears = ko.pureComputed( function () {
|
||||
return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) );
|
||||
} );
|
||||
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
||||
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
||||
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
|
||||
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
||||
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
||||
self.nextFinancialYears = ko.pureComputed( function () {
|
||||
return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) );
|
||||
} );
|
||||
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
|
||||
self.budget = dbo.helpers.thousandSeparator( data.budget );
|
||||
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
|
||||
self.budgetAvailable = dbo.helpers.thousandSeparator( data.budgetAvailable );
|
||||
self.saldo = dbo.helpers.thousandSeparator( data.saldo );
|
||||
|
||||
self.employees = ko.observableArray( [] );
|
||||
$.each( data.employees, function ( i, p ) {
|
||||
self.employees.push( new vm.Employee( p ) );
|
||||
if ( !self.totalEmployeeRevenues ) self.totalEmployeeRevenues = 0;
|
||||
if ( !self.totalEmployeeHours ) self.totalEmployeeHours = 0;
|
||||
} );
|
||||
self.totalEmployeeRevenues = data.projectEuros;
|
||||
self.totalEmployeeHours = data.projectHours;
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
||||
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
||||
vm.totalAvailableRevenues( Number( vm.totalAvailableRevenues() ) + Number( self.availableRevenue ) );
|
||||
vm.totalOwp( Number( vm.totalOwp() ) + Number( self.owp ) );
|
||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||
self.availableRevenue = dbo.helpers.thousandSeparator( self.availableRevenue );
|
||||
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
||||
self.owp = dbo.helpers.thousandSeparator( self.owp );
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
self.employees = ko.observableArray( [] );
|
||||
$.each( data.employees, function ( i, p ) {
|
||||
self.employees.push( new vm.Employee( p ) );
|
||||
if ( !self.totalEmployeeRevenues ) self.totalEmployeeRevenues = 0;
|
||||
if ( !self.totalEmployeeHours ) self.totalEmployeeHours = 0;
|
||||
} );
|
||||
self.totalEmployeeRevenues = data.projectEuros;
|
||||
self.totalEmployeeHours = data.projectHours;
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
||||
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
||||
vm.totalAvailableRevenues( Number( vm.totalAvailableRevenues() ) + Number( self.availableRevenue ) );
|
||||
vm.totalOwp( Number( vm.totalOwp() ) + Number( self.owp ) );
|
||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||
self.availableRevenue = dbo.helpers.thousandSeparator( self.availableRevenue );
|
||||
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
||||
self.owp = dbo.helpers.thousandSeparator( self.owp );
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
|
||||
self.invoiced = ko.observableArray( [] );
|
||||
$.each( data.invoiced, function ( i, p ) {
|
||||
self.invoiced.push( {invoiced: dbo.helpers.thousandSeparator( p.invoiced )} );
|
||||
} );
|
||||
self.invoiced = ko.observableArray( [] );
|
||||
$.each( data.invoiced, function ( i, p ) {
|
||||
self.invoiced.push( {invoiced: dbo.helpers.thousandSeparator( p.invoiced )} );
|
||||
} );
|
||||
|
||||
vm.setTotals( data );
|
||||
},
|
||||
vm.setTotals( data );
|
||||
},
|
||||
|
||||
setTotals: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
setTotals: function ( data ) {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
|
||||
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
||||
vm.totalOwnRevenue( vm.totalOwnRevenue() + Number( data.own_revenue ) );
|
||||
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
||||
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.ownRevenueAvailable ) );
|
||||
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
||||
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
||||
vm.totalBudget( vm.totalBudget() + Number( data.budget ) );
|
||||
vm.totalOwnRevenue( vm.totalOwnRevenue() + Number( data.own_revenue ) );
|
||||
vm.totalCosts( vm.totalCosts() + Number( data.projectcosts ) );
|
||||
vm.totalAvailableBudget( vm.totalAvailableBudget() + Number( data.ownRevenueAvailable ) );
|
||||
vm.totalSaldo( vm.totalSaldo() + Number( data.saldo ) );
|
||||
vm.totalWorkInProgress( vm.totalWorkInProgress() + Number( data.workInProgress ) );
|
||||
|
||||
var hasTotalEmployees = true;
|
||||
if ( vm.totalPerEmployee().length == 0 ) hasTotalEmployees = false;
|
||||
_.each( data.employees, function ( p ) {
|
||||
if ( !hasTotalEmployees ) {
|
||||
vm.totalPerEmployee.push( {
|
||||
id : p.id,
|
||||
fullname : p.fullname,
|
||||
totalRevenue : ko.observable( 0 ),
|
||||
totalHours : ko.observable( 0 ),
|
||||
totalAvailableHours: ko.observable( 0 )
|
||||
} );
|
||||
}
|
||||
var a = _.find( vm.totalPerEmployee(), function ( o ) {
|
||||
return o.id == p.id
|
||||
} );
|
||||
a.totalRevenue( a.totalRevenue() + Number( p.revenues ) );
|
||||
a.totalHours( a.totalHours() + Number( p.hours ) );
|
||||
a.totalAvailableHours( a.totalAvailableHours() + Number( p.availableHours ) );
|
||||
} );
|
||||
var hasTotalEmployees = true;
|
||||
if ( vm.totalPerEmployee().length == 0 ) hasTotalEmployees = false;
|
||||
_.each( data.employees, function ( p ) {
|
||||
if ( !hasTotalEmployees ) {
|
||||
vm.totalPerEmployee.push( {
|
||||
id : p.id,
|
||||
fullname : p.fullname,
|
||||
totalRevenue : ko.observable( 0 ),
|
||||
totalHours : ko.observable( 0 ),
|
||||
totalAvailableHours: ko.observable( 0 )
|
||||
} );
|
||||
}
|
||||
var a = _.find( vm.totalPerEmployee(), function ( o ) {
|
||||
return o.id == p.id
|
||||
} );
|
||||
a.totalRevenue( a.totalRevenue() + Number( p.revenues ) );
|
||||
a.totalHours( a.totalHours() + Number( p.hours ) );
|
||||
a.totalAvailableHours( a.totalAvailableHours() + Number( p.availableHours ) );
|
||||
} );
|
||||
|
||||
var hasTotalsOwpYear = true;
|
||||
if ( vm.totalInvoicedYear().length == 0 ) hasTotalsOwpYear = false;
|
||||
_.each( data.invoiced, function ( p ) {
|
||||
if ( !hasTotalsOwpYear ) {
|
||||
vm.totalInvoicedYear.push( {year: p.year, totalInvoiced: ko.observable( 0 )} );
|
||||
}
|
||||
var a = _.find( vm.totalInvoicedYear(), function ( o ) {
|
||||
return o.year == p.year
|
||||
} );
|
||||
a.totalInvoiced( a.totalInvoiced() + Number( p.invoiced ) );
|
||||
} );
|
||||
},
|
||||
var hasTotalsOwpYear = true;
|
||||
if ( vm.totalInvoicedYear().length == 0 ) hasTotalsOwpYear = false;
|
||||
_.each( data.invoiced, function ( p ) {
|
||||
if ( !hasTotalsOwpYear ) {
|
||||
vm.totalInvoicedYear.push( {year: p.year, totalInvoiced: ko.observable( 0 )} );
|
||||
}
|
||||
var a = _.find( vm.totalInvoicedYear(), function ( o ) {
|
||||
return o.year == p.year
|
||||
} );
|
||||
a.totalInvoiced( a.totalInvoiced() + Number( p.invoiced ) );
|
||||
} );
|
||||
},
|
||||
|
||||
Employee: function ( data ) {
|
||||
this.fullname = data.fullname;
|
||||
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
||||
this.hours = data.hours;
|
||||
this.budget = data.budget;
|
||||
this.availableHours = data.availableHours;
|
||||
},
|
||||
Employee: function ( data ) {
|
||||
this.fullname = data.fullname;
|
||||
this.revenues = dbo.helpers.thousandSeparator( data.revenues );
|
||||
this.hours = data.hours;
|
||||
this.budget = data.budget;
|
||||
this.availableHours = data.availableHours;
|
||||
},
|
||||
|
||||
saveCurrentFinancialYear: function () {
|
||||
var self = this;
|
||||
self.pristine( false );
|
||||
saveCurrentFinancialYear: function () {
|
||||
var self = this;
|
||||
self.pristine( false );
|
||||
|
||||
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
|
||||
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
|
||||
|
||||
if ( timeout ) {
|
||||
clearTimeout( timeout );
|
||||
timeout = null;
|
||||
}
|
||||
timeout = setTimeout( function () {
|
||||
if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 );
|
||||
if ( timeout ) {
|
||||
clearTimeout( timeout );
|
||||
timeout = null;
|
||||
}
|
||||
timeout = setTimeout( function () {
|
||||
if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 );
|
||||
|
||||
dbo.reportsDataService.saveCurrentFinnacialYear(
|
||||
self.projectID, self.currentFinancialYear(), function () {
|
||||
self.pristine( true );
|
||||
} );
|
||||
}, 400 );
|
||||
dbo.reportsDataService.saveCurrentFinnacialYear(
|
||||
self.projectID, self.currentFinancialYear(), function () {
|
||||
self.pristine( true );
|
||||
} );
|
||||
}, 400 );
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
dbo.monthlyEmployeeHoursModel.init();
|
||||
dbo.monthlyEmployeeHoursModel.init();
|
||||
|
||||
|
||||
dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () {
|
||||
var totalCurrentFinancialYear = 0
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
totalCurrentFinancialYear += Number( p.currentFinancialYear() );
|
||||
} );
|
||||
dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () {
|
||||
var totalCurrentFinancialYear = 0
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
totalCurrentFinancialYear += Number( p.currentFinancialYear() );
|
||||
} );
|
||||
|
||||
return dbo.helpers.thousandSeparator( totalCurrentFinancialYear );
|
||||
} );
|
||||
return dbo.helpers.thousandSeparator( totalCurrentFinancialYear );
|
||||
} );
|
||||
|
||||
dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () {
|
||||
var totalNextFinancialYear = 0
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() );
|
||||
} );
|
||||
dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () {
|
||||
var totalNextFinancialYear = 0
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
_.each( vm.recap(), function ( p ) {
|
||||
totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() );
|
||||
} );
|
||||
|
||||
return dbo.helpers.thousandSeparator( totalNextFinancialYear );
|
||||
} );
|
||||
return dbo.helpers.thousandSeparator( totalNextFinancialYear );
|
||||
} );
|
||||
|
||||
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
||||
}
|
||||
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user