Kevin_Rell
18th February 2002, 23:06
I am working on a custom Sales Invoice report for Baan IVc4. One of the requirements is that the text for the order and the lines prints on a separate page.
Invoice #
Order Data
Line Data
Line Data
Invoice Totals
--- new page ---
Invoice #
Order Text
Line Text
Line Text
I cannot decide if it is better to make a separate report or just do something fancy with report layouts. Either way, I can't figure out how to do it. Can anyone help???
evesely
19th February 2002, 15:53
I would use the same report. Adding another just complicates things.
I'm guessing that you are working with the standard program script and you can't/don't want to change it. So, my suggestion is to use an array to capture the line text numbers.
As you go through the detail lines in your report script, if the text number is non-zero, add it to a new array that you create in your report. Then, in one after.field layout for the invoice, print the order text. In a second after.field layout, loop through the array printing the line texts you stored. This can be done using the layout.again() function.
If your process allows multiple orders on the same invoice, then you can either add another array for order texts or populate them in the same array as the line texts -- it just depends on how you want to lay them out.
Kevin_Rell
20th February 2002, 21:39
That sounds like a good idea. I can handle populating the array with the text numbers but I'm a little fuzzy on the printing part. Can you give me a few more details on how to get the data to print as part of the after.field layout?
I'm familiar with doing a rprt_send() in the program script to print a detail line but I am not familiar with printing from within the report script.
Thanks
evesely
21st February 2002, 16:05
You should place a text field (e.g., my.text) in the actual layout. Define this as an extern in the report script declaration (e.g., extern domain tctxtn my.text). Then, in the before.layout subsection in your script, set my.text = text.array(n). Of course, you need to initialize n at some point and use the after.layout subsection to increment n and decide when to exit the loop. There is no need to "send" the data to the report; my.text is simply evaluated and processed when the layout is printed.
I hope that helps.