Diversen debug
This commit is contained in:
@@ -30,6 +30,7 @@ class ReservationsController extends MY_Controller {
|
||||
'costs' => 0,
|
||||
'reservation' => 0,
|
||||
'payed' => 0,
|
||||
'fromreservation' => 0,
|
||||
'saldo' => 0,
|
||||
'saldoToPay' => 0,
|
||||
'other_revenue' => 0,
|
||||
@@ -40,6 +41,7 @@ class ReservationsController extends MY_Controller {
|
||||
$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;
|
||||
@@ -50,6 +52,7 @@ class ReservationsController extends MY_Controller {
|
||||
'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>
|
||||
|
||||
@@ -113,6 +113,9 @@ th.rotate > div > span {
|
||||
border:0;
|
||||
font-weight: bold;
|
||||
}
|
||||
.lighgrey-background{
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
.red-line{
|
||||
border-bottom: 1px solid red !important;
|
||||
}
|
||||
|
||||
@@ -809,7 +809,8 @@ $( function () {
|
||||
vm.busy = true;
|
||||
|
||||
dbo.projectDataService.getProject( vm.projectID, function ( data ) {
|
||||
var totalRevenuesIncl = Math.round( (data.invoiceDetails.totalrevenue * (Number( data.vat.vatrate ) + 100)) / 100 );
|
||||
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
|
||||
vm.projectleaderID( data.projectleader_id );
|
||||
@@ -832,7 +833,6 @@ $( 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 ) ) ) );
|
||||
var revenues = Number(data.offer.own_revenue) + Number(data.offer.other_revenue) + Number(data.offer.costs);
|
||||
vm.totalRevenues( dbo.helpers.numberWithPoints( Math.round( revenues ) ) );
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ dbo.reservationsInit = function () {
|
||||
costs : ko.observable(),
|
||||
reservation : ko.observable(),
|
||||
payed : ko.observable(),
|
||||
fromreservation: ko.observable(),
|
||||
saldo : ko.observable(),
|
||||
saldoToPay : ko.observable(),
|
||||
otherRevenue : ko.observable(),
|
||||
@@ -38,6 +39,7 @@ dbo.reservationsInit = function () {
|
||||
vm.costs( 0 );
|
||||
vm.reservation( 0 );
|
||||
vm.payed( 0 );
|
||||
vm.fromreservation( 0 );
|
||||
vm.saldo( 0 );
|
||||
vm.saldoToPay( 0 );
|
||||
vm.otherRevenue( 0 );
|
||||
@@ -50,6 +52,7 @@ dbo.reservationsInit = function () {
|
||||
vm.costs( dbo.helpers.numberWithPoints( vm.costs() ) );
|
||||
vm.reservation( dbo.helpers.numberWithPoints( vm.reservation() ) );
|
||||
vm.payed( dbo.helpers.numberWithPoints( vm.payed() ) );
|
||||
vm.fromreservation( dbo.helpers.numberWithPoints( vm.fromreservation() ) );
|
||||
vm.saldo( dbo.helpers.numberWithPoints( vm.saldo() ) );
|
||||
vm.saldoToPay( dbo.helpers.numberWithPoints( vm.saldoToPay() ) );
|
||||
vm.otherRevenue( dbo.helpers.numberWithPoints( vm.otherRevenue() ) );
|
||||
@@ -69,6 +72,7 @@ dbo.reservationsInit = function () {
|
||||
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
||||
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||
self.fromreservation = dbo.helpers.numberWithPoints( data.fromreservation );
|
||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
||||
self.otherRevenue = dbo.helpers.numberWithPoints( data.other_revenue );
|
||||
@@ -78,6 +82,7 @@ dbo.reservationsInit = function () {
|
||||
vm.costs( Number( vm.costs() ) + Number( data.costs ) );
|
||||
vm.reservation( Number( vm.reservation() ) + Number( data.reservation ) );
|
||||
vm.payed( Number( vm.payed() ) + Number( data.payed ) );
|
||||
vm.fromreservation( Number( vm.fromreservation() ) + Number( data.fromreservation ) );
|
||||
vm.saldo( Number( vm.saldo() ) + Number( data.saldo ) );
|
||||
vm.saldoToPay( Number( vm.saldoToPay() ) + Number( data.saldoToPay ) );
|
||||
vm.otherRevenue( Number( vm.otherRevenue() ) + Number( data.other_revenue ) );
|
||||
@@ -96,6 +101,7 @@ dbo.reservationsInit = function () {
|
||||
self.costs = dbo.helpers.numberWithPoints( data.costs );
|
||||
self.reservation = dbo.helpers.numberWithPoints( data.reservation );
|
||||
self.payed = dbo.helpers.numberWithPoints( data.payed );
|
||||
self.fromreservation = dbo.helpers.numberWithPoints( data.fromreservation );
|
||||
self.saldo = dbo.helpers.numberWithPoints( data.saldo );
|
||||
self.saldoToPay = dbo.helpers.numberWithPoints( data.saldoToPay );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user