Diversen debug
This commit is contained in:
@@ -26,31 +26,34 @@ class ReservationsController extends MY_Controller {
|
||||
if ( ! isset( $projects[ $result->projectID ] ) )
|
||||
{
|
||||
$projects[ $result->projectID ] = [
|
||||
'projectnumber' => $result->projectnumber,
|
||||
'costs' => 0,
|
||||
'reservation' => 0,
|
||||
'payed' => 0,
|
||||
'saldo' => 0,
|
||||
'saldoToPay' => 0,
|
||||
'other_revenue' => 0,
|
||||
'customers' => []
|
||||
'projectnumber' => $result->projectnumber,
|
||||
'costs' => 0,
|
||||
'reservation' => 0,
|
||||
'payed' => 0,
|
||||
'fromreservation' => 0,
|
||||
'saldo' => 0,
|
||||
'saldoToPay' => 0,
|
||||
'other_revenue' => 0,
|
||||
'customers' => []
|
||||
];
|
||||
}
|
||||
|
||||
$projects[ $result->projectID ]['reservation'] += $result->reservation;
|
||||
$projects[ $result->projectID ]['costs'] += $result->costs;
|
||||
$projects[ $result->projectID ]['payed'] += $result->payed;
|
||||
$projects[ $result->projectID ]['fromreservation'] += $result->fromreservation;
|
||||
$projects[ $result->projectID ]['saldo'] += $result->saldo;
|
||||
$projects[ $result->projectID ]['saldoToPay'] += $result->saldoToPay;
|
||||
$projects[ $result->projectID ]['other_revenue'] = $result->other_revenue;
|
||||
|
||||
$projects[ $result->projectID ]['externals'][] = [
|
||||
'external' => $result->contactperson,
|
||||
'reservation' => $result->reservation,
|
||||
'costs' => $result->costs,
|
||||
'payed' => $result->payed,
|
||||
'saldo' => $result->saldo,
|
||||
'saldoToPay' => $result->saldoToPay
|
||||
'external' => $result->contactperson,
|
||||
'reservation' => $result->reservation,
|
||||
'costs' => $result->costs,
|
||||
'payed' => $result->payed,
|
||||
'saldo' => $result->saldo,
|
||||
'fromreservation' => $result->fromreservation,
|
||||
'saldoToPay' => $result->saldoToPay
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ class ReservationTotals {
|
||||
{
|
||||
// UNION ALL wordt gebruikt voor een full outer join
|
||||
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
|
||||
Q5.costs, reservation, payed, (reservation - payed) AS saldo,
|
||||
fromreservation,
|
||||
Q5.costs, reservation, payed, (reservation - fromreservation) AS saldo,
|
||||
(Q5.costs - payed) AS saldoToPay, PRJ.projectnumber, EXT.contactperson,
|
||||
ROUND(( (OFF.costs * (100 + (SELECT vatrate
|
||||
FROM vats VTS
|
||||
@@ -20,7 +21,8 @@ class ReservationTotals {
|
||||
ON VTS.id = P.vat_id
|
||||
WHERE P.id = PRJ.id LIMIT 1))) / 100 ), 0) other_revenue
|
||||
FROM (
|
||||
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id
|
||||
SELECT COALESCE(reservation, 0) AS reservation, costs, payed, Q2.external_id, Q2.project_id,
|
||||
IF(from_reservation = 'T', payed, 0) fromreservation
|
||||
FROM (
|
||||
SELECT SUM(reservationamount) AS reservation, external_id, project_id
|
||||
FROM reservations
|
||||
@@ -28,14 +30,14 @@ class ReservationTotals {
|
||||
) Q1
|
||||
RIGHT JOIN
|
||||
(
|
||||
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id
|
||||
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id, from_reservation
|
||||
FROM projectcosts
|
||||
WHERE from_reservation = 'T'
|
||||
GROUP BY external_id, project_id
|
||||
) Q2
|
||||
ON Q1.external_id = Q2.external_id AND Q1.project_id = Q2.project_id
|
||||
UNION ALL
|
||||
SELECT reservation, COALESCE(costs, 0), COALESCE(payed, 0), Q3.external_id, Q3.project_id
|
||||
SELECT reservation, COALESCE(costs, 0), COALESCE(payed, 0), Q3.external_id, Q3.project_id,
|
||||
IF(from_reservation = 'T', payed, 0) fromreservation
|
||||
FROM (
|
||||
SELECT SUM(reservationamount) AS reservation, external_id, project_id
|
||||
FROM reservations
|
||||
@@ -43,9 +45,8 @@ class ReservationTotals {
|
||||
) Q3
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id, id
|
||||
SELECT SUM(costs) AS costs, SUM(payed) AS payed, external_id, project_id, id, from_reservation
|
||||
FROM projectcosts
|
||||
WHERE from_reservation = 'T'
|
||||
GROUP BY external_id, project_id
|
||||
) Q4
|
||||
ON Q3.external_id = Q4.external_id AND Q3.project_id = Q4.project_id
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
Financieel <i class="icon fa-refresh pull-right" title="ververs" data-bind="click:refreshProject"></i>
|
||||
Financieel
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<div style="position:relative; float:right;">
|
||||
<h3 style="position:absolute;top:-65px; right:30px; width:350px;">
|
||||
Projectnummer: <span data-bind="text:projectnumber"></span>
|
||||
<i class="icon fa-refresh pointer blueish" title="ververs" data-bind="click:refreshProject"></i>
|
||||
</h3>
|
||||
<button class="btn btn-danger" data-bind="click:closeProject"
|
||||
style="position:absolute;right:0px;top:-50px">
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<div id="RESERVATIONS">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label class="col-xs-12">
|
||||
alle bedragen inclusief btw
|
||||
</label>
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5px"> </th>
|
||||
<th>project</th>
|
||||
<th class="align-right">Kosten derden</th>
|
||||
<th class="align-right">gefactureerd</th>
|
||||
<th class="align-right">gereserveerd</th>
|
||||
<th class="align-right">betaald</th>
|
||||
<th class="align-right">saldo te betalen</th>
|
||||
<th class="align-right">saldo reservering</th>
|
||||
<th class="align-right">saldo te factureren</th>
|
||||
<th width="3%"> </th>
|
||||
<th width="17%">project</th>
|
||||
<th width="10%" class="align-right">Kosten derden</th>
|
||||
<th width="10%" class="align-right">gefactureerd</th>
|
||||
<th width="10%" class="align-right">gereserveerd</th>
|
||||
<th width="10%" class="align-right">betaald</th>
|
||||
<th width="10%" class="align-right">saldo te<br />betalen</th>
|
||||
<th width="10%" class="align-right">betaald via<br />reserveringen</th>
|
||||
<th width="10%" class="align-right">saldo reservering</th>
|
||||
<th width="10%" class="align-right">saldo te<br />factureren</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- ko foreach:projects -->
|
||||
@@ -44,6 +48,9 @@
|
||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||
<span data-bind="text:saldoToPay"></span>
|
||||
</th>
|
||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||
<span data-bind="text:fromreservation"></span>
|
||||
</th>
|
||||
<th class="align-right" data-bind="visible: ! showExternals()">
|
||||
<span data-bind="text:saldo"></span>
|
||||
</th>
|
||||
@@ -59,18 +66,21 @@
|
||||
<span data-bind="text:externalName"></span>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td class="align-right">
|
||||
<td class="align-right lighgrey-background">
|
||||
<span data-bind="text:costs"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:reservation"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<td class="align-right lighgrey-background">
|
||||
<span data-bind="text:payed"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:saldoToPay"></span>
|
||||
</td>
|
||||
<td class="align-right lighgrey-background">
|
||||
<span data-bind="text:fromreservation"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:saldo"></span>
|
||||
</td>
|
||||
@@ -96,6 +106,9 @@
|
||||
<th class="align-right">
|
||||
<span data-bind="text:saldoToPay"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:fromreservation"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:saldo"></span>
|
||||
</th>
|
||||
@@ -114,6 +127,7 @@
|
||||
<th class="align-right"><span data-bind="text:reservation"></span></th>
|
||||
<th class="align-right"><span data-bind="text:payed"></span></th>
|
||||
<th class="align-right"><span data-bind="text:saldoToPay"></span></th>
|
||||
<th class="align-right"><span data-bind="text:fromreservation"></span></th>
|
||||
<th class="align-right"><span data-bind="text:saldo"></span></th>
|
||||
<th class="align-right"><span data-bind="text:saldoInvoices"></span></th>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user