2018-02-12 10:34:50 +01:00
|
|
|
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
2013-12-06 16:36:23 +05:30
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
2014-02-14 15:47:51 +05:30
|
|
|
frappe.query_reports["General Ledger"] = {
|
2013-12-06 16:36:23 +05:30
|
|
|
"filters": [
|
|
|
|
{
|
|
|
|
"fieldname":"company",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("Company"),
|
2013-12-06 16:36:23 +05:30
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
2015-12-23 16:37:00 +05:30
|
|
|
"default": frappe.defaults.get_user_default("Company"),
|
2013-12-06 16:36:23 +05:30
|
|
|
"reqd": 1
|
|
|
|
},
|
2018-04-23 02:29:22 +05:30
|
|
|
{
|
|
|
|
"fieldname":"finance_book",
|
|
|
|
"label": __("Finance Book"),
|
|
|
|
"fieldtype": "Link",
|
2018-05-09 15:10:29 +05:30
|
|
|
"options": "Finance Book"
|
2018-04-23 02:29:22 +05:30
|
|
|
},
|
2013-12-06 16:36:23 +05:30
|
|
|
{
|
|
|
|
"fieldname":"from_date",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("From Date"),
|
2013-12-06 16:36:23 +05:30
|
|
|
"fieldtype": "Date",
|
2014-02-14 15:47:51 +05:30
|
|
|
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
|
2013-12-06 16:36:23 +05:30
|
|
|
"reqd": 1,
|
|
|
|
"width": "60px"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"to_date",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("To Date"),
|
2013-12-06 16:36:23 +05:30
|
|
|
"fieldtype": "Date",
|
2014-02-14 15:47:51 +05:30
|
|
|
"default": frappe.datetime.get_today(),
|
2013-12-06 16:36:23 +05:30
|
|
|
"reqd": 1,
|
|
|
|
"width": "60px"
|
2013-12-27 17:33:55 +05:30
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"account",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("Account"),
|
2021-06-14 13:22:44 +05:30
|
|
|
"fieldtype": "MultiSelectList",
|
2013-12-27 17:33:55 +05:30
|
|
|
"options": "Account",
|
2021-06-14 13:22:44 +05:30
|
|
|
get_data: function(txt) {
|
|
|
|
return frappe.db.get_link_options('Account', txt, {
|
|
|
|
company: frappe.query_report.get_filter_value("company")
|
|
|
|
});
|
2013-12-27 17:33:55 +05:30
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"voucher_no",
|
2014-04-14 16:25:30 +05:30
|
|
|
"label": __("Voucher No"),
|
2013-12-27 17:33:55 +05:30
|
|
|
"fieldtype": "Data",
|
2018-04-19 15:09:46 +05:30
|
|
|
on_change: function() {
|
2020-05-13 19:48:42 +05:30
|
|
|
frappe.query_report.set_filter_value('group_by', "Group by Voucher (Consolidated)");
|
2018-04-19 15:09:46 +05:30
|
|
|
}
|
2013-12-27 17:33:55 +05:30
|
|
|
},
|
2015-01-12 12:18:54 +05:30
|
|
|
{
|
|
|
|
"fieldtype": "Break",
|
|
|
|
},
|
2015-04-20 17:13:43 +05:30
|
|
|
{
|
|
|
|
"fieldname":"party_type",
|
|
|
|
"label": __("Party Type"),
|
2017-02-01 12:02:08 +05:30
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Party Type",
|
2018-03-27 11:29:25 +05:30
|
|
|
"default": "",
|
|
|
|
on_change: function() {
|
2018-07-18 09:28:44 +05:30
|
|
|
frappe.query_report.set_filter_value('party', "");
|
2018-03-27 11:29:25 +05:30
|
|
|
}
|
2015-04-20 17:13:43 +05:30
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"party",
|
|
|
|
"label": __("Party"),
|
2019-06-19 12:15:37 +05:30
|
|
|
"fieldtype": "MultiSelectList",
|
|
|
|
get_data: function(txt) {
|
2018-07-20 16:31:01 +05:30
|
|
|
if (!frappe.query_report.filters) return;
|
2018-05-03 19:00:43 +05:30
|
|
|
|
2019-06-19 12:15:37 +05:30
|
|
|
let party_type = frappe.query_report.get_filter_value('party_type');
|
|
|
|
if (!party_type) return;
|
2018-05-03 19:00:43 +05:30
|
|
|
|
2019-06-19 12:15:37 +05:30
|
|
|
return frappe.db.get_link_options(party_type, txt);
|
2017-05-11 11:38:30 +05:30
|
|
|
},
|
2017-06-27 11:56:30 +05:30
|
|
|
on_change: function() {
|
2018-07-18 09:28:44 +05:30
|
|
|
var party_type = frappe.query_report.get_filter_value('party_type');
|
|
|
|
var parties = frappe.query_report.get_filter_value('party');
|
2018-05-03 19:00:43 +05:30
|
|
|
|
2019-06-19 12:15:37 +05:30
|
|
|
if(!party_type || parties.length === 0 || parties.length > 1) {
|
2018-07-18 09:28:44 +05:30
|
|
|
frappe.query_report.set_filter_value('party_name', "");
|
|
|
|
frappe.query_report.set_filter_value('tax_id', "");
|
2017-05-11 11:38:30 +05:30
|
|
|
return;
|
2018-05-03 19:00:43 +05:30
|
|
|
} else {
|
2019-06-19 12:15:37 +05:30
|
|
|
var party = parties[0];
|
2018-05-03 19:00:43 +05:30
|
|
|
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
|
|
|
|
frappe.db.get_value(party_type, party, fieldname, function(value) {
|
2018-07-18 09:28:44 +05:30
|
|
|
frappe.query_report.set_filter_value('party_name', value[fieldname]);
|
2018-03-23 15:04:37 +05:30
|
|
|
});
|
2018-05-03 19:00:43 +05:30
|
|
|
|
|
|
|
if (party_type === "Customer" || party_type === "Supplier") {
|
|
|
|
frappe.db.get_value(party_type, party, "tax_id", function(value) {
|
2018-07-18 09:28:44 +05:30
|
|
|
frappe.query_report.set_filter_value('tax_id', value["tax_id"]);
|
2018-05-03 19:00:43 +05:30
|
|
|
});
|
|
|
|
}
|
2018-03-23 15:04:37 +05:30
|
|
|
}
|
2015-04-20 17:13:43 +05:30
|
|
|
}
|
|
|
|
},
|
2017-05-11 11:38:30 +05:30
|
|
|
{
|
|
|
|
"fieldname":"party_name",
|
|
|
|
"label": __("Party Name"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
|
|
|
},
|
2018-04-17 15:12:26 +05:30
|
|
|
{
|
|
|
|
"fieldname":"group_by",
|
|
|
|
"label": __("Group by"),
|
|
|
|
"fieldtype": "Select",
|
2018-11-12 16:58:24 +05:30
|
|
|
"options": ["", __("Group by Voucher"), __("Group by Voucher (Consolidated)"),
|
|
|
|
__("Group by Account"), __("Group by Party")],
|
|
|
|
"default": __("Group by Voucher (Consolidated)")
|
2018-04-17 15:12:26 +05:30
|
|
|
},
|
2018-03-23 15:04:37 +05:30
|
|
|
{
|
|
|
|
"fieldname":"tax_id",
|
|
|
|
"label": __("Tax Id"),
|
|
|
|
"fieldtype": "Data",
|
|
|
|
"hidden": 1
|
|
|
|
},
|
2018-01-18 09:32:43 +05:30
|
|
|
{
|
2018-02-12 10:34:50 +01:00
|
|
|
"fieldname": "presentation_currency",
|
|
|
|
"label": __("Currency"),
|
|
|
|
"fieldtype": "Select",
|
|
|
|
"options": erpnext.get_presentation_currency_list()
|
2019-05-20 12:25:53 +05:30
|
|
|
},
|
2019-05-28 12:15:56 +05:30
|
|
|
{
|
|
|
|
"fieldname":"cost_center",
|
|
|
|
"label": __("Cost Center"),
|
2019-06-19 12:15:37 +05:30
|
|
|
"fieldtype": "MultiSelectList",
|
|
|
|
get_data: function(txt) {
|
2021-06-14 16:41:56 +05:30
|
|
|
return frappe.db.get_link_options('Cost Center', txt, {
|
|
|
|
company: frappe.query_report.get_filter_value("company")
|
|
|
|
});
|
2019-05-28 12:15:56 +05:30
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"project",
|
|
|
|
"label": __("Project"),
|
2019-06-19 12:15:37 +05:30
|
|
|
"fieldtype": "MultiSelectList",
|
|
|
|
get_data: function(txt) {
|
2021-06-14 16:42:27 +05:30
|
|
|
return frappe.db.get_link_options('Project', txt, {
|
|
|
|
company: frappe.query_report.get_filter_value("company")
|
|
|
|
});
|
2019-05-28 12:15:56 +05:30
|
|
|
}
|
|
|
|
},
|
2020-08-14 06:42:54 +00:00
|
|
|
{
|
|
|
|
"fieldname": "include_dimensions",
|
|
|
|
"label": __("Consider Accounting Dimensions"),
|
|
|
|
"fieldtype": "Check",
|
|
|
|
"default": 0
|
|
|
|
},
|
2019-05-20 12:25:53 +05:30
|
|
|
{
|
|
|
|
"fieldname": "show_opening_entries",
|
|
|
|
"label": __("Show Opening Entries"),
|
|
|
|
"fieldtype": "Check"
|
2019-05-28 12:15:56 +05:30
|
|
|
},
|
2019-06-18 18:34:14 +05:30
|
|
|
{
|
|
|
|
"fieldname": "include_default_book_entries",
|
|
|
|
"label": __("Include Default Book Entries"),
|
2020-04-30 10:38:58 +05:30
|
|
|
"fieldtype": "Check"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "show_cancelled_entries",
|
|
|
|
"label": __("Show Cancelled Entries"),
|
|
|
|
"fieldtype": "Check"
|
2021-05-25 20:39:17 +05:30
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname": "show_net_values_in_party_account",
|
|
|
|
"label": __("Show Net Values in Party Account"),
|
|
|
|
"fieldtype": "Check"
|
2019-06-18 18:34:14 +05:30
|
|
|
}
|
2013-12-06 16:36:23 +05:30
|
|
|
]
|
2015-01-12 12:18:54 +05:30
|
|
|
}
|
2019-05-12 18:34:23 +05:30
|
|
|
|
2020-05-26 19:23:45 +05:30
|
|
|
erpnext.utils.add_dimensions('General Ledger', 15)
|
2019-07-17 15:38:21 +05:30
|
|
|
|