2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
2014-07-22 13:32:11 +00:00
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2016-04-29 11:52:42 +00:00
|
|
|
frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|
|
|
frappe.query_reports["Trial Balance"] = {
|
|
|
|
"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",
|
2023-07-16 07:28:42 +00:00
|
|
|
"default": erpnext.utils.get_fiscal_year(frappe.datetime.get_today()),
|
2016-04-29 11:52:42 +00:00
|
|
|
"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);
|
2018-07-18 03:58:44 +00:00
|
|
|
frappe.query_report.set_filter_value({
|
|
|
|
from_date: fy.year_start_date,
|
|
|
|
to_date: fy.year_end_date
|
|
|
|
});
|
2016-04-29 11:52:42 +00:00
|
|
|
});
|
2014-07-22 13:32:11 +00:00
|
|
|
}
|
2016-04-29 11:52:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "from_date",
|
|
|
|
"label": __("From Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"default": frappe.defaults.get_user_default("year_start_date"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "to_date",
|
|
|
|
"label": __("To Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"default": frappe.defaults.get_user_default("year_end_date"),
|
|
|
|
},
|
2019-01-15 10:22:52 +00:00
|
|
|
{
|
2020-05-15 07:28:48 +00:00
|
|
|
"fieldname": "cost_center",
|
2019-01-15 10:22:52 +00:00
|
|
|
"label": __("Cost Center"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Cost Center",
|
|
|
|
"get_query": function() {
|
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
|
|
|
return {
|
|
|
|
"doctype": "Cost Center",
|
|
|
|
"filters": {
|
|
|
|
"company": company,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2020-05-15 07:28:48 +00:00
|
|
|
"fieldname": "project",
|
|
|
|
"label": __("Project"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Project"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "finance_book",
|
2019-01-15 10:22:52 +00:00
|
|
|
"label": __("Finance Book"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Finance Book",
|
|
|
|
},
|
2020-09-29 20:02:42 +00:00
|
|
|
{
|
|
|
|
"fieldname": "presentation_currency",
|
|
|
|
"label": __("Currency"),
|
|
|
|
"fieldtype": "Select",
|
2020-09-30 05:09:26 +00:00
|
|
|
"options": erpnext.get_presentation_currency_list()
|
2020-09-29 20:02:42 +00:00
|
|
|
},
|
2016-04-29 11:52:42 +00:00
|
|
|
{
|
|
|
|
"fieldname": "with_period_closing_entry",
|
|
|
|
"label": __("Period Closing Entry"),
|
|
|
|
"fieldtype": "Check",
|
|
|
|
"default": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "show_zero_values",
|
|
|
|
"label": __("Show zero values"),
|
|
|
|
"fieldtype": "Check"
|
|
|
|
},
|
2016-10-17 11:27:52 +00:00
|
|
|
{
|
|
|
|
"fieldname": "show_unclosed_fy_pl_balances",
|
|
|
|
"label": __("Show unclosed fiscal year's P&L balances"),
|
|
|
|
"fieldtype": "Check"
|
2019-01-15 10:22:52 +00:00
|
|
|
},
|
|
|
|
{
|
2019-01-17 12:23:58 +00:00
|
|
|
"fieldname": "include_default_book_entries",
|
|
|
|
"label": __("Include Default Book Entries"),
|
2020-01-27 09:48:51 +00:00
|
|
|
"fieldtype": "Check",
|
|
|
|
"default": 1
|
2016-10-17 11:27:52 +00:00
|
|
|
}
|
2016-04-29 11:52:42 +00:00
|
|
|
],
|
|
|
|
"formatter": erpnext.financial_statements.formatter,
|
|
|
|
"tree": true,
|
|
|
|
"name_field": "account",
|
|
|
|
"parent_field": "parent_account",
|
|
|
|
"initial_depth": 3
|
|
|
|
}
|
|
|
|
|
2020-05-26 13:53:45 +00:00
|
|
|
erpnext.utils.add_dimensions('Trial Balance', 6);
|
2019-07-03 12:38:41 +00:00
|
|
|
});
|