mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
Adding Flat Tax support with fixed amount (#253)
* Possibility to set a fixed amount on tax types settings * Pint and manage flat taxes on items * Fix display errors and handle global taxes * Tests * Pint with PHP 8.2 cause with PHP 8.3 version it cause workflow error * Merging percent and fixed amount into one column * Now display the currency on SelectTaxPopup on fixed taxes
This commit is contained in:
@@ -184,7 +184,12 @@ const taxes = computed({
|
||||
return {
|
||||
...tax,
|
||||
tax_type_id: tax.id,
|
||||
tax_name: tax.name + ' (' + tax.percent + '%)',
|
||||
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
||||
? new Intl.NumberFormat(undefined, {
|
||||
style: 'currency',
|
||||
currency: companyStore.selectedCompanyCurrency.code
|
||||
}).format(tax.fixed_amount / 100)
|
||||
: `${tax.percent}%`})`,
|
||||
}
|
||||
}
|
||||
}),
|
||||
@@ -204,7 +209,12 @@ const getTaxTypes = computed(() => {
|
||||
return {
|
||||
...tax,
|
||||
tax_type_id: tax.id,
|
||||
tax_name: tax.name + ' (' + tax.percent + '%)',
|
||||
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
||||
? new Intl.NumberFormat(undefined, {
|
||||
style: 'currency',
|
||||
currency: companyStore.selectedCompanyCurrency.code
|
||||
}).format(tax.fixed_amount / 100)
|
||||
: `${tax.percent}%`})`,
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -280,7 +290,9 @@ async function submitItem() {
|
||||
data.taxes = itemStore.currentItem.taxes.map((tax) => {
|
||||
return {
|
||||
tax_type_id: tax.tax_type_id,
|
||||
amount: price.value * tax.percent,
|
||||
calculation_type: tax.calculation_type,
|
||||
fixed_amount: tax.fixed_amount,
|
||||
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : price.value * tax.percent,
|
||||
percent: tax.percent,
|
||||
name: tax.name,
|
||||
collective_tax: 0,
|
||||
|
||||
Reference in New Issue
Block a user