2019-01-17 19:04:01 +00:00
|
|
|
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
|
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
|
|
|
|
frappe.query_reports["IRS 1099"] = {
|
|
|
|
"filters": [
|
|
|
|
{
|
2021-01-19 13:31:13 +00:00
|
|
|
"fieldname": "company",
|
2019-01-17 19:04:01 +00:00
|
|
|
"label": __("Company"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Company",
|
|
|
|
"default": frappe.defaults.get_user_default("Company"),
|
|
|
|
"reqd": 1,
|
|
|
|
"width": 80,
|
|
|
|
},
|
|
|
|
{
|
2021-01-19 13:31:13 +00:00
|
|
|
"fieldname": "fiscal_year",
|
2019-01-17 19:04:01 +00:00
|
|
|
"label": __("Fiscal Year"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Fiscal Year",
|
|
|
|
"default": frappe.defaults.get_user_default("fiscal_year"),
|
|
|
|
"reqd": 1,
|
|
|
|
"width": 80,
|
|
|
|
},
|
|
|
|
{
|
2021-01-19 13:31:13 +00:00
|
|
|
"fieldname": "supplier_group",
|
2019-01-17 19:04:01 +00:00
|
|
|
"label": __("Supplier Group"),
|
|
|
|
"fieldtype": "Link",
|
|
|
|
"options": "Supplier Group",
|
|
|
|
"default": "",
|
|
|
|
"reqd": 0,
|
|
|
|
"width": 80
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
2021-01-19 13:31:13 +00:00
|
|
|
onload: function (query_report) {
|
2019-01-17 19:04:01 +00:00
|
|
|
query_report.page.add_inner_button(__("Print IRS 1099 Forms"), () => {
|
|
|
|
build_1099_print(query_report);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-19 13:31:13 +00:00
|
|
|
function build_1099_print(query_report) {
|
2019-01-17 19:04:01 +00:00
|
|
|
let filters = JSON.stringify(query_report.get_values());
|
|
|
|
let w = window.open('/api/method/erpnext.regional.report.irs_1099.irs_1099.irs_1099_print?' +
|
2021-01-19 13:31:13 +00:00
|
|
|
'&filters=' + encodeURIComponent(filters));
|
2019-01-17 19:04:01 +00:00
|
|
|
// w.print();
|
|
|
|
}
|