From f01308b97288ac630bf9221df897f13071183b24 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 3 Feb 2024 09:11:12 +0530 Subject: [PATCH] Revert "feat: New financial views - Growth and margin views for P&L and balance sheet (#39588)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert "feat: New financial views - Growth and margin views for P&L and balan…" This reverts commit 3808ddbf860d9b5e88f544bb6a2108b22aaaca5c. --- .../report/balance_sheet/balance_sheet.js | 29 ----------- .../profit_and_loss_statement.js | 23 --------- erpnext/public/js/financial_statements.js | 51 ------------------- 3 files changed, 103 deletions(-) diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.js b/erpnext/accounts/report/balance_sheet/balance_sheet.js index 1d5d870cbfcb..f1f8e5f6e7c2 100644 --- a/erpnext/accounts/report/balance_sheet/balance_sheet.js +++ b/erpnext/accounts/report/balance_sheet/balance_sheet.js @@ -6,7 +6,6 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { erpnext.utils.add_dimensions('Balance Sheet', 10); -<<<<<<< HEAD frappe.query_reports["Balance Sheet"]["filters"].push({ "fieldname": "accumulated_values", "label": __("Accumulated Values"), @@ -20,32 +19,4 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "fieldtype": "Check", "default": 1 }); -======= -frappe.query_reports["Balance Sheet"]["filters"].push( - { - "fieldname": "selected_view", - "label": __("Select View"), - "fieldtype": "Select", - "options": [ - { "value": "Report", "label": __("Report View") }, - { "value": "Growth", "label": __("Growth View") } - ], - "default": "Report", - "reqd": 1 - }, -); - -frappe.query_reports["Balance Sheet"]["filters"].push({ - fieldname: "accumulated_values", - label: __("Accumulated Values"), - fieldtype: "Check", - default: 1, -}); - -frappe.query_reports["Balance Sheet"]["filters"].push({ - fieldname: "include_default_book_entries", - label: __("Include Default FB Entries"), - fieldtype: "Check", - default: 1, ->>>>>>> 92649de5c6 (Adding growth and margin views for P&L and balance sheet financial reports in collaboration with Sapcon Instruments Pvt Ltd) }); diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js index d2a2c4b46f5e..e794f270c2bc 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js +++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js @@ -6,7 +6,6 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { frappe.query_reports["Profit and Loss Statement"] = $.extend({}, erpnext.financial_statements); -<<<<<<< HEAD erpnext.utils.add_dimensions('Profit and Loss Statement', 10); frappe.query_reports["Profit and Loss Statement"]["filters"].push( @@ -17,26 +16,4 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() { "default": 1 } ); -======= -frappe.query_reports["Profit and Loss Statement"]["filters"].push( - { - "fieldname": "selected_view", - "label": __("Select View"), - "fieldtype": "Select", - "options": [ - { "value": "Report", "label": __("Report View") }, - { "value": "Growth", "label": __("Growth View") }, - { "value": "Margin", "label": __("Margin View") }, - ], - "default": "Report", - "reqd": 1 - }, -); - -frappe.query_reports["Profit and Loss Statement"]["filters"].push({ - fieldname: "accumulated_values", - label: __("Accumulated Values"), - fieldtype: "Check", - default: 1, ->>>>>>> 92649de5c6 (Adding growth and margin views for P&L and balance sheet financial reports in collaboration with Sapcon Instruments Pvt Ltd) }); diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js index 14b99aa6308b..5e1974299ee1 100644 --- a/erpnext/public/js/financial_statements.js +++ b/erpnext/public/js/financial_statements.js @@ -2,58 +2,7 @@ frappe.provide("erpnext.financial_statements"); erpnext.financial_statements = { "filters": get_filters(), - "baseData": null, "formatter": function(value, row, column, data, default_formatter, filter) { - if(frappe.query_report.get_filter_value("selected_view") == "Growth" && data && column.colIndex >= 3){ - //Assuming that the first three columns are s.no, account name and the very first year of the accounting values, to calculate the relative percentage values of the successive columns. - const lastAnnualValue = row[column.colIndex - 1].content; - const currentAnnualvalue = data[column.fieldname]; - if(currentAnnualvalue == undefined) return 'NA'; //making this not applicable for undefined/null values - let annualGrowth = 0; - if(lastAnnualValue == 0 && currentAnnualvalue > 0){ - //If the previous year value is 0 and the current value is greater than 0 - annualGrowth = 1; - } - else if(lastAnnualValue > 0){ - annualGrowth = (currentAnnualvalue - lastAnnualValue) / lastAnnualValue; - } - - const growthPercent = (Math.round(annualGrowth*10000)/100); //calculating the rounded off percentage - - value = $(`${((growthPercent >=0)? '+':'' )+growthPercent+'%'}`); - if(growthPercent < 0){ - value = $(value).addClass("text-danger"); - } - else{ - value = $(value).addClass("text-success"); - } - value = $(value).wrap("

").parent().html(); - - return value; - } - else if(frappe.query_report.get_filter_value("selected_view") == "Margin" && data){ - if(column.fieldname =="account" && data.account_name == __("Income")){ - //Taking the total income from each column (for all the financial years) as the base (100%) - this.baseData = row; - } - if(column.colIndex >= 2){ - //Assuming that the first two columns are s.no and account name, to calculate the relative percentage values of the successive columns. - const currentAnnualvalue = data[column.fieldname]; - const baseValue = this.baseData[column.colIndex].content; - if(currentAnnualvalue == undefined || baseValue <= 0) return 'NA'; - const marginPercent = Math.round((currentAnnualvalue/baseValue)*10000)/100; - - value = $(`${marginPercent+'%'}`); - if(marginPercent < 0) - value = $(value).addClass("text-danger"); - else - value = $(value).addClass("text-success"); - value = $(value).wrap("

").parent().html(); - return value; - } - - } - if (data && column.fieldname=="account") { value = data.account_name || value;