// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.query_reports["Mining Resources Stock Report"] = {
	filters: [
		{
			fieldname: "from_date",
			label: __("From Date"),
			fieldtype: "Date",
			default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
			reqd: 1,
		},
		{
			fieldname: "to_date",
			label: __("To Date"),
			fieldtype: "Date",
			default: frappe.datetime.get_today(),
			reqd: 1,
		}
	],
	formatter: function (value, row, column, data, default_formatter) {
		value = default_formatter(value, row, column, data);
		
		// Format stock quantity columns with green color for positive values
		if (column.fieldtype == "Float" && data && parseFloat(value) > 0) {
			value = "<span style='color:green; font-weight: bold'>" + value + "</span>";
		}
		
		// Format sales amount columns with blue color for positive values
		if (column.fieldtype == "Currency" && data && parseFloat(value) > 0) {
			value = "<span style='color:blue; font-weight: bold'>" + value + "</span>";
		}
		
		// Format date column
		if (column.fieldname == "date") {
			value = "<span style='font-weight: bold'>" + value + "</span>";
		}

		return value;
	}
};