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
@ -25,8 +25,13 @@ def get_columns():
] ]
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 = []
@ -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":