// Copyright (c) 2024, Company and contributors
// For license information, please see license.txt

frappe.query_reports["Sales invoice info 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);

		// Highlight net amount in blue
		if (column.fieldname == "net_amount" && data && data.net_amount > 0) {
			value = "<span style='color: #1f77b4; font-weight: bold;'>" + value + "</span>";
		}

		// Highlight VAT amount in green
		if (column.fieldname == "vat_amount" && data && data.vat_amount > 0) {
			value = "<span style='color: #2ca02c;'>" + value + "</span>";
		}

		// Highlight grand total in dark gray
		if (column.fieldname == "grand_total" && data && data.grand_total > 0) {
			value = "<span style='color: #333; font-weight: bold;'>" + value + "</span>";
		}

		return value;
	}
};