Average Days to Pay calculation

Does anyone know how this field (average days to pay) is calculated? or the table it’ being pulled from?
Customer Tracker > Financial > Invoices > Aging

2 Likes

I’m wondering about the same question ? How is this field calculated ?
Thank you in advance for your help

1 Like

I created this query to mimic the average days to pay for each customer per given year.
Teik-AR invoices Avg Pmt Days.baq (28.1 KB)

tables = InvoiceHead linked to Cashdtl linked via “Company” and “Invoice Number” | Cashdtl table linked to Customer table via fields “company” and “CusNum”
Table criteria - CashDtl.TranType = “PayInv”

calculated field - days = datediff(day,InvcHead.InvoiceDate,CashDtl.TranDate )

group by customer id and name and use aggregate function to average the calculated field “days” to get average days to per per customer.

4 Likes

It was very nice of you to share your BAQ with us. Thank you. I changed it so that it shows average payment days for Suppliers. Here it is if anyone needs it: Average_AP_Pay_day.baq (26.3 KB)

1 Like

I am wondering if someone has the EXACT formula which the epicor application uses to determine this field?

foreach (var CashDtl_iterator in listWrapper)
{
	CashDtl = CashDtl_iterator;
	if (CashDtl.TranType.Equals("Adjust", StringComparison.OrdinalIgnoreCase))
	{
		TotalPay = TotalPay - CashDtl.TranAmt;
	}
	else
	{
		TotalPay = TotalPay + CashDtl.TranAmt;
	}
	if (InvcHead.InvoiceAmt == TotalPay && listWrapper.LastOf("InvoiceNum"))
	{
		YTDTotPayDays = YTDTotPayDays + ((DateTime)CashDtl.TranDate - (DateTime)InvcHead.InvoiceDate).Days;
		YTDNumPaidInv = YTDNumPaidInv + 1;
	}
}
// YTDTotPayDays / YTDNumPaidInv
YTDAvgDaysToPay = YTDTotPayDays.SafeDivision(YTDNumPaidInv); 
5 Likes

Thank you.

Thank you!

Can you tell me how to download this BAQ and load it to my system?

@barry.byers Go to EpicWeb and get the tools guide for your version. The BAQ is only a query. You will need to learn how to import it and how to build a dashboard around it. Both of these require elevated permissions in Epicor.

1 Like