2015-03-03 09:25:30 +00:00
|
|
|
// Copyright (c) 2015, 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
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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() {
|
2016-09-01 12:23:19 +00:00
|
|
|
var company = frappe.query_report_filters_by_name.company.get_value();
|
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",
|
|
|
|
},
|
2017-01-24 09:42:24 +00:00
|
|
|
{
|
|
|
|
"fieldname":"project",
|
|
|
|
"label": __("Project"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Project"
|
|
|
|
},
|
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",
|
2015-07-13 04:53:41 +00:00
|
|
|
"default": ""
|
2015-04-20 11:43:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"party",
|
|
|
|
"label": __("Party"),
|
|
|
|
"fieldtype": "Dynamic Link",
|
|
|
|
"get_options": function() {
|
2016-09-01 12:23:19 +00:00
|
|
|
var party_type = frappe.query_report_filters_by_name.party_type.get_value();
|
|
|
|
var party = frappe.query_report_filters_by_name.party.get_value();
|
2015-04-20 11:43:43 +00:00
|
|
|
if(party && !party_type) {
|
|
|
|
frappe.throw(__("Please select Party Type first"));
|
|
|
|
}
|
|
|
|
return party_type;
|
2017-05-11 06:08:30 +00:00
|
|
|
},
|
2017-06-27 06:26:30 +00:00
|
|
|
on_change: function() {
|
2017-05-11 06:08:30 +00:00
|
|
|
var party_type = frappe.query_report_filters_by_name.party_type.get_value();
|
|
|
|
var party = frappe.query_report_filters_by_name.party.get_value();
|
|
|
|
if(!party_type || !party) {
|
|
|
|
frappe.query_report_filters_by_name.party_name.set_value("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-11-30 10:23:39 +00:00
|
|
|
var fieldname = frappe.scrub(party_type) + "_name";
|
2017-05-11 06:08:30 +00:00
|
|
|
frappe.db.get_value(party_type, party, fieldname, function(value) {
|
|
|
|
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
|
|
|
|
});
|
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
|
|
|
|
},
|
2013-12-27 12:03:55 +00:00
|
|
|
{
|
|
|
|
"fieldname":"group_by_voucher",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Group by Voucher"),
|
2013-12-27 12:03:55 +00:00
|
|
|
"fieldtype": "Check",
|
|
|
|
"default": 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"group_by_account",
|
2014-04-14 10:55:30 +00:00
|
|
|
"label": __("Group by Account"),
|
2013-12-27 12:03:55 +00:00
|
|
|
"fieldtype": "Check",
|
2018-01-18 04:02:43 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"fieldname":"print_in_account_currency",
|
|
|
|
"label": __("Print in Account Currency"),
|
|
|
|
"fieldtype": "Check",
|
2013-12-06 11:06:23 +00:00
|
|
|
}
|
|
|
|
]
|
2015-01-12 06:48:54 +00:00
|
|
|
}
|