applied new features of money package

This commit is contained in:
Denis Duliçi
2023-07-11 12:03:14 +03:00
parent 20e5b57562
commit bfb37c62c6
51 changed files with 110 additions and 105 deletions

View File

@ -42,9 +42,9 @@ class Accounts extends Controller
->orWhereHas('income_transaction', fn ($query) => $query->where('account_id', $account->id))
->collect(['expense_transaction.paid_at' => 'desc']);
$incoming_amount = money($account->income_balance, $account->currency_code, true);
$outgoing_amount = money($account->expense_balance, $account->currency_code, true);
$current_amount = money($account->balance, $account->currency_code, true);
$incoming_amount = money($account->income_balance, $account->currency_code);
$outgoing_amount = money($account->expense_balance, $account->currency_code);
$current_amount = money($account->balance, $account->currency_code);
$summary_amounts = [
'incoming_exact' => $incoming_amount->format(),

View File

@ -24,8 +24,8 @@ class Reconciliations extends Controller
{
$reconciliations = Reconciliation::with('account')->collect();
$reconciled_amount = money($reconciliations->where('reconciled', 1)->sum('closing_balance'), default_currency(), true);
$in_progress_amount = money($reconciliations->where('reconciled', 0)->sum('closing_balance'), default_currency(), true);
$reconciled_amount = money($reconciliations->where('reconciled', 1)->sum('closing_balance'));
$in_progress_amount = money($reconciliations->where('reconciled', 0)->sum('closing_balance'));
$summary_amounts = [
'amount_exact' => $reconciled_amount->format(),
@ -246,9 +246,9 @@ class Reconciliations extends Controller
$difference = $closing_balance - $cleared_amount;
$json->closing_balance = money($closing_balance, $currency_code, true)->format();
$json->cleared_amount = money($cleared_amount, $currency_code, true)->format();
$json->difference = money($difference, $currency_code, true)->format();
$json->closing_balance = money($closing_balance, $currency_code)->format();
$json->cleared_amount = money($cleared_amount, $currency_code)->format();
$json->difference = money($difference, $currency_code)->format();
$json->difference_raw = (int) $difference;
return response()->json($json);

View File

@ -56,9 +56,9 @@ class Transactions extends Controller
$totals['profit'] = $totals['income'] - $totals['expense'];
$incoming_amount = money($totals['income'], default_currency(), true);
$expense_amount = money($totals['expense'], default_currency(), true);
$profit_amount = money($totals['profit'], default_currency(), true);
$incoming_amount = money($totals['income']);
$expense_amount = money($totals['expense']);
$profit_amount = money($totals['profit']);
$summary_amounts = [
'incoming_exact' => $incoming_amount->format(),

View File

@ -51,9 +51,9 @@ class DocumentTransactions extends Controller
$document->{$document_total->code} = $document_total->amount;
}
$total = money($document->total, $currency->code, true)->format();
$total = money($document->total, $currency->code)->format();
$document->grand_total = money($total, $currency->code)->getAmount();
$document->grand_total = money($total, $currency->code, false)->getAmount();
if (! empty($paid)) {
$document->grand_total = round($document->total - $paid, $currency->precision);
@ -140,7 +140,7 @@ class DocumentTransactions extends Controller
$number = $transaction->number;
$document->grand_total = money($transaction->amount, $currency->code)->getAmount();
$document->grand_total = money($transaction->amount, $currency->code, false)->getAmount();
$document->paid_at = $transaction->paid_at;