Report based on more than one year

airamairam Member Posts: 88
Hi all, I need to create a Turnover report based on the G/L Entries amounts of one particular account only. But the problem is that the total of each month of the last 5 years are needed.

For example if the user needs to see 2009 turnover, the report will show each individual total from Jan-Dec of the last 5 years. Any hints of how to go about it? i tried a 2 dimensional array and loop within it but it is not working.

thanks a lot

Comments

  • SnoopySnoopy Member Posts: 43
    edited 2009-09-01
    Define a variable e.g.: Month als integer and Dimension = 60. Another variable, Amount[60] as decimal.
    Set the appropriate filter and then:

    IF GLEntry.FIND('-') THEN
    REPEAT
    Month := DATE2DMY(GLEntry."Posting Date", 2);
    Amount[Month] := Amount[Month] + GLEntry.Amount;
    UNTIL GLEntry.NEXT = 0;

    But I think, you can set the dimension to 12 and clear the variable, but this depends on the required output.
  • kapil4dynamicskapil4dynamics Member Posts: 591
    U can use A/c Schedules or Analysis by Dimensions the one which seems easy to use to u .
    Kapil Khanna
  • Alex_ChowAlex_Chow Member Posts: 5,063
    When you say "turnover". Do you mean inventory quantity turnover? Or inventory values turnover?

    There's a standard Item Turnover report report you might want to check out.
  • airamairam Member Posts: 88
    hey,
    thanks all for your posts i did something like this and it worked, probably it's not as efficient as the other methods but it worked
    G/L Entry - OnPreDataItem()
    IF (Year = 0 ) THEN
      ERROR(Text001)
    ELSE
      IF (Year < 2000) THEN
        ERROR(Text002);
    
    SETRANGE ("Posting Date",   DMY2DATE(1,1,(Year - 4)), DMY2DATE(31,12,Year));
    
    G/L Entry - OnAfterGetRecord()
    WHILE FirstTime = FALSE DO
    BEGIN
      g_ShowLocality := "Global Dimension 2 Code";
      FirstTime := TRUE
    END;
    IF g_ShowLocality <>  "Global Dimension 2 Code" THEN
      g_ShowLocality := 'ALL';
    
    
    g_currday := DATE2DMY("Posting Date",1);
    g_currmonth := DATE2DMY("Posting Date",2);
    g_curryear  := DATE2DMY("Posting Date",3);
    j := 1;
    
    FOR i := 1 TO 5 DO     //year no
      BEGIN
        g_year[i] := Year - i + 1;
      END;
       
    CASE g_curryear OF            //fill array of years
      g_year[1] : i := 1;
      g_year[2] : i := 2;
      g_year[3] : i := 3;
      g_year[4] : i := 4;
      g_year[5] : i := 5;
    END;
    
    CASE g_currmonth OF
      1 : g_sales [i][1] += ("G/L Entry".Amount);
      2 : g_sales [i][2] += ("G/L Entry".Amount);
      3 : g_sales [i][3] += ("G/L Entry".Amount);
      4 : g_sales [i][4] += ("G/L Entry".Amount);
      5 : g_sales [i][5] += ("G/L Entry".Amount);
      6 : g_sales [i][6] += ("G/L Entry".Amount);
      7 : g_sales [i][7] += ("G/L Entry".Amount);
      8 : g_sales [i][8] += ("G/L Entry".Amount);
      9 : g_sales [i][9] += ("G/L Entry".Amount);
      10 : g_sales [i][10] += ("G/L Entry".Amount);
      11 : g_sales [i][11] += ("G/L Entry".Amount);
      12 : g_sales [i][12] += ("G/L Entry".Amount);
    END;
    
    
    IF NEXT = 0  THEN
    BEGIN
      FOR j := 1 TO 12 DO                      //months total
      BEGIN
        FOR i := 1 TO 5 DO
          g_MonthTotal[j] += g_sales[i][j];
      END;
    
      FOR i := 1 TO 5 DO                        //years total
      BEGIN
        FOR j := 1 TO 12 DO
           g_YearTotal[i] += g_sales[i][j];
      END;
    
    
    END;  //end if
    

    regards :)
Sign In or Register to comment.