Sortering factuuroverzicht rapportages

This commit is contained in:
2020-09-07 14:06:44 +02:00
parent 04b109850c
commit c6140e04a6
8 changed files with 38 additions and 8 deletions
+2 -2
View File
@@ -63,13 +63,13 @@ class Invoice extends BaseModel {
return $invoiceID;
}
public static function getInvoiced( $year )
public static function getInvoiced( $year, $orderType='invoicedate', $orderDirection='DESC' )
{
$invoiced = Invoice::selectRaw('invoicenumber, PRJ.projectname, projectnumber, CUS.name, invoicedate, CUS.name, ROUND(invoiceamount, 0) AS 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')
->orderBy($orderType, $orderDirection)
->get();
return $invoiced;