updated reports

This commit is contained in:
denisdulici
2020-01-18 13:11:19 +03:00
parent 78ede398f2
commit ead2256589
9 changed files with 27 additions and 26 deletions

View File

@ -41,11 +41,11 @@ class ExpenseSummary extends Report
default:
// Bills
$bills = $this->applyFilters(Bill::accrued(), ['date_field' => 'billed_at'])->get();
Recurring::reflect($bills, 'bill', 'billed_at');
Recurring::reflect($bills, 'billed_at');
$this->setTotals($bills, 'billed_at');
// Payments
Recurring::reflect($payments, 'payment', 'paid_at');
Recurring::reflect($payments, 'paid_at');
$this->setTotals($payments, 'paid_at');
break;

View File

@ -31,11 +31,11 @@ class IncomeExpenseSummary extends Report
default:
// Invoices
$invoices = $this->applyFilters(Invoice::accrued(), ['date_field' => 'invoiced_at'])->get();
Recurring::reflect($invoices, 'invoice', 'invoiced_at');
Recurring::reflect($invoices, 'invoiced_at');
$this->setTotals($invoices, 'invoiced_at', true);
// Income Transactions
Recurring::reflect($income_transactions, 'transaction', 'paid_at');
Recurring::reflect($income_transactions, 'paid_at');
$this->setTotals($income_transactions, 'paid_at', true);
// Bills
@ -44,7 +44,7 @@ class IncomeExpenseSummary extends Report
$this->setTotals($bills, 'billed_at', true);
// Expense Transactions
Recurring::reflect($expense_transactions, 'transaction', 'paid_at');
Recurring::reflect($expense_transactions, 'paid_at');
$this->setTotals($expense_transactions, 'paid_at', true);
break;

View File

@ -41,11 +41,11 @@ class IncomeSummary extends Report
default:
// Invoices
$invoices = $this->applyFilters(Invoice::accrued(), ['date_field' => 'invoiced_at'])->get();
Recurring::reflect($invoices, 'invoice', 'invoiced_at');
Recurring::reflect($invoices, 'invoiced_at');
$this->setTotals($invoices, 'invoiced_at');
// Transactions
Recurring::reflect($transactions, 'transaction', 'paid_at');
Recurring::reflect($transactions, 'paid_at');
$this->setTotals($transactions, 'paid_at');
break;

View File

@ -79,11 +79,11 @@ class ProfitLoss extends Report
default:
// Invoices
$invoices = $this->applyFilters(Invoice::accrued(), ['date_field' => 'invoiced_at'])->get();
Recurring::reflect($invoices, 'invoice', 'invoiced_at');
Recurring::reflect($invoices, 'invoiced_at');
$this->setTotals($invoices, 'invoiced_at', true, $this->tables['income']);
// Income Transactions
Recurring::reflect($income_transactions, 'transaction', 'paid_at');
Recurring::reflect($income_transactions, 'paid_at');
$this->setTotals($income_transactions, 'paid_at', true, $this->tables['income']);
// Bills
@ -92,7 +92,7 @@ class ProfitLoss extends Report
$this->setTotals($bills, 'billed_at', true, $this->tables['expense']);
// Expense Transactions
Recurring::reflect($expense_transactions, 'transaction', 'paid_at');
Recurring::reflect($expense_transactions, 'paid_at');
$this->setTotals($expense_transactions, 'paid_at', true, $this->tables['expense']);
break;

View File

@ -62,12 +62,12 @@ class TaxSummary extends Report
default:
// Invoices
$invoices = $this->applyFilters(Invoice::accrued(), ['date_field' => 'invoiced_at'])->get();
Recurring::reflect($invoices, 'invoice', 'invoiced_at');
Recurring::reflect($invoices, 'invoiced_at');
$this->setTotals($invoices, 'invoiced_at');
// Bills
$bills = $this->applyFilters(Bill::accrued(), ['date_field' => 'billed_at'])->get();
Recurring::reflect($bills, 'bill', 'billed_at');
Recurring::reflect($bills, 'billed_at');
$this->setTotals($bills, 'billed_at');
break;
@ -80,7 +80,7 @@ class TaxSummary extends Report
// Make groups extensible
$item = $this->applyGroups($item);
$db_table = $item->getTable();
$type = (($item instanceof Invoice) || (($item instanceof Transaction) && ($item->type == 'income'))) ? 'income' : 'expense';
$date = $this->getFormattedDate(Date::parse($item->$date_field));
@ -97,8 +97,6 @@ class TaxSummary extends Report
continue;
}
$type = (($db_table == 'invoices') || (($db_table == 'transactions') && ($item->type == 'income'))) ? 'income' : 'expense';
if (!isset($this->rows[$item_total->name][$type][$date]) ||
!isset($this->totals[$item_total->name][$date]))
{