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

frappe.query_reports["Payment entry 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 paid amount in blue
		if (column.fieldname == "paid_amount" && data && data.paid_amount > 0) {
			value = "<span style='color: #1f77b4; font-weight: bold;'>" + value + "</span>";
		}

		// Highlight received amount in green
		if (column.fieldname == "received_amount" && data && data.received_amount > 0) {
			value = "<span style='color: #2ca02c; font-weight: bold;'>" + value + "</span>";
		}

		// Highlight VAT amount in orange
		if (column.fieldname == "vat_amount" && data && data.vat_amount > 0) {
			value = "<span style='color: #ff7f0e; font-weight: bold;'>" + value + "</span>";
		}

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

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

		return value;
	}
};