hejingsong
17th November 2004, 17:10
I print a report.I need sum amount in every page.so i add foodter in report layout.but last purchase order line always reprint.Attach file is script.How can i delete reprint order line!


|*get po line information
|=========================
select tdpur401.*
from tdpur401
where tdpur401._index1 = {:tdpur400.orno }
and tdpur401.sqnb = 0
and tdpur401.clyn <> tcyesno.yes
order by tdpur401._index1
selectdo
po.position = tdpur401.pono
po.item = tdpur401.item
po.item.dsca = get.item.dsca(tdpur401.item)
po.unit = tdpur401.cuqp
dt.string = sprintf$("%u002",tdpur401.rdta)
po.req.dt = dt.string(5;4) & dt.string(3;2) & dt.string(1;2)
po.qty = tdpur401.oqua
po.price = tdpur401.pric
po.amnunt = tdpur401.oqua * tdpur401.pric

total.page.amount=total.page.amount + po.amnunt
total.all.amount =total.all.amount + po.amnunt
row.count = row.count + 1
if row.count = 10 then
print.amount=total.page.amount
amount.dsca = "PAGE TOTAL : "
amount.eng.dsca = convert.amount.to.word(po.currency.dsca,rpt.curr.ifx,total.page.amount)
rprt_send()
total.page.amount=0
row.count = 0
else
rprt_send()
endif
selecteos
print.amount=total.all.amount
amount.dsca = "GRAND TOTAL :"
amount.eng.dsca = convert.amount.to.word(po.currency.dsca,rpt.curr.ifx,total.all.amount)
rprt_send()
endselect

rdbailey
19th November 2004, 23:03
I have had issues like this in the past where it wasn't actually the code causing the problem, but the report layout.

If you ensure the report layout is not using standard baan fields (i.e. tdpur401.orno) you may have better luck. We just create variables in the script, dump the values into them and the report layout points to the variables (instead of the actual field names). Also make sure you are NOT using any of the aggregate functions for totalling etc... as they seem to trigger the same behaviour.

It appears to have something to do with the way Baan handles break-points that sends that extra line. This even happened to us at the beginning of the report in some cases, but by writing all the totalling and columns ourselves, the problems disappeared.

I hope this helps.

tjbyfield
20th November 2004, 00:36
A simple approach may be to do let baan do most of the work in a report-script.

The page_total field could be reset a "Header" section and to either updated in a "Detail" section or let baan do that automatically with the "total" agrgate function.

The report script need only be a few line of code and the program script could then be simplified.

Terry

hejingsong
20th November 2004, 12:32
Now,i can not think out good solution.So.i get repeat po order position first.when send to report ,skip this position.Can anybody give better solution?

tjbyfield
22nd November 2004, 00:16
I think it would be much more simple to use a very simple 4GL script and standard report features augmented with a few lines of report script as mentioned in earlier post.
For example 4GL script:

|*get po line information
|=========================
select tdpur401.*, tiitm001.dsca
from tdpur401, tiitm001
where tdpur401._index1 = {:tdpur400.orno }
and tdpur401.sqnb = 0
and tdpur401.clyn <> tcyesno.yes
and tdpur401.item refers to tiitm001 unref clear
order by tdpur401._index1
selectdo
rprt_send()
endselect

(note I am not familiar with tdpur400/401 but have asumed item number will be 'item')

Terry