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