26 lines
641 B
PHP
26 lines
641 B
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 21/02/2018
|
|
* Time: 10:34
|
|
*/
|
|
|
|
class Invoices_model extends MY_Model {
|
|
|
|
protected $tablename = 'invoices';
|
|
|
|
public function getInvoicedPerYearPerProject( $projectID )
|
|
{
|
|
$this->sql = "
|
|
SELECT ROUND(COALESCE(SUM(invoiceamount), 0),0) AS invoiced, YEAR(invoicedate) AS invoiceyear
|
|
FROM invoices
|
|
WHERE project_id = {$projectID}
|
|
GROUP BY YEAR(invoicedate)
|
|
ORDER BY YEAR(invoicedate) ";
|
|
|
|
$invoiced = $this->get_query_result();
|
|
|
|
return $invoiced;
|
|
}
|
|
} |