brotherton-erpnext/erpnext/regional/report/gstr_1/gstr_1.js
Deepesh Garg 56e23e7d47 feat: GSTR1 json format download (#16887)
* feat: download gstr-1 b2b in json in its appropriate json format

* fix: download file as raw type

* feat: added logic to convert export gst data to its json

* code commonify and logic for b2cl added

* fix: Codacy and typo fixes

* fix: B2B json creation fixes

* fix: Filter customer by category

* fix: Fetch fp from to date
2019-03-29 22:22:54 +05:30

69 lines
1.6 KiB
JavaScript

// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.query_reports["GSTR-1"] = {
"filters": [
{
"fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname": "company_address",
"label": __("Address"),
"fieldtype": "Link",
"options": "Address",
"get_query": function () {
var company = frappe.query_report.get_filter_value('company');
if (company) {
return {
"query": 'frappe.contacts.doctype.address.address.address_query',
"filters": { link_doctype: 'Company', link_name: company }
};
}
}
},
{
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -3),
"width": "80"
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.get_today()
},
{
"fieldname": "type_of_business",
"label": __("Type of Business"),
"fieldtype": "Select",
"reqd": 1,
"options": ["B2B", "B2C Large", "B2C Small", "CDNR", "EXPORT"],
"default": "B2B"
}
],
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);
});
}
}