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:
Devin Slauenwhite 2021-09-02 00:09:35 -04:00 committed by GitHub
parent c25367f107
commit 43c476ddf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 7 deletions

View File

@ -135,15 +135,15 @@ frappe.ui.form.on("Salary Slip", {
change_form_labels: function(frm, company_currency) {
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);
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);
// toggle fields
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);
},

View File

@ -56,6 +56,8 @@
"totals",
"gross_pay",
"base_gross_pay",
"gross_year_to_date",
"base_gross_year_to_date",
"column_break_25",
"total_deduction",
"base_total_deduction",
@ -625,13 +627,27 @@
"label": "Leave Details",
"options": "Salary Slip Leave",
"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",
"idx": 9,
"is_submittable": 1,
"links": [],
"modified": "2021-03-31 22:44:09.772331",
"modified": "2021-09-01 10:35:52.374549",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Salary Slip",
@ -672,4 +688,4 @@
"sort_order": "DESC",
"timeline_field": "employee",
"title_field": "employee_name"
}
}

View File

@ -1214,7 +1214,7 @@ class SalarySlip(TransactionBase):
period_start_date, period_end_date = self.get_year_to_date_period()
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,
'start_date' : ['>=', period_start_date],
'end_date' : ['<', period_end_date],
@ -1222,10 +1222,13 @@ class SalarySlip(TransactionBase):
'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
gross_year_to_date += self.gross_pay
self.year_to_date = year_to_date
self.gross_year_to_date = gross_year_to_date
def compute_month_to_date(self):
month_to_date = 0