Auto commit for release 'branch-v6.2' on 2024-12-26

This commit is contained in:
github-actions
2024-12-26 10:24:39 +01:00
parent 1e8f0adaf8
commit 71cf6c6a5e
7 changed files with 127 additions and 125 deletions

View File

@@ -85,6 +85,7 @@ class IndexController extends Controller
$parameters->set('end', $end); $parameters->set('end', $end);
$parameters->set('convertToNative', $this->convertToNative); $parameters->set('convertToNative', $this->convertToNative);
$parameters->set('defaultCurrency', $this->defaultCurrency); $parameters->set('defaultCurrency', $this->defaultCurrency);
/** @var BillTransformer $transformer */ /** @var BillTransformer $transformer */
$transformer = app(BillTransformer::class); $transformer = app(BillTransformer::class);
$transformer->setParameters($parameters); $transformer->setParameters($parameters);

View File

@@ -455,7 +455,7 @@ class AccountController extends Controller
Log::debug('END temp get end balance done'); Log::debug('END temp get end balance done');
$previous = array_values($range)[0]; $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.'); Log::debug('Start chart loop.');
$newRange = []; $newRange = [];
@@ -473,7 +473,7 @@ class AccountController extends Controller
$momentBalance = $newRange[$expectedIndex]['info']; $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'))); 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']); $carbon = Carbon::createFromFormat('Y-m-d', $newRange[$expectedIndex]['date']);
$expectedIndex++; ++$expectedIndex;
} }
$return = $this->updateChartKeys($return, $momentBalance); $return = $this->updateChartKeys($return, $momentBalance);

View File

@@ -123,7 +123,7 @@ class ReconcileController extends Controller
Log::debug(sprintf('End balance: "%s"', $endBalance)); Log::debug(sprintf('End balance: "%s"', $endBalance));
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount)); Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
Log::debug(sprintf('Amount: "%s"', $amount)); 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'); $diffCompare = bccomp($difference, '0');
$countCleared = count($clearedJournals); $countCleared = count($clearedJournals);
$reconSum = bcadd(bcadd($startBalance ?? '0', $amount ?? '0'), $clearedAmount ?? '0'); $reconSum = bcadd(bcadd($startBalance ?? '0', $amount ?? '0'), $clearedAmount ?? '0');

View File

@@ -129,7 +129,8 @@ class Steam
DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'), DB::raw('SUM(transactions.foreign_amount) AS modified_foreign'),
DB::raw('SUM(transactions.native_amount) AS modified_native'), DB::raw('SUM(transactions.native_amount) AS modified_native'),
] ]
); )
;
$currentBalance = $startBalance; $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'))); 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 convert to native, if NOT convert to native.
if($convertToNative) { 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))); 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 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.'); Log::debug('Add amount to native.');
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $modified); $currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $modified);
} }
// add to native balance. // 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. // 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. // so adding this would mean nothing.
$currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $nativeModified); $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); $currentBalance['native_balance'] = bcadd($currentBalance['native_balance'], $foreignModified);
} }
// add to balance if is the same. // add to balance if is the same.
@@ -329,7 +330,7 @@ class Steam
if ($native->id === $accountCurrency?->id) { if ($native->id === $accountCurrency?->id) {
$return['balance'] = bcadd('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance, $return['balance']); $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 // native balance
$return['native_balance'] = (string) $account->transactions() $return['native_balance'] = (string) $account->transactions()
@@ -340,7 +341,7 @@ class Steam
; ;
// plus native virtual balance. // plus native virtual balance.
$return['native_balance'] = bcadd('' === (string) $account->native_virtual_balance ? '0' : $account->native_virtual_balance, $return['native_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. // plus foreign transactions in THIS currency.
$sum = (string) $account->transactions() $sum = (string) $account->transactions()

View File

@@ -174,7 +174,7 @@ class BillTransformer extends AbstractTransformer
'links' => [ 'links' => [
[ [
'rel' => 'self', 'rel' => 'self',
'uri' => '/bills/' . $bill->id, 'uri' => '/bills/'.$bill->id,
], ],
], ],
]; ];