feat(facturacion): precio unitario sin IVA en conceptos
- 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
This commit is contained in:
@@ -435,7 +435,7 @@ export async function createInvoiceContribuyente(
|
|||||||
unit_key: item.unitKey || 'E48',
|
unit_key: item.unitKey || 'E48',
|
||||||
unit_name: item.unitName || 'Servicio',
|
unit_name: item.unitName || 'Servicio',
|
||||||
price: item.price,
|
price: item.price,
|
||||||
tax_included: item.taxIncluded ?? true,
|
tax_included: item.taxIncluded ?? false,
|
||||||
taxes: item.taxes?.map((t: any) => ({
|
taxes: item.taxes?.map((t: any) => ({
|
||||||
type: t.type,
|
type: t.type,
|
||||||
rate: t.rate,
|
rate: t.rate,
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ export async function createInvoice(
|
|||||||
unit_key: item.unitKey || 'E48',
|
unit_key: item.unitKey || 'E48',
|
||||||
unit_name: item.unitName || 'Servicio',
|
unit_name: item.unitName || 'Servicio',
|
||||||
price: item.price,
|
price: item.price,
|
||||||
tax_included: item.taxIncluded ?? true,
|
tax_included: item.taxIncluded ?? false,
|
||||||
taxes: item.taxes?.map(t => ({
|
taxes: item.taxes?.map(t => ({
|
||||||
type: t.type,
|
type: t.type,
|
||||||
rate: t.rate,
|
rate: t.rate,
|
||||||
|
|||||||
@@ -611,8 +611,7 @@ export default function FacturacionPage() {
|
|||||||
// Cálculos
|
// Cálculos
|
||||||
function calcConcepto(c: ConceptoForm) {
|
function calcConcepto(c: ConceptoForm) {
|
||||||
const trasladoRates = c.taxes.filter(t => t.category === 'traslado' && t.factor === 'Tasa').reduce((s, t) => s + t.rate, 0);
|
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 = c.price * c.quantity - c.discount;
|
||||||
const base = unitPrice * 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 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);
|
const retenciones = c.taxes.filter(t => t.category === 'retencion').reduce((s, t) => s + base * t.rate, 0);
|
||||||
return { base, traslados, retenciones };
|
return { base, traslados, retenciones };
|
||||||
@@ -688,7 +687,7 @@ export default function FacturacionPage() {
|
|||||||
quantity: c.quantity,
|
quantity: c.quantity,
|
||||||
price: tipoComprobante === 'T' ? 0 : c.price,
|
price: tipoComprobante === 'T' ? 0 : c.price,
|
||||||
discount: c.discount || 0,
|
discount: c.discount || 0,
|
||||||
taxIncluded: true,
|
taxIncluded: false,
|
||||||
objetoImp: c.objetoImp,
|
objetoImp: c.objetoImp,
|
||||||
taxes: tipoComprobante === 'T' || c.objetoImp === '01' ? [] : c.taxes.map(t => ({
|
taxes: tipoComprobante === 'T' || c.objetoImp === '01' ? [] : c.taxes.map(t => ({
|
||||||
type: t.type,
|
type: t.type,
|
||||||
@@ -1437,7 +1436,7 @@ export default function FacturacionPage() {
|
|||||||
{tipoComprobante !== 'T' && (
|
{tipoComprobante !== 'T' && (
|
||||||
<>
|
<>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label>Precio Unitario (IVA incluido)</Label>
|
<Label>Precio Unitario (sin IVA)</Label>
|
||||||
<Input type="number" min="0" step="0.01" value={c.price || ''} onChange={e => updateConcepto(idx, 'price', parseFloat(e.target.value) || 0)} placeholder="0.00" required />
|
<Input type="number" min="0" step="0.01" value={c.price || ''} onChange={e => updateConcepto(idx, 'price', parseFloat(e.target.value) || 0)} placeholder="0.00" required />
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user