Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Change the precision. Should not influence anything.
James Colefe9b8e834dcd
diff --git a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.phpindex d611ab2ad3..38987abec1 100644--- a/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php+++ b/app/Generator/Chart/Account/ChartJsAccountChartGenerator.php@@ -30,7 +30,6 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface'label' => trans('firefly.spent'),'data' => []]]];- bcscale(2);$start->subDay();$ids = $this->getIdsFromCollection($accounts);$startBalances = Steam::balancesById($ids, $start);diff --git a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.phpindex 3f219606fb..ffbc35759a 100644--- a/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php+++ b/app/Generator/Chart/Bill/ChartJsBillChartGenerator.php@@ -30,7 +30,6 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface*/public function frontpage(string $paid, string $unpaid): array{- bcscale(2);$data = [['value' => round($unpaid, 2),@@ -57,7 +56,6 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface*/public function single(Bill $bill, Collection $entries): array{- bcscale(2);$format = (string)trans('config.month');$data = ['count' => 3,diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.phpindex e5ce03b155..45f5447dc9 100644--- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php+++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php@@ -68,7 +68,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface*/public function frontpage(Collection $entries): array{- bcscale(2);$data = ['count' => 0,'labels' => [],diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.phpindex 9c15606ddd..f2a2893cf7 100644--- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php+++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php@@ -89,7 +89,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface*/public function frontpage(Collection $entries): array{- bcscale(2);$data = ['count' => 1,'labels' => [],diff --git a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.phpindex c59663b8c9..086e208039 100644--- a/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php+++ b/app/Generator/Chart/PiggyBank/ChartJsPiggyBankChartGenerator.php@@ -36,7 +36,6 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface],];$sum = '0';- bcscale(2);foreach ($set as $entry) {$date = new Carbon($entry->date);$sum = bcadd($sum, $entry->sum);diff --git a/app/Handlers/Events/ConnectJournalToPiggyBank.php b/app/Handlers/Events/ConnectJournalToPiggyBank.phpindex 287ae8de3e..83089674cc 100644--- a/app/Handlers/Events/ConnectJournalToPiggyBank.php+++ b/app/Handlers/Events/ConnectJournalToPiggyBank.php@@ -29,7 +29,6 @@ class ConnectJournalToPiggyBank/** @var TransactionJournal $journal */$journal = $event->journal;$piggyBankId = $event->piggyBankId;- bcscale(2);/** @var PiggyBank $piggyBank */$piggyBank = Auth::user()->piggybanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);@@ -42,7 +41,6 @@ class ConnectJournalToPiggyBankif (is_null($repetition)) {return true;}- bcscale(2);$amount = TransactionJournal::amountPositive($journal);// if piggy account matches source account, the amount is positivediff --git a/app/Handlers/Events/UpdateJournalConnection.php b/app/Handlers/Events/UpdateJournalConnection.phpindex fe1a961fb4..0a5e5f2804 100644--- a/app/Handlers/Events/UpdateJournalConnection.php+++ b/app/Handlers/Events/UpdateJournalConnection.php@@ -43,7 +43,6 @@ class UpdateJournalConnectionif (is_null($repetition)) {return false;}- bcscale(2);$amount = TransactionJournal::amount($journal);$diff = bcsub($amount, $event->amount); // update current repetitiondiff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.phpindex d1035ac3ab..e6157f6c06 100644--- a/app/Helpers/Collection/BalanceLine.php+++ b/app/Helpers/Collection/BalanceLine.php@@ -124,7 +124,6 @@ class BalanceLine*/public function leftOfRepetition(): string{- bcscale(2);$start = $this->budget->amount ?? '0';/** @var BalanceEntry $balanceEntry */foreach ($this->getBalanceEntries() as $balanceEntry) {diff --git a/app/Helpers/Collection/Budget.php b/app/Helpers/Collection/Budget.phpindex 7569f3eeb1..f7fad282f2 100644--- a/app/Helpers/Collection/Budget.php+++ b/app/Helpers/Collection/Budget.php@@ -46,7 +46,6 @@ class Budgetpublic function addBudgeted(string $add){$add = strval(round($add, 2));- bcscale(2);$this->budgeted = bcadd($this->budgeted, $add);}@@ -56,7 +55,6 @@ class Budgetpublic function addLeft(string $add){$add = strval(round($add, 2));- bcscale(2);$this->left = bcadd($this->left, $add);}@@ -66,7 +64,6 @@ class Budgetpublic function addOverspent(string $add){$add = strval(round($add, 2));- bcscale(2);$this->overspent = bcadd($this->overspent, $add);}@@ -76,7 +73,6 @@ class Budgetpublic function addSpent(string $add){$add = strval(round($add, 2));- bcscale(2);$this->spent = bcadd($this->spent, $add);}diff --git a/app/Helpers/Collection/Category.php b/app/Helpers/Collection/Category.phpindex 644656a00f..df337c5773 100644--- a/app/Helpers/Collection/Category.php+++ b/app/Helpers/Collection/Category.php@@ -47,7 +47,6 @@ class Categorypublic function addTotal(string $add){$add = strval(round($add, 2));- bcscale(2);$this->total = bcadd($this->total, $add);}diff --git a/app/Helpers/Collection/Expense.php b/app/Helpers/Collection/Expense.phpindex 25441b493b..b241f04f9f 100644--- a/app/Helpers/Collection/Expense.php+++ b/app/Helpers/Collection/Expense.php@@ -34,7 +34,6 @@ class Expense*/public function addOrCreateExpense(TransactionJournal $entry){- bcscale(2);$accountId = $entry->account_id;$amount = strval(round($entry->journalAmount, 2));@@ -62,7 +61,6 @@ class Expense*/public function addToTotal(string $add){- bcscale(2);$add = strval(round($add, 2));diff --git a/app/Helpers/Collection/Income.php b/app/Helpers/Collection/Income.phpindex fc3cf45814..b2ff2bd52f 100644--- a/app/Helpers/Collection/Income.php+++ b/app/Helpers/Collection/Income.php@@ -45,7 +45,6 @@ class Income$newObject->id = $accountId;$this->incomes->put($accountId, $newObject);} else {- bcscale(2);$existing = $this->incomes->get($accountId);$existing->amount = bcadd($existing->amount, $entry->journalAmount);$existing->count++;@@ -59,7 +58,6 @@ class Incomepublic function addToTotal(string $add){$add = strval(round($add, 2));- bcscale(2);$this->total = bcadd($this->total, $add);}diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.phpindex 43873f9070..ac1bcdffb4 100644--- a/app/Helpers/Csv/Importer.php+++ b/app/Helpers/Csv/Importer.php@@ -147,7 +147,6 @@ class Importer*/protected function createTransactionJournal(){- bcscale(2);$date = $this->importData['date'];if (is_null($this->importData['date'])) {$date = $this->importData['date-rent'];diff --git a/app/Helpers/Csv/PostProcessing/Amount.php b/app/Helpers/Csv/PostProcessing/Amount.phpindex 336c69dfb9..fc5f9b9fc7 100644--- a/app/Helpers/Csv/PostProcessing/Amount.php+++ b/app/Helpers/Csv/PostProcessing/Amount.php@@ -19,7 +19,6 @@ class Amount implements PostProcessorInterface*/public function process(){- bcscale(2);$amount = $this->data['amount'] ?? '0';$modifier = strval($this->data['amount-modifier']);$this->data['amount'] = bcmul($amount, $modifier);diff --git a/app/Helpers/Report/AccountReportHelper.php b/app/Helpers/Report/AccountReportHelper.phpindex 728d5e11d9..6a75df21c6 100644--- a/app/Helpers/Report/AccountReportHelper.php+++ b/app/Helpers/Report/AccountReportHelper.php@@ -44,7 +44,6 @@ class AccountReportHelper implements AccountReportHelperInterface$yesterday = clone $start;$yesterday->subDay();- bcscale(2);// get balances for start.$startSet = Account::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.phpindex a33163df3f..0e70cc3745 100644--- a/app/Helpers/Report/BalanceReportHelper.php+++ b/app/Helpers/Report/BalanceReportHelper.php@@ -155,7 +155,6 @@ class BalanceReportHelper implements BalanceReportHelperInterfaceif (!is_null($leftEntry->first())) {$left = $leftEntry->first()->sum;}- bcscale(2);$diffValue = bcadd($spent, $left);// difference:@@ -225,7 +224,6 @@ class BalanceReportHelper implements BalanceReportHelperInterfaceif (!is_null($leftEntry->first())) {$left = $leftEntry->first()->sum;}- bcscale(2);// balanced by tags$tagEntry = new BalanceEntry;diff --git a/app/Helpers/Report/BudgetReportHelper.php b/app/Helpers/Report/BudgetReportHelper.phpindex 338d6b6d2b..aee2bf4ee6 100644--- a/app/Helpers/Report/BudgetReportHelper.php+++ b/app/Helpers/Report/BudgetReportHelper.php@@ -40,7 +40,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface$set = $repository->getBudgets();$allRepetitions = $repository->getAllBudgetLimitRepetitions($start, $end);$allTotalSpent = $repository->spentAllPerDayForAccounts($accounts, $start, $end);- bcscale(2);foreach ($set as $budget) {@@ -119,7 +118,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface*/protected function getSumOfRange(Carbon $start, Carbon $end, array $array){- bcscale(2);$sum = '0';$currentStart = clone $start; // to not mess with the original one$currentEnd = clone $end; // to not mess with the original onediff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex 48a10c4830..c63fdf7960 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -77,7 +77,6 @@ class ReportHelper implements ReportHelperInterface$billLine->setMax($bill->amount_max);// is hit in period?- bcscale(2);$entry = $journals->filter(function (TransactionJournal $journal) use ($bill) {@@ -229,7 +228,6 @@ class ReportHelper implements ReportHelperInterface*/public function tagReport(Carbon $start, Carbon $end, Collection $accounts): array{- bcscale(2);$ids = $accounts->pluck('id')->toArray();$set = Tag::distinct()@@ -289,7 +287,6 @@ class ReportHelper implements ReportHelperInterface*/protected function getSumOfRange(Carbon $start, Carbon $end, array $array){- bcscale(2);$sum = '0';$currentStart = clone $start; // to not mess with the original one$currentEnd = clone $end; // to not mess with the original onediff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex b767e3d355..6424acf265 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -156,7 +156,6 @@ class BudgetController extends Controller$period = Navigation::periodShow($start, $range);$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);- bcscale(2);/*** Do some cleanup:*/diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 5752890878..18a61759d2 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -98,7 +98,6 @@ class BudgetController extends Controller{$start = clone $repetition->startdate;$end = $repetition->enddate;- bcscale(2);// chart properties for cache:$cache = new CacheProperties();@@ -170,8 +169,6 @@ class BudgetController extends Controller$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);- bcscale(2);-/** @var Budget $budget */foreach ($budgets as $budget) {// we already have amount, startdate and enddate.diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.phpindex a50eab8454..7362ae68a8 100644--- a/app/Http/Controllers/Chart/ReportController.php+++ b/app/Http/Controllers/Chart/ReportController.php@@ -46,7 +46,6 @@ class ReportController extends Controller*/public function netWorth(string $reportType, Carbon $start, Carbon $end, Collection $accounts){- bcscale(2);// chart properties for cache:$cache = new CacheProperties;$cache->addProperty('netWorth');@@ -200,7 +199,6 @@ class ReportController extends Controller*/protected function multiYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end){- bcscale(2);$income = '0';$expense = '0';$count = 0;@@ -228,7 +226,6 @@ class ReportController extends Controller*/protected function pluckFromArray($year, array $set){- bcscale(2);$sum = '0';foreach ($set as $date => $amount) {if (substr($date, 0, 4) == $year) {@@ -278,7 +275,6 @@ class ReportController extends Controller*/protected function singleYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end){- bcscale(2);$income = '0';$expense = '0';$count = 0;@@ -305,7 +301,6 @@ class ReportController extends Controller*/private function arraySum($array) : string{- bcscale(2);$sum = '0';foreach ($array as $entry) {$sum = bcadd($sum, $entry);diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex 373bf1968b..b3070f64bf 100644--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -82,7 +82,6 @@ class Controller extends BaseController*/protected function getSumOfRange(Carbon $start, Carbon $end, array $array){- bcscale(2);$sum = '0';$currentStart = clone $start; // to not mess with the original one$currentEnd = clone $end; // to not mess with the original onediff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 2a4299e3a6..47b2f482d6 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -92,7 +92,6 @@ class HomeController extends Controller{$types = Config::get('firefly.accountTypesByIdentifier.asset');$count = $repository->countAccounts($types);- bcscale(2);if ($count == 0) {return redirect(route('new-user.index'));diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.phpindex 8e11142d10..229879cf1a 100644--- a/app/Http/Controllers/JsonController.php+++ b/app/Http/Controllers/JsonController.php@@ -56,7 +56,6 @@ class JsonController extends Controller{$start = session('start', Carbon::now()->startOfMonth());$end = session('end', Carbon::now()->endOfMonth());- bcscale(2);/** Since both this method and the chart use the exact same data, we can suffice@@ -81,7 +80,6 @@ class JsonController extends Controller*/public function boxBillsUnpaid(BillRepositoryInterface $repository){- bcscale(2);$start = session('start', Carbon::now()->startOfMonth());$end = session('end', Carbon::now()->endOfMonth());$amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.phpindex 2435d37b76..0a9c50e40a 100644--- a/app/Http/Controllers/PiggyBankController.php+++ b/app/Http/Controllers/PiggyBankController.php@@ -47,7 +47,6 @@ class PiggyBankController extends Controller*/public function add(ARI $repository, PiggyBank $piggyBank){- bcscale(2);/** @var Carbon $date */$date = session('end', Carbon::now()->endOfMonth());$leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date);@@ -169,7 +168,6 @@ class PiggyBankController extends Controller$piggyBanks = $piggyRepository->getPiggyBanks();/** @var Carbon $end */$end = session('end', Carbon::now()->endOfMonth());- bcscale(2);$accounts = [];/** @var PiggyBank $piggyBank */@@ -228,7 +226,6 @@ class PiggyBankController extends Controller*/public function postAdd(PiggyBankRepositoryInterface $repository, ARI $accounts, PiggyBank $piggyBank){- bcscale(2);$amount = round(Input::get('amount'), 2);/** @var Carbon $date */$date = session('end', Carbon::now()->endOfMonth());@@ -264,7 +261,6 @@ class PiggyBankController extends Controllerpublic function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank){$amount = round(Input::get('amount'), 2);- bcscale(2);$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 64db219d7f..8b328be162 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -271,7 +271,6 @@ class TransactionController extends Controller});- bcscale(2);$journal->transactions->each(function (Transaction $t) use ($journal, $repository) {$t->before = $repository->getAmountBefore($journal, $t);diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex da148f936f..b185d6ac3e 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -268,7 +268,6 @@ class AccountRepository implements AccountRepositoryInterfaceif (count($ids) > 0) {$accounts = $this->user->accounts()->whereIn('id', $ids)->where('accounts.active', 1)->get();}- bcscale(2);$accounts->each(function (Account $account) use ($start, $end) {@@ -309,7 +308,6 @@ class AccountRepository implements AccountRepositoryInterface$start = clone session('start', new Carbon);$end = clone session('end', new Carbon);- bcscale(2);$accounts->each(function (Account $account) use ($start, $end) {diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex 0eedc0b419..956a4645f3 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -78,7 +78,6 @@ class JournalRepository implements JournalRepositoryInterface->where('transaction_journals.order', '>=', $journal->order)->where('transaction_journals.id', '!=', $journal->id)->get(['transactions.*']);- bcscale(2);$sum = '0';foreach ($set as $entry) {$sum = bcadd($entry->amount, $sum);diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex c939045b9b..7ec2bcd6c8 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -131,7 +131,6 @@ class TagRepository implements TagRepositoryInterface// because there will be less of them any way.$tags = $this->user->tags()->where('tagMode', 'balancingAct')->get();$amount = '0';- bcscale(2);/** @var Tag $tag */foreach ($tags as $tag) {diff --git a/app/Support/Migration/TestData.php b/app/Support/Migration/TestData.phpindex 24e020ad2c..a650581572 100644--- a/app/Support/Migration/TestData.php+++ b/app/Support/Migration/TestData.php@@ -354,7 +354,6 @@ class TestData*/public static function createGroceries(User $user, Carbon $date): bool{- bcscale(2);$start = clone $date;$end = clone $date;$today = new Carbon;diff --git a/app/Support/Models/TransactionJournalSupport.php b/app/Support/Models/TransactionJournalSupport.phpindex 0357b05d0b..53688699a0 100644--- a/app/Support/Models/TransactionJournalSupport.php+++ b/app/Support/Models/TransactionJournalSupport.php@@ -40,7 +40,6 @@ class TransactionJournalSupport extends Modelreturn $cache->get(); // @codeCoverageIgnore}- bcscale(2);$transaction = $journal->transactions->sortByDesc('amount')->first();$amount = $transaction->amount;if ($journal->isWithdrawal()) {diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 34d22e7f70..b5c7c1db19 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -38,8 +38,6 @@ class Steamreturn $cache->get(); // @codeCoverageIgnore}- bcscale(2);-$balance = strval($account->transactions()->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'@@ -124,8 +122,6 @@ class Steamreturn $cache->get(); // @codeCoverageIgnore}- bcscale(2);-$balances = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transaction_journals.date', '<=', $date->format('Y-m-d'))diff --git a/bootstrap/app.php b/bootstrap/app.phpindex ebd712abe1..500021fb9a 100644--- a/bootstrap/app.php+++ b/bootstrap/app.php@@ -11,6 +11,9 @@|*/+bcscale(4);++$app = new Illuminate\Foundation\Application(realpath(__DIR__.'/../'));@@ -26,6 +29,7 @@ $app = new Illuminate\Foundation\Application(|*/+$app->singleton(Illuminate\Contracts\Http\Kernel::class,FireflyIII\Http\Kernel::class