Empty page in report.

A question about Financials 2.60a Standard Version. If you book a Sales invoice that has from 14 till 27 lines and print it, you’ll always have 2 pages. The problem is that the second page only has the header of the invoice and no lines. That means that the second page is useless. Does anybody have a solution for this problem?

I had to solve this problems last month for Invoices and shipment-reports. There is no “official” way to do it, it requires quite a bit of programming: Step 1: Determine the number of lines which fit on one page (e.g. LinesPerPage=25) Step 2: You need some pre-processing to count the numbers of sales-lines which will be printed for the whole invoice (e.g. LinesTotal=78) Step 3: If you divide LinesTotal / LinesPerPage you will see, that you have 3 full pages and a 4th page with only three lines. If you decide that you want to have a minimum of 8 lines per page, you have to subtract 1 from LinesPerPage until this condition is met:


IF TotalLines > LinesPerPage THEN
  WHILE (TotalLines MOD LinesPerPage) < 8 DO
    LinesPerPage -= 1;

Note that the IF in the first line is very important. It handles the situation where you might print a report with totally less than 25 Records! Step 4: Have an internal line-counter which is being reset whenever a an old page ends (NOT when new page starts! See step 6). The counter is incremented whenever ShowOutput is TRUE in a line-printing section. Step 5: Add a Line-Group-Footer which issues a NEWPAGE and resets the linecounter whenever

ActLine > LinesPerPage

Step 6: In Invoices you typically have the situation that the first page can hold less line-records than all the following pages as head-information have to be printed. Let’s say, the first page can only hold 17 records while the following lines can hold 25 lines. In this case you simply set ActLine := 8 on Header.OnAfterGetRecord and you will get clean page breaks and equally filled pages. Hope this helps With best regards from Switzerland Marcus Fabian

Marcus, This is a very neat way to handle this issue. Do you have any good hints on how best to do the preprocssing to count the number of Invoice lines to be printed (LinesTotal)? Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner

I am new in this, but already faced with an issue like this. The description by Marcus leaves some question marks for me (lets take the invoice report as an example) : - step2 : pre-processing : counting how many records will be printed, … before they are printed ? Is this is a special seperate select of sales invoice lines, before the report is issued (eg on predataitem) ? - the piece of code in step 3 is not clear for me. The totallines variable is the linestotalvariable from step 1 I guess. But where would you put this code ? Thanks for helping, Gunther … Belgium.

Dave, You are right - that is a pretty cool way to handle this!! With regards to your question on how to calc the number of sales invoice lines…I would probably create a second sales line global (mSalesLine2), set the range to the invoice number, initialize the counter variable to zero, do a “find” on the first mSalesLine2 and then Repeat Count := Count + 1; Until mSalesLine2.Next = 0; You’re a better programmer than I am though so you can probably look at this and come up with a slightly more elegant solution. Later, Mark.