Skip to content

Commit

Permalink
removed tax from profit & loss
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed May 16, 2020
1 parent af66baa commit ce84e47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/Abstracts/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function setRows()
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
Expand All @@ -347,7 +347,7 @@ public function setTotals($items, $date_field, $check_type = false, $table = 'de
continue;
}

$amount = $item->getAmountConvertedToDefault();
$amount = $item->getAmountConvertedToDefault(false, $with_tax);

$type = (($item instanceof Invoice) || (($item instanceof Transaction) && ($item->type == 'income'))) ? 'income' : 'expense';

Expand Down
12 changes: 6 additions & 6 deletions app/Reports/ProfitLoss.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,33 @@ public function setData()
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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Reports/TaxSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setData()
}
}

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
Expand Down

0 comments on commit ce84e47

Please sign in to comment.