Diverse aanpassing nav mail Peter

This commit is contained in:
2019-02-22 14:19:03 +01:00
parent d71692f320
commit 695f6c6960
23 changed files with 295 additions and 79 deletions
@@ -8,8 +8,8 @@
dbo.invoiceDataService = {
getInvoiceOverview: function ( year, callback ) {
$.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year )
getInvoiceOverview: function ( year, orderType, orderDirection, archive, callback ) {
$.getJSON( 'index.php/reports/reportsController/getInvoiceOverview/' + year + '/' + orderType + '/' + orderDirection + '/' + archive )
.done( function ( data ) {
callback( data );
} );
@@ -15,8 +15,8 @@ dbo.reportsDataService = {
} );
},
getRecapProjects: function(callback){
$.getJSON( 'index.php/reports/reportsController/recapProjects' )
getRecapProjects: function(archive, callback){
$.getJSON( 'index.php/reports/reportsController/recapProjects/' + archive )
.done( function ( data ) {
callback( data );
} );
+4 -4
View File
@@ -56,10 +56,10 @@ dbo.helpers = {
},
findArrayElement: function ( toFind, element, value, array ) {
console.log( toFind ); // het element in de array
console.log( element );
console.log( value );
console.log( array );
// console.log( toFind ); // het element in de array
// console.log( element );
// console.log( value );
// console.log( array );
if ( !Array.isArray( array ) ) return null;
var foundValue = null
+46 -27
View File
@@ -28,34 +28,38 @@ $( function () {
showProject : ko.observable( false ),
projectID : null,
callback : null,
customerID : ko.observable( null ),
projectnumber : ko.observable(),
projectleaderID : ko.observable(),
archive : ko.observable( false ),
startdate : ko.observable( null ),
enddate : ko.observable( null ),
vat_id : ko.observable(),
projectname : ko.observable(),
busy : false,
ownRevenue : ko.observable(),
otherRevenue : ko.observable(),
costs : ko.observable(),
projectname : ko.observable(),
years : ko.observableArray( dbo.years ),
months : ko.observableArray( dbo.monthArray ),
outstanding : ko.observable(),
documents : ko.observableArray( [] ),
comments : ko.observableArray( [] ),
activeTab : ko.observable(),
totalRevenues : ko.observable(),
totalInvoiced : ko.observable(),
totalRevenuesIncl: ko.observable(),
customerID : ko.observable( null ),
projectnumber : ko.observable(),
projectleaderID : ko.observable(),
archive : ko.observable( false ),
startdate : ko.observable( null ),
enddate : ko.observable( null ),
vat_id : ko.observable(),
projectname : ko.observable(),
busy : false,
ownRevenue : ko.observable(),
otherRevenue : ko.observable(),
costs : ko.observable(),
projectname : ko.observable(),
years : ko.observableArray( dbo.years ),
months : ko.observableArray( dbo.monthArray ),
outstanding : ko.observable(),
documents : ko.observableArray( [] ),
comments : ko.observableArray( [] ),
activeTab : ko.observable(),
totalRevenues : ko.observable(),
totalInvoiced : ko.observable(),
totalRevenuesIncl : ko.observable(),
outstanding : ko.observable(),
outstandingInvoices: ko.observable(),
payed : ko.observable(),
totalForecast : ko.observable(),
toForecast : ko.observable(),
toInvoice : 0,
hourTotals : ko.observableArray( [] ),
totalNonDeclarable : ko.observable( 0 ),
totalDeclarable : ko.observable( 0 ),
totalRevenueHours : ko.observable( 0 ),
init: function () {
var vm = dbo.editProjectModal;
@@ -113,7 +117,7 @@ $( function () {
self.fromReservation( !self.fromReservation() );
vm.saveProjectCost(self);
vm.saveProjectCost( self );
},
editProjectemployee: function () {
@@ -800,7 +804,7 @@ $( function () {
dbo.projectDataService.getAvailableEmployees( vm.projectID, function ( data ) {
vm.availableEmployees( data );
if ( typeof(callback) == 'function' ) callback();
if ( typeof (callback) == 'function' ) callback();
} );
},
@@ -809,7 +813,7 @@ $( function () {
vm.busy = true;
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
var revenues = Number(data.offer.own_revenue) + Number(data.offer.other_revenue) + Number(data.offer.costs);
var revenues = Number( data.offer.own_revenue ) + Number( data.offer.other_revenue ) + Number( data.offer.costs );
var totalRevenuesIncl = Math.round( (revenues * (Number( data.vat.vatrate ) + 100)) / 100 );
vm.id = data.id
@@ -832,9 +836,25 @@ $( function () {
vm.ownRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.own_revenue ) ) ) );
vm.otherRevenue( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.other_revenue ) ) ) );
vm.costs(dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
vm.costs( dbo.helpers.numberWithPoints( Math.round( Number( data.offer.costs ) ) ) );
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) );
vm.hourTotals.removeAll();
vm.totalNonDeclarable( 0 );
vm.totalDeclarable( 0 );
vm.totalRevenueHours( 0 );
_.each( data.hourTotals, function ( p ) {
vm.hourTotals.push( {
fullname : p.fullname,
nondeclarable: p.nondeclarable,
declarable : p.declarable,
revenues : dbo.helpers.numberWithPoints( Math.round( Number( p.revenues ) ) )
} );
vm.totalNonDeclarable( Number( vm.totalNonDeclarable() ) + Number( p.nondeclarable ) );
vm.totalDeclarable( Number( vm.totalDeclarable() ) + Number( p.declarable ) );
vm.totalRevenueHours( Number( vm.totalRevenueHours() ) + Number( p.revenues ) );
} );
vm.totalRevenueHours( dbo.helpers.numberWithPoints( Math.round( vm.totalRevenueHours() ) ) );
_.each( data.projectemployees, function ( p ) {
vm.projectEmployees.push( new vm.Projectemployee( p ) );
@@ -1012,7 +1032,6 @@ $( function () {
},
Reservation: function ( data ) {
console.log( data );
this.id = data.id;
this.project_id = data.project_id;
this.reservationamount = ko.observable( data.reservationamount );
@@ -154,6 +154,7 @@ dbo.projectsInit = function () {
self.id = data.id;
self.projectnumber = data.projectnumber;
self.projectleader = data.projectleader ? data.projectleader.fullname : '#NB';
self.projectname = data.projectname;
self.customer = data.customer ? data.customer.name : '#NB';
self.startdate = data.startdate;
self.enddate = data.enddate;
+29 -6
View File
@@ -35,6 +35,9 @@ dbo.invoicereportInit = function () {
forecastOtherYears : ko.observable(),
forecastRemaining : ko.observable(),
totalProjectPayments : ko.observable(),
orderType : 'projectnumber',
orderDirection : false,
archive : ko.observable( false ),
init: function () {
var vm = dbo.invoicereport;
@@ -52,7 +55,10 @@ dbo.invoicereportInit = function () {
vm.resetTotals();
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) {
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 );
@@ -70,7 +76,7 @@ dbo.invoicereportInit = function () {
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( Number( vm.totalProjectPayments() ) + Number( p.totalProjectPayments.replace( '.', '' ) ) );
console.log( vm.totalProjectPayments() );
} );
vm.totalProjectPayments( dbo.helpers.thousandSeparator( vm.totalProjectPayments() ) );
@@ -81,6 +87,22 @@ dbo.invoicereportInit = function () {
} );
},
toggleArchive: function () {
var vm = dbo.invoicereport;
vm.archive( !vm.archive() );
vm.initModule();
},
sortList: function ( orderType ) {
var vm = dbo.invoicereport;
vm.orderType = orderType;
vm.orderDirection = !vm.orderDirection;
vm.initModule();
},
resetTotals: function () {
var vm = dbo.invoicereport;
@@ -165,6 +187,7 @@ dbo.invoicereportInit = function () {
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;
@@ -175,7 +198,7 @@ dbo.invoicereportInit = function () {
_.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) );
if ( q.monthID == i ) q.forecastamount( Number( q.forecastamount() ) + Number( p.forecastamount ) );
} );
} );
},
@@ -195,7 +218,7 @@ dbo.invoicereportInit = function () {
_.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) );
if ( q.monthID == i ) q.paymentamount( Number( q.paymentamount() ) + Number( p.paymentamount ) );
} );
} );
},
@@ -204,10 +227,10 @@ dbo.invoicereportInit = function () {
this.paymentamount = dbo.helpers.thousandSeparator( data.paymentamount );
},
createSpreadsheet:function(){
createSpreadsheet: function () {
var vm = dbo.invoicereport;
var url = 'index.php/reports/reportsController/createInvoicesSpreadsheet/' + vm.selectedYear();
window.open(url, '_blank');
window.open( url, '_blank' );
}
}
@@ -39,6 +39,7 @@ dbo.monthlyemployeehoursInit = function () {
totalNextFinancialYear : ko.observable(),
totalInvoicedYear : ko.observableArray( [] ),
validYear : ko.observable( true ),
archive : ko.observable(),
init: function () {
var vm = dbo.monthlyEmployeeHoursModel;
@@ -72,7 +73,9 @@ dbo.monthlyemployeehoursInit = function () {
vm.uniqueEmployees.push( new vm.UniqueEmployee( p ) )
} );
} );
dbo.reportsDataService.getRecapProjects( function ( data ) {
var archive = vm.archive() ? 'T' : 'F';
dbo.reportsDataService.getRecapProjects( archive, function ( data ) {
vm.recap.removeAll();
vm.uniqueYears.removeAll();
$.each( data, function ( i, p ) {
@@ -90,7 +93,7 @@ dbo.monthlyemployeehoursInit = function () {
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.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 ) {
@@ -121,6 +124,13 @@ dbo.monthlyemployeehoursInit = function () {
} );
},
toggleArchive: function () {
var vm = dbo.monthlyEmployeeHoursModel;
vm.archive( !vm.archive() );
vm.initModule();
},
checkYear: function () {
var vm = dbo.monthlyEmployeeHoursModel;
if ( timeout ) {