WSLSP ejemplo operativo

Este ejemplo operativo para el WSLSP de liquidación pecuaria muestra como cargar campos para autorizar un liquidación y obtener el CAE. para ejecutar el ejemplo:

Debe usarse el instalador 41.60 o superior.

en el PDF de AFIP figuran los diferentes datos de prueba.

En el ejemplo usar datos concretos. Se han comentado (REM) los campos que no deben cargarse para esta liquidación en particular.

Ver más detalles en el apartado como usar.

Dim fe As New WSAFIPFE.Factura

Dim bresultado As Boolean

If fe.iniciar(0, "cuit", "cuit.pfx", "") Then

REM fe.forzarCertificadoSSL(true)

REM esta linea puede ser necesaria si se recibe el error "no se pudo establecer una conex.." aun despues de seguir los pasos de la guia para este REM error https://sites.google.com/site/facturaelectronicax/Home/solucion-de-problemas

fe.ArchivoXMLEnviado = "d:\lspenvio.xml"

fe.ArchivoXMLRecibido = "d:\lsprecibo.xml"

fe.lspPDF = "d:\liquidacion.pdf"

fe.ArchivoCertificadoPassword = ""

If fe.lspObtenerTicketAcceso() Then

bresultado = fe.lspCargarPropiedad("limpiar", "", 0, 0)

bresultado = fe.lspCargarPropiedad("codoperacion", "4", 0, 0)

bresultado = fe.lspCargarPropiedad("datosAdicionales", " ", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.codLocalidadDestino", "6262", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.codLocalidadProcedencia", "6262", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.codMotivo", "2", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.codProvinciaProcedencia", "3", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.codProvinciaDestino", "3", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaOperacion", "20170122", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaComprobante", "20170122", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaFaena", "20170122", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaFaenaNO", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaRecepcion", "20170122", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.fechaRecepcionNO", "v", 0, 0)

REM bresultado = fe.lspCargarPropiedad("datosLiquidacion.frigorifico.cuit", "20160000261", 0, 0)

REM bresultado = fe.lspCargarPropiedad("datosLiquidacion.frigorifico.nroPlanta", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("datosLiquidacion.lugarRealizacion", "zona rural", 0, 0)

bresultado = fe.lspCargarPropiedad("dte.itemcantidad", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("dte.nroDTE", "443-1", 0, 0)

REM bresultado = fe.lspCargarPropiedad("dte.nroRenspa", "22.123.1.12345/45", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.codCaracter", "5", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.fechaInicioActividades", "20160101", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.iibb", "123456789", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.nroComprobante", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.cuitAutorizado", "0", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.cuitAutorizadoNO", "V", 0, 0)

REM bresultado = fe.lspCargarPropiedad("emisor.nroRenspa", "22.123.1.12345/45", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.nroRUCA", "305", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.nroRUCANO", "F", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.puntoVenta", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("emisor.tipoComprobante", "185", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.itemcantidad", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.alicuota", "3", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.alicuotaNo", "f", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.alicuotaiva", "10.50", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.alicuotaivaNo", "f", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.baseImponible", "230520.6", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.baseImponibleNo", "F", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.codGasto", "16", 0, 0)

REM bresultado = fe.lspCargarPropiedad("gasto.descripcion", "felete", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.importe", "10", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.importeNo", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.tipoivanulo", "NG", 0, 0)

bresultado = fe.lspCargarPropiedad("gasto.tipoivanuloNO", "T", 0, 0)

bresultado = fe.lspCargarPropiedad("guia.itemCantidad", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("guia.nroGuia", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.itemcantidad", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.alicuotaIVA", "21", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.alicuotaIVANo", "F", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidad", "40", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadCabezas", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadCabezasNo", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadKgVivo", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadKgVivoNo", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.codCategoria", "51020102", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.codCorte", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.codCorteNo", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.codRaza", "1", 0, 0)

REM bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.raza.detalle", " ", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cuitCliente", "20160000261", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cuitClienteNo", "f", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.nroTropa", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.nroTropaNO", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.precioRecupero", "1.50", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.precioRecuperoNo", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.precioUnitario", "10", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.tipoliquidacion", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadPorCorte", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.cantidadPorCorteNO", "F", 0, 0)

bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.itemcantidad", "0", 0, 0)

REM bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.cantidadasociada", "1", 0, 0)

REM bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.nrocomprobante", "1", 0, 0)

REM bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.puntoventa", "1", 0, 0)

REM bresultado = fe.lspCargarPropiedad("itemDetalleLiquidacion.liquidacionCompraAsociada.tipocomprobante", "183", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.codCaracter", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.cuit", "20160000148", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.cuitAutorizado", "20160000148", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.cuitAutorizadoNo", "v", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.iibb", "64564", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.nroRenspa", "22.123.1.12345/45", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.nroRUCA", "23564564", 0, 0)

bresultado = fe.lspCargarPropiedad("receptor.operador.nroRUCANO", "V", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.itemcantidad", "1", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.alicuota", "5", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.alicuotaNo", "F", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.baseImponible", "10000", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.baseImponibleNo", "f", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.codTributo", "5", 0, 0)

REM bresultado = fe.lspCargarPropiedad("tributo.descripcion", "prueba", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.importe", "5", 0, 0)

bresultado = fe.lspCargarPropiedad("tributo.importeNo", "V", 0, 0)

If fe.UltimoMensajeError = "" Then

bresultado = fe.lspGenerarLiquidacion()

If fe.UltimoMensajeError = "" And fe.lspErrorDescripcion1 = "" Then

MsgBox("CAE " + fe.lspLeerPropiedad("lspgenerarliquidacion", "encabezado.cae", "", 0, 0))

MsgBox("barras " + fe.lspLeerPropiedad("lspgenerarliquidacion", "encabezado.nroCodigoBarras", "", 0, 0))

Else

MsgBox("error general" + fe.UltimoMensajeError)

MsgBox("error servidor " + fe.lspErrorDescripcion1)

End If

Else

MsgBox("error al cargar propiedad " + fe.UltimoMensajeError)

End If

Else

MsgBox("fallo acceso " + fe.UltimoMensajeError)

End If

Else

MsgBox("fallo iniciar " + fe.UltimoMensajeError)

End If