From 3f2cd6294874bcc7c09e0a99b3be4ec9f7784f6f Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 26 Nov 2024 14:53:53 +0100 Subject: [PATCH] fix: refs #7936 decimal places & locale --- src/composables/getTotal.js | 4 ++-- src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue | 2 +- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/composables/getTotal.js b/src/composables/getTotal.js index 41c4330c4..24ac3aa27 100644 --- a/src/composables/getTotal.js +++ b/src/composables/getTotal.js @@ -1,10 +1,10 @@ import { toCurrency } from 'src/filters'; export function getTotal(rows, key, opts = {}) { - const { currency, cb } = opts; + const { currency, cb, decimalPlaces } = opts; const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0); return currency ? toCurrency(total, currency == 'default' ? undefined : currency) - : total; + : parseFloat(total).toFixed(decimalPlaces ?? 2); } diff --git a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue index bee50a07d..08ce0755d 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue @@ -261,7 +261,7 @@ const formatOpt = (row, { model, options }, prop) => { country: Country es: Code: Código - amount: Cantidad + amount: Valor mercancía net: Neto stems: Tallos country: País diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index 526092f02..100eecda6 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -188,11 +188,6 @@ const formatOpt = (row, { model, options }, prop) => {