1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Fix dashboard totals when 'First month' is set

This commit is contained in:
Hillel Coren 2017-02-02 14:33:43 +02:00
parent 6e18841cea
commit 4853d32bf4

View File

@ -205,8 +205,12 @@ class DashboardRepository
if ($startDate) {
$paidToDate->where('payments.payment_date', '>=', $startDate);
} elseif ($account->financial_year_start) {
$yearStart = str_replace('2000', date('Y'), $account->financial_year_start);
$paidToDate->where('payments.payment_date', '>=', $yearStart);
$yearStart = Carbon::parse($account->financial_year_start);
$yearStart->year = date('Y');
if ($yearStart->isFuture()) {
$yearStart->subYear();
}
$paidToDate->where('payments.payment_date', '>=', $yearStart->format('Y-m-d'));
}
return $paidToDate->groupBy('payments.account_id')