mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
fix: Create item with tax (#377)
When the `tax-per-item` is enabled and also has a tax added, during the item creation, the price + tax returns an amount as float making the database fail. To fix this was necessary to round the result.
This commit is contained in:
@@ -184,7 +184,7 @@ const taxes = computed({
|
|||||||
return {
|
return {
|
||||||
...tax,
|
...tax,
|
||||||
tax_type_id: tax.id,
|
tax_type_id: tax.id,
|
||||||
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
||||||
? new Intl.NumberFormat(undefined, {
|
? new Intl.NumberFormat(undefined, {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: companyStore.selectedCompanyCurrency.code
|
currency: companyStore.selectedCompanyCurrency.code
|
||||||
@@ -209,7 +209,7 @@ const getTaxTypes = computed(() => {
|
|||||||
return {
|
return {
|
||||||
...tax,
|
...tax,
|
||||||
tax_type_id: tax.id,
|
tax_type_id: tax.id,
|
||||||
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
tax_name: `${tax.name} (${tax.calculation_type === 'fixed'
|
||||||
? new Intl.NumberFormat(undefined, {
|
? new Intl.NumberFormat(undefined, {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: companyStore.selectedCompanyCurrency.code
|
currency: companyStore.selectedCompanyCurrency.code
|
||||||
@@ -292,7 +292,7 @@ async function submitItem() {
|
|||||||
tax_type_id: tax.tax_type_id,
|
tax_type_id: tax.tax_type_id,
|
||||||
calculation_type: tax.calculation_type,
|
calculation_type: tax.calculation_type,
|
||||||
fixed_amount: tax.fixed_amount,
|
fixed_amount: tax.fixed_amount,
|
||||||
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : price.value * tax.percent,
|
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : Math.round(price.value * tax.percent),
|
||||||
percent: tax.percent,
|
percent: tax.percent,
|
||||||
name: tax.name,
|
name: tax.name,
|
||||||
collective_tax: 0,
|
collective_tax: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user