fix: using ORM

This commit is contained in:
Afshan
2020-12-03 15:14:30 +05:30
parent 785579e67b
commit 482996f8d1

View File

@@ -406,9 +406,12 @@ class PayrollEntry(Document):
def get_count_employee_attendance(self, employee, start_date): def get_count_employee_attendance(self, employee, start_date):
marked_days = 0 marked_days = 0
attendances = frappe.db.sql("""select count(*) from tabAttendance where attendances = frappe.get_all("Attendance",
employee=%s and docstatus=1 and attendance_date between %s and %s""", fields = ["count(*)"],
(employee, start_date, self.end_date)) filters = {
"employee": employee,
"attendance_date": ('between', [start_date, self.end_date])
}, as_list=1)
if attendances and attendances[0][0]: if attendances and attendances[0][0]:
marked_days = attendances[0][0] marked_days = attendances[0][0]
return marked_days return marked_days