*** Le coloco los campos adicionales: Días, Banco, Nro transacción y Fecha del Despacho
SET DATE TO DMY
SET STRICTDATE TO 0
SELECT vreportes
i = 1
SCAN
lnSaldo = vreportes.saldo
lnStatus = vreportes.status
IF lnSaldo > 0
lnFact_num = vreportes.fact_num
sql = "select n.fact_num "
sql = sql + "from reng_ndd r inner join not_dep n on "
sql = sql + "r.fact_num = n.fact_num "
sql = sql + "where r.tipo_doc = 'F' and "
sql = sql + "r.num_doc = ?lnFact_num and "
sql = sql + "n.anulada = 0"
tresult = SQLEXEC(tconnect, sql, 'cNota_dpp')
*BROWSE
lnNotaDesp = cNota_dpp.fact_num
sql = "select fec_emis from not_dep where fact_num = ?lnNotaDesp"
tresult = SQLEXEC(tconnect, sql, 'cNotaDesp')
*BROWSE
ldFechaDesp = cNotaDesp.fec_emis
ldHoy = DATETIME()
lnDias = ldHoy - ldFechaDesp
lcDias = ALLTRIM(STR(lnDias))
IF i < 30
MESSAGEBOX("ldHoy: " + DTOC(ldHoy))
MESSAGEBOX("ldFechaDesp: " + DTOC(ldFechaDesp))
MESSAGEBOX("lcDias: " + lcDias)
ENDIF
ENDIF
i = i + 1
ENDSCAN