mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 02:03:40 +00:00
🤖 Auto commit for release 'develop' on 2025-08-01
This commit is contained in:
@@ -83,18 +83,18 @@ class BillRepository implements BillRepositoryInterface
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'primary_currency_id' => (string) $primary->id,
|
||||
'primary_currency_name' => $primary->name,
|
||||
'primary_currency_symbol' => $primary->symbol,
|
||||
'primary_currency_code' => $primary->code,
|
||||
'primary_currency_decimal_places' => $primary->decimal_places,
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
];
|
||||
|
||||
/** @var TransactionJournal $transactionJournal */
|
||||
@@ -102,7 +102,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
/** @var null|Transaction $sourceTransaction */
|
||||
$sourceTransaction = $transactionJournal->transactions()->where('amount', '<', 0)->first();
|
||||
if (null !== $sourceTransaction) {
|
||||
$amount = $sourceTransaction->amount;
|
||||
$amount = $sourceTransaction->amount;
|
||||
if ((int) $sourceTransaction->foreign_currency_id === $currency->id) {
|
||||
// use foreign amount instead!
|
||||
$amount = (string) $sourceTransaction->foreign_amount;
|
||||
@@ -117,7 +117,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
// ignore conversion, use foreign amount
|
||||
$pcAmount = (string) $sourceTransaction->foreign_amount;
|
||||
}
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], (string) $amount);
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], (string) $amount);
|
||||
$return[$currencyId]['pc_sum'] = bcadd($return[$currencyId]['pc_sum'], (string) $pcAmount);
|
||||
}
|
||||
}
|
||||
@@ -151,25 +151,25 @@ class BillRepository implements BillRepositoryInterface
|
||||
$total = $dates->count() - $count;
|
||||
|
||||
if ($total > 0) {
|
||||
$currency = $bill->transactionCurrency;
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
$average = bcdiv(bcadd((string) $bill->amount_max, (string) $bill->amount_min), '2');
|
||||
$currency = $bill->transactionCurrency;
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
$average = bcdiv(bcadd((string) $bill->amount_max, (string) $bill->amount_min), '2');
|
||||
$pcAverage = $converter->convert($currency, $primary, $start, $average);
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'primary_currency_id' => (string) $primary->id,
|
||||
'primary_currency_name' => $primary->name,
|
||||
'primary_currency_symbol' => $primary->symbol,
|
||||
'primary_currency_code' => $primary->code,
|
||||
'primary_currency_decimal_places' => $primary->decimal_places,
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
'sum' => '0',
|
||||
'pc_sum' => '0',
|
||||
];
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], bcmul($average, (string) $total));
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], bcmul($average, (string) $total));
|
||||
$return[$currencyId]['pc_sum'] = bcadd($return[$currencyId]['pc_sum'], bcmul($pcAverage, (string) $total));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user