From 557e088c46c5b616686d630e975de1fa60b0e841 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 7 Feb 2017 09:18:17 +0200 Subject: [PATCH] Fix date range in profit/loss report --- app/Ninja/Reports/ProfitAndLossReport.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Ninja/Reports/ProfitAndLossReport.php b/app/Ninja/Reports/ProfitAndLossReport.php index d4bddd69fb95..23c6e10f534e 100644 --- a/app/Ninja/Reports/ProfitAndLossReport.php +++ b/app/Ninja/Reports/ProfitAndLossReport.php @@ -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;