erpnext icon indicating copy to clipboard operation
erpnext copied to clipboard

feat: significant enhancements to sales analytics report to support charts

Open casesolved-co-uk opened this issue 10 months ago • 9 comments

The Sales Analytics report currently only shows charts if the data rows are selected in the datatable in the browser. This means it is incompatible with dashboard charts which expect the data to be delivered server-side.

The data is also arranged in the wrong orientation for dashboard charts which expect the X axis labels to be in the data vertically, but are horizontal in this report, which means you cannot use the report data output either.

All added features:

  • An extra 'Curves' filter which defaults to 'Select' to support old behaviour, but has the following additional modes to support dashboard charts (generated server-side):

    • All - shows all data rows on the chart
    • Non-Zeros - shows only non-zero data rows
    • Total Only - shows a single curve which is the total of the data rows
  • A special 'All' document mode (shown below) which shows all Sales cycle documents in Customer, Value and Total Only mode, over the time period

  • Quotations supported

  • Sales Invoice (by due date) supported

  • Payment Entry supported

  • The Fiscal Year dynamic from/to filter can be overridden by setting two user defaults in JS:

// used by sales_analytics report to give a custom time period in charts
const wk = frappe.datetime.week_start();
frappe.defaults.set_user_default_local('sales_start_date', frappe.datetime.add_months(wk,-2));
frappe.defaults.set_user_default_local('sales_end_date',   frappe.datetime.add_months(wk,1));

One known issue: Payment entries do not 'know about' the taxes (the other reports show net amounts), so will always be more than the other document values.

Screen Shot 2024-03-29 at 18 19 47

fixes #40751

version-15-hotfix (not compatible with version-14-hotfix due to missing erpnext.utils.get_fiscal_year)

casesolved-co-uk avatar Mar 29 '24 18:03 casesolved-co-uk

I'm not able to sign up to the documentation website to modify:

Screen Shot 2024-03-29 at 19 40 11

casesolved-co-uk avatar Mar 29 '24 19:03 casesolved-co-uk

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

stale[bot] avatar Apr 14 '24 13:04 stale[bot]

This would be extremely useful for us if it were implemented!

cgpurbaugh avatar Apr 15 '24 20:04 cgpurbaugh

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

stale[bot] avatar May 03 '24 04:05 stale[bot]

This has three endorsements, please merge.

casesolved-co-uk avatar May 03 '24 13:05 casesolved-co-uk

This pull request has been automatically marked as inactive because it has not had recent activity. It will be closed within 3 days if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

stale[bot] avatar May 19 '24 00:05 stale[bot]

Last chance before I remove this branch. It is available here:

https://github.com/CaseSolvedUK/erpnext

casesolved-co-uk avatar May 19 '24 11:05 casesolved-co-uk

I support merge this, then I will add another new feature.

szufisher avatar May 21 '24 01:05 szufisher

@deepeshgarg007 @ruthra-kumar ?

casesolved-co-uk avatar May 21 '24 10:05 casesolved-co-uk