mirror of
https://github.com/getnamingo/registry.git
synced 2025-08-19 07:43:49 +02:00
Fixed small issue on invoice display
This commit is contained in:
parent
0e2041edd6
commit
da14e81358
1 changed files with 19 additions and 5 deletions
|
@ -86,7 +86,21 @@ class FinancialsController extends Controller
|
||||||
$billing_country = $iso3166->alpha2($billing['cc']);
|
$billing_country = $iso3166->alpha2($billing['cc']);
|
||||||
$billing_country = $billing_country['name'];
|
$billing_country = $billing_country['name'];
|
||||||
|
|
||||||
return view($response,'admin/financials/viewInvoice.twig', [
|
$locale = $_SESSION['_lang'] ?? 'en_US'; // Fallback to 'en_US' if no locale is set
|
||||||
|
$currency = $_SESSION['_currency'] ?? 'USD'; // Fallback to 'USD' if no currency is set
|
||||||
|
|
||||||
|
// Initialize the number formatter for the locale
|
||||||
|
$numberFormatter = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
|
||||||
|
$currencyFormatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
|
||||||
|
|
||||||
|
// Format values explicitly with the session currency
|
||||||
|
$formattedVatRate = $numberFormatter->format($taxRate * 100) . "%";
|
||||||
|
$formattedVatAmount = $currencyFormatter->formatCurrency($taxValue, $currency);
|
||||||
|
$formattedNetPrice = $currencyFormatter->formatCurrency($netPrice, $currency);
|
||||||
|
$formattedTotalAmount = $currencyFormatter->formatCurrency($totalAmount, $currency);
|
||||||
|
|
||||||
|
// Pass formatted values to Twig
|
||||||
|
return view($response, 'admin/financials/viewInvoice.twig', [
|
||||||
'invoice_details' => $invoice_details,
|
'invoice_details' => $invoice_details,
|
||||||
'billing' => $billing,
|
'billing' => $billing,
|
||||||
'billing_company' => $billing_company,
|
'billing_company' => $billing_company,
|
||||||
|
@ -99,11 +113,11 @@ class FinancialsController extends Controller
|
||||||
'vat_number' => $vat_number,
|
'vat_number' => $vat_number,
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
'email' => $email,
|
'email' => $email,
|
||||||
'vatRate' => ($taxRate * 100) . "%",
|
'vatRate' => $formattedVatRate,
|
||||||
'vatAmount' => sprintf("%.2f", $taxValue),
|
'vatAmount' => $formattedVatAmount,
|
||||||
'validVAT' => $validVAT,
|
'validVAT' => $validVAT,
|
||||||
'netPrice' => sprintf("%.2f", $netPrice),
|
'netPrice' => $formattedNetPrice,
|
||||||
'total' => sprintf("%.2f", $totalAmount),
|
'total' => $formattedTotalAmount,
|
||||||
'currentUri' => $uri,
|
'currentUri' => $uri,
|
||||||
'billing_country' => $billing_country,
|
'billing_country' => $billing_country,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue