This commit is contained in:
James Cole
2020-07-12 17:32:48 +02:00
parent 0c9a25a073
commit c4979bdd27
14 changed files with 79 additions and 60 deletions

View File

@@ -78,6 +78,7 @@ class AccountTransformer extends AbstractTransformer
[$openingBalance, $openingBalanceDate] = $this->getOpeningBalance($account, $accountType, $decimalPlaces);
[$interest, $interestPeriod] = $this->getInterest($account, $accountType);
$openingBalance = number_format((float) $openingBalance, $decimalPlaces, '.', '');
$liabilityAmount = null;
$liabilityStart = null;
if (null !== $liabilityType) {
@@ -94,7 +95,6 @@ class AccountTransformer extends AbstractTransformer
$latitude = $location->latitude;
$zoomLevel = $location->zoom_level;
}
return [
'id' => (int)$account->id,
'created_at' => $account->created_at->toAtomString(),
@@ -107,7 +107,7 @@ class AccountTransformer extends AbstractTransformer
'currency_code' => $currencyCode,
'currency_symbol' => $currencySymbol,
'currency_decimal_places' => $decimalPlaces,
'current_balance' => (string) round(app('steam')->balance($account, $date), $decimalPlaces),
'current_balance' => number_format((float) app('steam')->balance($account, $date), $decimalPlaces, '.', ''),
'current_balance_date' => $date->format('Y-m-d'),
'notes' => $this->repository->getNoteText($account),
'monthly_payment_date' => $monthlyPaymentDate,
@@ -115,7 +115,7 @@ class AccountTransformer extends AbstractTransformer
'account_number' => $this->repository->getMetaValue($account, 'account_number'),
'iban' => '' === $account->iban ? null : $account->iban,
'bic' => $this->repository->getMetaValue($account, 'BIC'),
'virtual_balance' => round($account->virtual_balance, $decimalPlaces),
'virtual_balance' => number_format((float) $account->virtual_balance, $decimalPlaces, '.', ''),
'opening_balance' => $openingBalance,
'opening_balance_date' => $openingBalanceDate,
'liability_type' => $liabilityType,
@@ -240,7 +240,7 @@ class AccountTransformer extends AbstractTransformer
$openingBalanceDate = null;
if (in_array($accountType, ['asset', 'liabilities'], true)) {
$amount = $this->repository->getOpeningBalanceAmount($account);
$openingBalance = null === $amount ? null : round($amount, $decimalPlaces);
$openingBalance = $amount;
$openingBalanceDate = $this->repository->getOpeningBalanceDate($account);
}