// Copyright (c) 2024, Nitin Jain and contributors
// For license information, please see license.txt
frappe.query_reports[“MoM Expenses”] = {
“filters”: [
{
“fieldname”: “period”,
“label”: __(“Period”),
“fieldtype”: “Select”,
“options”: [“Monthly”, “Quarterly”, “Yearly”],
“default”: “Monthly”,
“reqd”: 1
},
{
“fieldname”: “financial_year”,
“label”: __(“Financial Year”),
“fieldtype”: “Select”,
“options”: get_financial_years(),
“default”: get_default_financial_year(),
“reqd”: 1
},
{
“fieldname”: “vendor_name”,
“label”: __(“Selected Vendor”),
“fieldtype”: “Link”,
“options”: “NG 02 Vendor Master”, // Link to the correct doctype
“reqd”: 0
}
]
};
// Helper function to generate financial year options
function get_financial_years() {
const currentYear = new Date().getFullYear();
const financialYears = ;
for (let i = 0; i < 5; i++) {
const startYear = currentYear - i;
const endYear = startYear + 1;
financialYears.push(${startYear}-${endYear}
);
}
return financialYears;
}
// Helper function to get the default financial year
function get_default_financial_year() {
const currentDate = new Date();
const currentMonth = currentDate.getMonth() + 1; // Months are 0-indexed in JS
const currentYear = currentDate.getFullYear();
// If before April, return the previous financial year
if (currentMonth < 4) {
return `${currentYear - 1}-${currentYear}`;
} else {
return `${currentYear}-${currentYear + 1}`;
}
}
why this code not showing in report in deployed frappe site. Showing in local setup