Skip to content

Commit

Permalink
fix: filter and bold issue in Salary Payments Based On Payment Mode (…
Browse files Browse the repository at this point in the history
…backport #2025) (#2049)

* fix: filter and bold issue in Salary Payments Based On Payment Mode

* fix: filter and bold issue in Salary Payments Based On Payment Mode --prettier

(cherry picked from commit 567ab9e)

Co-authored-by: Nihantra C. Patel <[email protected]>
  • Loading branch information
mergify[bot] and Nihantra-Patel authored Aug 6, 2024
1 parent cd1bdc0 commit 46ed7be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
// For license information, please see license.txt
/* eslint-disable */

frappe.require("assets/hrms/js/salary_slip_deductions_report_filters.js", function () {
frappe.query_reports["Salary Payments Based On Payment Mode"] =
hrms.salary_slip_deductions_report_filters;
});
frappe.query_reports["Salary Payments Based On Payment Mode"] = $.extend(
{},
hrms.salary_slip_deductions_report_filters,
{
formatter: function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);
if (data.branch && data.branch.includes("Total") && column.colIndex === 1) {
value = value.bold();
}
return value;
},
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def get_data(filters, mode_of_payments):
if data:
data.append(total_row)
data.append({})
data.append({"branch": "<b>Total Gross Pay</b>", mode_of_payments[0]: gross_pay})
data.append({"branch": "<b>Total Deductions</b>", mode_of_payments[0]: total_deductions})
data.append({"branch": "<b>Total Net Pay</b>", mode_of_payments[0]: total_row.get("total")})
data.append({"branch": "Total Gross Pay", mode_of_payments[0]: gross_pay})
data.append({"branch": "Total Deductions", mode_of_payments[0]: total_deductions})
data.append({"branch": "Total Net Pay", mode_of_payments[0]: total_row.get("total")})

currency = erpnext.get_company_currency(filters.company)
report_summary = get_report_summary(gross_pay, total_deductions, total_row.get("total"), currency)
Expand All @@ -124,7 +124,7 @@ def get_data(filters, mode_of_payments):

def get_total_based_on_mode_of_payment(data, mode_of_payments):
total = 0
total_row = {"branch": "<b>Total</b>"}
total_row = {"branch": "Total"}
for mode in mode_of_payments:
sum_of_payment = sum([detail[mode] for detail in data if mode in detail.keys()])
total_row[mode] = sum_of_payment
Expand Down

0 comments on commit 46ed7be

Please sign in to comment.