ERPNext API for Balance Sheet and Profit & Loss Statement Reports

Is there any API of ERPNext which provide information about balance sheet and profit & loss statement. I appreciate to any who can help me with that.

Finally this one worked for me

/api/method/frappe.desk.query_report.run?report_name=Balance Sheet&filters={“from_fiscal_year”:“2021”,“to_fiscal_year”:“2022”,“periodicity”:“Yearly”,“company”:“Demo”}

just replace balance sheet with profit and loss statement and it should work fine

2 Likes

This error occurred.


A
Server Error
Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1603, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/__init__.py", line 801, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 237, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 801, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 89, in generate_report_result
    res = get_report_result(report, filters) or []
  File "apps/frappe/frappe/desk/query_report.py", line 70, in get_report_result
    res = report.execute_script_report(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 128, in execute_script_report
    res = self.execute_module(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 145, in execute_module
    return frappe.get_attr(method_name)(frappe._dict(filters))
  File "apps/erpnext/erpnext/accounts/report/balance_sheet/balance_sheet.py", line 18, in execute
    period_list = get_period_list(
  File "apps/erpnext/erpnext/accounts/report/financial_statements.py", line 42, in get_period_list
    validate_dates(period_start_date, period_end_date)
  File "apps/erpnext/erpnext/accounts/report/financial_statements.py", line 130, in validate_dates
    frappe.throw(_("From Date and To Date are mandatory"))
  File "apps/frappe/frappe/__init__.py", line 536, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 504, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 450, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: From Date and To Date are mandatory
Status: 417

Your email address...
Powered by ERPNext