Rename bills to subscriptions

This commit is contained in:
James Cole
2024-12-26 13:41:57 +01:00
parent 286a29ca3e
commit 291e73da4b
26 changed files with 161 additions and 154 deletions

View File

@@ -164,7 +164,7 @@ class BillController extends Controller
$currencyId = $bill->transaction_currency_id;
$amountMin = $bill->amount_min;
$amountMax = $bill->amount_max;
if($this->convertToNative) {
if($this->convertToNative && $currencyId !== $this->defaultCurrency->id) {
$amountMin = $bill->native_amount_min;
$amountMax = $bill->native_amount_max;
}
@@ -178,7 +178,7 @@ class BillController extends Controller
$chartData[2]['entries'][$date] = '0';
}
$amount = bcmul($journal['amount'], '-1');
if($this->convertToNative) {
if($this->convertToNative && $currencyId !== $journal['currency_id']) {
$amount = bcmul($journal['native_amount'], '-1');
}
if($this->convertToNative && $currencyId === $journal['foreign_currency_id']) {

View File

@@ -268,7 +268,7 @@ class BillRepository implements BillRepositoryInterface
'currency_decimal_places' => $currency->decimal_places,
];
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
}
@@ -394,7 +394,7 @@ class BillRepository implements BillRepositoryInterface
'currency_decimal_places' => $currency->decimal_places,
];
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
}