mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-14 00:04:24 +00:00
Fixed all problems related to strict types.
This commit is contained in:
@@ -253,10 +253,10 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
function (Account $account) use ($start, $end) {
|
||||
$account->startBalance = Steam::balance($account, $start, true);
|
||||
$account->endBalance = Steam::balance($account, $end, true);
|
||||
$account->piggyBalance = 0;
|
||||
$account->piggyBalance = '0';
|
||||
/** @var PiggyBank $piggyBank */
|
||||
foreach ($account->piggyBanks as $piggyBank) {
|
||||
$account->piggyBalance += $piggyBank->currentRelevantRep()->currentamount;
|
||||
$account->piggyBalance = bcadd($piggyBank->currentRelevantRep()->currentamount, $account->piggyBalance);
|
||||
}
|
||||
// sum of piggy bank amounts on this account:
|
||||
// diff between endBalance and piggyBalance.
|
||||
|
@@ -162,16 +162,17 @@ class BillRepository implements BillRepositoryInterface
|
||||
$ranges = $this->getRanges($bill, $start, $end);
|
||||
|
||||
foreach ($ranges as $range) {
|
||||
$paid = $bill->transactionjournals()
|
||||
->before($range['end'])
|
||||
->after($range['start'])
|
||||
->leftJoin(
|
||||
'transactions', function (JoinClause $join) {
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
$amount = bcadd($amount, $paid->sum_amount);
|
||||
$paid = $bill->transactionjournals()
|
||||
->before($range['end'])
|
||||
->after($range['start'])
|
||||
->leftJoin(
|
||||
'transactions', function (JoinClause $join) {
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '<', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
$sumAmount = $paid->sum_amount ?? '0';
|
||||
$amount = bcadd($amount, $sumAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,16 +197,17 @@ class BillRepository implements BillRepositoryInterface
|
||||
$ranges = $this->getRanges($bill, $start, $end);
|
||||
$paidBill = '0';
|
||||
foreach ($ranges as $range) {
|
||||
$paid = $bill->transactionjournals()
|
||||
->before($range['end'])
|
||||
->after($range['start'])
|
||||
->leftJoin(
|
||||
'transactions', function (JoinClause $join) {
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
$paidBill = bcadd($paid->sum_amount, $paidBill);
|
||||
$paid = $bill->transactionjournals()
|
||||
->before($range['end'])
|
||||
->after($range['start'])
|
||||
->leftJoin(
|
||||
'transactions', function (JoinClause $join) {
|
||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0);
|
||||
}
|
||||
)
|
||||
->first([DB::Raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||
$sumAmount = $paid->sum_amount ?? '0';
|
||||
$paidBill = bcadd($sumAmount, $paidBill);
|
||||
}
|
||||
if ($paidBill == 0) {
|
||||
$amount = bcadd($amount, $bill->expectedAmount);
|
||||
|
@@ -37,7 +37,7 @@ class ComponentRepository
|
||||
->whereIn('accounts.id', $ids)
|
||||
->after($start)
|
||||
->first([DB::raw('SUM(`transactions`.`amount`) as `journalAmount`')]);
|
||||
$amount = $entry->journalAmount;
|
||||
$amount = $entry->journalAmount ?? '0';
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
Reference in New Issue
Block a user