mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 15:39:20 +00:00
fix: using ORM
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user