Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
bahaaabed committed Oct 16, 2022
1 parent e8a58ca commit f5d150b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions erpnext/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,18 @@ def get_working_days_details(
diff_list = Counter(shift_days)
diff_days = [k for k,v in diff_list.items() if v == 1 ]
count_same_days = [item for item, count in collections.Counter(shift_days).items() if count > 1]
count = 0
count_same = 0
count_diff = 0
set_shift = set()
shift_same = 0
shift_diff = 0
for i in diff_list:
set_shift.add(diff_list[i])
for j in set_shift:
if j == 1:
shift_diff = j
else:
shift_same = j

import datetime, calendar
currentDate = datetime.date.today()
Expand All @@ -339,10 +350,12 @@ def get_working_days_details(
for i in range(1, daysInMonth+1):
day = datetime.datetime(currentDate.year, currentDate.month, i)
days.append(calendar.day_name[day.weekday()])

for x,y in zip(count_same_days,diff_days):
count_same += days.count(x)
count_diff += days.count(y)

for x in count_same_days:
count += days.count(x)
work_shifts = (count + len(diff_days)) * len(employee_shifts)
work_shifts = ((count_same*shift_same) + (count_diff * shift_diff))
holidays = self.get_holidays_for_employee(self.start_date, self.end_date)
number_of_holiday_shift = frappe.db.get_single_value(
"Payroll Settings", "number_of_holiday_shift"
Expand Down

0 comments on commit f5d150b

Please sign in to comment.