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