Attribute VB_Name = "modWSLSPPecuarioEjemplos"
Option Explicit
' ==============================================================================
' WSAFIPFE - EJEMPLOS DE PRODUCCION VB6: AREA 1 PECUARIO BOVINO/BUBALINO Y PORCINO
' Servicio: WSLSP (LspService v2.0.6 - ARCA / ex-AFIP) - Interfaz COM WSAFIPFE.Factura
' Manual ARCA de referencia: manual_wslsp_2.0.6.pdf (23/06/2026)
' Guia maestra: GUIA_WSLSP.md
'
' ALCANCE ESTRICTO (AREA 1 - HACIENDA Y CARNES BOVINO/BUBALINO Y PORCINO):
' - NO utiliza propiedad lspVersion (las areas se distinguen por nombre de metodo).
' - Tipos de Comprobante Area 1: 180, 182, 183, 185, 186, 188, 189, 190, 191.
' - Operaciones Area 1: 1..6 (Bovino/Bubalino) y 101..106 (Porcino).
' - Se omiten llamadas ejecutables a iniciar() y lspObtenerTicketAcceso()
' (se documentan como prerrequisitos ya ejecutados en la sesion actual).
'
' Cobertura: 3 / 3 operaciones SOAP del Area 1 (6 ejemplos completos):
' 1. generarLiquidacion (Sec. 2.7.17) -> lspGenerarLiquidacion:
' - Ejemplo_lspGenerarLiquidacion_Bovino_CompraDirecta (Op 5, Cbte 186, Kg Carne)
' - Ejemplo_lspGenerarLiquidacion_Bovino_CuentaVenta_Asoc (Op 1, Cbte 180, CompraAsoc)
' - Ejemplo_lspGenerarLiquidacion_Porcino_Carne_Cortes (Op 103, Cbte 180, Remito, Kg/Corte)
' 2. consultarLiquidacionPorNroComprobante (Sec. 2.7.18) -> lspconsultarLiquidacionPorNroComprobante:
' - Ejemplo_lspConsultarLiquidacion_BovinoPorcino
' 3. ajustarLiquidacion / generarAjuste (Sec. 2.7.19) -> lspAjustarLiquidacion:
' - Ejemplo_lspAjustarLiquidacion_BovinoPorcino (Fisico / Monetario / Financiero)
' - Ejemplo_lspAjustarLiquidacion_AnulacionTotal (Credito Fisico + Financiero, p. 93)
' ==============================================================================
' ==============================================================================
' 1A. GENERAR LIQUIDACION BOVINA - COMPRA DIRECTA A FAENA (Sec. 2.7.17)
' Op 5 (Compra Directa), Cbte 186 (Tipo A), Emisor Car 4 (Frigorifico),
' Receptor Car 1 (Productor RI), Motivo 1 (FAENA), TipoLiq 3 (Kg de Carne).
' Incluye variantes condicionales: cuitAutorizado, precioRecupero,
' raza.detalle (codRaza = 99), tipoIVANulo = "TF" (Ley 19640), gastos y tributos.
' ==============================================================================
Public Sub Ejemplo_lspGenerarLiquidacion_Bovino_CompraDirecta()
Dim fe As Object
Dim bOk As Boolean
Dim nPtoVta As Integer
Dim nTipoCbte As Integer
Dim sProxNro As String
Dim bEsExentoLey19640 As Boolean
Dim bRazaOtra As Boolean
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
' Configuracion TLS 1.2, auditoria XML y descarga automatica de PDF oficial
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_bovino_compradirecta_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_bovino_compradirecta_rec.xml"
nPtoVta = 3000
nTipoCbte = 186 ' 186 = Liquidacion de Compra Directa A (RI -> RI, Op 5)
bEsExentoLey19640 = False ' True = usa tipoIVANulo="TF" sin alicuotaIVA (error 2414 si ambos)
bRazaOtra = False ' True = codRaza=99 con raza.detalle obligatorio (error 2411)
' Obtener correlativo: ultimo comprobante autorizado + 1
sProxNro = CStr(Val(fe.lspconsultarUltimoNro(nPtoVta, nTipoCbte)) + 1)
fe.lspPDF = "C:\temp\wslsp_compra_directa_186_" & sProxNro & ".pdf"
' Limpieza obligatoria de estructura interna
bOk = fe.lspCargarPropiedad("LIMPIAR", "", 0, 0)
' Operacion 5 = Liquidacion Compra Directa (Bovino/Bubalino)
bOk = bOk And fe.lspCargarPropiedad("codOperacion", "5", 0, 0)
' --- Emisor: Frigorifico (codCaracter = 4 -> nroRUCA obligatorio, SIN nroRenspa) ---
bOk = bOk And fe.lspCargarPropiedad("emisor.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.tipoComprobante", CStr(nTipoCbte), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroComprobante", sProxNro, 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.codCaracter", "4", 0, 0) ' 4 = Establecimiento faenador/frigorifico
bOk = bOk And fe.lspCargarPropiedad("emisor.fechaInicioActividades", "20100101", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.iibb", "9011234567", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroRUCA", "1011", 0, 0)
' Obligatorio en Compra Directa si emisor Car 4 o 9 esta inscripto en registro RFOCB (Tabla 2)
bOk = bOk And fe.lspCargarPropiedad("emisor.cuitAutorizado", "20160000261", 0, 0)
' --- Receptor: Productor/Criador RI (codCaracter = 1 -> nroRenspa obligatorio, SIN nroRUCA) ---
' Datos oficiales de prueba Tabla 1 (manual p. 8): 20160000024 = Productor/criador RI
bOk = bOk And fe.lspCargarPropiedad("receptor.codCaracter", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.cuit", "20160000024", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.iibb", "9027654321", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.nroRenspa", "01.123.1.12345/A4", 0, 0)
' --- Datos de la Liquidacion (Motivo 1 = FAENA -> fechaRecepcion y fechaFaena obligatorios) ---
' Nota: en Op 5 NO se informa datosLiquidacion.frigorifico (solo aplica en Op 2/102 y 3/103)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaComprobante", Format(Date, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaOperacion", Format(Date - 1, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.lugarRealizacion", "MERCADO AGROGANADERO CANUELAS", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.codMotivo", "1", 0, 0) ' 1 = FAENA
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaRecepcion", Format(Date - 1, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaFaena", Format(Date, "yyyymmdd"), 0, 0)
' --- Guias (0..N, base 0) ---
bOk = bOk And fe.lspCargarPropiedad("guia.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("guia.nroGuia", "G-2026-000987", 0, 0)
' --- DTE (obligatorio al menos 1 salvo Op 3/103; regex nroDTE: \d{1,9}-\d{1}) ---
bOk = bOk And fe.lspCargarPropiedad("dte.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("dte.nroDTE", "123456789-2", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("dte.nroRenspa", "01.123.1.12345/A4", 0, 0)
' --- Detalle de Items (1..N, base 0) ---
' tipoLiquidacion: 1=Por Cabeza | 2=Por Kilo vivo | 3=Por Kilo de carne | 5=Por Corte | 6=Kg. por Corte
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.codCategoria", "51040101", 0, 0) ' Bovino Novillos 431/460 kg
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.tipoLiquidacion", "3", 0, 0) ' 3 = Por Kilo de carne
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidad", "7560", 0, 0) ' Kilos de carne limpia
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadCabezas", "30", 0, 0) ' Obligatorio si tipoLiq <> 1
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadKgVivo", "13500", 0, 0) ' Para calculo de rinde
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.nroTropa", "4501", 0, 0) ' Obligatorio Op 5 emisor 4/9
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.precioUnitario", "4150.50", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.precioRecupero", "120.00", 0, 0)
If bRazaOtra Then
' codRaza = 99 (Otra): raza.detalle es obligatorio (error 2411); nulo en otros codigos
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.codRaza", "99", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.detalle", "Cruza Britanica", 0, 0)
Else
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.codRaza", "1", 0, 0) ' 1 = Aberdeen Angus
End If
' IVA en items: mutuamente excluyente entre alicuotaIVA (10.5 o 21) y tipoIVANulo ("TF")
' Nota: ARCA no permite alicuotaIVA = 0; en items el unico tipoIVANulo valido es "TF" (error 2413)
If bEsExentoLey19640 Then
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.tipoIVANulo", "TF", 0, 0)
Else
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.alicuotaIVA", "10.5", 0, 0)
End If
' --- Gastos (0..N): baseImponible+alicuota O importe (excluyentes, error 2602) ---
' En Cbte tipo A, cada gasto exige alicuotaIVA (10.5/21) O tipoIVANulo (NG/NA/EX/TF)
bOk = bOk And fe.lspCargarPropiedad("gasto.itemcantidad", "2", 0, 0)
' Gasto #0: por base imponible + alicuota + IVA 10.5%
bOk = bOk And fe.lspCargarPropiedad("gasto.codGasto", "4", 0, 0) ' 4 = FLETE
bOk = bOk And fe.lspCargarPropiedad("gasto.baseImponible", "32284980.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.alicuota", "1.50", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.alicuotaIVA", "10.5", 0, 0)
' Gasto #1: codGasto = 99 (OTROS -> descripcion obligatoria, error 2601) por importe fijo Exento
bOk = bOk And fe.lspCargarPropiedad("gasto.codGasto", "99", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.descripcion", "Servicio de pesaje adicional", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.importe", "25000.00", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.tipoIVANulo", "EX", 1, 0)
' --- Tributos (0..N): NO informar 15, 16, 17, 22, 23 (ARCA los calcula automaticamente, error 2705) ---
bOk = bOk And fe.lspCargarPropiedad("tributo.itemcantidad", "2", 0, 0)
' Tributo #0: por base imponible + alicuota
bOk = bOk And fe.lspCargarPropiedad("tributo.codTributo", "5", 0, 0) ' 5 = IIBB
bOk = bOk And fe.lspCargarPropiedad("tributo.baseImponible", "32284980.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("tributo.alicuota", "1.00", 0, 0)
' Tributo #1: codTributo = 99 (Otros -> descripcion obligatoria, error 2701) por importe fijo
bOk = bOk And fe.lspCargarPropiedad("tributo.codTributo", "99", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("tributo.descripcion", "Tasa municipal de faena", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("tributo.importe", "12500.00", 1, 0)
bOk = bOk And fe.lspCargarPropiedad("datosAdicionales", "Liquidacion compra directa sujeta a romaneo.", 0, 0)
If (Not bOk) Or (fe.UltimoNumeroError <> 0) Then
Debug.Print "Error al cargar propiedades: " & fe.UltimoMensajeError
Exit Sub
End If
' Ejecutar autorizacion ante ARCA
If fe.lspGenerarLiquidacion() Then
MostrarErroresLsp fe, "lspGenerarLiquidacion (Bovino Compra Directa)"
LeerRespuestaLiquidacionPecuaria fe, "lspGenerarLiquidacion"
Else
Debug.Print "Error SOAP lspGenerarLiquidacion: [" & fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' 1B. GENERAR LIQUIDACION BOVINA - CUENTA DE VENTA Y LIQUIDO PRODUCTO CON
' LIQUIDACION DE COMPRA ASOCIADA (Sec. 2.7.17 y Anexo 4.5)
' Op 1 (Cuenta de Venta y Liquido Producto - Hacienda), Cbte 180 (Tipo A),
' Emisor Car 5 (Consignatario), Receptor Car 3 (Invernador RI),
' TipoLiq 2 (Por Kilo vivo), cuitCliente y subtabla liquidacionCompraAsociada.
' ==============================================================================
Public Sub Ejemplo_lspGenerarLiquidacion_Bovino_CuentaVenta_Asoc()
Dim fe As Object
Dim bOk As Boolean
Dim nPtoVta As Integer
Dim nTipoCbte As Integer
Dim sProxNro As String
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_bovino_cvlp_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_bovino_cvlp_rec.xml"
nPtoVta = 3000
nTipoCbte = 180 ' 180 = Cuenta de Venta y Liquido Producto A (Op 1, RI -> RI)
sProxNro = CStr(Val(fe.lspconsultarUltimoNro(nPtoVta, nTipoCbte)) + 1)
fe.lspPDF = "C:\temp\wslsp_cvlp_180_" & sProxNro & ".pdf"
bOk = fe.lspCargarPropiedad("LIMPIAR", "", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("codOperacion", "1", 0, 0) ' 1 = CVLP Hacienda Bovino
' Emisor: Consignatario/Comisionista (Car 5 -> nroRUCA obligatorio, SIN nroRenspa)
bOk = bOk And fe.lspCargarPropiedad("emisor.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.tipoComprobante", CStr(nTipoCbte), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroComprobante", sProxNro, 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.codCaracter", "5", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.fechaInicioActividades", "20160101", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.iibb", "9012345678", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroRUCA", "305", 0, 0)
' Receptor: Invernador RI (Tabla 1: 20160000121; Car 3 -> nroRenspa obligatorio, SIN nroRUCA)
bOk = bOk And fe.lspCargarPropiedad("receptor.codCaracter", "3", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.cuit", "20160000121", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.iibb", "345678", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.nroRenspa", "01.123.1.12345/A4", 0, 0)
' Datos de liquidacion (Motivo 2 = INVERNADA; en Op 1 no se informa frigorifico)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaComprobante", Format(Date, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaOperacion", Format(Date - 1, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.lugarRealizacion", "CORONEL SUAREZ", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.codMotivo", "2", 0, 0) ' 2 = INVERNADA
' DTE con nroRenspa (obligatorio en Op 1)
bOk = bOk And fe.lspCargarPropiedad("dte.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("dte.nroDTE", "123456789-2", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("dte.nroRenspa", "01.123.1.12345/45", 0, 0)
' Item #0: en Op 1 son obligatorios cuitCliente y liquidacionCompraAsociada (Cbte 183 o 185)
' La suma de cantidadAsociada debe coincidir exactamente con la cantidad del item (error 2507)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cuitCliente", "20160000083", 0, 0) ' Comprador Feed lot (Tabla 1)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.codCategoria", "51020102", 0, 0) ' Bovino Vaquillona 391/430 kg
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.tipoLiquidacion", "2", 0, 0) ' 2 = Por Kilo vivo
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidad", "4000", 0, 0) ' 4000 kg vivos
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadCabezas", "10", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.precioUnitario", "2100.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.alicuotaIVA", "10.5", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.codRaza", "1", 0, 0)
' Subtabla anidada (2do nivel): nIndice = 0 (item), nSubIndice = 0 (comprobante asociado)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.tipoComprobante", "183", 0, 0) ' Solo 183 o 185
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.nroComprobante", "33", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.nroItem", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.cantidadAsociada", "4000", 0, 0)
' Gasto de comision de consignatario (codGasto = 16)
bOk = bOk And fe.lspCargarPropiedad("gasto.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.codGasto", "16", 0, 0) ' 16 = COMISION
bOk = bOk And fe.lspCargarPropiedad("gasto.baseImponible", "8400000.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.alicuota", "3.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("gasto.alicuotaIVA", "10.5", 0, 0)
If (Not bOk) Or (fe.UltimoNumeroError <> 0) Then
Debug.Print "Error al cargar propiedades CVLP: " & fe.UltimoMensajeError
Exit Sub
End If
If fe.lspGenerarLiquidacion() Then
MostrarErroresLsp fe, "lspGenerarLiquidacion (Bovino CVLP con Compra Asociada)"
LeerRespuestaLiquidacionPecuaria fe, "lspGenerarLiquidacion"
Else
Debug.Print "Error SOAP lspGenerarLiquidacion: [" & fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' 1C. GENERAR LIQUIDACION PORCINA - CONSIGNATARIO DE CARNES POR CORTE (v2.0.4+)
' Op 103 (CVLP - Carne - Porcinos), Cbte 180 (Tipo A),
' Emisor Car 106 (Consignatario de Carnes Porcino),
' Receptor Car 102 (Frigorifico Porcino RI, Tabla 1/3: 30160000011, RUCA 1011),
' Frigorifico obligatorio (Tabla 4: 30160000011, Planta 1),
' Remito obligatorio formato "xxxxx-xxxxxxxx" (SIN DTE en Op 3/103),
' TipoLiq 6 (Kg. por Corte) con codCorte porcino (201..227) y cantidadPorCorte.
' ==============================================================================
Public Sub Ejemplo_lspGenerarLiquidacion_Porcino_Carne_Cortes()
Dim fe As Object
Dim bOk As Boolean
Dim nPtoVta As Integer
Dim nTipoCbte As Integer
Dim sProxNro As String
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_porcino_carne_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_porcino_carne_rec.xml"
nPtoVta = 3000
nTipoCbte = 180 ' 180 = Cuenta de Venta y Liquido Producto A (Op 103)
sProxNro = CStr(Val(fe.lspconsultarUltimoNro(nPtoVta, nTipoCbte)) + 1)
fe.lspPDF = "C:\temp\wslsp_porcino_180_" & sProxNro & ".pdf"
bOk = fe.lspCargarPropiedad("LIMPIAR", "", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("codOperacion", "103", 0, 0) ' 103 = CVLP Carne - Porcinos
' Emisor: Consignatario de Carnes Porcino (Car 106 -> nroRUCA obligatorio)
bOk = bOk And fe.lspCargarPropiedad("emisor.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.tipoComprobante", CStr(nTipoCbte), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroComprobante", sProxNro, 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.codCaracter", "106", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.fechaInicioActividades", "20180101", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.iibb", "9015556667", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("emisor.nroRUCA", "305", 0, 0)
' Receptor: Frigorifico Porcino RI (Tabla 1/3: 30160000011, Car 102, RUCA 1011)
bOk = bOk And fe.lspCargarPropiedad("receptor.codCaracter", "102", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.cuit", "30160000011", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.iibb", "9019998887", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("receptor.operador.nroRUCA", "1011", 0, 0)
' Datos de liquidacion + Frigorifico obligatorio para Op 2/102 y 3/103 (Tabla 4)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaComprobante", Format(Date, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.fechaOperacion", Format(Date - 1, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.lugarRealizacion", "ROSARIO", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.codMotivo", "5", 0, 0) ' 5 = REMATE DE CARNE
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.frigorifico.cuit", "30160000011", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("datosLiquidacion.frigorifico.nroPlanta", "1", 0, 0)
' Remitos (v2.0.4+, exclusivo Consignatarios de Carne Op 3/103; formato 13 chars "xxxxx-xxxxxxxx")
' Nota: NO informar DTE para Op 3/103 (manual p. 123)
bOk = bOk And fe.lspCargarPropiedad("remito.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("remito.nroRemito", "00001-00004567", 0, 0)
' Item Porcino con tipoLiquidacion = 6 (Kg. por Corte, v2.0.4+)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.codCategoria", "520304", 0, 0) ' Porcina Capon
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.tipoLiquidacion", "6", 0, 0) ' 6 = Kg. por Corte
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidad", "850", 0, 0) ' Cantidad de Kg del corte
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadCabezas", "20", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.codCorte", "201", 0, 0) ' 201 = Media res porcina
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadPorCorte", "20", 0, 0) ' Obligatorio para tipoLiq = 6
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.nroTropa", "8820", 0, 0) ' Obligatorio Op 3/103
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.precioUnitario", "3250.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.alicuotaIVA", "10.5", 0, 0)
bOk = bOk And fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.codRaza", "5201", 0, 0) ' 5201 = YORKSHIRE / LARGE-WHITE
If (Not bOk) Or (fe.UltimoNumeroError <> 0) Then
Debug.Print "Error al cargar propiedades Porcino: " & fe.UltimoMensajeError
Exit Sub
End If
If fe.lspGenerarLiquidacion() Then
MostrarErroresLsp fe, "lspGenerarLiquidacion (Porcino Carne Cortes)"
LeerRespuestaLiquidacionPecuaria fe, "lspGenerarLiquidacion"
Else
Debug.Print "Error SOAP lspGenerarLiquidacion: [" & fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' 2. CONSULTAR LIQUIDACION POR NUMERO DE COMPROBANTE (Sec. 2.7.18)
' Metodo COM: lspconsultarLiquidacionPorNroComprobante(nPtoVta, nTipoCbte, cNro)
' Permite recuperar todos los datos de una liquidacion o ajuste bovino/porcino
' y descargar nuevamente su PDF oficial (util tambien tras aviso no bloqueante 550).
' ==============================================================================
Public Sub Ejemplo_lspConsultarLiquidacion_BovinoPorcino()
Dim fe As Object
Dim nPtoVta As Integer
Dim nTipoCbte As Integer
Dim cNroCbte As String
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_consultar_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_consultar_rec.xml"
nPtoVta = 3000
nTipoCbte = 186
cNroCbte = "1"
fe.lspPDF = "C:\temp\wslsp_consulta_" & CStr(nTipoCbte) & "_" & cNroCbte & ".pdf"
If fe.lspconsultarLiquidacionPorNroComprobante(nPtoVta, nTipoCbte, cNroCbte) Then
MostrarErroresLsp fe, "lspconsultarLiquidacionPorNroComprobante"
LeerRespuestaLiquidacionPecuaria fe, "lspconsultarLiquidacionPorNroComprobante"
Else
Debug.Print "Error SOAP lspconsultarLiquidacionPorNroComprobante: [" & _
fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' 3A. AJUSTAR LIQUIDACION BOVINA / PORCINA (Sec. 2.7.19 - generarAjuste)
' Metodo COM: lspCargarPropiedadAjuste + lspAjustarLiquidacion
' Modos (reglas 3002 y 3010):
' - Ajuste Fisico y Ajuste Monetario son MUTUAMENTE EXCLUYENTES (error 3002).
' - Cualquiera de ellos puede combinarse con Ajuste Financiero.
' - En Ajuste Financiero se admite Gastos O Tributos, NO ambos (error 3010).
' ==============================================================================
Public Sub Ejemplo_lspAjustarLiquidacion_BovinoPorcino()
Dim fe As Object
Dim bOk As Boolean
Dim nPtoVta As Integer
Dim nTipoCbteAjustado As Integer
Dim nPtoVtaAjustado As Integer
Dim cNroCbteAjustado As String
Dim sProxAjuste As String
Dim nModoEjemplo As Integer
Dim nTipoFinanciero As Integer
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_ajuste_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_ajuste_rec.xml"
nPtoVta = 3000
nTipoCbteAjustado = 186
nPtoVtaAjustado = 3000
cNroCbteAjustado = "1"
' Selector de variante de ajuste:
' 1 = Monetario (precioUnitario / precioRecupero)
' 2 = Fisico (cantidad / cantidadCabezas / cantidadKgVivo / cantidadPorCorte / ajusteCompraAsociada)
' 3 = Solo Financiero
nModoEjemplo = 1
' Selector de ajuste financiero opcional (error 3010: Gastos O Tributos, nunca ambos):
' 0 = Ninguno | 1 = Gastos | 2 = Tributos
nTipoFinanciero = 1
' El ajuste hereda el tipo de comprobante del comprobante original ajustado
sProxAjuste = CStr(Val(fe.lspconsultarUltimoNro(nPtoVta, nTipoCbteAjustado)) + 1)
fe.lspPDF = "C:\temp\wslsp_ajuste_" & CStr(nTipoCbteAjustado) & "_" & sProxAjuste & ".pdf"
bOk = fe.lspCargarPropiedadAjuste("LIMPIAR", "", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("tipoAjuste", "D", 0, 0) ' D = Debito (incrementa) | C = Credito (reduce)
bOk = bOk And fe.lspCargarPropiedadAjuste("fechaComprobante", Format(Date, "yyyymmdd"), 0, 0)
' Identificacion del comprobante de ajuste y del comprobante original a ajustar
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.nroComprobante", sProxAjuste, 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.tipoComprobante", CStr(nTipoCbteAjustado), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.puntoVenta", CStr(nPtoVtaAjustado), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.nroComprobante", cNroCbteAjustado, 0, 0)
' --- Bloque de Items a Ajustar (excluyente entre ajusteMonetario y ajusteFisico) ---
Select Case nModoEjemplo
Case 1 ' Ajuste Monetario
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.nroItemAjustar", "1", 0, 0) ' Base 1 segun nroItem ARCA
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteMonetario.precioUnitario", "50.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteMonetario.precioRecupero", "5.00", 0, 0)
Case 2 ' Ajuste Fisico (incluye campos opcionales y ejemplo de compra asociada)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.nroItemAjustar", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteFisico.cantidad", "250", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteFisico.cantidadCabezas", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteFisico.cantidadKgVivo", "440", 0, 0)
' Para tipoLiquidacion = 6 (Kg. por Corte, v2.0.4+):
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteFisico.cantidadPorCorte", "2", 0, 0)
' Solo si el comprobante original era Op 1/101 (CVLP Hacienda con compras asociadas):
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.itemcantidad", "1", 0, 0)
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.tipoComprobante", "183", 0, 0)
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.puntoVenta", CStr(nPtoVta), 0, 0)
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.nroComprobante", "33", 0, 0)
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.nroItem", "1", 0, 0)
' bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteCompraAsociada.cantidadAsociada", "250", 0, 0)
Case 3 ' Solo Financiero (sin itemDetalleAjusteLiquidacion)
End Select
' --- Bloque Financiero opcional (regla 3010: Gastos O Tributos, NO ambos en un mismo ajuste) ---
Select Case nTipoFinanciero
Case 1 ' Ajuste Financiero de Gastos (nunca enviar alicuotaIVA = 0 ni combinar con tipoIVANulo)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.codGasto", "99", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.descripcion", "Diferencia flete hacienda", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.importe", "15000.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.tipoIVANulo", "EX", 0, 0)
Case 2 ' Ajuste Financiero de Tributos
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.codTributo", "5", 0, 0) ' 5 = IIBB
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.baseImponible", "378000.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.alicuota", "1.00", 0, 0)
End Select
bOk = bOk And fe.lspCargarPropiedadAjuste("datosAdicionales", "Ajuste de liquidacion pecuaria.", 0, 0)
If (Not bOk) Or (fe.UltimoNumeroError <> 0) Then
Debug.Print "Error al cargar propiedades de ajuste: " & fe.UltimoMensajeError
Exit Sub
End If
If fe.lspAjustarLiquidacion() Then
MostrarErroresLsp fe, "lspAjustarLiquidacion"
LeerRespuestaLiquidacionPecuaria fe, "lspAjustarLiquidacion"
Else
Debug.Print "Error SOAP lspAjustarLiquidacion: [" & fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' 3B. ANULACION TOTAL DE LIQUIDACION MEDIANTE AJUSTE DE CREDITO (Sec. 2.7.19, p. 93)
' Reglas oficiales (validaciones 5000/5001/5002):
' - Solo puede anularse hasta el dia 6 inclusive del mes siguiente.
' - No se puede anular un ajuste ni una liquidacion ya anulada.
' - Se emite tipoAjuste = "C" con ajusteFisico por el 100% de cada item
' mas los gastos/tributos originales en ajusteFinanciero.
' ==============================================================================
Public Sub Ejemplo_lspAjustarLiquidacion_AnulacionTotal()
Dim fe As Object
Dim bOk As Boolean
Dim nPtoVta As Integer
Dim nTipoCbteOriginal As Integer
Dim cNroCbteOriginal As String
Dim sProxAjuste As String
Set fe = CreateObject("WSAFIPFE.Factura")
' --------------------------------------------------------------------------
' NOTA: Se asume que los siguientes metodos ya fueron ejecutados
' previamente y sin errores en la sesion actual:
' - fe.iniciar(Modo, CUIT, RutaCertificadoPFX, ArchivoLicencia)
' - fe.lspObtenerTicketAcceso() (o restaurado con lspRestaurarTicketAcceso)
' --------------------------------------------------------------------------
fe.tls = 12
fe.ArchivoXMLEnviado = "C:\temp\wslsp_anulacion_env.xml"
fe.ArchivoXMLRecibido = "C:\temp\wslsp_anulacion_rec.xml"
nPtoVta = 3000
nTipoCbteOriginal = 185 ' Liquidacion de Compra B (ejemplo Solicitud 2 manual p. 93)
cNroCbteOriginal = "33"
sProxAjuste = CStr(Val(fe.lspconsultarUltimoNro(nPtoVta, nTipoCbteOriginal)) + 1)
fe.lspPDF = "C:\temp\wslsp_anulacion_" & CStr(nTipoCbteOriginal) & "_" & sProxAjuste & ".pdf"
bOk = fe.lspCargarPropiedadAjuste("LIMPIAR", "", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("tipoAjuste", "C", 0, 0) ' Credito para anular
bOk = bOk And fe.lspCargarPropiedadAjuste("fechaComprobante", Format(Date, "yyyymmdd"), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.nroComprobante", sProxAjuste, 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.tipoComprobante", CStr(nTipoCbteOriginal), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.puntoVenta", CStr(nPtoVta), 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("emisor.comprobanteAAjustar.nroComprobante", cNroCbteOriginal, 0, 0)
' Reversar el 100% de la cantidad del item #1 de la liquidacion original
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.nroItemAjustar", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("itemDetalleAjusteLiquidacion.ajusteFisico.cantidad", "40", 0, 0)
' Reversar gastos de la liquidacion original (en Cbte 185 el importe incluye IVA y lleva alicuotaIVA)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.codGasto", "16", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.baseImponible", "230520.60", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.alicuota", "3.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.gasto.alicuotaIVA", "10.5", 0, 0)
' Reversar tributos de la liquidacion original (nota: en anulacion total ARCA replica ambos)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.itemcantidad", "1", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.codTributo", "3", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.baseImponible", "10000.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("ajusteFinanciero.tributo.alicuota", "5.00", 0, 0)
bOk = bOk And fe.lspCargarPropiedadAjuste("datosAdicionales", "Anulacion total de comprobante original.", 0, 0)
If (Not bOk) Or (fe.UltimoNumeroError <> 0) Then
Debug.Print "Error al cargar anulacion: " & fe.UltimoMensajeError
Exit Sub
End If
If fe.lspAjustarLiquidacion() Then
MostrarErroresLsp fe, "lspAjustarLiquidacion (Anulacion Total)"
LeerRespuestaLiquidacionPecuaria fe, "lspAjustarLiquidacion"
Else
Debug.Print "Error SOAP anulacion: [" & fe.UltimoNumeroError & "] " & fe.UltimoMensajeError
End If
End Sub
' ==============================================================================
' HELPERS INTERNOS DE LECTURA COMPLETA Y ERRORES (AREA 1 - BOVINO / PORCINO)
' ==============================================================================
Private Sub MostrarErroresLsp(ByVal fe As Object, ByVal sContexto As String)
Dim i As Integer
Dim sCod As String
Dim sDesc As String
If fe.lspErrorItemCantidad <= 0 Then Exit Sub
Debug.Print "--- Errores / Avisos ARCA en " & sContexto & " (" & CStr(fe.lspErrorItemCantidad) & ") ---"
For i = 0 To fe.lspErrorItemCantidad - 1
fe.IndiceItem = i
sCod = fe.lspErrorCodigo
sDesc = fe.lspErrorDescripcion
If sCod = "550" Then
' Codigo 550 NO es bloqueante: ARCA otorgo CAE valido, solo fallo la generacion sincrona de PDF.
' Guardar el CAE y reintentar descarga con lspconsultarLiquidacionPorNroComprobante.
Debug.Print " [AVISO NO BLOQUEANTE 550] " & sDesc
Else
Debug.Print " [ERROR " & sCod & "] " & sDesc
End If
Next i
End Sub
Private Sub LeerRespuestaLiquidacionPecuaria(ByVal fe As Object, ByVal sMetodo As String)
Dim sCAE As String
Dim nCant As Long, nSubCant As Long
Dim i As Long, j As Long
sCAE = fe.lspLeerPropiedad(sMetodo, "cabecera.cae", "", 0, 0)
Debug.Print "=== RESPUESTA " & sMetodo & " ==="
Debug.Print " codOperacion : " & fe.lspLeerPropiedad(sMetodo, "cabecera.codOperacion", "", 0, 0)
Debug.Print " CAE : " & sCAE
Debug.Print " fechaVencimiento : " & fe.lspLeerPropiedad(sMetodo, "cabecera.fechaVencimientoCae", "", 0, 0)
Debug.Print " fechaProcesoAFIP : " & fe.lspLeerPropiedad(sMetodo, "cabecera.fechaProcesoAFIP", "", 0, 0)
Debug.Print " Servidor / Fecha : " & fe.lspLeerPropiedad(sMetodo, "metadata.servidor", "", 0, 0) & " | " & _
fe.lspLeerPropiedad(sMetodo, "metadata.fechaHora", "", 0, 0)
' Bloque ajuste (presente cuando la liquidacion es un ajuste)
If fe.lspLeerPropiedad(sMetodo, "ajuste.tipoAjuste", "", 0, 0) <> "" Then
Debug.Print " Ajuste : Tipo=" & fe.lspLeerPropiedad(sMetodo, "ajuste.tipoAjuste", "", 0, 0) & _
" | Modo=" & fe.lspLeerPropiedad(sMetodo, "ajuste.modoAjuste", "", 0, 0) & _
" | Orig=" & fe.lspLeerPropiedad(sMetodo, "ajuste.comprobanteAjustado.tipoComprobante", "", 0, 0) & "-" & _
fe.lspLeerPropiedad(sMetodo, "ajuste.comprobanteAjustado.puntoVenta", "", 0, 0) & "-" & _
fe.lspLeerPropiedad(sMetodo, "ajuste.comprobanteAjustado.nroComprobante", "", 0, 0)
End If
' Emisor y Receptor
Debug.Print " Emisor : " & fe.lspLeerPropiedad(sMetodo, "emisor.razonSocial", "", 0, 0) & _
" | IVA=" & fe.lspLeerPropiedad(sMetodo, "emisor.situacionIVA", "", 0, 0) & _
" | PtoVta=" & fe.lspLeerPropiedad(sMetodo, "emisor.puntoVenta", "", 0, 0) & _
" | Cbte=" & fe.lspLeerPropiedad(sMetodo, "emisor.tipoComprobante", "", 0, 0) & "-" & _
fe.lspLeerPropiedad(sMetodo, "emisor.nroComprobante", "", 0, 0)
Debug.Print " Receptor : " & fe.lspLeerPropiedad(sMetodo, "receptor.cuit", "", 0, 0) & " - " & _
fe.lspLeerPropiedad(sMetodo, "receptor.nombre", "", 0, 0) & _
" | IVA=" & fe.lspLeerPropiedad(sMetodo, "receptor.situacionIVA", "", 0, 0)
' Frigorifico (si aplica)
If fe.lspLeerPropiedad(sMetodo, "datosLiquidacion.frigorifico.cuit", "", 0, 0) <> "" Then
Debug.Print " Frigorifico : " & fe.lspLeerPropiedad(sMetodo, "datosLiquidacion.frigorifico.cuit", "", 0, 0) & _
" - " & fe.lspLeerPropiedad(sMetodo, "datosLiquidacion.frigorifico.razonSocial", "", 0, 0) & _
" (Planta " & fe.lspLeerPropiedad(sMetodo, "datosLiquidacion.frigorifico.nroPlanta", "", 0, 0) & ")"
End If
' DTE, Guias y Remitos
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "dte.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " DTE #" & CStr(i) & ": " & fe.lspLeerPropiedad(sMetodo, "dte.nroDTE", "", CInt(i), 0) & _
" | Renspa=" & fe.lspLeerPropiedad(sMetodo, "dte.nroRenspa", "", CInt(i), 0)
Next i
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "guia.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " Guia #" & CStr(i) & ": " & fe.lspLeerPropiedad(sMetodo, "guia.nroGuia", "", CInt(i), 0)
Next i
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "remito.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " Remito #" & CStr(i) & ": " & fe.lspLeerPropiedad(sMetodo, "remito.nroRemito", "", CInt(i), 0)
Next i
' Items y calculos devueltos por ARCA
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " Item nro=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.nroItem", "", CInt(i), 0) & _
" | Cat=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.codCategoria", "", CInt(i), 0) & _
" | UM=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.unidadMedida", "", CInt(i), 0) & _
" | Cant=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.cantidad", "", CInt(i), 0) & _
" | Bruto=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.importeBruto", "", CInt(i), 0) & _
" | IVA=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.importeIVA", "", CInt(i), 0) & _
" | Rinde=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.rinde", "", CInt(i), 0) & _
" | Total=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.importeTotal", "", CInt(i), 0)
nSubCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.liquidacionCompraAsociada.itemcantidad", "", CInt(i), 0)))
For j = 0 To nSubCant - 1
Debug.Print " CompraAsoc #" & CStr(j) & ": " & _
fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.liquidacionCompraAsociada.tipoComprobante", "", CInt(i), CInt(j)) & "-" & _
fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.liquidacionCompraAsociada.puntoVenta", "", CInt(i), CInt(j)) & "-" & _
fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.liquidacionCompraAsociada.nroComprobante", "", CInt(i), CInt(j)) & _
" Cant=" & fe.lspLeerPropiedad(sMetodo, "itemDetalleLiquidacion.liquidacionCompraAsociada.cantidadAsociada", "", CInt(i), CInt(j))
Next j
Next i
' Gastos y Tributos
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "gasto.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " Gasto #" & CStr(i) & ": Cod=" & fe.lspLeerPropiedad(sMetodo, "gasto.codGasto", "", CInt(i), 0) & _
" | Imp=" & fe.lspLeerPropiedad(sMetodo, "gasto.importe", "", CInt(i), 0) & _
" | IVA=" & fe.lspLeerPropiedad(sMetodo, "gasto.importeIVA", "", CInt(i), 0)
Next i
nCant = CLng(Val(fe.lspLeerPropiedad(sMetodo, "tributo.itemcantidad", "", 0, 0)))
For i = 0 To nCant - 1
Debug.Print " Tributo #" & CStr(i) & ": Cod=" & fe.lspLeerPropiedad(sMetodo, "tributo.codTributo", "", CInt(i), 0) & _
" | Imp=" & fe.lspLeerPropiedad(sMetodo, "tributo.importe", "", CInt(i), 0)
Next i
' Resumen de Totales
Debug.Print " Totales : Bruto=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeBruto", "", 0, 0) & _
" | IVABruto=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeIVASobreBruto", "", 0, 0) & _
" | Gastos=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeTotalGastos", "", 0, 0) & _
" | IVAGastos=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeIVASobreGastos", "", 0, 0) & _
" | Tributos=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeTotalTributos", "", 0, 0) & _
" | NETO=" & fe.lspLeerPropiedad(sMetodo, "resumenTotales.importeTotalNeto", "", 0, 0)
End Sub