Fix date range in profit/loss report

This commit is contained in:
Hillel Coren 2017-02-07 09:18:17 +02:00
parent 85352f02cf
commit 557e088c46

View File

@ -23,7 +23,9 @@ class ProfitAndLossReport extends AbstractReport
$payments = Payment::scope()
->with('client.contacts')
->withArchived()
->excludeFailed();
->excludeFailed()
->where('payment_date', '>=', $this->startDate)
->where('payment_date', '<=', $this->endDate);
foreach ($payments->get() as $payment) {
$client = $payment->client;
@ -43,7 +45,9 @@ class ProfitAndLossReport extends AbstractReport
$expenses = Expense::scope()
->with('client.contacts')
->withArchived();
->withArchived()
->where('expense_date', '>=', $this->startDate)
->where('expense_date', '<=', $this->endDate);
foreach ($expenses->get() as $expense) {
$client = $expense->client;