mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-28 01:14:46 +00:00
Added mark as present to student leave application
This commit is contained in:
@@ -126,6 +126,34 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "mark_as_present",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Mark as Present",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@@ -220,7 +248,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-12-15 14:51:28.774955",
|
"modified": "2016-12-20 15:08:40.750278",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Leave Application",
|
"name": "Student Leave Application",
|
||||||
|
|||||||
@@ -51,26 +51,40 @@ def get_attendance_list(conditions, filters):
|
|||||||
status from `tabStudent Attendance` where docstatus = 1 %s order by student, date""" %
|
status from `tabStudent Attendance` where docstatus = 1 %s order by student, date""" %
|
||||||
conditions, filters, as_dict=1)
|
conditions, filters, as_dict=1)
|
||||||
|
|
||||||
|
students_with_leave_application = get_students_with_leave_application(filters)
|
||||||
|
|
||||||
att_map = {}
|
att_map = {}
|
||||||
for d in attendance_list:
|
for d in attendance_list:
|
||||||
att_map.setdefault(d.student, frappe._dict()).setdefault(d.day_of_month, "")
|
att_map.setdefault(d.student, frappe._dict()).setdefault(d.day_of_month, "")
|
||||||
att_map[d.student][d.day_of_month] = d.status
|
for stud in students_with_leave_application:
|
||||||
|
if stud.student== d.student and stud.day_of_month== d.day_of_month:
|
||||||
|
att_map[d.student][d.day_of_month] = "Present"
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
att_map[d.student][d.day_of_month] = d.status
|
||||||
|
|
||||||
return att_map
|
return att_map
|
||||||
|
|
||||||
|
def get_students_with_leave_application(filters):
|
||||||
|
students_with_leave_application = frappe.db.sql("""select student, day(date) as day_of_month
|
||||||
|
from `tabStudent Leave Application` where mark_as_present and docstatus = 1
|
||||||
|
and month(date) = %(month)s and year(date) = %(year)s
|
||||||
|
order by student, date""", filters, as_dict=1)
|
||||||
|
return students_with_leave_application
|
||||||
|
|
||||||
def get_conditions(filters):
|
def get_conditions(filters):
|
||||||
if not (filters.get("month") and filters.get("year")):
|
if not (filters.get("month") and filters.get("year")):
|
||||||
msgprint(_("Please select month and year"), raise_exception=1)
|
msgprint(_("Please select month and year"), raise_exception=1)
|
||||||
|
|
||||||
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||||
"Dec"].index(filters.month) + 1
|
"Dec"].index(filters.month) + 1
|
||||||
|
|
||||||
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
|
filters["total_days_in_month"] = monthrange(cint(filters.year), filters.month)[1]
|
||||||
|
|
||||||
conditions = " and month(date) = %(month)s and year(date) = %(year)s"
|
conditions = " and month(date) = %(month)s and year(date) = %(year)s"
|
||||||
|
|
||||||
if filters.get("student_batch"): conditions += " and student_batch = %(student_batch)s"
|
if filters.get("student_batch"): conditions += " and student_batch = %(student_batch)s"
|
||||||
|
|
||||||
return conditions, filters
|
return conditions, filters
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
Reference in New Issue
Block a user