Idea: Grouping in Reports and their Print

Hi,

Currently only a few documents allow showing grouped entries:

  • General Ledger (group by Account, Party, Voucher)
  • AR/AP (still an unmerged pull request https://github.com/frappe/erpnext/pull/16317)
  • Stock Ledger (I haven’t made a PR yet, since there are a lot of unmerged PRs already)

It’s a very helpful feature, however, it’s still quite a manual process to allow grouping in reports. Also it lacks the feature to allow printing groups in separate tables and also putting a page break between those tables.

If you can print different groups on different tables (and different pages) you can essentially print an Accounts Receivable report for each and every Customer in one go. You can also have the ability to convert to multiple PDFs for each group (customer) and even emailing them automatically, making reporting a lot easier.

So the idea is to allow sending Report data as 3 dimensional data and updating DataTable to handle them easily.

[
	{
		group 1 attributes,
		rows: [...rows as list or dict...]
	},
	{
		group 2 attributes,
		rows: [...rows as list or dict...]
	},
]

This way the report developers only have to separate the groups at server-side

  • DataTable will take care of the group totals and grand totals.
  • Frappe will seperate the tables itself in the standard report print.
  • Writing custom print formats that prints a different table (on a different page) would be much easier since the developer will only have to include an extra for loop.
7 Likes

Sending separate reports is a good idea.

What do you think about pivot tables?
They fulfill the “group by” requirement, sorting and filtering quite well.
There’s a great app for it as well, however it needs to be integrated properly to enable saving and printing.

1 Like

It’s a great idea! I plan on working on that in the future. Currently I want to be able to print all customer’s or sales person’s reports in one go

1 Like

:+1: For these type of reports.
We have to customize all the report. And these reports are very important for basic use.

My developer have made group reports for salesmen wise. I will check how did he do it and update on this thread

1 Like

My idea is to keep reports backwards compatible while allowing this new scheme for grouping in updated reports.

And sure please, let me know what you and your developer has done before about this. I have made my own customizations for grouping, however, this feature is to generalize the grouping functionality to make it much easier to develop and to print and distribute grouped reports.

2 Likes

@sunhoww
Can you explain how we achieved item wise report grouped by sales person?

I think the code here is pretty much self-explanatory.

2 Likes

This feature was merged recently (I think) - I see group by customer option in A/R report. Any guidance on how to auto email individual A/R report to customers?

The recent feature merged is not the same… it’s a much simpler version of the grouping feature I’ve developed.

Currently you cannot auto email reports using the same print format as you would see in your browser, however, I have developed a solution that allows you to create auto email reports for individual customers and sends them using the same print format.

3 Likes

Hi @saifi0102

Great! Did you send a PR?

Kind regards,