fix: (Backport-develop) track salary slip ytd gross salary. (#27242)
* fix: track salary slip ytd gross salary. * fix: ytd gross salary unique label * Revert "fix: ytd gross salary unique label" This reverts commit a68b387ac21e32c250d042caf75ef301b5a49a1a. * fix: gross ytd salary unique label
This commit is contained in:
parent
c25367f107
commit
43c476ddf7
@ -135,15 +135,15 @@ frappe.ui.form.on("Salary Slip", {
|
|||||||
|
|
||||||
change_form_labels: function(frm, company_currency) {
|
change_form_labels: function(frm, company_currency) {
|
||||||
frm.set_currency_labels(["base_hour_rate", "base_gross_pay", "base_total_deduction",
|
frm.set_currency_labels(["base_hour_rate", "base_gross_pay", "base_total_deduction",
|
||||||
"base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date"],
|
"base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "gross_base_year_to_date"],
|
||||||
company_currency);
|
company_currency);
|
||||||
|
|
||||||
frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date"],
|
frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date", "gross_year_to_date"],
|
||||||
frm.doc.currency);
|
frm.doc.currency);
|
||||||
|
|
||||||
// toggle fields
|
// toggle fields
|
||||||
frm.toggle_display(["exchange_rate", "base_hour_rate", "base_gross_pay", "base_total_deduction",
|
frm.toggle_display(["exchange_rate", "base_hour_rate", "base_gross_pay", "base_total_deduction",
|
||||||
"base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date"],
|
"base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "base_gross_year_to_date"],
|
||||||
frm.doc.currency != company_currency);
|
frm.doc.currency != company_currency);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
"totals",
|
"totals",
|
||||||
"gross_pay",
|
"gross_pay",
|
||||||
"base_gross_pay",
|
"base_gross_pay",
|
||||||
|
"gross_year_to_date",
|
||||||
|
"base_gross_year_to_date",
|
||||||
"column_break_25",
|
"column_break_25",
|
||||||
"total_deduction",
|
"total_deduction",
|
||||||
"base_total_deduction",
|
"base_total_deduction",
|
||||||
@ -625,13 +627,27 @@
|
|||||||
"label": "Leave Details",
|
"label": "Leave Details",
|
||||||
"options": "Salary Slip Leave",
|
"options": "Salary Slip Leave",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "gross_year_to_date",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Gross Year To Date",
|
||||||
|
"options": "currency",
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "base_gross_year_to_date",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Gross Year To Date(Company Currency)",
|
||||||
|
"options": "Company:company:default_currency",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 9,
|
"idx": 9,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-03-31 22:44:09.772331",
|
"modified": "2021-09-01 10:35:52.374549",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Payroll",
|
"module": "Payroll",
|
||||||
"name": "Salary Slip",
|
"name": "Salary Slip",
|
||||||
@ -672,4 +688,4 @@
|
|||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"timeline_field": "employee",
|
"timeline_field": "employee",
|
||||||
"title_field": "employee_name"
|
"title_field": "employee_name"
|
||||||
}
|
}
|
||||||
|
@ -1214,7 +1214,7 @@ class SalarySlip(TransactionBase):
|
|||||||
period_start_date, period_end_date = self.get_year_to_date_period()
|
period_start_date, period_end_date = self.get_year_to_date_period()
|
||||||
|
|
||||||
salary_slip_sum = frappe.get_list('Salary Slip',
|
salary_slip_sum = frappe.get_list('Salary Slip',
|
||||||
fields = ['sum(net_pay) as sum'],
|
fields = ['sum(net_pay) as net_sum', 'sum(gross_pay) as gross_sum'],
|
||||||
filters = {'employee_name' : self.employee_name,
|
filters = {'employee_name' : self.employee_name,
|
||||||
'start_date' : ['>=', period_start_date],
|
'start_date' : ['>=', period_start_date],
|
||||||
'end_date' : ['<', period_end_date],
|
'end_date' : ['<', period_end_date],
|
||||||
@ -1222,10 +1222,13 @@ class SalarySlip(TransactionBase):
|
|||||||
'docstatus': 1
|
'docstatus': 1
|
||||||
})
|
})
|
||||||
|
|
||||||
year_to_date = flt(salary_slip_sum[0].sum) if salary_slip_sum else 0.0
|
year_to_date = flt(salary_slip_sum[0].net_sum) if salary_slip_sum else 0.0
|
||||||
|
gross_year_to_date = flt(salary_slip_sum[0].gross_sum) if salary_slip_sum else 0.0
|
||||||
|
|
||||||
year_to_date += self.net_pay
|
year_to_date += self.net_pay
|
||||||
|
gross_year_to_date += self.gross_pay
|
||||||
self.year_to_date = year_to_date
|
self.year_to_date = year_to_date
|
||||||
|
self.gross_year_to_date = gross_year_to_date
|
||||||
|
|
||||||
def compute_month_to_date(self):
|
def compute_month_to_date(self):
|
||||||
month_to_date = 0
|
month_to_date = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user