Hello, below is the script for Accounts payable summary. Kindly help me to edit the script to sort supplier name in assending order.
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.query_reports[“Accounts Payable Summary”] = {
“filters”: [
{
“fieldname”:“company”,
“label”: __(“Company”),
“fieldtype”: “Link”,
“options”: “Company”,
“default”: frappe.defaults.get_user_default(“Company”)
},
{
“fieldname”:“report_date”,
“label”: __(“Posting Date”),
“fieldtype”: “Date”,
“default”: frappe.datetime.get_today()
},
{
“fieldname”:“ageing_based_on”,
“label”: __(“Ageing Based On”),
“fieldtype”: “Select”,
“options”: ‘Posting Date\nDue Date’,
“default”: “Posting Date”
},
{
“fieldname”:“range1”,
“label”: __(“Ageing Range 1”),
“fieldtype”: “Int”,
“default”: “30”,
“reqd”: 1
},
{
“fieldname”:“range2”,
“label”: __(“Ageing Range 2”),
“fieldtype”: “Int”,
“default”: “60”,
“reqd”: 1
},
{
“fieldname”:“range3”,
“label”: __(“Ageing Range 3”),
“fieldtype”: “Int”,
“default”: “90”,
“reqd”: 1
},
{
“fieldname”:“range4”,
“label”: __(“Ageing Range 4”),
“fieldtype”: “Int”,
“default”: “120”,
“reqd”: 1
},
{
“fieldname”:“finance_book”,
“label”: __(“Finance Book”),
“fieldtype”: “Link”,
“options”: “Finance Book”
},
{
“fieldname”:“cost_center”,
“label”: __(“Cost Center”),
“fieldtype”: “Link”,
“options”: “Cost Center”,
get_query: () => {
var company = frappe.query_report.get_filter_value(‘company’);
return {
filters: {
‘company’: company
}
}
}
},
{
“fieldname”:“supplier”,
“label”: __(“Supplier”),
“fieldtype”: “Link”,
“options”: “Supplier”
},
{
“fieldname”:“payment_terms_template”,
“label”: __(“Payment Terms Template”),
“fieldtype”: “Link”,
“options”: “Payment Terms Template”
},
{
“fieldname”:“supplier_group”,
“label”: __(“Supplier Group”),
“fieldtype”: “Link”,
“options”: “Supplier Group”
},
{
“fieldname”:“based_on_payment_terms”,
“label”: __(“Based On Payment Terms”),
“fieldtype”: “Check”,
}
],
“formatter”: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (column.fieldname == "range1" || column.fieldname == "range2" || column.fieldname == "range3" || column.fieldname == "range4" || column.fieldname == "range5") {
if(data!=undefined){
if(data.credit_days>0){
if( frappe.query_report.get_filter_value("range1")>data.credit_days && column.fieldname == "range1"){
value = "<span style='color:red'>" + value + "</span>";
}
if((frappe.query_report.get_filter_value("range1")+1)>data.credit_days && column.fieldname == "range2"){
value = "<span style='color:red'>" + value + "</span>";
}
if((frappe.query_report.get_filter_value("range2")+1)>data.credit_days && column.fieldname == "range3"){
value = "<span style='color:red'>" + value + "</span>";
}
if((frappe.query_report.get_filter_value("range3")+1)>data.credit_days && column.fieldname == "range4"){
value = "<span style='color:red'>" + value + "</span>";
}
if((frappe.query_report.get_filter_value("range4")+1)>data.credit_days && column.fieldname == "range5"){
value = "<span style='color:red'>" + value + "</span>";
}
}
}
}
return value;
},
onload: function(report) {
report.page.add_inner_button(__("Accounts Payable"), function() {
var filters = report.get_values();
frappe.set_route('query-report', 'Accounts Payable', {company: filters.company});
});
}
}
erpnext.utils.add_dimensions(‘Accounts Payable Summary’, 9);