gget79
29th September 2007, 01:53
Hola a todos:
Alguien me puede proporcionar ayuda en este tema:
Estoy utilizando brp.ready() para enviar los datos a un reporte, existen circunstancias en los que no se envían los datos al dispositivo, para realizar un seguimiento puse un log que me permita saber si el programa estaba pasando por la instrucción brp.ready() y en efecto el dato esta llegando hasta allí con los datos correctos, pero pasa algo cuando entra en esa función (brp.ready()), no se si me quiera decir algo esto, pero cuando compilo el programa aparece un warning indicando que se esta descartando el valor de la función devuelto por send.wait() (while expanding macro 'brp.ready'), alguien sabe que puedo hacer ????????????:D

Felipe_Saavedra
3rd October 2007, 12:52
La instruccion brp.ready(id from brp.open) no regresa un valor.

verifica que cada vez la funcion brp.open te esta regresando un valor positivo

>0 an ID for the activated report
0 report could not be activated
-1 spooler could not be opened

Si colocas tu codigo puede ser mas facil ver si algo le falta.

Saludos,

Felipe

gget79
3rd October 2007, 16:57
Hola Felipe

Muchas gracias por tu ayuda, te adjunto el código en virtud de que puedas revisarlo y agregar tus comentarios.

declaration:

table ttfret020 | Historico de Retenciones en la Fuente
table ttfret401
table ttfret415
table ttfret402
table ttfacp200
table ttfgld005
table ttfgld018

table ttfgld011 |Tipos de Transacción

table ttfret450

extern domain tfgld.prod prod.f
extern domain tfgld.prod prod.t
extern domain tccom.bpid suno.f fixed
extern domain tccom.bpid suno.t fixed
extern domain tfgld.ttyp d102.f fixed
extern domain tfgld.ttyp d102.t fixed
extern domain tfgld.docn e102.f
extern domain tfgld.docn e102.t
extern domain tfgld.year r_anio
extern domain tccom.bpid aux.suno
extern domain tfgld.ttyp aux.d102
extern domain tfgld.docn aux.e102
extern domain tfacp.sern.c secue.f

extern domain tfgld.seri numero.serie
extern domain tcmcs.str8 aux.serie

extern domain tfgld.date fecha.actual

extern domain tcmcs.str50 nombre.archivo
extern domain tcmcs.str300m registro.bi
extern domain tcmcs.long val1, val2

long spooler

extern domain tfgld.user user


|****************************** form section **********************************

form.1:
init.form:
get.screen.defaults()

|****************************** choice section ********************************

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
before.choice:
spool.pr.copies = 1
spool.preview = FALSE

on.choice:
user = logname$
select tfret450.*
from tfret450
where tfret450._index1 = {:user}
selectdo
endselect
spooler = spool.open("","",1)
if spooler then
spool.close()
spool.pr.copies = 1
if tfret450.perm = tcyesno.yes then
spool.preview = true
else
spool.preview = FALSE
endif
spooler = brp.open( spool.report, spool.device, 0 )
if spooler then
read.main.table()
brp.close(spooler)
spool.close()
else
choice.again()
endif
else
choice.again()
endif

|****************************** field section *********************************

field.suno.f:
when.field.changes:
suno.t = suno.f

field.d102.f:
when.field.changes:
d102.t = d102.f

field.e102.f:
before.zoom:
tfgld018.ttyp=d102.f
tfgld018.docn=e102.f
when.field.changes:
e102.t = e102.f

field.e102.t:
before.zoom:
tfgld018.ttyp=d102.t
tfgld018.docn=e102.t


field.prod.f:
before.zoom:
tfgld005.ptyp = tfgld.ptyp.financial
tfgld005.year = r_anio
tfgld005.prno = prod.f

when.field.changes:
prod.t = prod.f

field.prod.t:
before.zoom:
tfgld005.ptyp = tfgld.ptyp.financial
tfgld005.year = r_anio
tfgld005.prno = prod.f

|****************************** function section ******************************

functions:

function read.main.table()
{
long sw
sw = 0
nombre.archivo = bse.tmp.dir$() & "/get/ret" & str$(logname$) & str$(utc.num()) & ".txt"
fecha.actual = date.num()
aux.suno=""
aux.d102=""
aux.e102=0
select tfret020.*
from tfret020
where (tfret020._index5 inrange {:suno.f, :d102.f, :e102.f}
and {:suno.t, :d102.t, :e102.t})
and tfret020.b102=:r_anio
and tfret020.simp=0
and tfret020.stat=tfret.stat.noimpreso
and tfret020.iret > 0
order by tfret020._index5
selectdo
select tfacp200.*
from tfacp200
where tfacp200._index1 = {:tfret020.d102, :tfret020.e102}
and tfacp200.tdoc = ""
and tfacp200.docn = 0
and tfacp200.lino = 0
and tfacp200.prod >= :prod.f
and tfacp200.prod <= :prod.t
as set with 1 rows
selectdo
select tfgld018.*
from tfgld018
where tfgld018._index1 = {:tfacp200.ttyp, :tfacp200.ninv}
and tfgld018.trun <> 0
selectdo
ver.numero.serie()
select tfret415.*
from tfret415
where tfret415._index1 = {:tfacp200.ttyp, :numero.serie}
and tfret415.rmoa = tcyesno.no
selectdo
select tfret401.*
from tfret401
where tfret401._index1 = {:tfret415.ptoe, :tfret415.ptof}
and tfret401.dval>=:fecha.actual
and tfret401.ultnu < tfret401.hast
as set with 1 rows
selectdo
if tfret020.suno = aux.suno and tfret020.d102 = aux.d102
and tfret020.e102 = aux.e102 then
actualiza.tfret020()
commit.transaction()
sw = 1
else
select tfret401.*
from tfret401 for update
where tfret401._index1 = {:tfret415.ptoe, :tfret415.ptof}
and tfret401.dval = :tfret401.dval
as set with 1 rows
selectdo
tfret401.ultnu = tfret401.ultnu + 1
actualiza.tfret020()
db.update(ttfret401, db.retry)
commit.transaction()
endselect

select tfret402.*
from tfret402 for update
where tfret402._index3 = {:tfacp200.ttyp, :tfacp200.ninv}
selectdo
selectempty
tfret402.ttyp=tfacp200.ttyp
tfret402.nume=tfret401.ultnu
tfret402.ncon=tfret401.ptoe&tfret401.ptof
tfret402.ncon=strip$(tfret402.ncon) & sprintf$("%@9999999@",tfret401.ultnu)
tfret402.ninv=tfacp200.ninv
tfret402.femi=utc.num()
actualiza.tfret020_fecha_emision()
db.insert(ttfret402, db.retry)
commit.transaction()
endselect
endif
aux.suno = tfret020.suno
aux.d102 = tfret020.d102
aux.e102 = tfret020.e102
tfret020.h102=0
if sw = 0 then
registro.bi = ""
spool.pr.copies = 1

if tfret450.perm = tcyesno.yes then
spool.preview = true
else

spool.preview = FALSE
endif
if spooler then
registro.bi = "|" & str$(tfret402.ncon) &
"|" & str$(tfacp200.ttyp) &
"|" & str$(tfret402.ninv) &
"|" & str$(tfret402.femi) &
"|" & logname$ &
"|" & "sw = 0"
escribe.bitacora()
val1 = 0
val1 = brp.ready(spooler)

registro.bi = "|" & str$(tfret402.ncon) &
"|" & str$(tfacp200.ttyp) &
"|" & str$(tfret402.ninv) &
"|" & str$(tfret402.femi) &
"|" & logname$ &
"|" & "sw = 0" &
"|" & str$(val1)
escribe.bitacora()
else
message("No se puede abrir la impresora")
endif
else
registro.bi = "|" & str$(tfret402.ncon) &
"|" & str$(tfacp200.ttyp) &
"|" & str$(tfret402.ninv) &
"|" & str$(tfret402.femi) &
"|" & logname$ &
"|" & "sw = 1"
escribe.bitacora()
val2 = 0
val2 = brp.ready(spooler)

registro.bi = "|" & str$(tfret402.ncon) &
"|" & str$(tfacp200.ttyp) &
"|" & str$(tfret402.ninv) &
"|" & str$(tfret402.femi) &
"|" & logname$ &
"|" & "sw = 1" &
"|" & str$(val2)
escribe.bitacora()
sw = 0
endif
endselect
endselect
endselect
endselect
endselect
}

function actualiza.tfret020()
{
select tfret020.usei, tfret020.simp, tfret020.stat
from tfret020 for update
where tfret020._index1={:tfret020.indi, :tfret020.cren, :tfret020.ultn}
selectdo
tfret020.stat=tfret.stat.impreso
tfret020.simp=tfret401.ultnu
tfret020.ncon=tfret401.ptoe&tfret401.ptof
tfret020.ncon=strip$(tfret020.ncon) & sprintf$("%@9999999@",tfret401.ultnu)
db.update(ttfret020, db.retry)
endselect
}

function actualiza.tfret020_fecha_emision()
{
select tfret020.femi
from tfret020 for update
where tfret020._index1={:tfret020.indi, :tfret020.cren, :tfret020.ultn}
selectdo
tfret020.femi=tfret402.femi
db.update(ttfret020, db.retry)
endselect
}


function ver.numero.serie()
{
select tfgld011.*
from tfgld011
where tfgld011._index1={:tfacp200.ttyp}
selectdo
if tfgld011.dsrs=0 then
numero.serie=0
else
aux.serie=str$(tfacp200.ninv)
numero.serie=val(aux.serie(1;tfgld011.dsrs))
endif
endselect
}


function escribe.bitacora()
{

long out.fp
long r_log
long err.close

out.fp = seq.open(strip$(nombre.archivo),"a+")
r_log = seq.puts(strip$(registro.bi),out.fp)
err.close = seq.close(out.fp)
}



Este es un programa que realiza impresiones de retenciones de impuesto a la renta.

En espera de tus comentarios me despido.


Saludos,

Gonzalo