Customer Top N - Aging

teckpohteckpoh Member Posts: 271
Dear All,
I wish to sort "Age account receivable" report by top N list of customer who has the highest aging will show at top and second higher will show on second row...so and so...

i ever tried to use "Net Change" field as a key in customer table to sort the customer but i can't because it's flowfield..

Any idea how to implement this by modify the existing "age accnt receivable" report?? thank in advance~~!!!

Comments

  • Alex_ChowAlex_Chow Member Posts: 5,063
    teckpoh wrote:
    Dear All,
    I wish to sort "Age account receivable" report by top N list of customer who has the highest aging will show at top and second higher will show on second row...so and so...

    i ever tried to use "Net Change" field as a key in customer table to sort the customer but i can't because it's flowfield..

    Any idea how to implement this by modify the existing "age accnt receivable" report?? thank in advance~~!!!

    Take a look at the Top Customer and the Top Inventory reports in standard Navision to see how this is done. You'll need to replicate the same kind of code in your new aging report.

    An easy way is to just export to Excel then manipulate it there.
  • teckpohteckpoh Member Posts: 271
    i copied the sorting code from "Customer Top 10 List" and paste it in "Age Account Receivable" under customer data item. But the report still not sort by top N customer it still sorted by customer no. .....

    Code that i copied
    ============

    Window.OPEN(Text000);
    i := 0;
    CustAmount.DELETEALL;
    CurrReport.CREATETOTALS("Sales (LCY)","Balance (LCY)");

    Customer - OnAfterGetRecord()
    Window.UPDATE(1,"No.");
    CALCFIELDS("Sales (LCY)","Balance (LCY)");
    IF ("Sales (LCY)" = 0) AND ("Balance (LCY)" = 0) THEN
    CurrReport.SKIP;
    CustAmount.INIT;
    CustAmount."Customer No." := "No.";
    IF ShowType = ShowType::"Sales (LCY)" THEN BEGIN
    CustAmount."Amount (LCY)" := -"Sales (LCY)";
    CustAmount."Amount 2 (LCY)" := -"Balance (LCY)";
    END ELSE BEGIN
    CustAmount."Amount (LCY)" := -"Balance (LCY)";
    CustAmount."Amount 2 (LCY)" := -"Sales (LCY)";
    END;
    CustAmount.INSERT;
    IF (NoOfRecordsToPrint = 0) OR (i < NoOfRecordsToPrint) THEN
    i := i + 1
    ELSE BEGIN
    CustAmount.FIND('+');
    CustAmount.DELETE;
    END;


    Any idea?? Thank a lot's~~
  • SavatageSavatage Member Posts: 7,142
    Where did you find that code? In My Top__Customer List the code looks like this. It uses an Array to gather & sort the data

    OnPreDataItem()
    NextTopLineNo := 1;
    Window.OPEN(Text000 + ' #1########');
    

    OnAfterGetRecord()
    Window.UPDATE(1,"No.");
    IF TopType = TopType::"Balance ($)" THEN BEGIN
      CALCFIELDS("Balance ($)");
      TempAmount := "Balance ($)";
    END ELSE BEGIN
      CALCFIELDS("Sales ($)");
      TempAmount := "Sales ($)";
    END;
    GrandTotal := GrandTotal + TempAmount;
    TopNo[NextTopLineNo] := "No.";
    TopAmount[NextTopLineNo] := TempAmount;
    TopName[NextTopLineNo] := Name;
    i := NextTopLineNo;
    IF NextTopLineNo < (CustomersToRank + 1) THEN
      NextTopLineNo := NextTopLineNo + 1;
    WHILE (i > 1) DO BEGIN
      i := i - 1;
      IF (TopAmount[i + 1] > TopAmount[i]) THEN BEGIN
    
      // Sort the Customers by amount, largest should be first, smallest last. Put
      // values from position i into save variables, move values from position
      // i+1 to position i then put save values back in array in position i+1.
        TempNo := TopNo[i];
        TempAmount := TopAmount[i];
        TempName := TopName[i];
        TopNo[i] := TopNo[i + 1];
        TopAmount[i] := TopAmount[i + 1];
        TopName[i] := TopName[i + 1];
        TopNo[i + 1] := TempNo;
        TopAmount[i + 1] := TempAmount;
        TopName[i + 1] := TempName;
      END;
    END;
    

    & don't forget the code that is needed onnthe print loop -integer dataitem.
    I would suggest exporting to excel too & just sort the column you want.
    In fact here ya go!
    http://savatage99.googlepages.com/50085 ... ngInfo.fob
  • Alex_ChowAlex_Chow Member Posts: 5,063
    In version 5.0, the Aged Accounts Receivable report is already preconfigured to be able to print to Excel.
  • ssinglassingla Member Posts: 2,973
    In version 5.0, the Aged Accounts Receivable report is already preconfigured to be able to print to Excel.

    Version 4 already has the option.
    CA Sandeep Singla
    http://ssdynamics.co.in
  • SavatageSavatage Member Posts: 7,142
    not all of us are using ver 4 & 5 :wink:
Sign In or Register to comment.