2018-01-10 12:18:03 +00:00
|
|
|
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
frappe.query_reports["GSTR-1"] = {
|
|
|
|
"filters": [
|
|
|
|
{
|
2019-03-29 16:52:54 +00:00
|
|
|
"fieldname": "company",
|
2018-01-10 12:18:03 +00:00
|
|
|
"label": __("Company"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
|
|
|
"reqd": 1,
|
|
|
|
"default": frappe.defaults.get_user_default("Company")
|
|
|
|
},
|
2018-05-31 04:03:36 +00:00
|
|
|
{
|
2019-03-29 16:52:54 +00:00
|
|
|
"fieldname": "company_address",
|
2018-05-31 04:03:36 +00:00
|
|
|
"label": __("Address"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Address",
|
2019-03-29 16:52:54 +00:00
|
|
|
"get_query": function () {
|
2018-07-18 03:58:44 +00:00
|
|
|
var company = frappe.query_report.get_filter_value('company');
|
2018-05-31 04:03:36 +00:00
|
|
|
if (company) {
|
|
|
|
return {
|
|
|
|
"query": 'frappe.contacts.doctype.address.address.address_query',
|
2019-03-29 16:52:54 +00:00
|
|
|
"filters": { link_doctype: 'Company', link_name: company }
|
2018-05-31 04:03:36 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2018-01-10 12:18:03 +00:00
|
|
|
{
|
2019-03-29 16:52:54 +00:00
|
|
|
"fieldname": "from_date",
|
2018-01-10 12:18:03 +00:00
|
|
|
"label": __("From Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"reqd": 1,
|
|
|
|
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -3),
|
|
|
|
"width": "80"
|
|
|
|
},
|
|
|
|
{
|
2019-03-29 16:52:54 +00:00
|
|
|
"fieldname": "to_date",
|
2018-01-10 12:18:03 +00:00
|
|
|
"label": __("To Date"),
|
|
|
|
"fieldtype": "Date",
|
|
|
|
"reqd": 1,
|
|
|
|
"default": frappe.datetime.get_today()
|
|
|
|
},
|
|
|
|
{
|
2019-03-29 16:52:54 +00:00
|
|
|
"fieldname": "type_of_business",
|
2018-01-10 12:18:03 +00:00
|
|
|
"label": __("Type of Business"),
|
|
|
|
"fieldtype": "Select",
|
|
|
|
"reqd": 1,
|
2019-03-29 16:52:54 +00:00
|
|
|
"options": ["B2B", "B2C Large", "B2C Small", "CDNR", "EXPORT"],
|
2018-01-10 12:18:03 +00:00
|
|
|
"default": "B2B"
|
|
|
|
}
|
2019-03-29 16:52:54 +00:00
|
|
|
],
|
|
|
|
onload: function (report) {
|
|
|
|
|
|
|
|
report.page.add_inner_button(__("Download as Json"), function () {
|
|
|
|
var filters = report.get_values();
|
|
|
|
|
|
|
|
const args = {
|
|
|
|
cmd: 'erpnext.regional.report.gstr_1.gstr_1.get_json',
|
|
|
|
data: report.data,
|
|
|
|
report_name: report.report_name,
|
|
|
|
filters: filters
|
|
|
|
};
|
|
|
|
|
|
|
|
open_url_post(frappe.request.url, args);
|
|
|
|
});
|
|
|
|
}
|
2018-01-10 12:18:03 +00:00
|
|
|
}
|