Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

Posted on by 5

Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

  • tanya07 Profile Picture
    tanya07 1,554 on at
    RE: Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

    Hi,

    As Mohana mentioned :-

    For Average Collection Period (Days) - it is under codeunit 1302 "Customer Mgt."

    For Average Late Payments (Days) - it is under codeunit 32 "Customer Card Calculations"

    Regards,

    Tanya Kharbanda

    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has a verified answer.

  • DarrylG Profile Picture
    DarrylG 5 on at
    RE: Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

    do you have a simplified calculation or formula like:

    Average Collection Period = (Accounts Receivable / Total Credit Sales) x Number of Days in the Period

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

    Yup, the values calculated based on the above code. a bit hard to explain..

  • DarrylG Profile Picture
    DarrylG 5 on at
    RE: Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

    Hello guys,

    I am referring to the below fields highlighted in Yellow on the Customer Card - Statistics Fast Tab.

    pastedimage1683789474490v2.png

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Customer Card - Statistics Fast Tab, how does Average Collection Period (Days) and Average Late Payments (Days) calculate.

    It is in Codeunit 1302

       procedure AvgDaysToPay(CustNo: Code[20]): Decimal

       var

           CustLedgEntry: Record "Cust. Ledger Entry";

           CustLedgEntry2: Record "Cust. Ledger Entry";

           AvgDaysToPay: Decimal;

           TotalDaysToPay: Decimal;

           TotalNoOfInv: Integer;

       begin

           with CustLedgEntry do begin

               AvgDaysToPay := 0;

               SetCurrentKey("Customer No.", "Posting Date");

               SetFilterForPostedDocs(CustLedgEntry, CustNo, "Document Type"::Invoice);

               SetRange(Open, false);

               if FindSet() then

                   repeat

                       case true of

                           "Closed at Date" > "Posting Date":

                               UpdateDaysToPay("Closed at Date" - "Posting Date", TotalDaysToPay, TotalNoOfInv);

                           "Closed by Entry No." <> 0:

                               if CustLedgEntry2.Get("Closed by Entry No.") then

                                   UpdateDaysToPay(CustLedgEntry2."Posting Date" - "Posting Date", TotalDaysToPay, TotalNoOfInv);

                           else begin

                                   CustLedgEntry2.SetCurrentKey("Closed by Entry No.");

                                   CustLedgEntry2.SetRange("Closed by Entry No.", "Entry No.");

                                   if CustLedgEntry2.FindFirst() then

                                       UpdateDaysToPay(CustLedgEntry2."Posting Date" - "Posting Date", TotalDaysToPay, TotalNoOfInv);

                               end;

                       end;

                   until Next() = 0;

           end;

           if TotalNoOfInv <> 0 then

               AvgDaysToPay := TotalDaysToPay / TotalNoOfInv;

           exit(AvgDaysToPay);

       end;

    procedure InvoicePaymentDaysAverage(CustomerNo: Code[20]): Decimal

       begin

           exit(Round(CalcInvPmtDaysAverage(CustomerNo), 1));

       end;

       local procedure CalcInvPmtDaysAverage(CustomerNo: Code[20]): Decimal

       var

           CustLedgEntry: Record "Cust. Ledger Entry";

           DetailedCustLedgEntry: Record "Detailed Cust. Ledg. Entry";

           PaymentDays: Integer;

           InvoiceCount: Integer;

       begin

           CustLedgEntry.SetCurrentKey("Document Type", "Customer No.", Open);

           if CustomerNo <> '' then

               CustLedgEntry.SetRange("Customer No.", CustomerNo);

           CustLedgEntry.SetRange("Document Type", CustLedgEntry."Document Type"::Invoice);

           CustLedgEntry.SetRange(Open, false);

           CustLedgEntry.SetFilter("Due Date", '<>%1', 0D);

           if not CustLedgEntry.FindSet() then

               exit(0);

           repeat

               DetailedCustLedgEntry.SetCurrentKey("Cust. Ledger Entry No.");

               DetailedCustLedgEntry.SetRange("Cust. Ledger Entry No.", CustLedgEntry."Entry No.");

               DetailedCustLedgEntry.SetRange("Document Type", DetailedCustLedgEntry."Document Type"::Payment);

               if DetailedCustLedgEntry.FindLast() then begin

                   PaymentDays += DetailedCustLedgEntry."Posting Date" - CustLedgEntry."Due Date";

                   InvoiceCount += 1;

               end;

           until CustLedgEntry.Next() = 0;

           if InvoiceCount = 0 then

               exit(0);

           exit(PaymentDays / InvoiceCount);

       end;

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans