From e9b96ccf212659cae53f10171dac0f20c16c5878 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 9 Nov 2025 13:02:02 +0100 Subject: [PATCH] =?UTF-8?q?Actualizaci=C3=B3n=20de=20los=20totales=20cuand?= =?UTF-8?q?o=20se=20cambia=20alg=C3=BAn=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/components/editor/invoice-totals.tsx | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx b/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx index a7694deb..51206341 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx @@ -20,17 +20,12 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => { const { control, getValues } = useFormContext(); const { currency_code, language_code, readOnly, taxCatalog } = useInvoiceContext(); - const displayTaxes = useWatch({ - control, - name: "taxes", - defaultValue: [], - }); - - const subtotal_amount = useWatch({ - control, - name: "subtotal_amount", - defaultValue: 0, - }); + const displayTaxes = useWatch({ control, name: "taxes", defaultValue: [] }); + const subtotal_amount = useWatch({ control, name: "subtotal_amount", defaultValue: 0 }); + const discount_amount = useWatch({ control, name: "discount_amount", defaultValue: 0 }); + const taxable_amount = useWatch({ control, name: "taxable_amount", defaultValue: 0 }); + const taxes_amount = useWatch({ control, name: "taxes_amount", defaultValue: 0 }); + const total_amount = useWatch({ control, name: "total_amount", defaultValue: 0 }); return (
@@ -66,7 +61,7 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => { /> - -{formatCurrency(getValues("discount_amount"), 2, currency_code, language_code)} + -{formatCurrency(discount_amount, 2, currency_code, language_code)} @@ -74,7 +69,7 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => {
Base imponible - {formatCurrency(getValues("taxable_amount"), 2, currency_code, language_code)} + {formatCurrency(taxable_amount, 2, currency_code, language_code)}
@@ -126,7 +121,7 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => {
Total de impuestos - {formatCurrency(getValues("taxes_amount"), 2, currency_code, language_code)} + {formatCurrency(taxes_amount, 2, currency_code, language_code)}
@@ -136,7 +131,7 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => {
Total de la factura - {formatCurrency(getValues("total_amount"), 2, currency_code, language_code)} + {formatCurrency(total_amount, 2, currency_code, language_code)}