Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Remove methods no longer used.
James Colef5adb4047f7c
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex 9c39d9c373..369a88ccdb 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -111,101 +111,6 @@ class AccountRepository implements AccountRepositoryInterfacereturn $transaction;}- /**- * Get the accounts of a user that have piggy banks connected to them.- *- * @param Carbon $start- * @param Carbon $end- *- * @return Collection- */- public function getPiggyBankAccounts(Carbon $start, Carbon $end): Collection- {- $collection = new Collection(DB::table('piggy_banks')->distinct()->get(['piggy_banks.account_id']));- $accountIds = $collection->pluck('account_id')->toArray();- $accounts = new Collection;- $accountIds = array_unique($accountIds);- if (count($accountIds) > 0) {- $accounts = $this->user->accounts()->whereIn('id', $accountIds)->where('accounts.active', 1)->get();- }-- $accounts->each(- function (Account $account) use ($start, $end) {- $account->startBalance = Steam::balanceIgnoreVirtual($account, $start);- $account->endBalance = Steam::balanceIgnoreVirtual($account, $end);- $account->piggyBalance = '0';- /** @var PiggyBank $piggyBank */- foreach ($account->piggyBanks as $piggyBank) {- $account->piggyBalance = bcadd($account->piggyBalance, $piggyBank->currentRelevantRep()->currentamount);- }- // sum of piggy bank amounts on this account:- // diff between endBalance and piggyBalance.- // then, percentage.- $difference = bcsub($account->endBalance, $account->piggyBalance);- $account->difference = $difference;- $account->percentage = $difference != 0 && $account->endBalance != 0 ? round((($difference / $account->endBalance) * 100)) : 100;-- }- );--- return $accounts;-- }-- /**- * Get savings accounts.- *- * @param Carbon $start- * @param Carbon $end- *- * @return Collection- */- public function getSavingsAccounts(Carbon $start, Carbon $end): Collection- {- $accounts = $this->user->accounts()->accountTypeIn(['Default account', 'Asset account'])->orderBy('accounts.name', 'ASC')- ->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')- ->where('account_meta.name', 'accountRole')- ->where('accounts.active', 1)- ->where('account_meta.data', '"savingAsset"')- ->get(['accounts.*']);-- $accounts->each(- function (Account $account) use ($start, $end) {- $account->startBalance = Steam::balance($account, $start);- $account->endBalance = Steam::balance($account, $end);-- // diff (negative when lost, positive when gained)- $diff = bcsub($account->endBalance, $account->startBalance);-- if ($diff < 0 && $account->startBalance > 0) {- // percentage lost compared to start.- $pct = (($diff * -1) / $account->startBalance) * 100;-- $pct = $pct > 100 ? 100 : $pct;- $account->difference = $diff;- $account->percentage = round($pct);-- return;- }- if ($diff >= 0 && $account->startBalance > 0) {- $pct = ($diff / $account->startBalance) * 100;- $pct = $pct > 100 ? 100 : $pct;- $account->difference = $diff;- $account->percentage = round($pct);-- return;- }- $account->difference = $diff;- $account->percentage = 100;-- }- );--- return $accounts;- }-/*** @param Collection $accounts* @param array $typesdiff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.phpindex d4b6c55212..7ed47ff454 100644--- a/app/Repositories/Account/AccountRepositoryInterface.php+++ b/app/Repositories/Account/AccountRepositoryInterface.php@@ -60,26 +60,6 @@ interface AccountRepositoryInterface*/public function getFirstTransaction(TransactionJournal $journal, Account $account): Transaction;- /**- * Get the accounts of a user that have piggy banks connected to them.- *- * @param Carbon $start- * @param Carbon $end- *- * @return Collection- */- public function getPiggyBankAccounts(Carbon $start, Carbon $end): Collection;-- /**- * Get savings accounts.- *- * @param Carbon $start- * @param Carbon $end- *- * @return Collection- */- public function getSavingsAccounts(Carbon $start, Carbon $end): Collection;-/*** @param Collection $accounts* @param array $types