Invoiced report

This commit is contained in:
2020-01-10 17:42:25 +01:00
parent b4d69d272c
commit 5594865554
11 changed files with 384 additions and 190 deletions
+13 -1
View File
@@ -62,4 +62,16 @@ class Invoice extends BaseModel {
return $invoiceID;
}
}
public static function getInvoiced( $year )
{
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, invoiceamount')
->join('projects AS PRJ', 'PRJ.id', '=', 'invoices.project_id')
->join('customers AS CUS', 'CUS.id', '=', 'PRJ.customer_id')
->whereRaw("DATE_FORMAT(invoicedate, '%Y') = {$year}")
->orderBy('invoicedate')
->get();
return $invoiced;
}
}
@@ -11,7 +11,8 @@ class ReservationTotals {
public static function fire()
{
// UNION ALL wordt gebruikt voor een full outer join
$sql = " SELECT PRJ.id AS projectID, external_id AS externalID,
$sql = "SELECT PRJ.id AS projectID, external_id AS externalID,
PRJ.projectname,
COALESCE(fromreservation, 0) AS fromreservation,
COALESCE(Q5.costs, 0) AS costs, COALESCE(reservation, 0) AS reservation,
COALESCE(payed, 0) AS payed, (COALESCE(reservation, 0) - COALESCE(fromreservation, 0)) AS saldo,