Diversen nav opmerkingen
This commit is contained in:
@@ -41,6 +41,11 @@ class Project extends BaseModel {
|
||||
return $this->hasMany( 'Reservation' );
|
||||
}
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo('Vat');
|
||||
}
|
||||
|
||||
public function projectleader()
|
||||
{
|
||||
return $this->belongsTo( 'User', 'projectleader_id' );
|
||||
@@ -112,6 +117,7 @@ class Project extends BaseModel {
|
||||
->with( 'projectcosts.external' )
|
||||
->with( 'invoices.payments' )
|
||||
->with( 'invoices.vat' )
|
||||
->with( 'vat' )
|
||||
->with( 'customer' );
|
||||
|
||||
return $project;
|
||||
|
||||
@@ -14,7 +14,12 @@ class ReservationTotals {
|
||||
$sql = "SELECT Q5.project_id AS projectID, external_id AS externalID,
|
||||
costs, reservation, payed, (reservation - payed) AS saldo,
|
||||
(costs - payed) AS saldoToPay, PRJ.projectnumber, EXT.contactperson,
|
||||
ROUND(( (other_revenue * (100 + (SELECT vatrate from vats where active='T' LIMIT 1))) / 100 ), 0) other_revenue
|
||||
ROUND(( (other_revenue * (100 + (
|
||||
SELECT vatrate
|
||||
FROM vats VTS
|
||||
JOIN projects P
|
||||
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
|
||||
FROM (
|
||||
|
||||
Reference in New Issue
Block a user