[Enhancement] Multi year financial statements
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index c1e53a2..bb13f81 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -1,37 +1,7 @@
frappe.provide("erpnext.financial_statements");
erpnext.financial_statements = {
- "filters": [
- {
- "fieldname":"company",
- "label": __("Company"),
- "fieldtype": "Link",
- "options": "Company",
- "default": frappe.defaults.get_user_default("Company"),
- "reqd": 1
- },
- {
- "fieldname":"fiscal_year",
- "label": __("Fiscal Year"),
- "fieldtype": "Link",
- "options": "Fiscal Year",
- "default": frappe.defaults.get_user_default("fiscal_year"),
- "reqd": 1
- },
- {
- "fieldname": "periodicity",
- "label": __("Periodicity"),
- "fieldtype": "Select",
- "options": [
- { "value": "Monthly", "label": __("Monthly") },
- { "value": "Quarterly", "label": __("Quarterly") },
- { "value": "Half-Yearly", "label": __("Half-Yearly") },
- { "value": "Yearly", "label": __("Yearly") }
- ],
- "default": "Monthly",
- "reqd": 1
- }
- ],
+ "filters": get_filters(),
"formatter": function(row, cell, value, columnDef, dataContext, default_formatter) {
if (columnDef.df.fieldname=="account") {
value = dataContext.account_name;
@@ -71,6 +41,8 @@
"initial_depth": 3,
onload: function(report) {
// dropdown for links to other financial statements
+ erpnext.financial_statements.filters = get_filters()
+
report.page.add_inner_button(__("Balance Sheet"), function() {
var filters = report.get_values();
frappe.set_route('query-report', 'Balance Sheet', {company: filters.company});
@@ -85,3 +57,45 @@
}, 'Financial Statements');
}
};
+
+function get_filters(){
+ return [
+ {
+ "fieldname":"company",
+ "label": __("Company"),
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": frappe.defaults.get_user_default("Company"),
+ "reqd": 1
+ },
+ {
+ "fieldname":"from_fiscal_year",
+ "label": __("Fiscal Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": frappe.defaults.get_user_default("fiscal_year"),
+ "reqd": 1
+ },
+ {
+ "fieldname":"to_fiscal_year",
+ "label": __("Fiscal Year"),
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": frappe.defaults.get_user_default("fiscal_year"),
+ "reqd": 1
+ },
+ {
+ "fieldname": "periodicity",
+ "label": __("Periodicity"),
+ "fieldtype": "Select",
+ "options": [
+ { "value": "Monthly", "label": __("Monthly") },
+ { "value": "Quarterly", "label": __("Quarterly") },
+ { "value": "Half-Yearly", "label": __("Half-Yearly") },
+ { "value": "Yearly", "label": __("Yearly") }
+ ],
+ "default": "Monthly",
+ "reqd": 1
+ }
+ ]
+}