diuversen opmerkingen 19062018
This commit is contained in:
@@ -35,6 +35,8 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
totalSaldo : ko.observable(),
|
||||
totalOwp : ko.observable(),
|
||||
totalWorkInProgress : ko.observable(),
|
||||
totalCurrentFinancialYear : ko.observable(),
|
||||
totalNextFinancialYear : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
validYear : ko.observable( true ),
|
||||
|
||||
@@ -62,6 +64,8 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.totalEmployeeHours( 0 );
|
||||
vm.totalEmployeeAvailableHours( 0 );
|
||||
vm.totalOwp( 0 );
|
||||
vm.totalCurrentFinancialYear( 0 );
|
||||
vm.totalNextFinancialYear( 0 );
|
||||
vm.totalPerEmployee.removeAll();
|
||||
vm.totalInvoicedYear.removeAll();
|
||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||
@@ -300,6 +304,7 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
var self = this;
|
||||
|
||||
self.projectID = data.id
|
||||
self.projectnumber = data.projectnumber;
|
||||
self.instroom = data.instroom;
|
||||
self.uitstroom = data.uitstroom;
|
||||
@@ -309,7 +314,14 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
self.hours = data.hours;
|
||||
self.totalEmpoloyeeRevenues = 0;
|
||||
self.availableRevenue = data.own_revenue - data.projectEuros;
|
||||
self.owp = self.availableRevenue < 0 ? 0 : self.availableRevenue;
|
||||
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 );
|
||||
@@ -393,11 +405,53 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
this.hours = data.hours;
|
||||
this.budget = data.budget;
|
||||
this.availableHours = data.availableHours;
|
||||
},
|
||||
|
||||
saveCurrentFinancialYear: function () {
|
||||
var self = this;
|
||||
self.pristine( false );
|
||||
|
||||
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
|
||||
|
||||
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.monthlyEmployeeHoursModel.init();
|
||||
|
||||
|
||||
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 );
|
||||
} );
|
||||
|
||||
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 );
|
||||
} );
|
||||
|
||||
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user