diversen opmerkingen Peter

This commit is contained in:
2018-04-02 17:32:20 +02:00
parent 0fd25f359b
commit 1b0ad5de83
5 changed files with 79 additions and 29 deletions
@@ -16,8 +16,8 @@ class Qinvoiceoverview {
PRJ.projectname, PRJ.projectname,
(own_revenue + other_revenue ) AS revenues, (own_revenue + other_revenue ) AS revenues,
CUS.name AS customername, CUS.name AS customername,
SUM(IF( YEAR(invoicedate) = {$year},invoiceamount, 0)) AS currentyear, SUM(IF( YEAR(invoicedate) = {$year}, invoiceamount* ((100 + vts.vatrate)/100), 0)) AS currentyear,
SUM(IF( YEAR(invoicedate) != {$year},invoiceamount, 0)) AS otheryear, SUM(IF( YEAR(invoicedate) != {$year}, invoiceamount * ((100 + vts.vatrate)/100), 0)) AS otheryear,
SUM(COALESCE(Q1.currentyearpayed, 0)) AS currentyearpayed, SUM(COALESCE(Q1.currentyearpayed, 0)) AS currentyearpayed,
SUM(COALESCE(Q1.otheryearpayed, 0)) AS otheryearpayed, SUM(COALESCE(Q1.otheryearpayed, 0)) AS otheryearpayed,
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
@@ -35,6 +35,8 @@ class Qinvoiceoverview {
ON CUS.id = PRJ.customer_id ON CUS.id = PRJ.customer_id
JOIN users USR JOIN users USR
ON USR.id = PRJ.projectleader_id ON USR.id = PRJ.projectleader_id
JOIN vats VTS
ON VTS.id = INV.vat_id
LEFT JOIN ( LEFT JOIN (
SELECT invoice_id, SELECT invoice_id,
SUM(IF(YEAR(paymentdate) = {$year},paymentamount, 0)) AS currentyearpayed, SUM(IF(YEAR(paymentdate) = {$year},paymentamount, 0)) AS currentyearpayed,
@@ -27,7 +27,7 @@
<td class="align-right"><span data-bind="text:target"></span></td> <td class="align-right"><span data-bind="text:target"></span></td>
<td class="align-right"><span data-bind="text:occupancyRateTotal"></span>%</td> <td class="align-right"><span data-bind="text:occupancyRateTotal"></span>%</td>
<td class="align-right"><span data-bind="text:occupancyRateHours"></span>%</td> <td class="align-right"><span data-bind="text:occupancyRateHours"></span>%</td>
<td class="align-right"><span data-bind="text:occupancyRateInvoice"></span></td> <td class="align-right"><span data-bind="text:occupancyRateInvoice"></span>%</td>
<td class="align-right"><i class="icon fa-euro"></i> <span data-bind="text:revenues"></span></td> <td class="align-right"><i class="icon fa-euro"></i> <span data-bind="text:revenues"></span></td>
<td class="align-right"><i class="icon fa-euro"></i> <span data-bind="text:averageDayRate"></span></td> <td class="align-right"><i class="icon fa-euro"></i> <span data-bind="text:averageDayRate"></span></td>
</tr> </tr>
@@ -10,9 +10,9 @@
<th class="rotate"> <th class="rotate">
<div><span>status afgehandeld</span></div> <div><span>status afgehandeld</span></div>
</th> </th>
<th class="rotate"> <!-- <th class="rotate">-->
<div><span>projectleider</span></div> <!-- <div><span>projectleider</span></div>-->
</th> <!-- </th>-->
<!-- ko if:$root.invoiceTab() == 'invoice' --> <!-- ko if:$root.invoiceTab() == 'invoice' -->
<th class="rotate"> <th class="rotate">
<div><span>te factureren(excl btw)</span></div> <div><span>te factureren(excl btw)</span></div>
@@ -27,7 +27,7 @@
<div><span>gefactureerd lopend jaar(incl btw)</span></div> <div><span>gefactureerd lopend jaar(incl btw)</span></div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>totaal gefactureerd(incl btw)</span></div> <div><span>totaal gefactureerd</span></div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>betaald voorgaande jaren</span></div> <div><span>betaald voorgaande jaren</span></div>
@@ -44,7 +44,7 @@
<!-- /ko --> <!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'forecast' --> <!-- ko if:$root.invoiceTab() == 'forecast' -->
<th class="rotate"> <th class="rotate">
<div><span>nog te factureren</span></div> <div><span>nog te factureren (incl.btw)</span></div>
</th> </th>
<th class="rotate"> <th class="rotate">
<div><span>nog te factureren lopend jaar</span></div> <div><span>nog te factureren lopend jaar</span></div>
@@ -56,9 +56,20 @@
<div><span>verschil prognose - werkelijk</span></div> <div><span>verschil prognose - werkelijk</span></div>
</th> </th>
<!-- /ko --> <!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'monthforecast' || $root.invoiceTab() == 'monthpayments' --> <!-- ko if:$root.invoiceTab() == 'monthforecast' -->
<th class="rotate">
<div><span>te factureren(incl btw)</span></div>
</th>
<!-- ko foreach:months --> <!-- ko foreach:months -->
<th><span data-bind="text:month"></span></th> <th class="rotate"><div><span data-bind="text:month"></span></div></th>
<!-- /ko -->
<th class="rotate">
<div><span>te factureren volgende jaren</span></div>
</th>
<!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'monthpayments' -->
<!-- ko foreach:months -->
<th class="rotate"><div><span data-bind="text:month"></span></div></th>
<!-- /ko --> <!-- /ko -->
<!-- /ko --> <!-- /ko -->
</tr> </tr>
@@ -69,7 +80,7 @@
<td><span data-bind="text:projectnumber"></span></td> <td><span data-bind="text:projectnumber"></span></td>
<td><span data-bind="text:customername"></span></td> <td><span data-bind="text:customername"></span></td>
<td><span data-bind="text:statusProject == 'CLOSED' ? 'afgesloten' : 'open'"></span></td> <td><span data-bind="text:statusProject == 'CLOSED' ? 'afgesloten' : 'open'"></span></td>
<td><span data-bind="text:fullname"></span> <!-- <td><span data-bind="text:fullname"></span>-->
</td> </td>
<!-- ko if:$root.invoiceTab() == 'invoice' --> <!-- ko if:$root.invoiceTab() == 'invoice' -->
<td class="align-right"> <td class="align-right">
@@ -128,12 +139,21 @@
</th> </th>
<!-- /ko --> <!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'monthforecast' --> <!-- ko if:$root.invoiceTab() == 'monthforecast' -->
<td class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:toInvoice"></span>
</td>
<!-- ko foreach:months --> <!-- ko foreach:months -->
<td class="align-right"> <td class="align-right">
<span data-bind="text:forecastamount"> <span data-bind="text:forecastamount">
</span> </span>
</td> </td>
<!-- /ko --> <!-- /ko -->
<td class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:toInvoiceFuture">
</span>
</td>
<!-- /ko --> <!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'monthpayments' --> <!-- ko if:$root.invoiceTab() == 'monthpayments' -->
<!-- ko foreach:months --> <!-- ko foreach:months -->
@@ -148,16 +168,24 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th colspan="4" class="align-right"> <th colspan="3" class="align-right">
totaal totaal
</th> </th>
<!-- ko if:$root.invoiceTab() == 'monthforecast' --> <!-- ko if:$root.invoiceTab() == 'monthforecast' -->
<th class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:totalToInvoice"></span>
</th>
<!-- ko foreach:months --> <!-- ko foreach:months -->
<th class="align-right"> <th class="align-right">
<span data-bind="text:dbo.helpers.numberWithPoints($root['forecast' + month]())"> <span data-bind="text:dbo.helpers.numberWithPoints($root['forecast' + month]())">
</span> </span>
</th> </th>
<!-- /ko --> <!-- /ko -->
<th class="align-right">
<i class="icon fa-euro"></i>
<span data-bind="text:totalToInvoiceFuture"></span>
</th>
<!-- /ko --> <!-- /ko -->
<!-- ko if:$root.invoiceTab() == 'monthpayments' --> <!-- ko if:$root.invoiceTab() == 'monthpayments' -->
<!-- ko foreach:months --> <!-- ko foreach:months -->
+7 -3
View File
@@ -23,19 +23,23 @@ $( function () {
other_revenue : ko.observable(), other_revenue : ko.observable(),
hasProject : ko.observable(), hasProject : ko.observable(),
init: function () { init: function ( callback = false ) {
dbo.editOfferModal.refreshCustomers(); dbo.editOfferModal.refreshCustomers();
dbo.editOfferModal.refreshUsers(); dbo.editOfferModal.refreshUsers();
if ( typeof(callback) == 'function' ) callback();
}, },
newEditOffer: function ( offer, projectID = false, customerID = false, hasProject = false, callback ) { newEditOffer: function ( offer, projectID = false, customerID = false, hasProject = false, callback ) {
var vm = dbo.editOfferModal; var vm = dbo.editOfferModal;
vm.callback = typeof(callback) == 'function' ? callback : null; vm.callback = typeof(callback) == 'function' ? callback : null;
vm.init( function () {
vm.showOfferModal(); vm.showOfferModal();
vm.setOffer( offer, projectID, customerID, hasProject ); vm.setOffer( offer, projectID, customerID, hasProject );
} );
}, },
getCustomerProjects: function () { getCustomerProjects: function () {
@@ -77,7 +81,7 @@ $( function () {
title : 'project aangemaakt', title : 'project aangemaakt',
message : 'er is een project aangemaakt met nummer: ' + data.projectnumber, message : 'er is een project aangemaakt met nummer: ' + data.projectnumber,
modalClass: 'modal-success' modalClass: 'modal-success'
}, function(){ }, function () {
vm.hideOfferModal(); vm.hideOfferModal();
vm.callback(); vm.callback();
} ); } );
@@ -104,7 +108,7 @@ $( function () {
message : errorMessage, message : errorMessage,
modalClass: 'modal-danger' modalClass: 'modal-danger'
} ); } );
}else{ } else {
vm.hideOfferModal(); vm.hideOfferModal();
vm.callback(); vm.callback();
} }
@@ -17,10 +17,12 @@ dbo.outgoinginvoicesInit = function () {
initialize : null, initialize : null,
years : ko.observableArray( [] ), years : ko.observableArray( [] ),
selectedYear : ko.observable(), selectedYear : ko.observable(),
selectedMonthID: ko.observable(), selectedMonthID : ko.observable(),
projects : ko.observableArray( [] ), projects : ko.observableArray( [] ),
invoiceTab : ko.observable( 'invoice' ), invoiceTab : ko.observable( 'invoice' ),
months : ko.observableArray( dbo.monthArray ), months : ko.observableArray( dbo.monthArray ),
totalToInvoice : ko.observable(),
totalToInvoiceFuture: ko.observable(),
init: function () { init: function () {
var vm = dbo.outgoinginvoicesModel; var vm = dbo.outgoinginvoicesModel;
@@ -56,6 +58,8 @@ dbo.outgoinginvoicesInit = function () {
refreshInvoiceDetails: function () { refreshInvoiceDetails: function () {
var vm = dbo.outgoinginvoicesModel; var vm = dbo.outgoinginvoicesModel;
vm.resetModel();
if ( vm.initialize ) return; if ( vm.initialize ) return;
dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) { dbo.invoiceDataService.getInvoiceOverview( vm.selectedYear(), function ( data ) {
@@ -63,9 +67,17 @@ dbo.outgoinginvoicesInit = function () {
_.each( data, function ( p ) { _.each( data, function ( p ) {
vm.projects.push( new vm.Project( p ) ); vm.projects.push( new vm.Project( p ) );
} ); } );
vm.totalToInvoice( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoice() ) ) );
vm.totalToInvoiceFuture( dbo.helpers.numberWithPoints( Math.round( vm.totalToInvoiceFuture() ) ) );
} ); } );
}, },
resetModel: function () {
var vm = dbo.outgoinginvoicesModel;
vm.totalToInvoice( 0 );
vm.totalToInvoiceFuture( 0 );
},
Project: function ( data ) { Project: function ( data ) {
var vm = dbo.outgoinginvoicesModel; var vm = dbo.outgoinginvoicesModel;
var self = this; var self = this;
@@ -88,11 +100,12 @@ dbo.outgoinginvoicesInit = function () {
self.totalInvoiced = dbo.helpers.numberWithPoints( totalInvoiced ); self.totalInvoiced = dbo.helpers.numberWithPoints( totalInvoiced );
self.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints( Math.round( data.otheryearpayed ) ); self.invoicedOtherYearsPayed = dbo.helpers.numberWithPoints( Math.round( data.otheryearpayed ) );
self.invoicedCurentYearPayed = dbo.helpers.numberWithPoints( Math.round( data.currentyearpayed ) ); self.invoicedCurentYearPayed = dbo.helpers.numberWithPoints( Math.round( data.currentyearpayed ) );
self.totalInvoicedPayed = dbo.helpers.numberWithPoints( totalInvoicedPayed ); self.totalInvoicedPayed = dbo.helpers.numberWithPoints( Math.round( totalInvoicedPayed ) );
self.notPayed = dbo.helpers.numberWithPoints( notPayed ); self.notPayed = dbo.helpers.numberWithPoints( Math.round( notPayed ) );
self.toInvoice = dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced ); self.toInvoice = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced ) );
self.currentforecast = dbo.helpers.numberWithPoints( data.currentforecast ); self.toInvoiceFuture = dbo.helpers.numberWithPoints( Math.round( totalInvoice - totalInvoiced - Number( data.currentforecast ) ) );
self.otherforecast = dbo.helpers.numberWithPoints( data.otherforecast ); self.currentforecast = dbo.helpers.numberWithPoints( Math.round( data.currentforecast ) );
self.otherforecast = dbo.helpers.numberWithPoints( Math.round( data.otherforecast ) );
self.missingForecast = self.missingForecast =
dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced - data.otherforecast ); dbo.helpers.numberWithPoints( totalInvoice - totalInvoiced - data.otherforecast );
@@ -106,6 +119,9 @@ dbo.outgoinginvoicesInit = function () {
if ( !vm['payment' + p.month] ) vm['payment' + p.month] = ko.observable( 0 ); if ( !vm['payment' + p.month] ) vm['payment' + p.month] = ko.observable( 0 );
vm['payment' + p.month]( Number( vm['payment' + p.month]() ) + Number( p.paymentamount ) ); vm['payment' + p.month]( Number( vm['payment' + p.month]() ) + Number( p.paymentamount ) );
} ); } );
vm.totalToInvoice( vm.totalToInvoice() + (totalInvoice - totalInvoiced) );
vm.totalToInvoiceFuture( vm.totalToInvoiceFuture() + (totalInvoice - totalInvoiced - Number( data.currentforecast )) );
}, },
Month: function ( data ) { Month: function ( data ) {