brotherton-erpnext/erpnext/fleet_management/report/vehicle_expenses/vehicle_expenses.js
Pawan Mehta 1a96cc1e8d Fixes 6171 (#6417)
* [fix] #6171

* [fix] #6171

* [fix] #6171

* [fix] #6171

* [fix] #6171

* [fix] #6171

* [fix] #6171

* [fix] #6171
2016-10-17 17:02:12 +05:30

42 lines
1.3 KiB
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_filters_by_name.from_date.set_input(fy.year_start_date);
frappe.query_report_filters_by_name.to_date.set_input(fy.year_end_date);
query_report.trigger_refresh();
});
}
},
{
"fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_start_date"),
},
{
"fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.defaults.get_user_default("year_end_date"),
}
]
}
});