Ejemplo WSSEG Visual FoxPro

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 separador", "aqui ruta del certificado *.pfx", "")

IF lResultado

lResultado = thisform.fe.sObtenerTicketAcceso()

IF lResultado

thisform.fe.sTipo_Doc = 80

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

thisform.fe.sTipo_cbte = 1

thisform.fe.sPunto_vta = 2

thisform.fe.sImp_total = 121

thisform.fe.sImp_neto = 100

thisform.fe.simpto_liq = 0

thisform.fe.simpto_liq_rni = 0

thisform.fe.simp_op_ex = 0

thisform.fe.sImp_perc = 0

thisform.fe.sImp_iibb = 0

thisform.fe.sImp_internos = 0

thisform.fe.sImp_moneda_id = 1

thisform.fe.sImp_moneda_ctz = 1

thisform.fe.sImp_otrib_prov = 0

thisform.fe.sFecha_cbte = "20091013"


thisform.fe.sItemCantidad = 1

thisform.fe.sIndiceItem = 0

thisform.fe.sITEMpoliza = "seguro auto"

thisform.fe.sITEMendoso = "endoso 1"

thisform.fe.sITEMds = "auto 1"

thisform.fe.sITEMprecio_uni = 100

thisform.fe.sITEMqty = 1

thisform.fe.sITEMIva_id = 1

thisform.fe.sITEMimp_total = 100

thisform.fe.sITEMimp_bonif = 0

thisform.fe.sITEMimp_valor_aseg = 1000

thisform.fe.sITEMimp_moneda_vaseg = "PES"

If thisform.fe.sRegistrar(3, 1, "1") Then

messagebox("CAE: " + thisform.fe.sRespuestaCAE + Chr(10) + "REPROCESO " + thisform.fe.sRespuestaReproceso+CHR(10)+"Evento "+thisform.fe.seventMsg+CHR(10)+"Observacion: "+thisform.fe.sRespuestaOBS)

Else

messagebox("ERROR " + thisform.fe.serrmsg + Chr(10) + "OBS: " + thisform.fe.srespuestaOBS + Chr(10) + "ERROR " + thisform.fe.sRespuestaOBS + Chr(10) + thisform.fe.serrmsg + "ERROR "+Chr(10) + thisform.fe.ultimoMensajeError+CHR(10)+"Reproceso: "+thisform.fe.sRespuestaReproceso)

ENDIF

ELSE

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

ENDIF

ELSE

MESSAGEBOX("Control no iniciado")

ENDIF