mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-27 05:51:56 +00:00
Auto commit for release 'branch-v6.2' on 2024-12-26
This commit is contained in:
@@ -85,6 +85,7 @@ class IndexController extends Controller
|
||||
$parameters->set('end', $end);
|
||||
$parameters->set('convertToNative', $this->convertToNative);
|
||||
$parameters->set('defaultCurrency', $this->defaultCurrency);
|
||||
|
||||
/** @var BillTransformer $transformer */
|
||||
$transformer = app(BillTransformer::class);
|
||||
$transformer->setParameters($parameters);
|
||||
|
||||
@@ -455,7 +455,7 @@ class AccountController extends Controller
|
||||
Log::debug('END temp get end balance done');
|
||||
|
||||
$previous = array_values($range)[0];
|
||||
$accountCurrency = $accountCurrency ?? $this->defaultCurrency; // do this AFTER getting the balances.
|
||||
$accountCurrency ??= $this->defaultCurrency; // do this AFTER getting the balances.
|
||||
Log::debug('Start chart loop.');
|
||||
|
||||
$newRange = [];
|
||||
@@ -473,7 +473,7 @@ class AccountController extends Controller
|
||||
$momentBalance = $newRange[$expectedIndex]['info'];
|
||||
Log::debug(sprintf('Expected index is %d!, date is %s, current is %s', $expectedIndex, $carbon->format('Y-m-d'), $current->format('Y-m-d')));
|
||||
$carbon = Carbon::createFromFormat('Y-m-d', $newRange[$expectedIndex]['date']);
|
||||
$expectedIndex++;
|
||||
++$expectedIndex;
|
||||
}
|
||||
|
||||
$return = $this->updateChartKeys($return, $momentBalance);
|
||||
|
||||
@@ -123,7 +123,7 @@ class ReconcileController extends Controller
|
||||
Log::debug(sprintf('End balance: "%s"', $endBalance));
|
||||
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
|
||||
Log::debug(sprintf('Amount: "%s"', $amount));
|
||||
$difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount?? '0'), $amount);
|
||||
$difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount ?? '0'), $amount);
|
||||
$diffCompare = bccomp($difference, '0');
|
||||
$countCleared = count($clearedJournals);
|
||||
$reconSum = bcadd(bcadd($startBalance ?? '0', $amount ?? '0'), $clearedAmount ?? '0');
|
||||
|
||||
@@ -129,7 +129,8 @@ class Steam
|
||||
DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'),
|
||||
DB::raw('SUM(transactions.native_amount) AS modified_native'),
|
||||
]
|
||||
);
|
||||
)
|
||||
;
|
||||
|
||||
$currentBalance = $startBalance;
|
||||
|
||||
@@ -148,21 +149,21 @@ class Steam
|
||||
Log::debug(sprintf('Processing transaction(s) on date %s', $carbon->format('Y-m-d H:i:s')));
|
||||
|
||||
// if convert to native, if NOT convert to native.
|
||||
if($convertToNative) {
|
||||
Log::debug(sprintf('Amount is %s %s, foreign amount is %s, native amount is %s', $entryCurrency->code, $this->bcround($modified,2), $this->bcround($foreignModified,2), $this->bcround($nativeModified,2)));
|
||||
if ($convertToNative) {
|
||||
Log::debug(sprintf('Amount is %s %s, foreign amount is %s, native amount is %s', $entryCurrency->code, $this->bcround($modified, 2), $this->bcround($foreignModified, 2), $this->bcround($nativeModified, 2)));
|
||||
// if the currency is the default currency add to native balance + currency balance
|
||||
if($entry->transaction_currency_id === $defaultCurrency->id) {
|
||||
if ($entry->transaction_currency_id === $defaultCurrency->id) {
|
||||
Log::debug('Add amount to native.');
|
||||
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $modified);
|
||||
}
|
||||
|
||||
// add to native balance.
|
||||
if($entry->foreign_currency_id !== $defaultCurrency->id) {
|
||||
if ($entry->foreign_currency_id !== $defaultCurrency->id) {
|
||||
// this check is not necessary, because if the foreign currency is the same as the default currency, the native amount is zero.
|
||||
// so adding this would mean nothing.
|
||||
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $nativeModified);
|
||||
}
|
||||
if($entry->foreign_currency_id === $defaultCurrency->id) {
|
||||
if ($entry->foreign_currency_id === $defaultCurrency->id) {
|
||||
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $foreignModified);
|
||||
}
|
||||
// add to balance if is the same.
|
||||
@@ -329,7 +330,7 @@ class Steam
|
||||
if ($native->id === $accountCurrency?->id) {
|
||||
$return['balance'] = bcadd('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance, $return['balance']);
|
||||
}
|
||||
Log::debug(sprintf('balance is (%s only) %s (with virtual balance)', $native->code, $this->bcround($return['balance'],2)));
|
||||
Log::debug(sprintf('balance is (%s only) %s (with virtual balance)', $native->code, $this->bcround($return['balance'], 2)));
|
||||
|
||||
// native balance
|
||||
$return['native_balance'] = (string) $account->transactions()
|
||||
@@ -340,7 +341,7 @@ class Steam
|
||||
;
|
||||
// plus native virtual balance.
|
||||
$return['native_balance'] = bcadd('' === (string) $account->native_virtual_balance ? '0' : $account->native_virtual_balance, $return['native_balance']);
|
||||
Log::debug(sprintf('native_balance is (all transactions to %s) %s (with virtual balance)', $native->code,$this->bcround( $return['native_balance'])));
|
||||
Log::debug(sprintf('native_balance is (all transactions to %s) %s (with virtual balance)', $native->code, $this->bcround($return['native_balance'])));
|
||||
|
||||
// plus foreign transactions in THIS currency.
|
||||
$sum = (string) $account->transactions()
|
||||
|
||||
@@ -174,7 +174,7 @@ class BillTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/bills/' . $bill->id,
|
||||
'uri' => '/bills/'.$bill->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user