From 0c8ae05919694fd51ad366d3c7417aa2823cb76b Mon Sep 17 00:00:00 2001 From: Horux Dev Date: Fri, 22 May 2026 22:23:38 +0000 Subject: [PATCH] feat(facturacion): precio unitario sin IVA en conceptos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Cambia label de 'Precio Unitario (IVA incluido)' a 'Precio Unitario (sin IVA)' - Elimina división interna price/(1+iva) en calcConcepto; ahora price es la base - Cambia taxIncluded: true → false en payload enviado a backend - Backend: tax_included default false en facturapi.service.ts y contribuyente-facturapi.service.ts - Build y deploy exitosos --- apps/api/src/services/contribuyente-facturapi.service.ts | 2 +- apps/api/src/services/facturapi.service.ts | 2 +- apps/web/app/(dashboard)/facturacion/page.tsx | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/api/src/services/contribuyente-facturapi.service.ts b/apps/api/src/services/contribuyente-facturapi.service.ts index dd3e89a..49fc197 100644 --- a/apps/api/src/services/contribuyente-facturapi.service.ts +++ b/apps/api/src/services/contribuyente-facturapi.service.ts @@ -435,7 +435,7 @@ export async function createInvoiceContribuyente( unit_key: item.unitKey || 'E48', unit_name: item.unitName || 'Servicio', price: item.price, - tax_included: item.taxIncluded ?? true, + tax_included: item.taxIncluded ?? false, taxes: item.taxes?.map((t: any) => ({ type: t.type, rate: t.rate, diff --git a/apps/api/src/services/facturapi.service.ts b/apps/api/src/services/facturapi.service.ts index 1b48e71..4fc7f3e 100644 --- a/apps/api/src/services/facturapi.service.ts +++ b/apps/api/src/services/facturapi.service.ts @@ -315,7 +315,7 @@ export async function createInvoice( unit_key: item.unitKey || 'E48', unit_name: item.unitName || 'Servicio', price: item.price, - tax_included: item.taxIncluded ?? true, + tax_included: item.taxIncluded ?? false, taxes: item.taxes?.map(t => ({ type: t.type, rate: t.rate, diff --git a/apps/web/app/(dashboard)/facturacion/page.tsx b/apps/web/app/(dashboard)/facturacion/page.tsx index b8da3e2..8371e8c 100644 --- a/apps/web/app/(dashboard)/facturacion/page.tsx +++ b/apps/web/app/(dashboard)/facturacion/page.tsx @@ -611,8 +611,7 @@ export default function FacturacionPage() { // Cálculos function calcConcepto(c: ConceptoForm) { const trasladoRates = c.taxes.filter(t => t.category === 'traslado' && t.factor === 'Tasa').reduce((s, t) => s + t.rate, 0); - const unitPrice = trasladoRates > 0 ? c.price / (1 + trasladoRates) : c.price; - const base = unitPrice * c.quantity - c.discount; + const base = c.price * c.quantity - c.discount; const traslados = c.taxes.filter(t => t.category === 'traslado' && t.factor === 'Tasa').reduce((s, t) => s + base * t.rate, 0); const retenciones = c.taxes.filter(t => t.category === 'retencion').reduce((s, t) => s + base * t.rate, 0); return { base, traslados, retenciones }; @@ -688,7 +687,7 @@ export default function FacturacionPage() { quantity: c.quantity, price: tipoComprobante === 'T' ? 0 : c.price, discount: c.discount || 0, - taxIncluded: true, + taxIncluded: false, objetoImp: c.objetoImp, taxes: tipoComprobante === 'T' || c.objetoImp === '01' ? [] : c.taxes.map(t => ({ type: t.type, @@ -1437,7 +1436,7 @@ export default function FacturacionPage() { {tipoComprobante !== 'T' && ( <>
- + updateConcepto(idx, 'price', parseFloat(e.target.value) || 0)} placeholder="0.00" required />