Removalls and offers revenues

This commit is contained in:
2018-06-10 17:31:05 +02:00
parent 8fe98e6ccb
commit c539d03fb6
20 changed files with 449 additions and 158 deletions
+2
View File
@@ -80,6 +80,8 @@ class Project extends BaseModel {
public static function removeProject( $projectID )
{
Offer::whereProjectId( $projectID )->update( ['project_id' => NULL] );
Project::whereId( $projectID )->delete();
}
@@ -14,7 +14,7 @@ class Qinvoiceoverview {
$sql = "
SELECT PRJ.id, PRJ.projectnumber,
PRJ.projectname,
(own_revenue + other_revenue ) AS revenues,
(own_revenue + other_revenue + OFF.costs ) AS revenues,
CUS.name AS customername,
SUM(IF( YEAR(invoicedate) = {$year}, invoiceamount* ((100 + VTS.vatrate)/100), 0)) AS currentyear,
SUM(IF( YEAR(invoicedate) != {$year}, invoiceamount * ((100 + VTS.vatrate)/100), 0)) AS otheryear,
@@ -27,7 +27,7 @@ class Invoices_model extends MY_Model {
public function getOutstandingPerProject( $projectID )
{
$this->sql = "
SELECT (own_revenue + other_revenue) AS totalrevenue,
SELECT (own_revenue + other_revenue + OFF.costs) AS totalrevenue,
ROUND(SUM(INV.invoiceamount * ((100 + vatrate) / 100)), 0) AS totalinvoiced,
(
SELECT SUM(paymentamount) PAYMENTAMOUNT