Change the precision. Should not influence anything.

This commit is contained in:
James Cole
2016-03-16 17:47:07 +01:00
parent 64f273120e
commit fe9b8e834d
33 changed files with 4 additions and 57 deletions

View File

@@ -30,7 +30,6 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
'label' => trans('firefly.spent'), 'label' => trans('firefly.spent'),
'data' => []]]]; 'data' => []]]];
bcscale(2);
$start->subDay(); $start->subDay();
$ids = $this->getIdsFromCollection($accounts); $ids = $this->getIdsFromCollection($accounts);
$startBalances = Steam::balancesById($ids, $start); $startBalances = Steam::balancesById($ids, $start);

View File

@@ -30,7 +30,6 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
*/ */
public function frontpage(string $paid, string $unpaid): array public function frontpage(string $paid, string $unpaid): array
{ {
bcscale(2);
$data = [ $data = [
[ [
'value' => round($unpaid, 2), 'value' => round($unpaid, 2),
@@ -57,7 +56,6 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
*/ */
public function single(Bill $bill, Collection $entries): array public function single(Bill $bill, Collection $entries): array
{ {
bcscale(2);
$format = (string)trans('config.month'); $format = (string)trans('config.month');
$data = [ $data = [
'count' => 3, 'count' => 3,

View File

@@ -68,7 +68,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*/ */
public function frontpage(Collection $entries): array public function frontpage(Collection $entries): array
{ {
bcscale(2);
$data = [ $data = [
'count' => 0, 'count' => 0,
'labels' => [], 'labels' => [],

View File

@@ -89,7 +89,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*/ */
public function frontpage(Collection $entries): array public function frontpage(Collection $entries): array
{ {
bcscale(2);
$data = [ $data = [
'count' => 1, 'count' => 1,
'labels' => [], 'labels' => [],

View File

@@ -36,7 +36,6 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface
], ],
]; ];
$sum = '0'; $sum = '0';
bcscale(2);
foreach ($set as $entry) { foreach ($set as $entry) {
$date = new Carbon($entry->date); $date = new Carbon($entry->date);
$sum = bcadd($sum, $entry->sum); $sum = bcadd($sum, $entry->sum);

View File

@@ -29,7 +29,6 @@ class ConnectJournalToPiggyBank
/** @var TransactionJournal $journal */ /** @var TransactionJournal $journal */
$journal = $event->journal; $journal = $event->journal;
$piggyBankId = $event->piggyBankId; $piggyBankId = $event->piggyBankId;
bcscale(2);
/** @var PiggyBank $piggyBank */ /** @var PiggyBank $piggyBank */
$piggyBank = Auth::user()->piggybanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']); $piggyBank = Auth::user()->piggybanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
@@ -42,7 +41,6 @@ class ConnectJournalToPiggyBank
if (is_null($repetition)) { if (is_null($repetition)) {
return true; return true;
} }
bcscale(2);
$amount = TransactionJournal::amountPositive($journal); $amount = TransactionJournal::amountPositive($journal);
// if piggy account matches source account, the amount is positive // if piggy account matches source account, the amount is positive

View File

@@ -43,7 +43,6 @@ class UpdateJournalConnection
if (is_null($repetition)) { if (is_null($repetition)) {
return false; return false;
} }
bcscale(2);
$amount = TransactionJournal::amount($journal); $amount = TransactionJournal::amount($journal);
$diff = bcsub($amount, $event->amount); // update current repetition $diff = bcsub($amount, $event->amount); // update current repetition

View File

@@ -124,7 +124,6 @@ class BalanceLine
*/ */
public function leftOfRepetition(): string public function leftOfRepetition(): string
{ {
bcscale(2);
$start = $this->budget->amount ?? '0'; $start = $this->budget->amount ?? '0';
/** @var BalanceEntry $balanceEntry */ /** @var BalanceEntry $balanceEntry */
foreach ($this->getBalanceEntries() as $balanceEntry) { foreach ($this->getBalanceEntries() as $balanceEntry) {

View File

@@ -46,7 +46,6 @@ class Budget
public function addBudgeted(string $add) public function addBudgeted(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->budgeted = bcadd($this->budgeted, $add); $this->budgeted = bcadd($this->budgeted, $add);
} }
@@ -56,7 +55,6 @@ class Budget
public function addLeft(string $add) public function addLeft(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->left = bcadd($this->left, $add); $this->left = bcadd($this->left, $add);
} }
@@ -66,7 +64,6 @@ class Budget
public function addOverspent(string $add) public function addOverspent(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->overspent = bcadd($this->overspent, $add); $this->overspent = bcadd($this->overspent, $add);
} }
@@ -76,7 +73,6 @@ class Budget
public function addSpent(string $add) public function addSpent(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->spent = bcadd($this->spent, $add); $this->spent = bcadd($this->spent, $add);
} }

View File

@@ -47,7 +47,6 @@ class Category
public function addTotal(string $add) public function addTotal(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->total = bcadd($this->total, $add); $this->total = bcadd($this->total, $add);
} }

View File

@@ -34,7 +34,6 @@ class Expense
*/ */
public function addOrCreateExpense(TransactionJournal $entry) public function addOrCreateExpense(TransactionJournal $entry)
{ {
bcscale(2);
$accountId = $entry->account_id; $accountId = $entry->account_id;
$amount = strval(round($entry->journalAmount, 2)); $amount = strval(round($entry->journalAmount, 2));
@@ -62,7 +61,6 @@ class Expense
*/ */
public function addToTotal(string $add) public function addToTotal(string $add)
{ {
bcscale(2);
$add = strval(round($add, 2)); $add = strval(round($add, 2));

View File

@@ -45,7 +45,6 @@ class Income
$newObject->id = $accountId; $newObject->id = $accountId;
$this->incomes->put($accountId, $newObject); $this->incomes->put($accountId, $newObject);
} else { } else {
bcscale(2);
$existing = $this->incomes->get($accountId); $existing = $this->incomes->get($accountId);
$existing->amount = bcadd($existing->amount, $entry->journalAmount); $existing->amount = bcadd($existing->amount, $entry->journalAmount);
$existing->count++; $existing->count++;
@@ -59,7 +58,6 @@ class Income
public function addToTotal(string $add) public function addToTotal(string $add)
{ {
$add = strval(round($add, 2)); $add = strval(round($add, 2));
bcscale(2);
$this->total = bcadd($this->total, $add); $this->total = bcadd($this->total, $add);
} }

View File

@@ -147,7 +147,6 @@ class Importer
*/ */
protected function createTransactionJournal() protected function createTransactionJournal()
{ {
bcscale(2);
$date = $this->importData['date']; $date = $this->importData['date'];
if (is_null($this->importData['date'])) { if (is_null($this->importData['date'])) {
$date = $this->importData['date-rent']; $date = $this->importData['date-rent'];

View File

@@ -19,7 +19,6 @@ class Amount implements PostProcessorInterface
*/ */
public function process() public function process()
{ {
bcscale(2);
$amount = $this->data['amount'] ?? '0'; $amount = $this->data['amount'] ?? '0';
$modifier = strval($this->data['amount-modifier']); $modifier = strval($this->data['amount-modifier']);
$this->data['amount'] = bcmul($amount, $modifier); $this->data['amount'] = bcmul($amount, $modifier);

View File

@@ -44,7 +44,6 @@ class AccountReportHelper implements AccountReportHelperInterface
$yesterday = clone $start; $yesterday = clone $start;
$yesterday->subDay(); $yesterday->subDay();
bcscale(2);
// get balances for start. // get balances for start.
$startSet = Account::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id') $startSet = Account::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')

View File

@@ -155,7 +155,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
if (!is_null($leftEntry->first())) { if (!is_null($leftEntry->first())) {
$left = $leftEntry->first()->sum; $left = $leftEntry->first()->sum;
} }
bcscale(2);
$diffValue = bcadd($spent, $left); $diffValue = bcadd($spent, $left);
// difference: // difference:
@@ -225,7 +224,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
if (!is_null($leftEntry->first())) { if (!is_null($leftEntry->first())) {
$left = $leftEntry->first()->sum; $left = $leftEntry->first()->sum;
} }
bcscale(2);
// balanced by tags // balanced by tags
$tagEntry = new BalanceEntry; $tagEntry = new BalanceEntry;

View File

@@ -40,7 +40,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface
$set = $repository->getBudgets(); $set = $repository->getBudgets();
$allRepetitions = $repository->getAllBudgetLimitRepetitions($start, $end); $allRepetitions = $repository->getAllBudgetLimitRepetitions($start, $end);
$allTotalSpent = $repository->spentAllPerDayForAccounts($accounts, $start, $end); $allTotalSpent = $repository->spentAllPerDayForAccounts($accounts, $start, $end);
bcscale(2);
foreach ($set as $budget) { foreach ($set as $budget) {
@@ -119,7 +118,6 @@ class BudgetReportHelper implements BudgetReportHelperInterface
*/ */
protected function getSumOfRange(Carbon $start, Carbon $end, array $array) protected function getSumOfRange(Carbon $start, Carbon $end, array $array)
{ {
bcscale(2);
$sum = '0'; $sum = '0';
$currentStart = clone $start; // to not mess with the original one $currentStart = clone $start; // to not mess with the original one
$currentEnd = clone $end; // to not mess with the original one $currentEnd = clone $end; // to not mess with the original one

View File

@@ -77,7 +77,6 @@ class ReportHelper implements ReportHelperInterface
$billLine->setMax($bill->amount_max); $billLine->setMax($bill->amount_max);
// is hit in period? // is hit in period?
bcscale(2);
$entry = $journals->filter( $entry = $journals->filter(
function (TransactionJournal $journal) use ($bill) { function (TransactionJournal $journal) use ($bill) {
@@ -229,7 +228,6 @@ class ReportHelper implements ReportHelperInterface
*/ */
public function tagReport(Carbon $start, Carbon $end, Collection $accounts): array public function tagReport(Carbon $start, Carbon $end, Collection $accounts): array
{ {
bcscale(2);
$ids = $accounts->pluck('id')->toArray(); $ids = $accounts->pluck('id')->toArray();
$set = Tag:: $set = Tag::
distinct() distinct()
@@ -289,7 +287,6 @@ class ReportHelper implements ReportHelperInterface
*/ */
protected function getSumOfRange(Carbon $start, Carbon $end, array $array) protected function getSumOfRange(Carbon $start, Carbon $end, array $array)
{ {
bcscale(2);
$sum = '0'; $sum = '0';
$currentStart = clone $start; // to not mess with the original one $currentStart = clone $start; // to not mess with the original one
$currentEnd = clone $end; // to not mess with the original one $currentEnd = clone $end; // to not mess with the original one

View File

@@ -156,7 +156,6 @@ class BudgetController extends Controller
$period = Navigation::periodShow($start, $range); $period = Navigation::periodShow($start, $range);
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
bcscale(2);
/** /**
* Do some cleanup: * Do some cleanup:
*/ */

View File

@@ -98,7 +98,6 @@ class BudgetController extends Controller
{ {
$start = clone $repetition->startdate; $start = clone $repetition->startdate;
$end = $repetition->enddate; $end = $repetition->enddate;
bcscale(2);
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties(); $cache = new CacheProperties();
@@ -170,8 +169,6 @@ class BudgetController extends Controller
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']); $accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
bcscale(2);
/** @var Budget $budget */ /** @var Budget $budget */
foreach ($budgets as $budget) { foreach ($budgets as $budget) {
// we already have amount, startdate and enddate. // we already have amount, startdate and enddate.

View File

@@ -46,7 +46,6 @@ class ReportController extends Controller
*/ */
public function netWorth(string $reportType, Carbon $start, Carbon $end, Collection $accounts) public function netWorth(string $reportType, Carbon $start, Carbon $end, Collection $accounts)
{ {
bcscale(2);
// chart properties for cache: // chart properties for cache:
$cache = new CacheProperties; $cache = new CacheProperties;
$cache->addProperty('netWorth'); $cache->addProperty('netWorth');
@@ -200,7 +199,6 @@ class ReportController extends Controller
*/ */
protected function multiYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end) protected function multiYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end)
{ {
bcscale(2);
$income = '0'; $income = '0';
$expense = '0'; $expense = '0';
$count = 0; $count = 0;
@@ -228,7 +226,6 @@ class ReportController extends Controller
*/ */
protected function pluckFromArray($year, array $set) protected function pluckFromArray($year, array $set)
{ {
bcscale(2);
$sum = '0'; $sum = '0';
foreach ($set as $date => $amount) { foreach ($set as $date => $amount) {
if (substr($date, 0, 4) == $year) { 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) protected function singleYearInOutSummarized(array $earned, array $spent, Carbon $start, Carbon $end)
{ {
bcscale(2);
$income = '0'; $income = '0';
$expense = '0'; $expense = '0';
$count = 0; $count = 0;
@@ -305,7 +301,6 @@ class ReportController extends Controller
*/ */
private function arraySum($array) : string private function arraySum($array) : string
{ {
bcscale(2);
$sum = '0'; $sum = '0';
foreach ($array as $entry) { foreach ($array as $entry) {
$sum = bcadd($sum, $entry); $sum = bcadd($sum, $entry);

View File

@@ -82,7 +82,6 @@ class Controller extends BaseController
*/ */
protected function getSumOfRange(Carbon $start, Carbon $end, array $array) protected function getSumOfRange(Carbon $start, Carbon $end, array $array)
{ {
bcscale(2);
$sum = '0'; $sum = '0';
$currentStart = clone $start; // to not mess with the original one $currentStart = clone $start; // to not mess with the original one
$currentEnd = clone $end; // to not mess with the original one $currentEnd = clone $end; // to not mess with the original one

View File

@@ -92,7 +92,6 @@ class HomeController extends Controller
{ {
$types = Config::get('firefly.accountTypesByIdentifier.asset'); $types = Config::get('firefly.accountTypesByIdentifier.asset');
$count = $repository->countAccounts($types); $count = $repository->countAccounts($types);
bcscale(2);
if ($count == 0) { if ($count == 0) {
return redirect(route('new-user.index')); return redirect(route('new-user.index'));

View File

@@ -56,7 +56,6 @@ class JsonController extends Controller
{ {
$start = session('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
bcscale(2);
/* /*
* Since both this method and the chart use the exact same data, we can suffice * 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) public function boxBillsUnpaid(BillRepositoryInterface $repository)
{ {
bcscale(2);
$start = session('start', Carbon::now()->startOfMonth()); $start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
$amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount. $amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.

View File

@@ -47,7 +47,6 @@ class PiggyBankController extends Controller
*/ */
public function add(ARI $repository, PiggyBank $piggyBank) public function add(ARI $repository, PiggyBank $piggyBank)
{ {
bcscale(2);
/** @var Carbon $date */ /** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth()); $date = session('end', Carbon::now()->endOfMonth());
$leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date); $leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date);
@@ -169,7 +168,6 @@ class PiggyBankController extends Controller
$piggyBanks = $piggyRepository->getPiggyBanks(); $piggyBanks = $piggyRepository->getPiggyBanks();
/** @var Carbon $end */ /** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth()); $end = session('end', Carbon::now()->endOfMonth());
bcscale(2);
$accounts = []; $accounts = [];
/** @var PiggyBank $piggyBank */ /** @var PiggyBank $piggyBank */
@@ -228,7 +226,6 @@ class PiggyBankController extends Controller
*/ */
public function postAdd(PiggyBankRepositoryInterface $repository, ARI $accounts, PiggyBank $piggyBank) public function postAdd(PiggyBankRepositoryInterface $repository, ARI $accounts, PiggyBank $piggyBank)
{ {
bcscale(2);
$amount = round(Input::get('amount'), 2); $amount = round(Input::get('amount'), 2);
/** @var Carbon $date */ /** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth()); $date = session('end', Carbon::now()->endOfMonth());
@@ -264,7 +261,6 @@ class PiggyBankController extends Controller
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank) public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{ {
$amount = round(Input::get('amount'), 2); $amount = round(Input::get('amount'), 2);
bcscale(2);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount; $savedSoFar = $piggyBank->currentRelevantRep()->currentamount;

View File

@@ -271,7 +271,6 @@ class TransactionController extends Controller
} }
); );
bcscale(2);
$journal->transactions->each( $journal->transactions->each(
function (Transaction $t) use ($journal, $repository) { function (Transaction $t) use ($journal, $repository) {
$t->before = $repository->getAmountBefore($journal, $t); $t->before = $repository->getAmountBefore($journal, $t);

View File

@@ -268,7 +268,6 @@ class AccountRepository implements AccountRepositoryInterface
if (count($ids) > 0) { if (count($ids) > 0) {
$accounts = $this->user->accounts()->whereIn('id', $ids)->where('accounts.active', 1)->get(); $accounts = $this->user->accounts()->whereIn('id', $ids)->where('accounts.active', 1)->get();
} }
bcscale(2);
$accounts->each( $accounts->each(
function (Account $account) use ($start, $end) { function (Account $account) use ($start, $end) {
@@ -309,7 +308,6 @@ class AccountRepository implements AccountRepositoryInterface
$start = clone session('start', new Carbon); $start = clone session('start', new Carbon);
$end = clone session('end', new Carbon); $end = clone session('end', new Carbon);
bcscale(2);
$accounts->each( $accounts->each(
function (Account $account) use ($start, $end) { function (Account $account) use ($start, $end) {

View File

@@ -78,7 +78,6 @@ class JournalRepository implements JournalRepositoryInterface
->where('transaction_journals.order', '>=', $journal->order) ->where('transaction_journals.order', '>=', $journal->order)
->where('transaction_journals.id', '!=', $journal->id) ->where('transaction_journals.id', '!=', $journal->id)
->get(['transactions.*']); ->get(['transactions.*']);
bcscale(2);
$sum = '0'; $sum = '0';
foreach ($set as $entry) { foreach ($set as $entry) {
$sum = bcadd($entry->amount, $sum); $sum = bcadd($entry->amount, $sum);

View File

@@ -131,7 +131,6 @@ class TagRepository implements TagRepositoryInterface
// because there will be less of them any way. // because there will be less of them any way.
$tags = $this->user->tags()->where('tagMode', 'balancingAct')->get(); $tags = $this->user->tags()->where('tagMode', 'balancingAct')->get();
$amount = '0'; $amount = '0';
bcscale(2);
/** @var Tag $tag */ /** @var Tag $tag */
foreach ($tags as $tag) { foreach ($tags as $tag) {

View File

@@ -354,7 +354,6 @@ class TestData
*/ */
public static function createGroceries(User $user, Carbon $date): bool public static function createGroceries(User $user, Carbon $date): bool
{ {
bcscale(2);
$start = clone $date; $start = clone $date;
$end = clone $date; $end = clone $date;
$today = new Carbon; $today = new Carbon;

View File

@@ -40,7 +40,6 @@ class TransactionJournalSupport extends Model
return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} }
bcscale(2);
$transaction = $journal->transactions->sortByDesc('amount')->first(); $transaction = $journal->transactions->sortByDesc('amount')->first();
$amount = $transaction->amount; $amount = $transaction->amount;
if ($journal->isWithdrawal()) { if ($journal->isWithdrawal()) {

View File

@@ -38,8 +38,6 @@ class Steam
return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} }
bcscale(2);
$balance = strval( $balance = strval(
$account->transactions()->leftJoin( $account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id' 'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
@@ -124,8 +122,6 @@ class Steam
return $cache->get(); // @codeCoverageIgnore return $cache->get(); // @codeCoverageIgnore
} }
bcscale(2);
$balances = Transaction:: $balances = Transaction::
leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.date', '<=', $date->format('Y-m-d')) ->where('transaction_journals.date', '<=', $date->format('Y-m-d'))

View File

@@ -11,6 +11,9 @@
| |
*/ */
bcscale(4);
$app = new Illuminate\Foundation\Application( $app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../') realpath(__DIR__.'/../')
); );
@@ -26,6 +29,7 @@ $app = new Illuminate\Foundation\Application(
| |
*/ */
$app->singleton( $app->singleton(
Illuminate\Contracts\Http\Kernel::class, Illuminate\Contracts\Http\Kernel::class,
FireflyIII\Http\Kernel::class FireflyIII\Http\Kernel::class