Need Help: Accounts Receivable (AR) using Query Report in ERPNext
Hi everyone ![]()
I’m currently working on a Query Report in ERPNext and need some guidance regarding Accounts Receivable (AR) reporting.
What I’m trying to do
I want to build an AR / Accounts Receivable Summary–type report using a Query Report (SQL), similar to the standard Accounts Receivable Summary report.
I’m aware that ERPNext internally uses Payment Ledger Entry, but I’m struggling to implement this correctly in a Query Report.
What I need help with
-
Has anyone successfully built an AR / Accounts Receivable report using a Query Report (SQL)?
If yes, could you please share the approach or logic you followed? -
Is it recommended to avoid Query Reports for AR and use Script Reports only?
From your experience, is AR too complex for SQL-only reports? -
How do you safely handle optional filters like:
-
customer_group -
sales_person
in Query Reports without gettingKeyErroror “not enough arguments for format string” errors when filters are empty?
-
-
Is there any official or recommended SQL example for AR using
Payment Ledger Entry?
I couldn’t find a clean reference that matches the standard report output. -
If anyone has already implemented a Query Report version of AR Summary, I’d really appreciate it if you could share or guide me.