brotherton-erpnext/erpnext/hr/report/vehicle_expenses/vehicle_expenses.js
Faris Ansari 9e874af9ba Query report print (#14935)
* QueryReport

- Only print visible columns in report
- Use get_columns_for_print method instead of directly
accessing report.columns

* Query Report

- Replace frappe.query_report_filters_by_name with new API
2018-07-18 09:28:44 +05:30

32 lines
895 B
JavaScript

// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Vehicle Expenses"] = {
"filters": [
{
"fieldname": "fiscal_year",
"label": __("Fiscal Year"),
"fieldtype": "Link",
"options": "Fiscal Year",
"default": frappe.defaults.get_user_default("fiscal_year"),
"reqd": 1,
"on_change": function(query_report) {
var fiscal_year = query_report.get_values().fiscal_year;
if (!fiscal_year) {
return;
}
frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
frappe.query_report.set_filter({
from_date: fy.year_start_date,
to_date: fy.year_end_date
});
});
}
}
]
}
});