Options

Invoice page break

GDGD Member Posts: 49
goodmorning to everybody,

i am experiencing a problem with a new custom invoice report for a customer.

i have to print a specific number of sales lines in each page and then to do a page break and continue print in another page.

Until now i put :

1) Sales Invoice Line -OnAfterGetRecord:

IF LinesPrinted >= 20 THEN BEGIN
CurrReport.NEWPAGE;
LinesPrinted := 0;


2) Sales invoice line - OnPostSection
LinesPrinted := LinesPrinted + 1;

3) i create a new section called LinesPrintedLoop and in PostSection i put the following:

WHILE LinesPrinted <= 19 DO BEGIN
CurrReport.SHOWOUTPUT := TRUE;
LinesPrinted := LinesPrinted + 1;
END;

the page break seems to go ok BUT in the second page the header infos does not printed again. (ie the properties of Header section "PrintOnEveryPage=Yes")

](*,) do you have any idea?

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,090
    GD wrote:
    3) i create a new section called LinesPrintedLoop and in PostSection i put the following:

    WHILE LinesPrinted <= 19 DO BEGIN
    CurrReport.SHOWOUTPUT := TRUE;
    LinesPrinted := LinesPrinted + 1;
    END;
    I fail to see the use of this.

    A possible solution: put an DataItem indented under the Sales line of type integer. Put a filter so it runs only once. Iin the "OnPreDataItem()" or "OnAfterGetRecord()" you can do something like this:
    intLinesPrinted := intLinesPrinted + 1;
    IF IntLinesPrinted = 20 then BEGIN
      IF NotLastSalesLinePrinted() THEN BEGIN
         CurrReport.NEWPAGE;
         intLinesPrinted := 0;
      END;
    END;
    
    "NotLastSalesLinePrinted()" : in this you have to check if you just printed the last line. In this case it is not necessary to do a NEWPAGE.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    GDGD Member Posts: 49
    sorry, kriki..

    as i understood i will delete all the previous commands!!!

    i am new in development and i have been confused.

    the "NotLastSalesLinePrinted()" is also an integer:

    and the filter you mentioned how i put it the dataItem properties:

    :oops: gd
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    There is nothing wrong with being new to Navision. Just post your questions and we will try to answer them. 8)

    You will be answering others people questions before you know. :D
  • Options
    GDGD Member Posts: 49
    thanks a lot Mark,

    As you read before, i am trying to print a specific amount of sales lines in each page of the invoice but goes a quite rong ....

    seems that does not work at all
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Problem is, I am not realy in the reporting thing but I can try to help you.

    First I need to clarify some things:

    Have you made a new invoice or have you created a copy of report 206?

    I understand the NEWPAGE thing works, or am I wrong?

    So the problem is only the printing of the header on the 2nd and following pages?

    I hope I've understand this correctly.
  • Options
    GDGD Member Posts: 49
    yes is a copy from 206

    no the NewPage does not work at all ...

    and yes the header in the following pages does not be printed

    i tried to follow the example of Kriki
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    If I put this
    LinesPrinted := LinesPrinted + 1;
    IF LinesPrinted = 5 THEN BEGIN
      CurrReport.NEWPAGE; 
       LinesPrinted := 0;
    END;
    

    in the "Sales Invoice Line" dataitem of a standard 206 invoice it works fine.

    Could you please test this also in a non-modified 206 invoice?

    I put in the 5 to test with a smaller invoice...
  • Options
    GDGD Member Posts: 49
    goes ok....with the page break but

    because i have a total footer with a property "place in Bottom"...

    when i print 4 sales lines (ie LinesPrinted=5 PageBreak), the footer goes to the second page at the bottom without any header at the top of the 2 page.

    there is enough space to be printed in the first page.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    As I mentioned I am not very much into the reporting thing in Navision, so I also have to try everything myself too.

    Have you tried searching on "NEWPAGE".

    There are some topics which discuss your problem.
  • Options
    GDGD Member Posts: 49
    THANKS
Sign In or Register to comment.