[fix] duplicate columns in monthly salary report #6623
This commit is contained in:
parent
025fbd8f14
commit
bc0783b527
@ -42,20 +42,20 @@ def get_columns(salary_slips):
|
|||||||
_("Payment Days") + ":Float:120"
|
_("Payment Days") + ":Float:120"
|
||||||
]
|
]
|
||||||
|
|
||||||
earning_types = frappe.db.sql_list("""select distinct salary_component from `tabSalary Detail`
|
salary_components = {_("Earning"): [], _("Deduction"): []}
|
||||||
where amount != 0 and parent in (%s)""" %
|
|
||||||
(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
|
|
||||||
|
|
||||||
ded_types = frappe.db.sql_list("""select distinct salary_component from `tabSalary Detail`
|
for component in frappe.db.sql("""select distinct sd.salary_component, sc.type
|
||||||
where amount != 0 and parent in (%s)""" %
|
from `tabSalary Detail` sd, `tabSalary Component` sc
|
||||||
(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
|
where sc.name=sd.salary_component and sd.amount != 0 and sd.parent in (%s)""" %
|
||||||
|
(', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1):
|
||||||
|
salary_components[component.type].append(component.salary_component)
|
||||||
|
|
||||||
columns = columns + [(e + ":Currency:120") for e in earning_types] + \
|
columns = columns + [(e + ":Currency:120") for e in salary_components[_("Earning")]] + \
|
||||||
["Arrear Amount:Currency:120", "Leave Encashment Amount:Currency:150",
|
[ _("Arrear Amount") + ":Currency:120", _("Leave Encashment Amount") + ":Currency:150",
|
||||||
"Gross Pay:Currency:120"] + [(d + ":Currency:120") for d in ded_types] + \
|
_("Gross Pay") + ":Currency:120"] + [(d + ":Currency:120") for d in salary_components[_("Deduction")]] + \
|
||||||
["Total Deduction:Currency:120", "Net Pay:Currency:120"]
|
[_("Total Deduction") + ":Currency:120", _("Net Pay") + ":Currency:120"]
|
||||||
|
|
||||||
return columns, earning_types, ded_types
|
return columns, salary_components[_("Earning")], salary_components[_("Deduction")]
|
||||||
|
|
||||||
def get_salary_slips(filters):
|
def get_salary_slips(filters):
|
||||||
conditions, filters = get_conditions(filters)
|
conditions, filters = get_conditions(filters)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user