mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-16 17:46:59 +02:00
Fixed invoices page to display right currency
This commit is contained in:
parent
e22ed9782e
commit
dd5aef123d
2 changed files with 11 additions and 9 deletions
|
@ -53,6 +53,9 @@ class FinancialsController extends Controller
|
|||
$billing_company = $db->selectValue('SELECT companyNumber FROM registrar WHERE id = ?',
|
||||
[ $invoice_details['registrar_id'] ]
|
||||
);
|
||||
$currency = $db->selectValue('SELECT currency FROM registrar WHERE id = ?',
|
||||
[ $invoice_details['registrar_id'] ]
|
||||
);
|
||||
$billing_vat = $db->selectValue('SELECT vatNumber FROM registrar WHERE id = ?',
|
||||
[ $invoice_details['registrar_id'] ]
|
||||
);
|
||||
|
@ -87,7 +90,6 @@ class FinancialsController extends Controller
|
|||
$billing_country = $billing_country['name'];
|
||||
|
||||
$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);
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
`;
|
||||
}
|
||||
|
||||
currency = "{{ currency }} ";
|
||||
|
||||
table = new Tabulator("#invoicesTable", {
|
||||
ajaxURL:"/api/records/invoices?join=registrar", // Set the URL for your JSON data
|
||||
ajaxConfig:"GET",
|
||||
|
@ -41,11 +39,13 @@
|
|||
{title:"{{ __('Number') }}", field:"invoice_number", width:200, resizable:false, headerSort:true, formatter: invoiceLinkFormatter, responsive:0},
|
||||
{title:"{{ __('Registrar') }}", field:"registrar_id.name", width:300, resizable:false, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Date') }}", field:"issue_date", width:300, resizable:false, headerSort:true, responsive:0},
|
||||
{title:"{{ __('Amount') }}", field:"total_amount", width:200, resizable:false, headerSort:true, responsive:0, formatter:"money", formatterParams:{
|
||||
decimal:".",
|
||||
thousand:" ",
|
||||
symbol:currency,
|
||||
negativeSign:true,
|
||||
{title:"{{ __('Amount') }}", field:"total_amount", width:200, resizable:false, headerSort:true, responsive:0, formatter:"money", formatterParams:function(cell){
|
||||
return {
|
||||
decimal: ".",
|
||||
thousand: " ",
|
||||
symbol: (cell.getRow().getData().registrar_id.currency || "$") + " ", // Ensures space after currency symbol
|
||||
negativeSign: true
|
||||
};
|
||||
}},
|
||||
{title: "{{ __('Actions') }}", formatter: actionsFormatter, headerSort: false, download:false, hozAlign: "center", responsive:0, cellClick:function(e, cell){ e.stopPropagation(); }},
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue