Sales Invoice Amount Month Wise

divyesh10divyesh10 Member Posts: 71
I am trying to create a report from sales header to display the total amount month wise
I have taken sales header table and i have to show currency wise amount
and tried to group on currency code in layout but not getting how to group monthwise.
the report is being printed for the starting month and all amount are printed in the Report.

Comments

  • geordiegeordie Member Posts: 655
    If it's RTC report what about adding a field to the dataset with year and month (something like FORMAT("Posting Date",0,'<Year4><Month,2>') ) and using it to group records?
  • divyesh10divyesh10 Member Posts: 71
    thank you very much sir for your time and advice
    i got the report
    this is the code for the same.

    I have defined start date end date as filter in report page

    OnPreReport()
    IF((sdate = 0D) AND (edate = 0D)) THEN
    ERROR(Text000);

    OnPostReport()

    Sales Header - OnPreDataItem()
    SETFILTER("Document Date",'%1..%2',sdate,edate);
    CurrReport.CREATETOTALS("Amount to Customer");
    SrNo :=0;
    Start:= DATE2DMY(sdate,2);

    Sales Header - OnAfterGetRecord()


    USDTotal:=0;
    EuroTotal:=0;
    Month:=0;
    Year:=0;
    Month:= DATE2DMY("Document Date",2);
    MonthName :=FORMAT("Document Date",0,'<Month Text>');
    Year:= DATE2DMY("Document Date",3);
    IF Month <> AfterMonth THEN
    SrNo := SrNo+1;
    IF "Currency Code" <> '' THEN BEGIN
    IF "Currency Code" = 'USD' THEN BEGIN
    CALCFIELDS("Amount to Customer");
    USDTotal := "Amount to Customer";
    END;
    IF "Currency Code" ='EURO'THEN BEGIN
    CALCFIELDS("Amount to Customer");
    EuroTotal := "Amount to Customer";
    END;
    END;
    AfterMonth:= DATE2DMY("Document Date",2);

    did grouping on month in report of rtc
    and will get the result
Sign In or Register to comment.