added Monthly Absence Report
This commit is contained in:
parent
ae7b0f5d17
commit
5477ad2e91
|
|
@ -39,5 +39,7 @@ frappe.query_reports["Monthly Absence Report"] = {
|
|||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
},
|
||||
|
||||
"initial_depth": 0
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,23 +14,40 @@ def execute(filters=None):
|
|||
def get_columns():
|
||||
return [
|
||||
{
|
||||
"label": _("Sıra №"),
|
||||
"fieldname": "employee",
|
||||
"fieldtype": "Link",
|
||||
"options": "Employee",
|
||||
"label": _("Soyad"),
|
||||
"fieldname": "last_name",
|
||||
"fieldtype": "Data",
|
||||
"width": 140
|
||||
},
|
||||
{
|
||||
"label": _("Ad"),
|
||||
"fieldname": "first_name",
|
||||
"fieldtype": "Data",
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("İşçi adı"),
|
||||
"fieldname": "employee_name",
|
||||
"label": _("Ata adı"),
|
||||
"fieldname": "father_name",
|
||||
"fieldtype": "Data",
|
||||
"width": 200
|
||||
"width": 120
|
||||
},
|
||||
{
|
||||
"label": _("Qayıb günlər"),
|
||||
"label": _("FİN"),
|
||||
"fieldname": "fin",
|
||||
"fieldtype": "Data",
|
||||
"width": 110
|
||||
},
|
||||
{
|
||||
"label": _("SSN"),
|
||||
"fieldname": "ssn",
|
||||
"fieldtype": "Data",
|
||||
"width": 130
|
||||
},
|
||||
{
|
||||
"label": _("İşçinin işləmədiyi iş günlərinin sayı"),
|
||||
"fieldname": "days_absent",
|
||||
"fieldtype": "Int",
|
||||
"width": 120
|
||||
"width": 160
|
||||
}
|
||||
]
|
||||
|
||||
|
|
@ -41,16 +58,20 @@ def get_data(filters):
|
|||
|
||||
return frappe.db.sql("""
|
||||
SELECT
|
||||
a.employee,
|
||||
a.employee_name,
|
||||
COUNT(*) as days_absent
|
||||
e.last_name,
|
||||
e.first_name,
|
||||
e.father_name,
|
||||
e.identification_number AS fin,
|
||||
e.ssn,
|
||||
COUNT(*) AS days_absent
|
||||
FROM `tabAttendance` a
|
||||
LEFT JOIN `tabEmployee` e ON e.name = a.employee
|
||||
WHERE
|
||||
a.docstatus = 1
|
||||
AND a.status = 'Absent'
|
||||
AND a.status != 'Present'
|
||||
AND a.company = %(company)s
|
||||
AND a.attendance_date >= %(from_date)s
|
||||
AND a.attendance_date <= %(to_date)s
|
||||
GROUP BY a.employee, a.employee_name
|
||||
ORDER BY days_absent DESC, a.employee_name ASC
|
||||
GROUP BY a.employee
|
||||
ORDER BY e.last_name ASC, e.first_name ASC
|
||||
""", filters, as_dict=1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue