WSCPE consultar ultimo numero

REM consultarUltNroOrden instalador 99 o superior

Dim fe As New WSAFIPFE.Factura

Dim cNumero as string

cNumero = ""

If fe.iniciar(0, "cuit", "certificado pfx tramitado en AFIP", "") Then

REM ATENCION, ejecutar este método necesario para que la interfaz capture el trafico hacia y desde el servidor antes que el sistema operativo.

REM servidor WS CPE usa un formato incompatible y debe ser transformado para operar normalmente.

If fe.registrarTrafico(True) Then

Else

MsgBox("error capturar trafico " + fe.UltimoMensajeError)

End If

REM fe.cpeversion = 0 / fe.cpeversion = 1

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

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

fe.ArchivoCertificadoPassword = ""

If fe.cpeObtenerTicketAcceso() Then

If bresultado Then

REM cNumero = fe.cpeconsultarUltNroOrden2S(tipocomprobante, puntoventa, cCuitSolicitante)

REM la versión2 es equivalente pero pide además el cuit solicitante del que se quiere recuperar el último numero

cNumero = fe.cpeconsultarUltNroOrdenS(tipocomprobante, puntoventa)

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

MsgBox("ultimo número autorizado " + cNumero)

Else

MsgBox("error leer" + fe.UltimoMensajeError)

MsgBox("error ller servidor " + fe.cpeErrorDescripcion1)

End If

Else

MsgBox("fallo cargar propiedad " + fe.UltimoMensajeError)

End If

Else

MsgBox("fallo acceso " + fe.UltimoMensajeError)

End If

Else

MsgBox("fallo iniciar " + fe.UltimoMensajeError)

End If