diff --git a/app/Abstracts/Report.php b/app/Abstracts/Report.php index 9b16044a3..d4206499f 100644 --- a/app/Abstracts/Report.php +++ b/app/Abstracts/Report.php @@ -329,7 +329,7 @@ abstract class Report event(new RowsShowing($this)); } - public function setTotals($items, $date_field, $check_type = false, $table = 'default') + public function setTotals($items, $date_field, $check_type = false, $table = 'default', $with_tax = true) { foreach ($items as $item) { // Make groups extensible @@ -347,7 +347,7 @@ abstract class Report continue; } - $amount = $item->getAmountConvertedToDefault(); + $amount = $item->getAmountConvertedToDefault(false, $with_tax); $type = (($item instanceof Invoice) || (($item instanceof Transaction) && ($item->type == 'income'))) ? 'income' : 'expense'; diff --git a/app/Reports/ProfitLoss.php b/app/Reports/ProfitLoss.php index 2169a61a6..f96aac242 100644 --- a/app/Reports/ProfitLoss.php +++ b/app/Reports/ProfitLoss.php @@ -47,33 +47,33 @@ class ProfitLoss extends Report case 'cash': // Revenues $revenues = $income_transactions->get(); - $this->setTotals($revenues, 'paid_at', true, $this->tables['income']); + $this->setTotals($revenues, 'paid_at', true, $this->tables['income'], false); // Payments $payments = $expense_transactions->get(); - $this->setTotals($payments, 'paid_at', true, $this->tables['expense']); + $this->setTotals($payments, 'paid_at', true, $this->tables['expense'], false); break; default: // Invoices $invoices = $this->applyFilters(Invoice::accrued(), ['date_field' => 'invoiced_at'])->get(); Recurring::reflect($invoices, 'invoiced_at'); - $this->setTotals($invoices, 'invoiced_at', true, $this->tables['income']); + $this->setTotals($invoices, 'invoiced_at', true, $this->tables['income'], false); // Revenues $revenues = $income_transactions->isNotDocument()->get(); Recurring::reflect($revenues, 'paid_at'); - $this->setTotals($revenues, 'paid_at', true, $this->tables['income']); + $this->setTotals($revenues, 'paid_at', true, $this->tables['income'], false); // Bills $bills = $this->applyFilters(Bill::accrued(), ['date_field' => 'billed_at'])->get(); Recurring::reflect($bills, 'bill', 'billed_at'); - $this->setTotals($bills, 'billed_at', true, $this->tables['expense']); + $this->setTotals($bills, 'billed_at', true, $this->tables['expense'], false); // Payments $payments = $expense_transactions->isNotDocument()->get(); Recurring::reflect($payments, 'paid_at'); - $this->setTotals($payments, 'paid_at', true, $this->tables['expense']); + $this->setTotals($payments, 'paid_at', true, $this->tables['expense'], false); break; } diff --git a/app/Reports/TaxSummary.php b/app/Reports/TaxSummary.php index 007d294e8..15baa5679 100644 --- a/app/Reports/TaxSummary.php +++ b/app/Reports/TaxSummary.php @@ -70,7 +70,7 @@ class TaxSummary extends Report } } - public function setTotals($items, $date_field, $check_type = false, $table = 'default') + public function setTotals($items, $date_field, $check_type = false, $table = 'default', $with_tax = true) { foreach ($items as $item) { // Make groups extensible