| Stock: 0.00 | $0.00
Aceite Vegetal 1L | Stock: 80.00 | $3.40
Arroz Superior (Funda 5lb) | Stock: 100.00 | $4.75
Azúcar Blanca (Funda 2lb) | Stock: 120.00 | $1.80
BEB ALOE VERA SAVILO | Stock: 4.00 | $0.65
Brocha 3 Pulgadas | Stock: 55.00 | $3.25
Cable Eléctrico #12 (Metro) | Stock: 200.00 | $0.95
Candado 40mm | Stock: 28.00 | $6.50
Casco de Seguridad | Stock: 15.00 | $9.90
Cinta Aislante Negra | Stock: 100.00 | $1.15
Cinta Métrica 5m | Stock: 40.00 | $4.75
Clavos 2 Pulgadas (Libra) | Stock: 150.00 | $1.40
Destornillador Estrella #2 | Stock: 59.00 | $2.25
Detergente en Polvo 1kg | Stock: 60.00 | $4.50
DISCO EMPANADALA CHI | Stock: 1.00 | $1.09
ESPAGUETI CORRUGADO NEGRO 07 MM NYLON (5/16) DNI ESP014A | Stock: 2.00 | $2.00
FDEO VASO POLL LONCH | Stock: 2.00 | $0.77
Foco LED 9W | Stock: 90.00 | $2.90
FUZE TEA NEGRO LIMON | Stock: 1.00 | $1.13
Guantes de Cuero (Par) | Stock: 50.00 | $4.20
Jabón de Baño (Unidad) | Stock: 150.00 | $1.00
JAMON SANDUCHE DON D | Stock: 0.34 | $9.26
LECHE ZYMIL FD PAR | Stock: 1.00 | $5.45
Llave de Paso 1/2" | Stock: 22.00 | $7.80
Manguera de Jardín 1/2" (Metro) | Stock: 80.00 | $1.75
MANI CRIS CLASIC | Stock: 1.00 | $0.45
MARGARINA GIRA | Stock: 1.00 | $1.78
MARTILLO | Stock: 103.00 | $8.00
MARTILLO | Stock: 46.00 | $7.00
MARTILLO | Stock: 10.00 | $8.00
Martillo de Uña 16oz | Stock: 25.00 | $7.50
MEDIDOR TEMP. CAÑERIA 144 IN ALPHA EJ-59126 | Stock: 1.00 | $30.00
PAPAS PALITO CR | Stock: 1.00 | $1.42
PERNO ESPARRAGO ARAÑA 3/4 X 3 1/2" | Stock: 2.00 | $3.43
PERNO ESPARRAGO ARAÑA 3/4 X 3 1/2" | Stock: 2.00 | $6.00
Pintura Latex Blanco (Galón) | Stock: 30.00 | $19.90
Sierra Circular 7 1/4" | Stock: 5.00 | $99.90
Silicona Transparente | Stock: 40.00 | $3.75
TAIPE ELECTRONICO TEMFLEX 155 19 MM X 9 MT NEGRO | Stock: 1.00 | $1.50
Taladro Percutor 1/2" | Stock: 8.00 | $68.90
Tomacorriente Doble | Stock: 65.00 | $2.50
Tornillos Autorroscantes 1" (Caja x100) | Stock: 45.00 | $5.50
Tubo PVC 1/2" (6m) | Stock: 35.00 | $5.20
TUERCA ARAÑA ALTA HG 3/4" | Stock: 2.00 | $2.35
TUERCA ARAÑA ALTA HG 3/4" | Stock: 2.00 | $5.00
YOG FRUTI C/TR TO | Stock: 1.00 | $5.02
YOG GRI MO/ARA CHIVE | Stock: 1.00 | $2.91
YOG GRIEG FRUT CHIVE | Stock: 1.00 | $2.91
Sistema de Facturación SRI
Comprobante en creación
Ver Comprobantes
Datos del Comprobante
Tipo de Comprobante:
Factura
Nota de Crédito
Nota de Débito
Retención
La retención se ligará a una factura existente.
Número de Comprobante:
Fecha de Emisión:
Documento Sustento para Retención
Selecciona la Factura Base:
Seleccione una factura activa
Solo se muestran facturas activas como sustento.
Factura relacionada:
No seleccionada
Fecha sustento:
-
Subtotal gravado:
0.00
IVA factura:
0.00
Total factura:
0.00
Datos del Cliente
Nombre del Cliente:
Puedes escribir o escoger un cliente ya usado.
Identificación:
Puedes verificar por cédula o RUC.
Verificar Cliente
Limpiar Cliente
Referencia / Observación
Observación:
Cálculo de Retenciones
Base IVA:
IVA de la Factura:
% Retención IVA:
0%
30%
70%
100%
Valor Retenido IVA:
Base Renta:
% Retención Renta:
0%
1%
1.75%
2%
2.75%
8%
10%
Valor Retenido Renta:
Total Retenido:
Detalle del Comprobante
Código
Descripción
Cantidad
Precio sin IVA
Tarifa IVA
Subtotal
IVA línea
Total línea
Acción
Agregar Ítem
Subtotal gravado:
Subtotal 0%:
Descuento:
Total IVA:
Total:
Guardar Comprobante
Agregar otra línea
Limpiar formulario
const clientes = [{"cliente_nombre":"ALLISSON NAOMY DELGADO GARCIA","cliente_identificacion":"1313360909"},{"cliente_nombre":"ANDY RIVADENEYRA NEIDA SONIA","cliente_identificacion":"1500982499"},{"cliente_nombre":"ANGULO GUADAMUD JONATHAN ALEJANDRO","cliente_identificacion":"1315258564"},{"cliente_nombre":"Antonio Marquez Firmiño","cliente_identificacion":"0903984243"},{"cliente_nombre":"ARRIAGA ALVARADO JOSE RICARDO","cliente_identificacion":"0940002207"},{"cliente_nombre":"AVEGNO TARABO KENT ANTHONY","cliente_identificacion":"1313444653"},{"cliente_nombre":"AYALA ERAZO HENRY FRANCISCO","cliente_identificacion":"0918696485"},{"cliente_nombre":"BELEN ASTUDILLO DUQUE","cliente_identificacion":"0915671127"},{"cliente_nombre":"BRIONES VELIZ CARLOS HUMBERTO","cliente_identificacion":"1311838617"},{"cliente_nombre":"CARGOFREIGHT LOGISTICS S.A.","cliente_identificacion":"0993247790001"},{"cliente_nombre":"CEDEÑO CEVALLOS STALIN JAVIER","cliente_identificacion":"1309989125"},{"cliente_nombre":"CHAVEZ PAZMIÑO DORA DIOCNADA","cliente_identificacion":"1304864455001"},{"cliente_nombre":"CONSUMIDOR FINAL","cliente_identificacion":"9999999999999"},{"cliente_nombre":"CONSUMINDOR FINAL","cliente_identificacion":"9999999999999"},{"cliente_nombre":"DAFARCA S.A.S.","cliente_identificacion":"0993370879001"},{"cliente_nombre":"DEL HIERRO AVILES MARIA BEATRIZ","cliente_identificacion":"0908948409001"},{"cliente_nombre":"DENISE LOPEZ","cliente_identificacion":"0914012760"},{"cliente_nombre":"EDUARDO RAAD SERRANO","cliente_identificacion":"0914617584"},{"cliente_nombre":"ESCOBAR CADENA RODRIGO VITERVO","cliente_identificacion":"0914021258"},{"cliente_nombre":"ESCOBAR CADENA RODRIGO VITERVO","cliente_identificacion":"0914021258001"},{"cliente_nombre":"ESTEFANIA KATHERINE RIVERA DELGADO","cliente_identificacion":"1312205048"},{"cliente_nombre":"FIGUEROA TUMBACO ALEJANDRO NEMECIO","cliente_identificacion":"0912445269001"},{"cliente_nombre":"GARITZMO SA","cliente_identificacion":"0992271744001"},{"cliente_nombre":"GUERRERO VINCES NEGDA SONIA","cliente_identificacion":"1307740579"},{"cliente_nombre":"HOLGUIN MUÑOZ OSCAR YOVANNY","cliente_identificacion":"0918048653001"},{"cliente_nombre":"INMOBILIARIA TODUBRI SA","cliente_identificacion":"0991058044001"},{"cliente_nombre":"LEGATORIE SA","cliente_identificacion":"0992171863001"},{"cliente_nombre":"MACIAS MUENTES MARITZA MIRELLA","cliente_identificacion":"1304024548"},{"cliente_nombre":"MANTUANO VELEZ ANGEL VICENTE","cliente_identificacion":"0918129537001"},{"cliente_nombre":"MARIA ELENA ELIZALDE DELGADO","cliente_identificacion":"0903821080"},{"cliente_nombre":"MARIA JOSE NAVARRETE","cliente_identificacion":"0921179180001"},{"cliente_nombre":"MUÑOZ SOLORZANO JOHANA ISABEL","cliente_identificacion":"1312941840"},{"cliente_nombre":"PINARGOTE PARRAGA ARELIS ANYELINE","cliente_identificacion":"0803552215"},{"cliente_nombre":"PROCORPORATION SA","cliente_identificacion":"0992361751001"},{"cliente_nombre":"PRODUCIR Y EXPORTAR PREXPORT SA","cliente_identificacion":"0992802707001"},{"cliente_nombre":"PRODUCSOL S.A.","cliente_identificacion":"0992701692001"},{"cliente_nombre":"PRODUCSOL S.A.","cliente_identificacion":"0992791692001"},{"cliente_nombre":"PRODUCSOL SA","cliente_identificacion":"0992701692001"},{"cliente_nombre":"PUBLIBRATA S.A.","cliente_identificacion":"0990953252001"},{"cliente_nombre":"RODRIGUEZ RIOS KERLY YESSTER","cliente_identificacion":"1310561798"},{"cliente_nombre":"RODRIGUEZ RODAS MARCELO BOLIVAR","cliente_identificacion":"0904327400001"},{"cliente_nombre":"ROSA MARGARITA SUCOZ DURAZNO","cliente_identificacion":"0905282836"},{"cliente_nombre":"ROSA MARGARTIA SUCOZ DURAZNO","cliente_identificacion":"0905282836"},{"cliente_nombre":"SEAMAR S.A.","cliente_identificacion":"0990713111001"},{"cliente_nombre":"SEAMAR S.A.","cliente_identificacion":"0990937818001"},{"cliente_nombre":"SICCO BELLINI NATALIA","cliente_identificacion":"0917130049001"},{"cliente_nombre":"SLEM S.A.","cliente_identificacion":"0992328029001"},{"cliente_nombre":"SOLORZANO BRUGOS MARIALENA ALEJANDRINA","cliente_identificacion":"1308285418"},{"cliente_nombre":"SOLORZANO MUÑOZ JOHANA ISABEL","cliente_identificacion":"1312941840"},{"cliente_nombre":"SONNIA ARACELY GUTIERREZ CASSAGNE","cliente_identificacion":"0901544882001"},{"cliente_nombre":"SUSANA AGUIRRE DE KONFLE","cliente_identificacion":"0914321682"},{"cliente_nombre":"TARABO VASQUEZ LESLIE ALEXANDRA","cliente_identificacion":"1307135523001"},{"cliente_nombre":"TECNOLOGICO EUROAMERICANO","cliente_identificacion":"0992410140001"},{"cliente_nombre":"VARGAS MERA YOLANDA FILOMENA","cliente_identificacion":"1310129158"},{"cliente_nombre":"VILLA TORRES KEVIN BRYAN","cliente_identificacion":"0950492843"}]; const facturasBase = []; const inputNombre = document.getElementById('cliente_nombre'); const inputIdentificacion = document.getElementById('cliente_identificacion'); const tipoComprobante = document.getElementById('tipo_comprobante'); const facturaBaseSelect = document.getElementById('factura_base_select'); function normalizarTexto(valor) { return (valor || '').toString().trim().toLowerCase(); } function buscarClientePorNombre(nombre) { const valor = normalizarTexto(nombre); return clientes.find(c => normalizarTexto(c.cliente_nombre) === valor); } function buscarClientePorIdentificacion(identificacion) { const valor = normalizarTexto(identificacion); return clientes.find(c => normalizarTexto(c.cliente_identificacion) === valor); } inputNombre.addEventListener('input', function () { const cliente = buscarClientePorNombre(this.value); if (cliente) { inputIdentificacion.value = cliente.cliente_identificacion; } }); inputIdentificacion.addEventListener('input', function () { const cliente = buscarClientePorIdentificacion(this.value); if (cliente) { inputNombre.value = cliente.cliente_nombre; } }); function verificarCliente() { let nombre = inputNombre.value.trim(); let identificacion = inputIdentificacion.value.trim(); let encontrado = false; if (nombre !== '') { const clientePorNombre = buscarClientePorNombre(nombre); if (clientePorNombre) { inputNombre.value = clientePorNombre.cliente_nombre; inputIdentificacion.value = clientePorNombre.cliente_identificacion; encontrado = true; } } if (!encontrado && identificacion !== '') { const clientePorId = buscarClientePorIdentificacion(identificacion); if (clientePorId) { inputNombre.value = clientePorId.cliente_nombre; inputIdentificacion.value = clientePorId.cliente_identificacion; encontrado = true; } } if (encontrado) { alert('Cliente encontrado correctamente.'); } else { alert('Cliente no encontrado. Puedes registrarlo con este comprobante.'); } } function limpiarCliente() { if (tipoComprobante.value === 'retencion') { return; } inputNombre.value = ''; inputIdentificacion.value = ''; } function agregarFila() { if (tipoComprobante.value === 'retencion') { return; } const tbody = document.querySelector("#tablaProductos tbody"); const fila = document.createElement("tr"); fila.innerHTML = `
IVA 15%
IVA 12%
IVA 8%
IVA 5%
IVA 0%
Eliminar
`; tbody.appendChild(fila); calcularTotales(); } function calcularFila(input) { const fila = input.closest("tr"); const cantidad = parseFloat(fila.querySelector('input[name="cantidad[]"]').value) || 0; const precio = parseFloat(fila.querySelector('input[name="precio[]"]').value) || 0; const tarifa = parseFloat(fila.querySelector('select[name="tarifa_iva[]"]').value) || 0; const subtotalLinea = cantidad * precio; const valorIva = subtotalLinea * (tarifa / 100); const totalLinea = subtotalLinea + valorIva; fila.querySelector('input[name="subtotal_linea[]"]').value = subtotalLinea.toFixed(2); fila.querySelector('input[name="iva_linea[]"]').value = valorIva.toFixed(2); fila.querySelector('input[name="total_producto[]"]').value = totalLinea.toFixed(2); calcularTotales(); } function eliminarFila(boton) { const fila = boton.closest("tr"); fila.remove(); calcularTotales(); } function calcularTotales() { if (tipoComprobante.value === 'retencion') { return; } const filas = document.querySelectorAll("#tablaProductos tbody tr"); let subtotalBrutoGravado = 0; let subtotalBruto0 = 0; let subtotalBrutoGeneral = 0; filas.forEach(function(fila) { const cantidad = parseFloat(fila.querySelector('input[name="cantidad[]"]').value) || 0; const precio = parseFloat(fila.querySelector('input[name="precio[]"]').value) || 0; const tarifa = parseFloat(fila.querySelector('select[name="tarifa_iva[]"]').value) || 0; const subtotalLinea = cantidad * precio; if (tarifa === 0) { subtotalBruto0 += subtotalLinea; } else { subtotalBrutoGravado += subtotalLinea; } subtotalBrutoGeneral += subtotalLinea; }); let descuento = parseFloat(document.getElementById('descuento').value) || 0; if (descuento < 0) descuento = 0; if (descuento > subtotalBrutoGeneral) descuento = subtotalBrutoGeneral; document.getElementById('descuento').value = descuento.toFixed(2); let subtotalGravadoNeto = 0; let subtotal0Neto = 0; let totalIva = 0; let totalFinal = 0; let descuentoAsignado = 0; const totalFilas = filas.length; filas.forEach(function(fila, index) { const cantidad = parseFloat(fila.querySelector('input[name="cantidad[]"]').value) || 0; const precio = parseFloat(fila.querySelector('input[name="precio[]"]').value) || 0; const tarifa = parseFloat(fila.querySelector('select[name="tarifa_iva[]"]').value) || 0; const subtotalLineaBruto = cantidad * precio; let descuentoLinea = 0; if (subtotalBrutoGeneral > 0 && descuento > 0) { if (index < totalFilas - 1) { descuentoLinea = ((subtotalLineaBruto / subtotalBrutoGeneral) * descuento); descuentoLinea = parseFloat(descuentoLinea.toFixed(2)); descuentoAsignado += descuentoLinea; } else { descuentoLinea = parseFloat((descuento - descuentoAsignado).toFixed(2)); } } if (descuentoLinea < 0) descuentoLinea = 0; if (descuentoLinea > subtotalLineaBruto) descuentoLinea = subtotalLineaBruto; const baseLinea = subtotalLineaBruto - descuentoLinea; const valorIva = baseLinea * (tarifa / 100); const totalLinea = baseLinea + valorIva; fila.querySelector('input[name="subtotal_linea[]"]').value = baseLinea.toFixed(2); fila.querySelector('input[name="iva_linea[]"]').value = valorIva.toFixed(2); fila.querySelector('input[name="total_producto[]"]').value = totalLinea.toFixed(2); if (tarifa === 0) { subtotal0Neto += baseLinea; } else { subtotalGravadoNeto += baseLinea; } totalIva += valorIva; totalFinal += totalLinea; }); document.getElementById('subtotal_gravado').value = subtotalGravadoNeto.toFixed(2); document.getElementById('subtotal_0').value = subtotal0Neto.toFixed(2); document.getElementById('iva').value = totalIva.toFixed(2); document.getElementById('total').value = totalFinal.toFixed(2); }