web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
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.

(0) ShareShare
ReportReport
Posted on by 5

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

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,977 Super User 2025 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;

  • DarrylG Profile Picture
    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
    60,977 Super User 2025 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
    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

  • tanya07 Profile Picture
    1,638 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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 2,655

#2
Sumit Singh Profile Picture

Sumit Singh 2,579

#3
YUN ZHU Profile Picture

YUN ZHU 2,022 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans