Added From and To date to Holiday Report

Changed HD to H in Monthly Attendance Report
This commit is contained in:
Valmik Jangla 2016-02-04 12:18:55 +05:30
parent 2d4cc7e71f
commit 8d0ed21c04
3 changed files with 30 additions and 12 deletions

View File

@ -3,6 +3,19 @@
frappe.query_reports["Employee Holiday Attendance"] = { frappe.query_reports["Employee Holiday Attendance"] = {
"filters": [ "filters": [
{
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.year_start()
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.datetime.year_end()
}
] ]
} }

View File

@ -11,7 +11,7 @@ def execute(filters=None):
filters = {} filters = {}
columns = get_columns() columns = get_columns()
data = get_employees() data = get_employees(filters)
return columns, data return columns, data
@ -19,14 +19,19 @@ def get_columns():
return [ return [
_("Employee") + ":Link/Employee:120", _("Employee") + ":Link/Employee:120",
_("Name") + ":Data:200", _("Name") + ":Data:200",
_("Date")+ ":Date:100", _("Date") + ":Date:100",
_("Status") + ":Data:70", _("Status") + ":Data:70",
_("Holiday") + ":Data:200" _("Holiday") + ":Data:200"
] ]
def get_employees(): def get_employees(filters):
holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"]) holidays = frappe.get_all("Holiday",
fields=["holiday_date", "description"],
filters=[["holiday_date", ">",
filters.from_date],
["holiday_date", "<", filters.to_date]])
print holidays
holiday_names = {} holiday_names = {}
holidays_list = [] holidays_list = []
@ -38,7 +43,7 @@ def get_employees():
employee, employee_name, att_date, status employee, employee_name, att_date, status
from tabAttendance from tabAttendance
where where
att_date in ({0})""".format(', '.join(["%s"]*len(holidays_list))), att_date in ({0})""".format(', '.join(["%s"] * len(holidays_list))),
holidays_list, as_list=True) holidays_list, as_list=True)
for employee_data in employee_list: for employee_data in employee_list:
@ -46,4 +51,4 @@ def get_employees():
return employee_list return employee_list
else: else:
return None return []

View File

@ -27,7 +27,7 @@ def execute(filters=None):
total_p = total_a = 0.0 total_p = total_a = 0.0
for day in range(filters["total_days_in_month"]): for day in range(filters["total_days_in_month"]):
status = att_map.get(emp).get(day + 1, "Absent") status = att_map.get(emp).get(day + 1, "Absent")
status_map = {"Present": "P", "Absent": "A", "Half Day": "HD"} status_map = {"Present": "P", "Absent": "A", "Half Day": "H"}
row.append(status_map[status]) row.append(status_map[status])
if status == "Present": if status == "Present":