mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Various code cleanup. [skip ci]
This commit is contained in:
parent
ccf1a6c182
commit
3ccb791674
@ -52,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// @var AttachmentRepositoryInterface repository
|
/** @var AttachmentRepositoryInterface repository */
|
||||||
$this->repository = app(AttachmentRepositoryInterface::class);
|
$this->repository = app(AttachmentRepositoryInterface::class);
|
||||||
// make storage:
|
// make storage:
|
||||||
$this->uploadDisk = Storage::disk('upload');
|
$this->uploadDisk = Storage::disk('upload');
|
||||||
|
@ -26,6 +26,7 @@ use Carbon\Carbon;
|
|||||||
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
use FireflyIII\Generator\Report\ReportGeneratorInterface;
|
||||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Steam;
|
use Steam;
|
||||||
@ -173,7 +174,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
|||||||
$startBalance = $dayBeforeBalance;
|
$startBalance = $dayBeforeBalance;
|
||||||
$currency = $currencyRepos->find(intval($account->getMeta('currency_id')));
|
$currency = $currencyRepos->find(intval($account->getMeta('currency_id')));
|
||||||
|
|
||||||
// @var Transaction $journal
|
/** @var Transaction $transaction */
|
||||||
foreach ($journals as $transaction) {
|
foreach ($journals as $transaction) {
|
||||||
$transaction->before = $startBalance;
|
$transaction->before = $startBalance;
|
||||||
$transactionAmount = $transaction->transaction_amount;
|
$transactionAmount = $transaction->transaction_amount;
|
||||||
|
@ -130,11 +130,11 @@ class CategoryController extends Controller
|
|||||||
/** @var Category $category */
|
/** @var Category $category */
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
|
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
|
||||||
if (0 !== bccomp($spent, '0')) {
|
$earned = $repository->earnedInPeriod(new Collection([$category]), $accounts, $start, $end);
|
||||||
$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id];
|
if (0 !== bccomp($spent, '0') || 0 !== bccomp($earned, '0')) {
|
||||||
|
$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'earned' => $earned, 'id' => $category->id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the result
|
// sort the result
|
||||||
// Obtain a list of columns
|
// Obtain a list of columns
|
||||||
$sum = [];
|
$sum = [];
|
||||||
|
@ -158,7 +158,7 @@ class PiggyBank extends Model
|
|||||||
public function leftOnAccount(Carbon $date): string
|
public function leftOnAccount(Carbon $date): string
|
||||||
{
|
{
|
||||||
$balance = Steam::balanceIgnoreVirtual($this->account, $date);
|
$balance = Steam::balanceIgnoreVirtual($this->account, $date);
|
||||||
// @var PiggyBank $p
|
/** @var PiggyBank $piggyBank */
|
||||||
foreach ($this->account->piggyBanks as $piggyBank) {
|
foreach ($this->account->piggyBanks as $piggyBank) {
|
||||||
$currentAmount = $piggyBank->currentRelevantRep()->currentamount ?? '0';
|
$currentAmount = $piggyBank->currentRelevantRep()->currentamount ?? '0';
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
public function findByTag(string $tag): Tag
|
public function findByTag(string $tag): Tag
|
||||||
{
|
{
|
||||||
$tags = $this->user->tags()->get();
|
$tags = $this->user->tags()->get();
|
||||||
// @var Tag $tag
|
/** @var Tag $databaseTag */
|
||||||
foreach ($tags as $databaseTag) {
|
foreach ($tags as $databaseTag) {
|
||||||
if ($databaseTag->tag === $tag) {
|
if ($databaseTag->tag === $tag) {
|
||||||
return $databaseTag;
|
return $databaseTag;
|
||||||
|
@ -2,14 +2,17 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ 'category'|_ }}</th>
|
<th>{{ 'category'|_ }}</th>
|
||||||
|
<th style="text-align: right;">{{ 'earned'|_ }}</th>
|
||||||
<th style="text-align: right;">{{ 'spent'|_ }}</th>
|
<th style="text-align: right;">{{ 'spent'|_ }}</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% set sum = 0 %}
|
{% set sumSpent = 0 %}
|
||||||
|
{% set sumEarned = 0 %}
|
||||||
{% for index, category in report %}
|
{% for index, category in report %}
|
||||||
{% set sum = sum + category.spent %}
|
{% set sumSpent = sumSpent + category.spent %}
|
||||||
|
{% set sumEarned = sumEarned + category.earned %}
|
||||||
{% if loop.index > listLength %}
|
{% if loop.index > listLength %}
|
||||||
<tr class="overListLength">
|
<tr class="overListLength">
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -18,6 +21,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="{{ route('categories.show', category.id) }}">{{ category.name }}</a>
|
<a href="{{ route('categories.show', category.id) }}">{{ category.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td style="text-align: right;">{{ 0|formatAmount }}</td>
|
||||||
<td style="text-align: right;">{{ category.spent|formatAmount }}</td>
|
<td style="text-align: right;">{{ category.spent|formatAmount }}</td>
|
||||||
<td style="width:20px;">
|
<td style="width:20px;">
|
||||||
<i class="fa fa-fw fa-info-circle text-muted firefly-info-button"
|
<i class="fa fa-fw fa-info-circle text-muted firefly-info-button"
|
||||||
@ -38,7 +42,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><em>{{ 'sum'|_ }}</em></td>
|
<td><em>{{ 'sum'|_ }}</em></td>
|
||||||
<td style="text-align: right;">{{ sum|formatAmount }}</td>
|
<td style="text-align: right;">{{ sumEarned|formatAmount }}</td>
|
||||||
|
<td style="text-align: right;">{{ sumSpent|formatAmount }}</td>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
Loading…
Reference in New Issue
Block a user