diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py index 7a415f013d..80e327402d 100644 --- a/erpnext/config/schools.py +++ b/erpnext/config/schools.py @@ -55,6 +55,41 @@ def get_data(): } ] }, + { + "label": _("Attendance"), + "items": [ + { + "type": "doctype", + "name": "Student Attendance" + }, + { + "type": "doctype", + "name": "Student Leave Application" + }, + { + "type": "doctype", + "name": "Student Batch Attendance Tool" + }, + { + "type": "report", + "is_query_report": True, + "name": "Absent Student Report", + "doctype": "Attendance" + }, + { + "type": "report", + "is_query_report": True, + "name": "Student Batch Wise Attendance", + "doctype": "Attendance" + }, + { + "type": "report", + "is_query_report": True, + "name": "Student Monthly Attendance Sheet", + "doctype": "Attendance" + } + ] + }, { "label": _("Schedule"), "items": [ @@ -63,17 +98,9 @@ def get_data(): "name": "Course Schedule", "route": "Calendar/Course Schedule" }, - { - "type": "doctype", - "name": "Student Attendance" - }, { "type": "doctype", "name": "Course Scheduling Tool" - }, - { - "type": "doctype", - "name": "Student Batch Attendance Tool" } ] }, diff --git a/erpnext/schools/doctype/assessment/assessment.js b/erpnext/schools/doctype/assessment/assessment.js index efadbd66a2..e842f41337 100644 --- a/erpnext/schools/doctype/assessment/assessment.js +++ b/erpnext/schools/doctype/assessment/assessment.js @@ -6,46 +6,46 @@ cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); cur_frm.add_fetch("student", "title", "student_name"); -frappe.ui.form.on("Assessment" ,{ - student_group : function(frm) { - frm.set_value("results" ,""); - if (frm.doc.student_group) { - frappe.call({ - method: "erpnext.schools.api.get_student_group_students", - args: { - "student_group": frm.doc.student_group - }, - callback: function(r) { - if (r.message) { - $.each(r.message, function(i, d) { - var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results"); - row.student = d.student; - row.student_name = d.student_name; - }); - } - refresh_field("results"); - } - }); - } - } +frappe.ui.form.on("Assessment", { + student_group: function(frm) { + frm.set_value("results", ""); + if (frm.doc.student_group) { + frappe.call({ + method: "erpnext.schools.api.get_student_group_students", + args: { + "student_group": frm.doc.student_group + }, + callback: function(r) { + if (r.message) { + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results"); + row.student = d.student; + row.student_name = d.student_name; + }); + } + refresh_field("results"); + } + }); + } + } }); -frappe.ui.form.on("Assessment Result" ,{ - result : function(frm, cdt, cdn) { - if(frm.doc.grading_structure){ - var assessment_result = locals[cdt][cdn]; - frappe.call({ - method:"erpnext.schools.doctype.assessment.assessment.get_grade", - args:{ - grading_structure: frm.doc.grading_structure, - result: assessment_result.result - }, - callback: function(r){ - if(r.message){ - frappe.model.set_value(cdt, cdn, 'grade', r.message); - } - } - }); - } - } +frappe.ui.form.on("Assessment Result", { + result: function(frm, cdt, cdn) { + if (frm.doc.grading_structure) { + var assessment_result = locals[cdt][cdn]; + frappe.call({ + method: "erpnext.schools.doctype.assessment.assessment.get_grade", + args: { + grading_structure: frm.doc.grading_structure, + result: assessment_result.result + }, + callback: function(r) { + if (r.message) { + frappe.model.set_value(cdt, cdn, 'grade', r.message); + } + } + }); + } + } }); \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment/assessment.py b/erpnext/schools/doctype/assessment/assessment.py index cb307cb7f4..003b4276e7 100644 --- a/erpnext/schools/doctype/assessment/assessment.py +++ b/erpnext/schools/doctype/assessment/assessment.py @@ -10,7 +10,7 @@ from frappe import _ class Assessment(Document): def validate(self): self.validate_overlap() - + def validate_overlap(self): """Validates overlap for Student Group/Student Batch, Instructor, Room""" diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.js b/erpnext/schools/doctype/course_schedule/course_schedule.js index ab34ae96c1..04a8cdedf2 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.js +++ b/erpnext/schools/doctype/course_schedule/course_schedule.js @@ -1,137 +1,134 @@ frappe.provide("schools") -frappe.ui.form.on("Course Schedule" ,{ - onload: function(frm) { - if (frm.doc.from_datetime && frm.doc.to_datetime) { - var from_datetime = moment(frm.doc.from_datetime); - var to_datetime = moment(frm.doc.to_datetime); - frm.doc.schedule_date = from_datetime.format(moment.defaultFormat); - frm.doc.from_time = from_datetime.format("HH:mm:ss"); - frm.doc.to_time = to_datetime.format("HH:mm:ss"); - } - }, - - refresh :function(frm) { - if(!frm.doc.__islocal && frm.doc.student_group) { - frappe.call({ - method: "erpnext.schools.api.check_attendance_records_exist", - args: { - "course_schedule": frm.doc.name - }, - callback: function(r) { - if(r.message) { - hide_field('attendance'); - frm.events.view_attendance(frm) - } - else { - frappe.call({ - method: "erpnext.schools.api.get_student_group_students", - args: { - "student_group": frm.doc.student_group - }, - callback: function(r) { - if (r.message) { - frm.events.get_students(frm, r.message) - } - } - }); - } - } - }); - } - else { - hide_field('attendance'); - } - }, - - view_attendance: function(frm) { - hide_field('attendance'); - frm.add_custom_button(__("View attendance"), function() { - frappe.route_options = { - course_schedule: frm.doc.name - } - frappe.set_route("List", "Student Attendance"); - }); - }, - - get_students: function(frm, students) { - if(!frm.students_area) { - frm.students_area = $('
') - .appendTo(frm.fields_dict.students_html.wrapper); - } - frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) - } +frappe.ui.form.on("Course Schedule", { + onload: function(frm) { + if (frm.doc.from_datetime && frm.doc.to_datetime) { + var from_datetime = moment(frm.doc.from_datetime); + var to_datetime = moment(frm.doc.to_datetime); + frm.doc.schedule_date = from_datetime.format(moment.defaultFormat); + frm.doc.from_time = from_datetime.format("HH:mm:ss"); + frm.doc.to_time = to_datetime.format("HH:mm:ss"); + } + }, + + refresh: function(frm) { + if (!frm.doc.__islocal && frm.doc.student_group) { + frappe.call({ + method: "erpnext.schools.api.check_attendance_records_exist", + args: { + "course_schedule": frm.doc.name + }, + callback: function(r) { + if (r.message) { + hide_field('attendance'); + frm.events.view_attendance(frm) + } else { + frappe.call({ + method: "erpnext.schools.api.get_student_group_students", + args: { + "student_group": frm.doc.student_group + }, + callback: function(r) { + if (r.message) { + frm.events.get_students(frm, r.message) + } + } + }); + } + } + }); + } else { + hide_field('attendance'); + } + }, + + view_attendance: function(frm) { + hide_field('attendance'); + frm.add_custom_button(__("View attendance"), function() { + frappe.route_options = { + course_schedule: frm.doc.name + } + frappe.set_route("List", "Student Attendance"); + }); + }, + + get_students: function(frm, students) { + if (!frm.students_area) { + frm.students_area = $('
') + .appendTo(frm.fields_dict.students_html.wrapper); + } + frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) + } }); schools.StudentsEditor = Class.extend({ - init: function(frm, wrapper, students) { - this.wrapper = wrapper; - this.frm = frm; - this.make(frm, students); - }, - make: function(frm, students) { - var me = this; - - $(this.wrapper).empty(); - var student_toolbar = $('

\ + init: function(frm, wrapper, students) { + this.wrapper = wrapper; + this.frm = frm; + this.make(frm, students); + }, + make: function(frm, students) { + var me = this; + + $(this.wrapper).empty(); + var student_toolbar = $('

\ \ \

').appendTo($(this.wrapper)); - student_toolbar.find(".btn-add") - .html(__('Check all')) - .on("click", function() { - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if(!$(check).is(":checked")) { - check.checked = true; - } - }); - }); + student_toolbar.find(".btn-add") + .html(__('Check all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if (!$(check).is(":checked")) { + check.checked = true; + } + }); + }); - student_toolbar.find(".btn-remove") - .html(__('Uncheck all')) - .on("click", function() { - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if($(check).is(":checked")) { - check.checked = false; - } - }); - }); - - student_toolbar.find(".btn-mark-att") - .html(__('Mark Attendence')) - .on("click", function() { - var students_present = []; - var students_absent = []; - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if($(check).is(":checked")) { - students_present.push(students[i]); - } - else { - students_absent.push(students[i]); - } - }); - frappe.call({ - method: "erpnext.schools.api.mark_attendance", - args: { - "students_present": students_present, - "students_absent": students_absent, - "course_schedule": frm.doc.name - }, - callback: function(r) { - frm.events.view_attendance(frm) - } - }); - }); + student_toolbar.find(".btn-remove") + .html(__('Uncheck all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if ($(check).is(":checked")) { + check.checked = false; + } + }); + }); - - $.each(students, function(i, m) { - $(repl('
\ + student_toolbar.find(".btn-mark-att") + .html(__('Mark Attendence')) + .on("click", function() { + var students_present = []; + var students_absent = []; + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if ($(check).is(":checked")) { + students_present.push(students[i]); + } else { + students_absent.push(students[i]); + } + }); + frappe.call({ + method: "erpnext.schools.api.mark_attendance", + args: { + "students_present": students_present, + "students_absent": students_absent, + "course_schedule": frm.doc.name + }, + callback: function(r) { + frm.events.view_attendance(frm) + } + }); + }); + + + $.each(students, function(i, m) { + $(repl('
\
\ \ -
', {student: m.student_name})).appendTo(me.wrapper); - }); - } +
', { student: m.student_name })).appendTo(me.wrapper); + }); + } }) \ No newline at end of file diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.json b/erpnext/schools/doctype/course_schedule/course_schedule.json index 4a4b2d3a4b..122285e980 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.json +++ b/erpnext/schools/doctype/course_schedule/course_schedule.json @@ -478,13 +478,34 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-11-16 16:38:00.454295", + "modified": "2016-12-01 12:59:25.086606", "modified_by": "Administrator", "module": "Schools", "name": "Course Schedule", "name_case": "", "owner": "Administrator", "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 1, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + }, { "amend": 0, "apply_user_permissions": 0, diff --git a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js index b8d4562b8d..ea62b8f544 100644 --- a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js +++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js @@ -7,12 +7,15 @@ cur_frm.add_fetch("student_group", "course", "course"); cur_frm.add_fetch("student_group", "academic_year", "academic_year"); cur_frm.add_fetch("student_group", "academic_term", "academic_term"); -frappe.ui.form.on("Course Scheduling Tool", "refresh", function(frm) { - frm.disable_save(); - frm.page.set_primary_action(__("Schedule Course"), function() { - frappe.call({ - method: "schedule_course", - doc:frm.doc - }) - }); +frappe.ui.form.on("Course Scheduling Tool", { + + refresh: function(frm) { + frm.disable_save(); + frm.page.set_primary_action(__("Schedule Course"), function() { + frappe.call({ + method: "schedule_course", + doc: frm.doc + }) + }); + } }); \ No newline at end of file diff --git a/erpnext/schools/doctype/student/student.json b/erpnext/schools/doctype/student/student.json index d188db316e..6984d383db 100644 --- a/erpnext/schools/doctype/student/student.json +++ b/erpnext/schools/doctype/student/student.json @@ -24,6 +24,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "First Name", "length": 0, "no_copy": 0, @@ -32,6 +33,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -50,6 +52,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Middle Name", "length": 0, "no_copy": 0, @@ -58,6 +61,7 @@ "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, @@ -76,6 +80,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Last Name", "length": 0, "no_copy": 0, @@ -84,6 +89,7 @@ "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, @@ -102,6 +108,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -109,6 +116,7 @@ "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, @@ -127,6 +135,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Naming Series", "length": 0, "no_copy": 0, @@ -136,6 +145,7 @@ "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, @@ -154,6 +164,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Student Email ID", "length": 0, "no_copy": 0, @@ -162,6 +173,7 @@ "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, @@ -180,6 +192,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Student Mobile Number", "length": 0, "no_copy": 0, @@ -189,6 +202,7 @@ "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, @@ -208,6 +222,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Joining Date", "length": 0, "no_copy": 0, @@ -216,6 +231,7 @@ "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, @@ -234,6 +250,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image", "length": 0, "no_copy": 0, @@ -242,6 +259,7 @@ "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, @@ -262,6 +280,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Personal Details", "length": 0, "no_copy": 0, @@ -270,6 +289,7 @@ "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, @@ -288,6 +308,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Date of Birth", "length": 0, "no_copy": 0, @@ -296,6 +317,7 @@ "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, @@ -314,6 +336,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Blood Group", "length": 0, "no_copy": 0, @@ -323,6 +346,7 @@ "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, @@ -341,6 +365,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -348,6 +373,7 @@ "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, @@ -366,6 +392,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Gender", "length": 0, "no_copy": 0, @@ -375,6 +402,7 @@ "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, @@ -393,6 +421,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Nationality", "length": 0, "no_copy": 0, @@ -402,6 +431,7 @@ "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, @@ -420,6 +450,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Student Applicant", "length": 0, "no_copy": 0, @@ -429,6 +460,7 @@ "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -447,6 +479,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Home Address", "length": 0, "no_copy": 0, @@ -455,6 +488,7 @@ "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, @@ -473,6 +507,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Address Line 1", "length": 0, "no_copy": 0, @@ -481,6 +516,7 @@ "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, @@ -499,6 +535,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Address Line 2", "length": 0, "no_copy": 0, @@ -507,6 +544,7 @@ "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, @@ -525,6 +563,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Pincode", "length": 0, "no_copy": 0, @@ -533,6 +572,7 @@ "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, @@ -551,6 +591,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -558,6 +599,7 @@ "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, @@ -576,6 +618,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "City", "length": 0, "no_copy": 0, @@ -584,6 +627,7 @@ "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, @@ -602,6 +646,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "State", "length": 0, "no_copy": 0, @@ -610,6 +655,7 @@ "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, @@ -628,6 +674,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Guardian Details", "length": 0, "no_copy": 0, @@ -636,6 +683,7 @@ "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, @@ -654,6 +702,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Guardians", "length": 0, "no_copy": 0, @@ -663,6 +712,7 @@ "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, @@ -681,6 +731,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Sibling Details", "length": 0, "no_copy": 0, @@ -690,6 +741,7 @@ "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, @@ -708,6 +760,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Siblings", "length": 0, "no_copy": 0, @@ -717,6 +770,7 @@ "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, @@ -736,6 +790,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Title", "length": 0, "no_copy": 0, @@ -744,6 +799,7 @@ "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, @@ -763,13 +819,34 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-10-26 12:24:10.533118", + "modified": "2016-12-01 12:55:32.453131", "modified_by": "Administrator", "module": "Schools", "name": "Student", "name_case": "", "owner": "Administrator", "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 + }, { "amend": 0, "apply_user_permissions": 0, diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.js b/erpnext/schools/doctype/student_attendance/student_attendance.js index 6e79d52ec2..ec2a0cbf8d 100644 --- a/erpnext/schools/doctype/student_attendance/student_attendance.js +++ b/erpnext/schools/doctype/student_attendance/student_attendance.js @@ -2,10 +2,4 @@ // For license information, please see license.txt cur_frm.add_fetch("course_schedule", "schedule_date", "date"); -cur_frm.add_fetch("course_schedule", "student_batch", "student_batch"); - -frappe.ui.form.on('Student Attendance', { - refresh: function(frm) { - - } -}); +cur_frm.add_fetch("course_schedule", "student_batch", "student_batch") \ No newline at end of file diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.json b/erpnext/schools/doctype/student_attendance/student_attendance.json index 70fcdf353c..3ea47f3734 100644 --- a/erpnext/schools/doctype/student_attendance/student_attendance.json +++ b/erpnext/schools/doctype/student_attendance/student_attendance.json @@ -252,13 +252,34 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-11-16 16:58:35.779867", + "modified": "2016-12-01 12:56:21.537215", "modified_by": "Administrator", "module": "Schools", "name": "Student Attendance", "name_case": "", "owner": "Administrator", "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 1, + "write": 1 + }, { "amend": 1, "apply_user_permissions": 0, diff --git a/erpnext/schools/doctype/student_batch/student_batch.json b/erpnext/schools/doctype/student_batch/student_batch.json index 51dc541eda..f571d9d5a6 100644 --- a/erpnext/schools/doctype/student_batch/student_batch.json +++ b/erpnext/schools/doctype/student_batch/student_batch.json @@ -70,6 +70,35 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "1", + "fieldname": "enabled", + "fieldtype": "Check", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Active", + "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, "bold": 0, @@ -280,7 +309,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-11-21 19:08:05.775954", + "modified": "2016-12-01 13:18:12.024001", "modified_by": "Administrator", "module": "Schools", "name": "Student Batch", @@ -307,6 +336,27 @@ "share": 1, "submit": 0, "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 } ], "quick_entry": 1, diff --git a/erpnext/schools/doctype/student_batch/student_batch.py b/erpnext/schools/doctype/student_batch/student_batch.py index ec2dc79903..1a0d799482 100644 --- a/erpnext/schools/doctype/student_batch/student_batch.py +++ b/erpnext/schools/doctype/student_batch/student_batch.py @@ -8,12 +8,11 @@ from erpnext.schools.utils import validate_duplicate_student import frappe class StudentBatch(Document): - def autoname(self): - prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation") - if not prog_abb: - prog_abb = self.program - self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year - - def validate(self): - validate_duplicate_student(self.students) - \ No newline at end of file + def autoname(self): + prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation") + if not prog_abb: + prog_abb = self.program + self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year + + def validate(self): + validate_duplicate_student(self.students) diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js index a6d035a6e6..6dc9181460 100644 --- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js +++ b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js @@ -3,126 +3,124 @@ frappe.provide("schools") frappe.ui.form.on('Student Batch Attendance Tool', { - refresh: function(frm) { - frm.disable_save(); - hide_field('attendance'); - }, - - student_batch :function(frm) { - if(frm.doc.student_batch && frm.doc.date) { - frappe.call({ - method: "erpnext.schools.api.check_attendance_records_exist", - args: { - "student_batch": frm.doc.student_batch, - "date": frm.doc.date - }, - callback: function(r) { - if(r.message) { - frappe.msgprint("Attendance already marked."); - hide_field('attendance'); - } - else { - frappe.call({ - method: "erpnext.schools.api.get_student_batch_students", - args: { - "student_batch": frm.doc.student_batch - }, - callback: function(r) { - if (r.message) { - unhide_field('attendance'); - frm.events.get_students(frm, r.message) - } - } - }); - } - } - }); - } - }, - - date: function(frm) { - frm.trigger("student_batch"); - }, - - get_students: function(frm, students) { - if(!frm.students_area) { - frm.students_area = $('
') - .appendTo(frm.fields_dict.students_html.wrapper); - } - frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) - } + refresh: function(frm) { + frm.disable_save(); + hide_field('attendance'); + }, + + student_batch: function(frm) { + if (frm.doc.student_batch && frm.doc.date) { + frappe.call({ + method: "erpnext.schools.api.check_attendance_records_exist", + args: { + "student_batch": frm.doc.student_batch, + "date": frm.doc.date + }, + callback: function(r) { + if (r.message) { + frappe.msgprint("Attendance already marked."); + hide_field('attendance'); + } else { + frappe.call({ + method: "erpnext.schools.api.get_student_batch_students", + args: { + "student_batch": frm.doc.student_batch + }, + callback: function(r) { + if (r.message) { + unhide_field('attendance'); + frm.events.get_students(frm, r.message) + } + } + }); + } + } + }); + } + }, + + date: function(frm) { + frm.trigger("student_batch"); + }, + + get_students: function(frm, students) { + if (!frm.students_area) { + frm.students_area = $('
') + .appendTo(frm.fields_dict.students_html.wrapper); + } + frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) + } }); schools.StudentsEditor = Class.extend({ - init: function(frm, wrapper, students) { - this.wrapper = wrapper; - this.frm = frm; - this.make(frm, students); - }, - make: function(frm, students) { - var me = this; - - $(this.wrapper).empty(); - var student_toolbar = $('

\ + init: function(frm, wrapper, students) { + this.wrapper = wrapper; + this.frm = frm; + this.make(frm, students); + }, + make: function(frm, students) { + var me = this; + + $(this.wrapper).empty(); + var student_toolbar = $('

\ \ \

').appendTo($(this.wrapper)); - student_toolbar.find(".btn-add") - .html(__('Check all')) - .on("click", function() { - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if(!$(check).is(":checked")) { - check.checked = true; - } - }); - }); + student_toolbar.find(".btn-add") + .html(__('Check all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if (!$(check).is(":checked")) { + check.checked = true; + } + }); + }); - student_toolbar.find(".btn-remove") - .html(__('Uncheck all')) - .on("click", function() { - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if($(check).is(":checked")) { - check.checked = false; - } - }); - }); - - student_toolbar.find(".btn-mark-att") - .html(__('Mark Attendence')) - .on("click", function() { - var students_present = []; - var students_absent = []; - $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { - if($(check).is(":checked")) { - students_present.push(students[i]); - } - else { - students_absent.push(students[i]); - } - }); - frappe.call({ - method: "erpnext.schools.api.mark_attendance", - args: { - "students_present": students_present, - "students_absent": students_absent, - "student_batch": frm.doc.student_batch, - "date": frm.doc.date - }, - callback: function(r) { - hide_field('attendance'); - } - }); - }); + student_toolbar.find(".btn-remove") + .html(__('Uncheck all')) + .on("click", function() { + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if ($(check).is(":checked")) { + check.checked = false; + } + }); + }); - - $.each(students, function(i, m) { - $(repl('
\ + student_toolbar.find(".btn-mark-att") + .html(__('Mark Attendence')) + .on("click", function() { + var students_present = []; + var students_absent = []; + $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { + if ($(check).is(":checked")) { + students_present.push(students[i]); + } else { + students_absent.push(students[i]); + } + }); + frappe.call({ + method: "erpnext.schools.api.mark_attendance", + args: { + "students_present": students_present, + "students_absent": students_absent, + "student_batch": frm.doc.student_batch, + "date": frm.doc.date + }, + callback: function(r) { + hide_field('attendance'); + } + }); + }); + + + $.each(students, function(i, m) { + $(repl('
\
\ \ -
', {student: m.student_name})).appendTo(me.wrapper); - }); - } -}); +
', { student: m.student_name })).appendTo(me.wrapper); + }); + } +}); \ No newline at end of file diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json index 3361dcb44c..defc886b1c 100644 --- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json +++ b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json @@ -163,13 +163,34 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2016-11-16 17:16:43.835693", + "modified": "2016-12-01 12:58:31.822014", "modified_by": "Administrator", "module": "Schools", "name": "Student Batch Attendance Tool", "name_case": "", "owner": "Administrator", "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 1 + }, { "amend": 0, "apply_user_permissions": 0, diff --git a/erpnext/schools/doctype/student_group/student_group.js b/erpnext/schools/doctype/student_group/student_group.js index 784f557f6c..6f4084be25 100644 --- a/erpnext/schools/doctype/student_group/student_group.js +++ b/erpnext/schools/doctype/student_group/student_group.js @@ -1,34 +1,36 @@ cur_frm.add_fetch("student", "title", "student_name"); -frappe.ui.form.on("Student Group", "refresh", function(frm) { - if(!frm.doc.__islocal) { - frm.add_custom_button(__("Course Schedule"), function() { - frappe.route_options = { - student_group: frm.doc.name - } - frappe.set_route("List", "Course Schedule"); - }); - - frm.add_custom_button(__("Assessment"), function() { - frappe.route_options = { - student_group: frm.doc.name - } - frappe.set_route("List", "Assessment"); - }); - } -}); +frappe.ui.form.on("Student Group", { + refresh: function(frm) { + if (!frm.doc.__islocal) { + frm.add_custom_button(__("Course Schedule"), function() { + frappe.route_options = { + student_group: frm.doc.name + } + frappe.set_route("List", "Course Schedule"); + }); -frappe.ui.form.on("Student Group", "onload", function(frm){ - cur_frm.set_query("academic_term",function(){ - return{ - "filters":{ - "academic_year": (frm.doc.academic_year) - } - }; - }); + frm.add_custom_button(__("Assessment"), function() { + frappe.route_options = { + student_group: frm.doc.name + } + frappe.set_route("List", "Assessment"); + }); + } + }, + + onload: function(frm) { + cur_frm.set_query("academic_term", function() { + return { + "filters": { + "academic_year": (frm.doc.academic_year) + } + }; + }); + } }); //If Student Batch is entered, deduce program, academic_year and academic term from it cur_frm.add_fetch("student_batch", "program", "program"); cur_frm.add_fetch("student_batch", "academic_term", "academic_term"); -cur_frm.add_fetch("student_batch", "academic_year", "academic_year"); +cur_frm.add_fetch("student_batch", "academic_year", "academic_year"); \ No newline at end of file diff --git a/erpnext/schools/doctype/student_group/student_group.json b/erpnext/schools/doctype/student_group/student_group.json index adab0c7a02..9e44f518f6 100644 --- a/erpnext/schools/doctype/student_group/student_group.json +++ b/erpnext/schools/doctype/student_group/student_group.json @@ -311,13 +311,34 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-11-07 05:26:38.673266", + "modified": "2016-12-01 12:57:17.125085", "modified_by": "Administrator", "module": "Schools", "name": "Student Group", "name_case": "", "owner": "Administrator", "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 0, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 0, + "read": 1, + "report": 0, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 0, + "write": 0 + }, { "amend": 0, "apply_user_permissions": 0, diff --git a/erpnext/schools/doctype/student_leave_application/__init__.py b/erpnext/schools/doctype/student_leave_application/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.js b/erpnext/schools/doctype/student_leave_application/student_leave_application.js new file mode 100644 index 0000000000..4746148311 --- /dev/null +++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.js @@ -0,0 +1,8 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Student Leave Application', { + refresh: function(frm) { + + } +}); diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.json b/erpnext/schools/doctype/student_leave_application/student_leave_application.json new file mode 100644 index 0000000000..238b13404f --- /dev/null +++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.json @@ -0,0 +1,280 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "SLA.######", + "beta": 0, + "creation": "2016-11-28 15:38:54.793854", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student", + "length": 0, + "no_copy": 0, + "options": "Student", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "student_name", + "fieldtype": "Read Only", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Student Name", + "length": 0, + "no_copy": 0, + "options": "student.title", + "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, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "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, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Date", + "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": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_5", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "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, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reason", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reason", + "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, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "options": "Student Leave Application", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-12-01 12:57:55.914656", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Leave Application", + "name_case": "", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Instructor", + "set_user_permissions": 0, + "share": 0, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Academics User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "sort_field": "modified", + "sort_order": "DESC", + "title_field": "student_name", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_leave_application/student_leave_application.py b/erpnext/schools/doctype/student_leave_application/student_leave_application.py new file mode 100644 index 0000000000..4a36590e69 --- /dev/null +++ b/erpnext/schools/doctype/student_leave_application/student_leave_application.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.document import Document + +class StudentLeaveApplication(Document): + pass diff --git a/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py b/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py new file mode 100644 index 0000000000..ddb30acb20 --- /dev/null +++ b/erpnext/schools/doctype/student_leave_application/test_student_leave_application.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# See license.txt +from __future__ import unicode_literals + +import frappe +import unittest + +# test_records = frappe.get_test_records('Student Leave Application') + +class TestStudentLeaveApplication(unittest.TestCase): + pass diff --git a/erpnext/schools/report/absent_student_report/__init__.py b/erpnext/schools/report/absent_student_report/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.js b/erpnext/schools/report/absent_student_report/absent_student_report.js new file mode 100644 index 0000000000..7515f2203b --- /dev/null +++ b/erpnext/schools/report/absent_student_report/absent_student_report.js @@ -0,0 +1,15 @@ +// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + + +frappe.query_reports["Absent Student Report"] = { + "filters": [ + { + "fieldname":"date", + "label": __("Date"), + "fieldtype": "Date", + "default": get_today(), + "reqd": 1 + } + ] +} diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.json b/erpnext/schools/report/absent_student_report/absent_student_report.json new file mode 100644 index 0000000000..5f3ca7111a --- /dev/null +++ b/erpnext/schools/report/absent_student_report/absent_student_report.json @@ -0,0 +1,18 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2013-05-13 14:04:03", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2016-12-01 14:28:27.184668", + "modified_by": "Administrator", + "module": "Schools", + "name": "Absent Student Report", + "owner": "Administrator", + "ref_doctype": "Student Attendance", + "report_name": "Absent Student Report", + "report_type": "Script Report" +} \ No newline at end of file diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.py b/erpnext/schools/report/absent_student_report/absent_student_report.py new file mode 100644 index 0000000000..a138ca6ba9 --- /dev/null +++ b/erpnext/schools/report/absent_student_report/absent_student_report.py @@ -0,0 +1,60 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import cstr, cint, getdate +from frappe import msgprint, _ + +def execute(filters=None): + if not filters: filters = {} + + if not filters.get("date"): + msgprint(_("Please select date"), raise_exception=1) + + columns = get_columns(filters) + + absent_students = get_absent_students(filters.get("date")) + leave_applicants = get_leave_applications(filters.get("date")) + + data = [] + for student in absent_students: + if not student.student in leave_applicants: + row = [student.student, student.student_name, student.student_batch] + stud_details = frappe.db.get_value("Student", student.student, ['student_email_id', 'student_mobile_number'], as_dict=True) + + if stud_details.student_email_id: + row+=[stud_details.student_email_id] + else: + row+= [""] + + if stud_details.student_mobile_number: + row+=[stud_details.student_mobile_number] + else: + row+= [""] + + data.append(row) + + return columns, data + +def get_columns(filters): + columns = [ + _("Student") + ":Link/Student:90", + _("Student Name") + "::150", + _("Student Batch") + "::180", + _("Student Email ID") + "::180", + _("Student Mobile No.") + "::150", + ] + return columns + +def get_absent_students(date): + absent_students = frappe.db.sql("""select student, student_name, student_batch from `tabStudent Attendance` + where docstatus = 1 and date = %s order by student_batch, student_name""", date, as_dict=1) + return absent_students + +def get_leave_applications(date): + leave_applicants = [] + for student in frappe.db.sql("""select student from `tabStudent Leave Application` + where docstatus = 1 and date = %s""", date): + leave_applicants.append(student[0]) + return leave_applicants \ No newline at end of file diff --git a/erpnext/schools/report/student_batch_wise_attendance/__init__.py b/erpnext/schools/report/student_batch_wise_attendance/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js new file mode 100644 index 0000000000..51f7346b89 --- /dev/null +++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.js @@ -0,0 +1,12 @@ +// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Student Batch-Wise Attendance"] = { + "filters": [{ + "fieldname": "date", + "label": __("Date"), + "fieldtype": "Date", + "default": get_today(), + "reqd": 1 + }] +} \ No newline at end of file diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json new file mode 100644 index 0000000000..f9c9e55268 --- /dev/null +++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.json @@ -0,0 +1,18 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2016-11-28 22:07:03.859124", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2016-12-01 10:48:23.380837", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Batch-Wise Attendance", + "owner": "Administrator", + "ref_doctype": "Student Attendance", + "report_name": "Student Batch-Wise Attendance", + "report_type": "Script Report" +} \ No newline at end of file diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py new file mode 100644 index 0000000000..eaf090e2ad --- /dev/null +++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py @@ -0,0 +1,64 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import cstr, cint, getdate +from frappe import msgprint, _ + +def execute(filters=None): + if not filters: filters = {} + + if not filters.get("date"): + msgprint(_("Please select date"), raise_exception=1) + + columns = get_columns(filters) + + active_student_batch = get_active_student_batch() + + data = [] + for student_batch in active_student_batch: + row = [student_batch.name] + present_students = 0 + absent_students = 0 + student_batch_strength = get_student_batch_strength(student_batch.name) + student_attendance = get_student_attendance(student_batch.name, filters.get("date")) + if student_attendance: + for attendance in student_attendance: + if attendance.status== "Present": + present_students = attendance.count + elif attendance.status== "Absent": + absent_students = attendance.count + + unmarked_students = student_batch_strength - (present_students + absent_students) + row+= [student_batch_strength, present_students, absent_students, unmarked_students] + data.append(row) + + return columns, data + +def get_columns(filters): + columns = [ + _("Student batch") + ":Link/Student Batch:250", + _("Student batch Strength") + "::170", + _("Present") + "::90", + _("Absent") + "::90", + _("Not Marked") + "::90" + ] + return columns + +def get_active_student_batch(): + active_student_batch = frappe.db.sql("""select name from `tabStudent Batch` + where active = 1 order by name""", as_dict=1) + return active_student_batch + +def get_student_batch_strength(student_batch): + student_batch_strength = frappe.db.sql("""select count(*) from `tabStudent Batch Student` + where parent = %s""", student_batch)[0][0] + return student_batch_strength + +def get_student_attendance(student_batch, date): + student_attendance = frappe.db.sql("""select count(*) as count, status from `tabStudent Attendance` where \ + student_batch= %s and date= %s and docstatus=1 and\ + (course_schedule is Null or course_schedule='') group by status""", + (student_batch, date), as_dict=1) + return student_attendance \ No newline at end of file diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/__init__.py b/erpnext/schools/report/student_monthly_attendance_sheet/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js new file mode 100644 index 0000000000..32c0551653 --- /dev/null +++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js @@ -0,0 +1,42 @@ +// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + + +frappe.query_reports["Student Monthly Attendance Sheet"] = { + "filters": [ + { + "fieldname":"month", + "label": __("Month"), + "fieldtype": "Select", + "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec", + "default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", + "Dec"][frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth()], + }, + { + "fieldname":"year", + "label": __("Year"), + "fieldtype": "Select", + "reqd": 1 + }, + { + "fieldname":"student_batch", + "label": __("Student Batch"), + "fieldtype": "Link", + "options": "Student Batch", + "reqd": 1 + } + ], + + "onload": function() { + return frappe.call({ + method: "erpnext.schools.report.student_monthly_attendance_sheet.student_monthly_attendance_sheet.get_attendance_years", + callback: function(r) { + var year_filter = frappe.query_report_filters_by_name.year; + year_filter.df.options = r.message; + year_filter.df.default = r.message.split("\n")[0]; + year_filter.refresh(); + year_filter.set_input(year_filter.df.default); + } + }); + } +} diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json new file mode 100644 index 0000000000..1d8f4d0a27 --- /dev/null +++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.json @@ -0,0 +1,18 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2013-05-13 14:04:03", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2016-12-01 14:29:53.547378", + "modified_by": "Administrator", + "module": "Schools", + "name": "Student Monthly Attendance Sheet", + "owner": "Administrator", + "ref_doctype": "Student Attendance", + "report_name": "Student Monthly Attendance Sheet", + "report_type": "Script Report" +} \ No newline at end of file diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py new file mode 100644 index 0000000000..8c6006eae6 --- /dev/null +++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py @@ -0,0 +1,82 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.utils import cstr, cint, getdate +from frappe import msgprint, _ +from calendar import monthrange +from erpnext.schools.api import get_student_batch_students + +def execute(filters=None): + if not filters: filters = {} + + conditions, filters = get_conditions(filters) + columns = get_columns(filters) + att_map = get_attendance_list(conditions, filters) + students = get_student_batch_students(filters.get("student_batch")) + data = [] + for stud in students: + row = [stud.student, stud.student_name] + + total_p = total_a = 0.0 + for day in range(filters["total_days_in_month"]): + status="None" + if att_map.get(stud.student): + status = att_map.get(stud.student).get(day + 1, "None") + status_map = {"Present": "P", "Absent": "A", "None": ""} + row.append(status_map[status]) + + if status == "Present": + total_p += 1 + elif status == "Absent": + total_a += 1 + + row += [total_p, total_a] + data.append(row) + + return columns, data + +def get_columns(filters): + columns = [ _("Student") + ":Link/Student:90", _("Student Name") + "::150"] + + for day in range(filters["total_days_in_month"]): + columns.append(cstr(day+1) +"::20") + + columns += [_("Total Present") + ":Int:95", _("Total Absent") + ":Int:90"] + return columns + +def get_attendance_list(conditions, filters): + attendance_list = frappe.db.sql("""select student, day(date) as day_of_month, + status from `tabStudent Attendance` where docstatus = 1 %s order by student, date""" % + conditions, filters, as_dict=1) + + att_map = {} + for d in attendance_list: + att_map.setdefault(d.student, frappe._dict()).setdefault(d.day_of_month, "") + att_map[d.student][d.day_of_month] = d.status + + return att_map + +def get_conditions(filters): + if not (filters.get("month") and filters.get("year")): + msgprint(_("Please select month and year"), raise_exception=1) + + filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", + "Dec"].index(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" + + if filters.get("student_batch"): conditions += " and student_batch = %(student_batch)s" + + return conditions, filters + +@frappe.whitelist() +def get_attendance_years(): + year_list = frappe.db.sql_list("""select distinct YEAR(date) from `tabStudent Attendance` ORDER BY YEAR(date) DESC""") + if not year_list: + year_list = [getdate().year] + + return "\n".join(str(year) for year in year_list)