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;
|
return value;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"initial_depth": 0
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,23 +14,40 @@ def execute(filters=None):
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"label": _("Sıra №"),
|
"label": _("Soyad"),
|
||||||
"fieldname": "employee",
|
"fieldname": "last_name",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Data",
|
||||||
"options": "Employee",
|
"width": 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Ad"),
|
||||||
|
"fieldname": "first_name",
|
||||||
|
"fieldtype": "Data",
|
||||||
"width": 120
|
"width": 120
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("İşçi adı"),
|
"label": _("Ata adı"),
|
||||||
"fieldname": "employee_name",
|
"fieldname": "father_name",
|
||||||
"fieldtype": "Data",
|
"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",
|
"fieldname": "days_absent",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"width": 120
|
"width": 160
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -41,16 +58,20 @@ def get_data(filters):
|
||||||
|
|
||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
a.employee,
|
e.last_name,
|
||||||
a.employee_name,
|
e.first_name,
|
||||||
COUNT(*) as days_absent
|
e.father_name,
|
||||||
|
e.identification_number AS fin,
|
||||||
|
e.ssn,
|
||||||
|
COUNT(*) AS days_absent
|
||||||
FROM `tabAttendance` a
|
FROM `tabAttendance` a
|
||||||
|
LEFT JOIN `tabEmployee` e ON e.name = a.employee
|
||||||
WHERE
|
WHERE
|
||||||
a.docstatus = 1
|
a.docstatus = 1
|
||||||
AND a.status = 'Absent'
|
AND a.status != 'Present'
|
||||||
AND a.company = %(company)s
|
AND a.company = %(company)s
|
||||||
AND a.attendance_date >= %(from_date)s
|
AND a.attendance_date >= %(from_date)s
|
||||||
AND a.attendance_date <= %(to_date)s
|
AND a.attendance_date <= %(to_date)s
|
||||||
GROUP BY a.employee, a.employee_name
|
GROUP BY a.employee
|
||||||
ORDER BY days_absent DESC, a.employee_name ASC
|
ORDER BY e.last_name ASC, e.first_name ASC
|
||||||
""", filters, as_dict=1)
|
""", filters, as_dict=1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue