Skip to content

Firefly III: a personal finances manager

Fix #4169

James Colefe66bb1984d8
diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.php
index a1d05fe4d2..e7d51ac5f7 100644
--- a/app/Http/Controllers/Report/BudgetController.php
+++ b/app/Http/Controllers/Report/BudgetController.php
@@ -73,6 +73,7 @@ class BudgetController extends Controller
/**
* Partial used in the budget report.
+ *
* @param Collection $accounts
* @param Collection $budgets
* @param Carbon $start
@@ -93,6 +94,7 @@ class BudgetController extends Controller
$generator->accountPerBudget();
$report = $generator->getReport();
+
return view('reports.budget.partials.account-per-budget', compact('report', 'budgets'));
}
@@ -183,8 +185,8 @@ class BudgetController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
}
@@ -268,6 +270,7 @@ class BudgetController extends Controller
$report[$budgetId]['currencies'][$currencyId]['sum_pct'] = $pct;
}
}
+
return view('reports.budget.partials.budgets', compact('sums', 'report'));
}
@@ -345,7 +348,7 @@ class BudgetController extends Controller
$report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0';
$report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]);
$report[$key]['sum'] = bcadd($report[$key] ['sum'], $journal['amount']);
- $report[$key]['avg'] = bcdiv($report[$key]['sum'], (string) count($periods));
+ $report[$key]['avg'] = bcdiv($report[$key]['sum'], (string)count($periods));
}
}
}
@@ -380,9 +383,10 @@ class BudgetController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'destination_account_name' => $journal['destination_account_name'],
'destination_account_id' => $journal['destination_account_id'],
'currency_id' => $currency['currency_id'],
diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php
index 113c644b69..c8c1a28e3f 100644
--- a/app/Http/Controllers/Report/CategoryController.php
+++ b/app/Http/Controllers/Report/CategoryController.php
@@ -59,6 +59,7 @@ class CategoryController extends Controller
function ($request, $next) {
$this->opsRepository = app(OperationsRepositoryInterface::class);
$this->noCatRepository = app(NoCategoryRepositoryInterface::class);
+
return $next($request);
}
);
@@ -302,8 +303,8 @@ class CategoryController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
}
@@ -354,8 +355,8 @@ class CategoryController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
}
@@ -703,9 +704,10 @@ class CategoryController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'destination_account_name' => $journal['destination_account_name'],
'destination_account_id' => $journal['destination_account_id'],
'currency_id' => $currency['currency_id'],
@@ -752,9 +754,10 @@ class CategoryController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'source_account_name' => $journal['source_account_name'],
'source_account_id' => $journal['source_account_id'],
'currency_id' => $currency['currency_id'],
diff --git a/app/Http/Controllers/Report/DoubleController.php b/app/Http/Controllers/Report/DoubleController.php
index d87382a802..c7f9650fb2 100644
--- a/app/Http/Controllers/Report/DoubleController.php
+++ b/app/Http/Controllers/Report/DoubleController.php
@@ -100,8 +100,8 @@ class DoubleController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
// sort by amount_float
@@ -152,8 +152,8 @@ class DoubleController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
// sort by amount_float
@@ -410,9 +410,10 @@ class DoubleController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'destination_account_name' => $journal['destination_account_name'],
'destination_account_id' => $journal['destination_account_id'],
'currency_id' => $currency['currency_id'],
@@ -459,9 +460,10 @@ class DoubleController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'destination_account_name' => $journal['destination_account_name'],
'destination_account_id' => $journal['destination_account_id'],
'currency_id' => $currency['currency_id'],
diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php
index e5b57fe2c4..606eeed1a8 100644
--- a/app/Http/Controllers/Report/TagController.php
+++ b/app/Http/Controllers/Report/TagController.php
@@ -297,8 +297,8 @@ class TagController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
}
@@ -349,8 +349,8 @@ class TagController extends Controller
];
$result[$key]['transactions']++;
$result[$key]['sum'] = bcadd($journal['amount'], $result[$key]['sum']);
- $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string) $result[$key]['transactions']);
- $result[$key]['avg_float'] = (float) $result[$key]['avg'];
+ $result[$key]['avg'] = bcdiv($result[$key]['sum'], (string)$result[$key]['transactions']);
+ $result[$key]['avg_float'] = (float)$result[$key]['avg'];
}
}
}
@@ -496,9 +496,10 @@ class TagController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'destination_account_name' => $journal['destination_account_name'],
'destination_account_id' => $journal['destination_account_id'],
'currency_id' => $currency['currency_id'],
@@ -545,9 +546,10 @@ class TagController extends Controller
$result[] = [
'description' => $journal['description'],
'transaction_group_id' => $journal['transaction_group_id'],
- 'amount_float' => (float) $journal['amount'],
+ 'amount_float' => (float)$journal['amount'],
'amount' => $journal['amount'],
'date' => $journal['date']->formatLocalized($this->monthAndDayFormat),
+ 'date_sort' => $journal['date']->format('Y-m-d'),
'source_account_name' => $journal['source_account_name'],
'source_account_id' => $journal['source_account_id'],
'currency_id' => $currency['currency_id'],
diff --git a/resources/views/v1/reports/budget/partials/top-expenses.twig b/resources/views/v1/reports/budget/partials/top-expenses.twig
index 8bcdee6243..8b5d71bd6b 100644
--- a/resources/views/v1/reports/budget/partials/top-expenses.twig
+++ b/resources/views/v1/reports/budget/partials/top-expenses.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/category/partials/top-expenses.twig b/resources/views/v1/reports/category/partials/top-expenses.twig
index 52e56fd701..f435d41189 100644
--- a/resources/views/v1/reports/category/partials/top-expenses.twig
+++ b/resources/views/v1/reports/category/partials/top-expenses.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/category/partials/top-income.twig b/resources/views/v1/reports/category/partials/top-income.twig
index 8c256c4d9e..e5d566d468 100644
--- a/resources/views/v1/reports/category/partials/top-income.twig
+++ b/resources/views/v1/reports/category/partials/top-income.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/double/partials/top-expenses.twig b/resources/views/v1/reports/double/partials/top-expenses.twig
index cbcbba030a..8c957eb6e3 100644
--- a/resources/views/v1/reports/double/partials/top-expenses.twig
+++ b/resources/views/v1/reports/double/partials/top-expenses.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/double/partials/top-income.twig b/resources/views/v1/reports/double/partials/top-income.twig
index cbcbba030a..8c957eb6e3 100644
--- a/resources/views/v1/reports/double/partials/top-income.twig
+++ b/resources/views/v1/reports/double/partials/top-income.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/tag/partials/top-expenses.twig b/resources/views/v1/reports/tag/partials/top-expenses.twig
index ef0bab8f92..1e88ec350b 100644
--- a/resources/views/v1/reports/tag/partials/top-expenses.twig
+++ b/resources/views/v1/reports/tag/partials/top-expenses.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>
diff --git a/resources/views/v1/reports/tag/partials/top-income.twig b/resources/views/v1/reports/tag/partials/top-income.twig
index f2c6e293e8..12dc972911 100644
--- a/resources/views/v1/reports/tag/partials/top-income.twig
+++ b/resources/views/v1/reports/tag/partials/top-income.twig
@@ -20,7 +20,7 @@
{{ row.description }}
</a>
</td>
- <td data-sortable="false">
+ <td data-value="{{ row.date_sort }}">
{{ row.date }}
</td>