Best solution for report?

MrCul1MrCul1 Member Posts: 8
edited 2004-11-29 in Navision Attain
Hi.

Just wanted to ask, maybe someone have some good way to do it. I have to design a new report where data comes from single table. Sales line for example. I need create some totals on group footer. Only tricky part is, that I need totals for different time periods on the same row.
Example:
(Ahh seems that after posting this all the spaces are gone. The date periods are column headers, marking same period, user can select. Colums are separated with | sign)


01.01.04-31.01.04 | 01.01.04-31.03.04 | 01.06.04-... | etc.

Total: 1000.- | 3000.- | 8000.- | ...


I hope I made myself clear enough. What could be the best (fastest) way for that?

Comments

  • AlbertvhAlbertvh Member Posts: 516
    I think want you want to do would best be solved by using an array for the total amounts. What you will have to do is use a date array aswell using code as used in report 120.
    Name Type
    PeriodStartDate Date click on properties and set dimensions to 5
    PeriodEndDate Date click on properties and set dimensions to 5
    LineAmount Decimal click on properties and set dimensions to 5
    i integer

    on the request form
    Start Date PeriodstartDate[1]

    in the OnPreReport Section
    periodenddate[1] := calcdate('<+CM>',periodstartdate[1]);
    for i := 2 to 5 do begin
    periodstartdate := calcdate('<+1M>',periodstartdate[i - 1]);
    periodenddate := calcdate('<+1M>',periodenddate[i - 1]);
    end;

    in salesline OnPreDataItem section
    currreport.createtotals(lineamount);

    in SalesLine OnAfterGetRecord
    for i := 1 to 5 do
    if (salesheader."posting date" >= periodstartdate) and
    (salesheader."posting date" <= periodenddate) then
    lineamount := salesline.Amount;

    Then on the report sections change your Footer to use Lineamount[1] to lineamount[5]

    Hope this helps
Sign In or Register to comment.