diff --git a/app/Models/Account.php b/app/Models/Account.php index 07ccf5c..ec497b7 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -258,8 +258,8 @@ class Account extends Model implements IDs DB::raw('SUM(discount) AS _discount'), DB::raw('SUM(item_total) AS _item_total'), DB::raw('SUM(payment_fees) AS _payment_fee'), - DB::raw('ROUND(CAST(SUM(item_total)-SUM(COALESCE(discount,0))+COALESCE(invoices.discount_amt,0) AS NUMERIC),2) AS _total'), - DB::raw('ROUND(CAST(SUM(item_total)-SUM(COALESCE(discount,0))+COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) AS _balance'), + DB::raw('ROUND(CAST(SUM(item_total)-SUM(COALESCE(discount,0))-COALESCE(invoices.discount_amt,0) AS NUMERIC),2) AS _total'), + DB::raw('ROUND(CAST(SUM(item_total)-SUM(COALESCE(discount,0))-COALESCE(invoices.discount_amt,0)-SUM(payments) AS NUMERIC),2) AS _balance'), 'invoices.due_at', 'invoices.created_at', ])