refactor: import financial_statement in erpnext bundle
This commit is contained in:
parent
aad77b133b
commit
40e7c43ce3
@ -1,25 +1,23 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function () {
|
frappe.query_reports["Balance Sheet"] = $.extend(
|
||||||
frappe.query_reports["Balance Sheet"] = $.extend(
|
{},
|
||||||
{},
|
erpnext.financial_statements
|
||||||
erpnext.financial_statements
|
);
|
||||||
);
|
|
||||||
|
|
||||||
erpnext.utils.add_dimensions("Balance Sheet", 10);
|
erpnext.utils.add_dimensions("Balance Sheet", 10);
|
||||||
|
|
||||||
frappe.query_reports["Balance Sheet"]["filters"].push({
|
frappe.query_reports["Balance Sheet"]["filters"].push({
|
||||||
fieldname: "accumulated_values",
|
fieldname: "accumulated_values",
|
||||||
label: __("Accumulated Values"),
|
label: __("Accumulated Values"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
frappe.query_reports["Balance Sheet"]["filters"].push({
|
frappe.query_reports["Balance Sheet"]["filters"].push({
|
||||||
fieldname: "include_default_book_entries",
|
fieldname: "include_default_book_entries",
|
||||||
label: __("Include Default Book Entries"),
|
label: __("Include Default Book Entries"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Cash Flow"] = $.extend(
|
||||||
frappe.query_reports["Cash Flow"] = $.extend({},
|
{},
|
||||||
erpnext.financial_statements);
|
erpnext.financial_statements
|
||||||
|
);
|
||||||
|
|
||||||
erpnext.utils.add_dimensions('Cash Flow', 10);
|
erpnext.utils.add_dimensions('Cash Flow', 10);
|
||||||
|
|
||||||
// The last item in the array is the definition for Presentation Currency
|
// The last item in the array is the definition for Presentation Currency
|
||||||
// filter. It won't be used in cash flow for now so we pop it. Please take
|
// filter. It won't be used in cash flow for now so we pop it. Please take
|
||||||
// of this if you are working here.
|
// of this if you are working here.
|
||||||
|
|
||||||
frappe.query_reports["Cash Flow"]["filters"].splice(8, 1);
|
frappe.query_reports["Cash Flow"]["filters"].splice(8, 1);
|
||||||
|
|
||||||
frappe.query_reports["Cash Flow"]["filters"].push(
|
frappe.query_reports["Cash Flow"]["filters"].push(
|
||||||
{
|
{
|
||||||
"fieldname": "include_default_book_entries",
|
"fieldname": "include_default_book_entries",
|
||||||
"label": __("Include Default Book Entries"),
|
"label": __("Include Default Book Entries"),
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"default": 1
|
"default": 1
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
@ -2,152 +2,150 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Consolidated Financial Statement"] = {
|
||||||
frappe.query_reports["Consolidated Financial Statement"] = {
|
"filters": [
|
||||||
"filters": [
|
{
|
||||||
{
|
"fieldname":"company",
|
||||||
"fieldname":"company",
|
"label": __("Company"),
|
||||||
"label": __("Company"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Company",
|
||||||
"options": "Company",
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"reqd": 1
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"filter_based_on",
|
|
||||||
"label": __("Filter Based On"),
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"options": ["Fiscal Year", "Date Range"],
|
|
||||||
"default": ["Fiscal Year"],
|
|
||||||
"reqd": 1,
|
|
||||||
on_change: function() {
|
|
||||||
let filter_based_on = frappe.query_report.get_filter_value('filter_based_on');
|
|
||||||
frappe.query_report.toggle_filter_display('from_fiscal_year', filter_based_on === 'Date Range');
|
|
||||||
frappe.query_report.toggle_filter_display('to_fiscal_year', filter_based_on === 'Date Range');
|
|
||||||
frappe.query_report.toggle_filter_display('period_start_date', filter_based_on === 'Fiscal Year');
|
|
||||||
frappe.query_report.toggle_filter_display('period_end_date', filter_based_on === 'Fiscal Year');
|
|
||||||
|
|
||||||
frappe.query_report.refresh();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"period_start_date",
|
|
||||||
"label": __("Start Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"hidden": 1,
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"period_end_date",
|
|
||||||
"label": __("End Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"hidden": 1,
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"from_fiscal_year",
|
|
||||||
"label": __("Start Year"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Fiscal Year",
|
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
|
||||||
"reqd": 1,
|
|
||||||
on_change: () => {
|
|
||||||
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
|
|
||||||
let year_start_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), "year_start_date");
|
|
||||||
frappe.query_report.set_filter_value({
|
|
||||||
period_start_date: year_start_date
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"to_fiscal_year",
|
|
||||||
"label": __("End Year"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Fiscal Year",
|
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
|
||||||
"reqd": 1,
|
|
||||||
on_change: () => {
|
|
||||||
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
|
|
||||||
let year_end_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), "year_end_date");
|
|
||||||
frappe.query_report.set_filter_value({
|
|
||||||
period_end_date: year_end_date
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"finance_book",
|
|
||||||
"label": __("Finance Book"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Finance Book"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"report",
|
|
||||||
"label": __("Report"),
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"options": ["Profit and Loss Statement", "Balance Sheet", "Cash Flow"],
|
|
||||||
"default": "Balance Sheet",
|
|
||||||
"reqd": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "presentation_currency",
|
|
||||||
"label": __("Currency"),
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"options": erpnext.get_presentation_currency_list(),
|
|
||||||
"default": frappe.defaults.get_user_default("Currency")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname":"accumulated_in_group_company",
|
|
||||||
"label": __("Accumulated Values in Group Company"),
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"default": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "include_default_book_entries",
|
|
||||||
"label": __("Include Default Book Entries"),
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"default": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "show_zero_values",
|
|
||||||
"label": __("Show zero values"),
|
|
||||||
"fieldtype": "Check"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formatter": function(value, row, column, data, default_formatter) {
|
|
||||||
if (data && column.fieldname=="account") {
|
|
||||||
value = data.account_name || value;
|
|
||||||
|
|
||||||
column.link_onclick =
|
|
||||||
"erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")";
|
|
||||||
column.is_tree = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data && data.account && column.apply_currency_formatter) {
|
|
||||||
data.currency = erpnext.get_currency(column.company_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
value = default_formatter(value, row, column, data);
|
|
||||||
if (!data.parent_account) {
|
|
||||||
value = $(`<span>${value}</span>`);
|
|
||||||
|
|
||||||
var $value = $(value).css("font-weight", "bold");
|
|
||||||
|
|
||||||
value = $value.wrap("<p></p>").parent().html();
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
},
|
},
|
||||||
onload: function() {
|
{
|
||||||
let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
|
"fieldname":"filter_based_on",
|
||||||
|
"label": __("Filter Based On"),
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"options": ["Fiscal Year", "Date Range"],
|
||||||
|
"default": ["Fiscal Year"],
|
||||||
|
"reqd": 1,
|
||||||
|
on_change: function() {
|
||||||
|
let filter_based_on = frappe.query_report.get_filter_value('filter_based_on');
|
||||||
|
frappe.query_report.toggle_filter_display('from_fiscal_year', filter_based_on === 'Date Range');
|
||||||
|
frappe.query_report.toggle_filter_display('to_fiscal_year', filter_based_on === 'Date Range');
|
||||||
|
frappe.query_report.toggle_filter_display('period_start_date', filter_based_on === 'Fiscal Year');
|
||||||
|
frappe.query_report.toggle_filter_display('period_end_date', filter_based_on === 'Fiscal Year');
|
||||||
|
|
||||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
frappe.query_report.refresh();
|
||||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
}
|
||||||
frappe.query_report.set_filter_value({
|
},
|
||||||
period_start_date: fy.year_start_date,
|
{
|
||||||
period_end_date: fy.year_end_date
|
"fieldname":"period_start_date",
|
||||||
|
"label": __("Start Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 1,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"period_end_date",
|
||||||
|
"label": __("End Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"hidden": 1,
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"from_fiscal_year",
|
||||||
|
"label": __("Start Year"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Fiscal Year",
|
||||||
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||||
|
"reqd": 1,
|
||||||
|
on_change: () => {
|
||||||
|
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), function(r) {
|
||||||
|
let year_start_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('from_fiscal_year'), "year_start_date");
|
||||||
|
frappe.query_report.set_filter_value({
|
||||||
|
period_start_date: year_start_date
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"to_fiscal_year",
|
||||||
|
"label": __("End Year"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Fiscal Year",
|
||||||
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||||
|
"reqd": 1,
|
||||||
|
on_change: () => {
|
||||||
|
frappe.model.with_doc("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), function(r) {
|
||||||
|
let year_end_date = frappe.model.get_value("Fiscal Year", frappe.query_report.get_filter_value('to_fiscal_year'), "year_end_date");
|
||||||
|
frappe.query_report.set_filter_value({
|
||||||
|
period_end_date: year_end_date
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"finance_book",
|
||||||
|
"label": __("Finance Book"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Finance Book"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"report",
|
||||||
|
"label": __("Report"),
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"options": ["Profit and Loss Statement", "Balance Sheet", "Cash Flow"],
|
||||||
|
"default": "Balance Sheet",
|
||||||
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "presentation_currency",
|
||||||
|
"label": __("Currency"),
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"options": erpnext.get_presentation_currency_list(),
|
||||||
|
"default": frappe.defaults.get_user_default("Currency")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"accumulated_in_group_company",
|
||||||
|
"label": __("Accumulated Values in Group Company"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_zero_values",
|
||||||
|
"label": __("Show zero values"),
|
||||||
|
"fieldtype": "Check"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"formatter": function(value, row, column, data, default_formatter) {
|
||||||
|
if (data && column.fieldname=="account") {
|
||||||
|
value = data.account_name || value;
|
||||||
|
|
||||||
|
column.link_onclick =
|
||||||
|
"erpnext.financial_statements.open_general_ledger(" + JSON.stringify(data) + ")";
|
||||||
|
column.is_tree = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data && data.account && column.apply_currency_formatter) {
|
||||||
|
data.currency = erpnext.get_currency(column.company_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = default_formatter(value, row, column, data);
|
||||||
|
if (!data.parent_account) {
|
||||||
|
value = $(`<span>${value}</span>`);
|
||||||
|
|
||||||
|
var $value = $(value).css("font-weight", "bold");
|
||||||
|
|
||||||
|
value = $value.wrap("<p></p>").parent().html();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
onload: function() {
|
||||||
|
let fiscal_year = erpnext.utils.get_fiscal_year(frappe.datetime.get_today());
|
||||||
|
|
||||||
|
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||||
|
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||||
|
frappe.query_report.set_filter_value({
|
||||||
|
period_start_date: fy.year_start_date,
|
||||||
|
period_end_date: fy.year_end_date
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
@ -2,83 +2,81 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Dimension-wise Accounts Balance Report"] = {
|
||||||
frappe.query_reports["Dimension-wise Accounts Balance Report"] = {
|
"filters": [
|
||||||
"filters": [
|
{
|
||||||
{
|
"fieldname": "company",
|
||||||
"fieldname": "company",
|
"label": __("Company"),
|
||||||
"label": __("Company"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Company",
|
||||||
"options": "Company",
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"reqd": 1
|
||||||
"reqd": 1
|
},
|
||||||
},
|
{
|
||||||
{
|
"fieldname": "fiscal_year",
|
||||||
"fieldname": "fiscal_year",
|
"label": __("Fiscal Year"),
|
||||||
"label": __("Fiscal Year"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Fiscal Year",
|
||||||
"options": "Fiscal Year",
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
"reqd": 1,
|
||||||
"reqd": 1,
|
"on_change": function(query_report) {
|
||||||
"on_change": function(query_report) {
|
var fiscal_year = query_report.get_values().fiscal_year;
|
||||||
var fiscal_year = query_report.get_values().fiscal_year;
|
if (!fiscal_year) {
|
||||||
if (!fiscal_year) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
|
||||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
|
||||||
frappe.query_report.set_filter_value({
|
|
||||||
from_date: fy.year_start_date,
|
|
||||||
to_date: fy.year_end_date
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||||
{
|
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||||
"fieldname": "from_date",
|
frappe.query_report.set_filter_value({
|
||||||
"label": __("From Date"),
|
from_date: fy.year_start_date,
|
||||||
"fieldtype": "Date",
|
to_date: fy.year_end_date
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
});
|
||||||
"reqd": 1
|
});
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
"fieldname": "to_date",
|
{
|
||||||
"label": __("To Date"),
|
"fieldname": "from_date",
|
||||||
"fieldtype": "Date",
|
"label": __("From Date"),
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
"fieldtype": "Date",
|
||||||
"reqd": 1
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
||||||
},
|
"reqd": 1
|
||||||
{
|
},
|
||||||
"fieldname": "finance_book",
|
{
|
||||||
"label": __("Finance Book"),
|
"fieldname": "to_date",
|
||||||
"fieldtype": "Link",
|
"label": __("To Date"),
|
||||||
"options": "Finance Book",
|
"fieldtype": "Date",
|
||||||
},
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
||||||
{
|
"reqd": 1
|
||||||
"fieldname": "dimension",
|
},
|
||||||
"label": __("Select Dimension"),
|
{
|
||||||
"fieldtype": "Select",
|
"fieldname": "finance_book",
|
||||||
"default": "Cost Center",
|
"label": __("Finance Book"),
|
||||||
"options": get_accounting_dimension_options(),
|
"fieldtype": "Link",
|
||||||
"reqd": 1,
|
"options": "Finance Book",
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
"formatter": erpnext.financial_statements.formatter,
|
"fieldname": "dimension",
|
||||||
"tree": true,
|
"label": __("Select Dimension"),
|
||||||
"name_field": "account",
|
"fieldtype": "Select",
|
||||||
"parent_field": "parent_account",
|
"default": "Cost Center",
|
||||||
"initial_depth": 3
|
"options": get_accounting_dimension_options(),
|
||||||
}
|
"reqd": 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"formatter": erpnext.financial_statements.formatter,
|
||||||
|
"tree": true,
|
||||||
|
"name_field": "account",
|
||||||
|
"parent_field": "parent_account",
|
||||||
|
"initial_depth": 3
|
||||||
|
}
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function get_accounting_dimension_options() {
|
function get_accounting_dimension_options() {
|
||||||
let options =["Cost Center", "Project"];
|
let options =["Cost Center", "Project"];
|
||||||
frappe.db.get_list('Accounting Dimension',
|
frappe.db.get_list('Accounting Dimension',
|
||||||
{fields:['document_type']}).then((res) => {
|
{fields:['document_type']}).then((res) => {
|
||||||
res.forEach((dimension) => {
|
res.forEach((dimension) => {
|
||||||
options.push(dimension.document_type);
|
options.push(dimension.document_type);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,15 @@
|
|||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
|
||||||
frappe.query_reports["Gross and Net Profit Report"] = {
|
frappe.query_reports["Gross and Net Profit Report"] = $.extend(
|
||||||
"filters": [
|
{},
|
||||||
|
erpnext.financial_statements
|
||||||
|
);
|
||||||
|
|
||||||
]
|
frappe.query_reports["Gross and Net Profit Report"]["filters"].push(
|
||||||
}
|
{
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
"fieldname": "accumulated_values",
|
||||||
frappe.query_reports["Gross and Net Profit Report"] = $.extend({},
|
"label": __("Accumulated Values"),
|
||||||
erpnext.financial_statements);
|
"fieldtype": "Check"
|
||||||
|
}
|
||||||
frappe.query_reports["Gross and Net Profit Report"]["filters"].push(
|
);
|
||||||
{
|
|
||||||
"fieldname": "accumulated_values",
|
|
||||||
"label": __("Accumulated Values"),
|
|
||||||
"fieldtype": "Check"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function () {
|
frappe.query_reports["Profit and Loss Statement"] = $.extend(
|
||||||
frappe.query_reports["Profit and Loss Statement"] = $.extend(
|
{},
|
||||||
{},
|
erpnext.financial_statements
|
||||||
erpnext.financial_statements
|
);
|
||||||
);
|
|
||||||
|
|
||||||
erpnext.utils.add_dimensions("Profit and Loss Statement", 10);
|
erpnext.utils.add_dimensions("Profit and Loss Statement", 10);
|
||||||
|
|
||||||
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
frappe.query_reports["Profit and Loss Statement"]["filters"].push({
|
||||||
fieldname: "accumulated_values",
|
fieldname: "accumulated_values",
|
||||||
label: __("Accumulated Values"),
|
label: __("Accumulated Values"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
default: 1,
|
default: 1,
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -1,133 +1,131 @@
|
|||||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
// For license information, please see license.txt
|
// For license information, please see license.txt
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Profitability Analysis"] = {
|
||||||
frappe.query_reports["Profitability Analysis"] = {
|
"filters": [
|
||||||
"filters": [
|
{
|
||||||
{
|
"fieldname": "company",
|
||||||
"fieldname": "company",
|
"label": __("Company"),
|
||||||
"label": __("Company"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Company",
|
||||||
"options": "Company",
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"reqd": 1
|
||||||
"reqd": 1
|
},
|
||||||
},
|
{
|
||||||
{
|
"fieldname": "based_on",
|
||||||
"fieldname": "based_on",
|
"label": __("Based On"),
|
||||||
"label": __("Based On"),
|
"fieldtype": "Select",
|
||||||
"fieldtype": "Select",
|
"options": ["Cost Center", "Project", "Accounting Dimension"],
|
||||||
"options": ["Cost Center", "Project", "Accounting Dimension"],
|
"default": "Cost Center",
|
||||||
"default": "Cost Center",
|
"reqd": 1,
|
||||||
"reqd": 1,
|
"on_change": function(query_report){
|
||||||
"on_change": function(query_report){
|
let based_on = query_report.get_values().based_on;
|
||||||
let based_on = query_report.get_values().based_on;
|
if(based_on!='Accounting Dimension'){
|
||||||
if(based_on!='Accounting Dimension'){
|
frappe.query_report.set_filter_value({
|
||||||
frappe.query_report.set_filter_value({
|
accounting_dimension: ''
|
||||||
accounting_dimension: ''
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "accounting_dimension",
|
|
||||||
"label": __("Accounting Dimension"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Accounting Dimension",
|
|
||||||
"get_query": () =>{
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
"disabled": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "fiscal_year",
|
|
||||||
"label": __("Fiscal Year"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Fiscal Year",
|
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
|
||||||
"reqd": 1,
|
|
||||||
"on_change": function(query_report) {
|
|
||||||
var fiscal_year = query_report.get_values().fiscal_year;
|
|
||||||
if (!fiscal_year) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
|
||||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
|
||||||
frappe.query_report.set_filter_value({
|
|
||||||
from_date: fy.year_start_date,
|
|
||||||
to_date: fy.year_end_date
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "from_date",
|
|
||||||
"label": __("From Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "to_date",
|
|
||||||
"label": __("To Date"),
|
|
||||||
"fieldtype": "Date",
|
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "show_zero_values",
|
|
||||||
"label": __("Show zero values"),
|
|
||||||
"fieldtype": "Check"
|
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"formatter": function(value, row, column, data, default_formatter) {
|
{
|
||||||
if (column.fieldname=="account") {
|
"fieldname": "accounting_dimension",
|
||||||
value = data.account_name;
|
"label": __("Accounting Dimension"),
|
||||||
|
"fieldtype": "Link",
|
||||||
column.link_onclick =
|
"options": "Accounting Dimension",
|
||||||
"frappe.query_reports['Profitability Analysis'].open_profit_and_loss_statement(" + JSON.stringify(data) + ")";
|
"get_query": () =>{
|
||||||
column.is_tree = true;
|
return {
|
||||||
}
|
filters: {
|
||||||
|
"disabled": 0
|
||||||
value = default_formatter(value, row, column, data);
|
}
|
||||||
|
|
||||||
if (!data.parent_account && data.based_on != 'project') {
|
|
||||||
value = $(`<span>${value}</span>`);
|
|
||||||
var $value = $(value).css("font-weight", "bold");
|
|
||||||
if (data.warn_if_negative && data[column.fieldname] < 0) {
|
|
||||||
$value.addClass("text-danger");
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "fiscal_year",
|
||||||
|
"label": __("Fiscal Year"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Fiscal Year",
|
||||||
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||||
|
"reqd": 1,
|
||||||
|
"on_change": function(query_report) {
|
||||||
|
var fiscal_year = query_report.get_values().fiscal_year;
|
||||||
|
if (!fiscal_year) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||||
|
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||||
|
frappe.query_report.set_filter_value({
|
||||||
|
from_date: fy.year_start_date,
|
||||||
|
to_date: fy.year_end_date
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "from_date",
|
||||||
|
"label": __("From Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "to_date",
|
||||||
|
"label": __("To Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_zero_values",
|
||||||
|
"label": __("Show zero values"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatter": function(value, row, column, data, default_formatter) {
|
||||||
|
if (column.fieldname=="account") {
|
||||||
|
value = data.account_name;
|
||||||
|
|
||||||
value = $value.wrap("<p></p>").parent().html();
|
column.link_onclick =
|
||||||
|
"frappe.query_reports['Profitability Analysis'].open_profit_and_loss_statement(" + JSON.stringify(data) + ")";
|
||||||
|
column.is_tree = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = default_formatter(value, row, column, data);
|
||||||
|
|
||||||
|
if (!data.parent_account && data.based_on != 'project') {
|
||||||
|
value = $(`<span>${value}</span>`);
|
||||||
|
var $value = $(value).css("font-weight", "bold");
|
||||||
|
if (data.warn_if_negative && data[column.fieldname] < 0) {
|
||||||
|
$value.addClass("text-danger");
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
value = $value.wrap("<p></p>").parent().html();
|
||||||
},
|
}
|
||||||
"open_profit_and_loss_statement": function(data) {
|
|
||||||
if (!data.account) return;
|
|
||||||
|
|
||||||
frappe.route_options = {
|
return value;
|
||||||
"company": frappe.query_report.get_filter_value('company'),
|
},
|
||||||
"from_fiscal_year": data.fiscal_year,
|
"open_profit_and_loss_statement": function(data) {
|
||||||
"to_fiscal_year": data.fiscal_year
|
if (!data.account) return;
|
||||||
};
|
|
||||||
|
|
||||||
if(data.based_on == 'Cost Center'){
|
frappe.route_options = {
|
||||||
frappe.route_options["cost_center"] = data.account
|
"company": frappe.query_report.get_filter_value('company'),
|
||||||
} else {
|
"from_fiscal_year": data.fiscal_year,
|
||||||
frappe.route_options["project"] = data.account
|
"to_fiscal_year": data.fiscal_year
|
||||||
}
|
};
|
||||||
|
|
||||||
frappe.set_route("query-report", "Profit and Loss Statement");
|
if(data.based_on == 'Cost Center'){
|
||||||
},
|
frappe.route_options["cost_center"] = data.account
|
||||||
"tree": true,
|
} else {
|
||||||
"name_field": "account",
|
frappe.route_options["project"] = data.account
|
||||||
"parent_field": "parent_account",
|
}
|
||||||
"initial_depth": 3
|
|
||||||
}
|
|
||||||
|
|
||||||
erpnext.dimension_filters.forEach((dimension) => {
|
frappe.set_route("query-report", "Profit and Loss Statement");
|
||||||
frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]);
|
},
|
||||||
});
|
"tree": true,
|
||||||
|
"name_field": "account",
|
||||||
|
"parent_field": "parent_account",
|
||||||
|
"initial_depth": 3
|
||||||
|
}
|
||||||
|
|
||||||
|
erpnext.dimension_filters.forEach((dimension) => {
|
||||||
|
frappe.query_reports["Profitability Analysis"].filters[1].options.push(dimension["document_type"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,118 +1,116 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
frappe.query_reports["Trial Balance"] = {
|
||||||
frappe.query_reports["Trial Balance"] = {
|
"filters": [
|
||||||
"filters": [
|
{
|
||||||
{
|
"fieldname": "company",
|
||||||
"fieldname": "company",
|
"label": __("Company"),
|
||||||
"label": __("Company"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Company",
|
||||||
"options": "Company",
|
"default": frappe.defaults.get_user_default("Company"),
|
||||||
"default": frappe.defaults.get_user_default("Company"),
|
"reqd": 1
|
||||||
"reqd": 1
|
},
|
||||||
},
|
{
|
||||||
{
|
"fieldname": "fiscal_year",
|
||||||
"fieldname": "fiscal_year",
|
"label": __("Fiscal Year"),
|
||||||
"label": __("Fiscal Year"),
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Link",
|
"options": "Fiscal Year",
|
||||||
"options": "Fiscal Year",
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
"reqd": 1,
|
||||||
"reqd": 1,
|
"on_change": function(query_report) {
|
||||||
"on_change": function(query_report) {
|
var fiscal_year = query_report.get_values().fiscal_year;
|
||||||
var fiscal_year = query_report.get_values().fiscal_year;
|
if (!fiscal_year) {
|
||||||
if (!fiscal_year) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
||||||
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
|
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
||||||
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
|
frappe.query_report.set_filter_value({
|
||||||
frappe.query_report.set_filter_value({
|
from_date: fy.year_start_date,
|
||||||
from_date: fy.year_start_date,
|
to_date: fy.year_end_date
|
||||||
to_date: fy.year_end_date
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
"fieldname": "from_date",
|
{
|
||||||
"label": __("From Date"),
|
"fieldname": "from_date",
|
||||||
"fieldtype": "Date",
|
"label": __("From Date"),
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
"fieldtype": "Date",
|
||||||
},
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[1],
|
||||||
{
|
},
|
||||||
"fieldname": "to_date",
|
{
|
||||||
"label": __("To Date"),
|
"fieldname": "to_date",
|
||||||
"fieldtype": "Date",
|
"label": __("To Date"),
|
||||||
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
"fieldtype": "Date",
|
||||||
},
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today(), true)[2],
|
||||||
{
|
},
|
||||||
"fieldname": "cost_center",
|
{
|
||||||
"label": __("Cost Center"),
|
"fieldname": "cost_center",
|
||||||
"fieldtype": "Link",
|
"label": __("Cost Center"),
|
||||||
"options": "Cost Center",
|
"fieldtype": "Link",
|
||||||
"get_query": function() {
|
"options": "Cost Center",
|
||||||
var company = frappe.query_report.get_filter_value('company');
|
"get_query": function() {
|
||||||
return {
|
var company = frappe.query_report.get_filter_value('company');
|
||||||
"doctype": "Cost Center",
|
return {
|
||||||
"filters": {
|
"doctype": "Cost Center",
|
||||||
"company": company,
|
"filters": {
|
||||||
}
|
"company": company,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "project",
|
|
||||||
"label": __("Project"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Project"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "finance_book",
|
|
||||||
"label": __("Finance Book"),
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Finance Book",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "presentation_currency",
|
|
||||||
"label": __("Currency"),
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"options": erpnext.get_presentation_currency_list()
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "with_period_closing_entry",
|
|
||||||
"label": __("Period Closing Entry"),
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"default": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "show_zero_values",
|
|
||||||
"label": __("Show zero values"),
|
|
||||||
"fieldtype": "Check"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "show_unclosed_fy_pl_balances",
|
|
||||||
"label": __("Show unclosed fiscal year's P&L balances"),
|
|
||||||
"fieldtype": "Check"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "include_default_book_entries",
|
|
||||||
"label": __("Include Default Book Entries"),
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"default": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "show_net_values",
|
|
||||||
"label": __("Show net values in opening and closing columns"),
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"default": 1
|
|
||||||
}
|
}
|
||||||
],
|
},
|
||||||
"formatter": erpnext.financial_statements.formatter,
|
{
|
||||||
"tree": true,
|
"fieldname": "project",
|
||||||
"name_field": "account",
|
"label": __("Project"),
|
||||||
"parent_field": "parent_account",
|
"fieldtype": "Link",
|
||||||
"initial_depth": 3
|
"options": "Project"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "finance_book",
|
||||||
|
"label": __("Finance Book"),
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Finance Book",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "presentation_currency",
|
||||||
|
"label": __("Currency"),
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"options": erpnext.get_presentation_currency_list()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "with_period_closing_entry",
|
||||||
|
"label": __("Period Closing Entry"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_zero_values",
|
||||||
|
"label": __("Show zero values"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_unclosed_fy_pl_balances",
|
||||||
|
"label": __("Show unclosed fiscal year's P&L balances"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "show_net_values",
|
||||||
|
"label": __("Show net values in opening and closing columns"),
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formatter": erpnext.financial_statements.formatter,
|
||||||
|
"tree": true,
|
||||||
|
"name_field": "account",
|
||||||
|
"parent_field": "parent_account",
|
||||||
|
"initial_depth": 3
|
||||||
|
}
|
||||||
|
|
||||||
erpnext.utils.add_dimensions('Trial Balance', 6);
|
erpnext.utils.add_dimensions('Trial Balance', 6);
|
||||||
});
|
|
||||||
|
@ -30,5 +30,6 @@ import "./utils/landed_taxes_and_charges_common.js";
|
|||||||
import "./utils/sales_common.js";
|
import "./utils/sales_common.js";
|
||||||
import "./controllers/buying.js";
|
import "./controllers/buying.js";
|
||||||
import "./utils/demo.js";
|
import "./utils/demo.js";
|
||||||
|
import "./financial_statements.js";
|
||||||
|
|
||||||
// import { sum } from 'frappe/public/utils/util.js'
|
// import { sum } from 'frappe/public/utils/util.js'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user