Hello,
May I know how to change color of values in non-standard Script Report (Is Standard = No).
Ref DocType: Attendance
Is Standard: No
Report Type: Script Report
Query / Script (Script)
columns = [
{'fieldname':'name','label':'ID','fieldtype':'Link', 'options': 'Attendance', "width": 200},
{'fieldname':'employee_name','label':'Employee Name','fieldtype':'Data', "width": 300 },
{'fieldname':'attendance_date','label':'Attendance Date','fieldtype':'Date', "width": 200},
{'fieldname':'status','label':'Status','fieldtype':'Data', "width": 200}
]
data = columns, frappe.db.get_all('Attendance', ['name','employee_name','attendance_date','status'])
Client Code (Javascript)
frappe.query_reports["Test script Report"] = {
"filters": [
{
fieldname: "date_filter",
label: "Date Filter",
fieldtype: "Date",
Note the following default attribute, which contains an API call
default: frappe.datetime.get_today()
}
],
formatter:function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if(column.fieldname == 'status'){
if(value == 'Present'){
value = `<b style="color:green">${value}</b>`
}else if(value == 'Absent'){
value = `<b style="color:red">${value}</b>`
}
}
return value;
}
};
In Report Absent should be in Red.
Thanks.