Ejemplo Fox Pro II

Para usar el control ActiveX en Visual FoxPro:

En Herramientas Opciones Controles Agregar el control WSAFIPFE.

Insertar el control WSAFIPFE a un fomulario (ver en la documentación de FoxPro todo lo referente a la propiedad AutoYield). Cambiar la propiedad "name" a "FE".

En el evento click de un control tipo botón insertar el siguiente código:

lLOCAL lResultado as Boolean

lResultado = thisform.fe.iniciar(0, "aqui cuit de certificado sin separado", "aqui ruta del certificado *.pfx", "")

IF lResultado

lResultado = thisform.fe.bObtenerTicketAcceso()

IF lResultado

thisform.fe.bTipo_Doc = 80

thisform.fe.bNro_doc = "aqui cuit del cliente sin separadores"

thisform.fe.bTipo_cbte = 1

thisform.fe.bPunto_vta = 2

thisform.fe.bImp_total = 121

thisform.fe.bImp_neto = 100

thisform.fe.bimpto_liq = 0

thisform.fe.bimpto_liq_rni = 0

thisform.fe.bimp_op_ex = 0

thisform.fe.bImp_perc = 0

thisform.fe.bImp_iibb = 0

thisform.fe.bImp_internos = 0

thisform.fe.bImp_moneda_id = 1

thisform.fe.bImp_moneda_ctz = 1

thisform.fe.bFecha_cbte = "20090608"

thisform.fe.bZona = 1


thisform.fe.bItemCantidad = 1

thisform.fe.bIndiceItem = 0

thisform.fe.bITEMpro_codigo_sec = "0"

thisform.fe.bITEMpro_codigo_ncm = "7308.10.00"

thisform.fe.bITEMpro_ds = "articulo"

thisform.fe.bITEMpro_precio_uni = 100

thisform.fe.bITEMpro_qty = 1

thisform.fe.bITEMpro_umed = 7

thisform.fe.bITEMIva_id = 1

thisform.fe.bITEMimp_total = 100

thisform.fe.bITEMimp_bonif = 0

If thisform.fe.bRegistrar(2, 1, "1") Then

messagebox("CAE: " + thisform.fe.bRespuestaCAE + Chr(10) + "REPROCESO " + thisform.fe.bRespuestaReproceso+CHR(10)+"Evento "+thisform.fe.beventMsg+CHR(10)+"Observacion: "+thisform.fe.bRespuestaOBS)

Else

messagebox("ERROR " + thisform.fe.berrmsg + Chr(10) + "OBS: " + thisform.fe.brespuestaOBS + Chr(10) + "ERROR " + thisform.fe.bRespuestaOBS + Chr(10) + thisform.fe.berrmsg + "ERROR "+Chr(10) + thisform.fe.ultimoMensajeError+CHR(10)+"Reproceso: "+thisform.fe.bRespuestaReproceso)

ENDIF

ELSE

MESSAGEBOX("Fallo al obtener ticket acceso: "+CHR(10)+thisform.fe.ultimoMensajeError)

ENDIF

ELSE

MESSAGEBOX("Control no iniciado")

ENDIF