Report Sections

david.weeksdavid.weeks Member Posts: 96
edited 2004-05-06 in Navision Attain
Hello All

I am working on printing a picking list that depends on the status of the shipping advice field within the sales header (partial or complete).

Once that has been determined for each order, I need to check against the reservation table and only show order lines that currently have reservations against them.

If the status is complete, all lines need to have reservations for the location within each sales line for the order. If any lines are not reserved, nothing should print.

If the status is partial, the picking list should only print those lines that have reservations.

Question is - where should i put this code?

I have tried to place it within OnAfterGetRecord but the link between Sales Header and Sales Line is acting strange.

Ideas?

Thanks

Comments

  • david.weeksdavid.weeks Member Posts: 96
    Hi All

    I have placed my code within OnPreDataItem of the Sales Line data item i.e. the data items:
    Sales Header
    Sales Line

    This I think is working, however for some reason, even if I comment out my code, when I run the report for all orders - the first order prints the first header twice and all subsequent body lines are not correct. If I print a single random order all is fine......

    Why am I getting the first record from sales header being printed twice, meaning that the sales line records are printing for the wrong headers?

    Ideas and is the right approach?

    Thanks
  • Tommy_SchouTommy_Schou Member Posts: 117
    I would create a report with the salesheader as the main dataitem. Indented under this I would put the salesline table. Be sure to link the two so you get the saleslines for a given salesheader only and not all the saleslines for each salesheader... hope that made sense :) Anyways. You have probably done this already! :)

    Now.. on the OnAfterGetRecord on the salesline you would put the code that determines whether there are reservations for the line or not. If there isn't you should issue the command: CurrReport.SKIP. This will skip the salesline and move on to the next one.

    The above should work as you wish......

    Now if you don't want the section with info from the salesheader to be printed if there are no saleslines that have reservations on them you should change the properties on the salesheader-DATAITEM so the property "PrintOnlyIfDetail" is set to YES.
    Best regards
    Tommy
Sign In or Register to comment.