Merge pull request #7092 from neilLasrado/reports

Updates to Student Attendance Module
This commit is contained in:
Nabin Hait 2016-12-01 15:21:43 +05:30 committed by GitHub
commit f129fd4695
32 changed files with 1206 additions and 336 deletions

View File

@ -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"), "label": _("Schedule"),
"items": [ "items": [
@ -63,17 +98,9 @@ def get_data():
"name": "Course Schedule", "name": "Course Schedule",
"route": "Calendar/Course Schedule" "route": "Calendar/Course Schedule"
}, },
{
"type": "doctype",
"name": "Student Attendance"
},
{ {
"type": "doctype", "type": "doctype",
"name": "Course Scheduling Tool" "name": "Course Scheduling Tool"
},
{
"type": "doctype",
"name": "Student Batch Attendance Tool"
} }
] ]
}, },

View File

@ -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("supervisor", "instructor_name", "supervisor_name");
cur_frm.add_fetch("student", "title", "student_name"); cur_frm.add_fetch("student", "title", "student_name");
frappe.ui.form.on("Assessment" ,{ frappe.ui.form.on("Assessment", {
student_group : function(frm) { student_group: function(frm) {
frm.set_value("results" ,""); frm.set_value("results", "");
if (frm.doc.student_group) { if (frm.doc.student_group) {
frappe.call({ frappe.call({
method: "erpnext.schools.api.get_student_group_students", method: "erpnext.schools.api.get_student_group_students",
args: { args: {
"student_group": frm.doc.student_group "student_group": frm.doc.student_group
}, },
callback: function(r) { callback: function(r) {
if (r.message) { if (r.message) {
$.each(r.message, function(i, d) { $.each(r.message, function(i, d) {
var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results"); var row = frappe.model.add_child(cur_frm.doc, "Assessment Result", "results");
row.student = d.student; row.student = d.student;
row.student_name = d.student_name; row.student_name = d.student_name;
}); });
} }
refresh_field("results"); refresh_field("results");
} }
}); });
} }
} }
}); });
frappe.ui.form.on("Assessment Result" ,{ frappe.ui.form.on("Assessment Result", {
result : function(frm, cdt, cdn) { result: function(frm, cdt, cdn) {
if(frm.doc.grading_structure){ if (frm.doc.grading_structure) {
var assessment_result = locals[cdt][cdn]; var assessment_result = locals[cdt][cdn];
frappe.call({ frappe.call({
method:"erpnext.schools.doctype.assessment.assessment.get_grade", method: "erpnext.schools.doctype.assessment.assessment.get_grade",
args:{ args: {
grading_structure: frm.doc.grading_structure, grading_structure: frm.doc.grading_structure,
result: assessment_result.result result: assessment_result.result
}, },
callback: function(r){ callback: function(r) {
if(r.message){ if (r.message) {
frappe.model.set_value(cdt, cdn, 'grade', r.message); frappe.model.set_value(cdt, cdn, 'grade', r.message);
} }
} }
}); });
} }
} }
}); });

View File

@ -1,137 +1,134 @@
frappe.provide("schools") frappe.provide("schools")
frappe.ui.form.on("Course Schedule" ,{ frappe.ui.form.on("Course Schedule", {
onload: function(frm) { onload: function(frm) {
if (frm.doc.from_datetime && frm.doc.to_datetime) { if (frm.doc.from_datetime && frm.doc.to_datetime) {
var from_datetime = moment(frm.doc.from_datetime); var from_datetime = moment(frm.doc.from_datetime);
var to_datetime = moment(frm.doc.to_datetime); var to_datetime = moment(frm.doc.to_datetime);
frm.doc.schedule_date = from_datetime.format(moment.defaultFormat); frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
frm.doc.from_time = from_datetime.format("HH:mm:ss"); frm.doc.from_time = from_datetime.format("HH:mm:ss");
frm.doc.to_time = to_datetime.format("HH:mm:ss"); frm.doc.to_time = to_datetime.format("HH:mm:ss");
} }
}, },
refresh :function(frm) { refresh: function(frm) {
if(!frm.doc.__islocal && frm.doc.student_group) { if (!frm.doc.__islocal && frm.doc.student_group) {
frappe.call({ frappe.call({
method: "erpnext.schools.api.check_attendance_records_exist", method: "erpnext.schools.api.check_attendance_records_exist",
args: { args: {
"course_schedule": frm.doc.name "course_schedule": frm.doc.name
}, },
callback: function(r) { callback: function(r) {
if(r.message) { if (r.message) {
hide_field('attendance'); hide_field('attendance');
frm.events.view_attendance(frm) frm.events.view_attendance(frm)
} } else {
else { frappe.call({
frappe.call({ method: "erpnext.schools.api.get_student_group_students",
method: "erpnext.schools.api.get_student_group_students", args: {
args: { "student_group": frm.doc.student_group
"student_group": frm.doc.student_group },
}, callback: function(r) {
callback: function(r) { if (r.message) {
if (r.message) { frm.events.get_students(frm, r.message)
frm.events.get_students(frm, r.message) }
} }
} });
}); }
} }
} });
}); } else {
} hide_field('attendance');
else { }
hide_field('attendance'); },
}
},
view_attendance: function(frm) { view_attendance: function(frm) {
hide_field('attendance'); hide_field('attendance');
frm.add_custom_button(__("View attendance"), function() { frm.add_custom_button(__("View attendance"), function() {
frappe.route_options = { frappe.route_options = {
course_schedule: frm.doc.name course_schedule: frm.doc.name
} }
frappe.set_route("List", "Student Attendance"); frappe.set_route("List", "Student Attendance");
}); });
}, },
get_students: function(frm, students) { get_students: function(frm, students) {
if(!frm.students_area) { if (!frm.students_area) {
frm.students_area = $('<div>') frm.students_area = $('<div>')
.appendTo(frm.fields_dict.students_html.wrapper); .appendTo(frm.fields_dict.students_html.wrapper);
} }
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
} }
}); });
schools.StudentsEditor = Class.extend({ schools.StudentsEditor = Class.extend({
init: function(frm, wrapper, students) { init: function(frm, wrapper, students) {
this.wrapper = wrapper; this.wrapper = wrapper;
this.frm = frm; this.frm = frm;
this.make(frm, students); this.make(frm, students);
}, },
make: function(frm, students) { make: function(frm, students) {
var me = this; var me = this;
$(this.wrapper).empty(); $(this.wrapper).empty();
var student_toolbar = $('<p>\ var student_toolbar = $('<p>\
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\ <button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\ <button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper)); <button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
student_toolbar.find(".btn-add") student_toolbar.find(".btn-add")
.html(__('Check all')) .html(__('Check all'))
.on("click", function() { .on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if(!$(check).is(":checked")) { if (!$(check).is(":checked")) {
check.checked = true; check.checked = true;
} }
}); });
}); });
student_toolbar.find(".btn-remove") student_toolbar.find(".btn-remove")
.html(__('Uncheck all')) .html(__('Uncheck all'))
.on("click", function() { .on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) { if ($(check).is(":checked")) {
check.checked = false; check.checked = false;
} }
}); });
}); });
student_toolbar.find(".btn-mark-att") student_toolbar.find(".btn-mark-att")
.html(__('Mark Attendence')) .html(__('Mark Attendence'))
.on("click", function() { .on("click", function() {
var students_present = []; var students_present = [];
var students_absent = []; var students_absent = [];
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) { if ($(check).is(":checked")) {
students_present.push(students[i]); students_present.push(students[i]);
} } else {
else { students_absent.push(students[i]);
students_absent.push(students[i]); }
} });
}); frappe.call({
frappe.call({ method: "erpnext.schools.api.mark_attendance",
method: "erpnext.schools.api.mark_attendance", args: {
args: { "students_present": students_present,
"students_present": students_present, "students_absent": students_absent,
"students_absent": students_absent, "course_schedule": frm.doc.name
"course_schedule": frm.doc.name },
}, callback: function(r) {
callback: function(r) { frm.events.view_attendance(frm)
frm.events.view_attendance(frm) }
} });
}); });
});
$.each(students, function(i, m) { $.each(students, function(i, m) {
$(repl('<div class="col-sm-6">\ $(repl('<div class="col-sm-6">\
<div class="checkbox">\ <div class="checkbox">\
<label><input type="checkbox" class="students-check" student="%(student)s">\ <label><input type="checkbox" class="students-check" student="%(student)s">\
%(student)s</label>\ %(student)s</label>\
</div></div>', {student: m.student_name})).appendTo(me.wrapper); </div></div>', { student: m.student_name })).appendTo(me.wrapper);
}); });
} }
}) })

View File

@ -478,13 +478,34 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-11-16 16:38:00.454295", "modified": "2016-12-01 12:59:25.086606",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Course Schedule", "name": "Course Schedule",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "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, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -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_year", "academic_year");
cur_frm.add_fetch("student_group", "academic_term", "academic_term"); cur_frm.add_fetch("student_group", "academic_term", "academic_term");
frappe.ui.form.on("Course Scheduling Tool", "refresh", function(frm) { frappe.ui.form.on("Course Scheduling Tool", {
frm.disable_save();
frm.page.set_primary_action(__("Schedule Course"), function() { refresh: function(frm) {
frappe.call({ frm.disable_save();
method: "schedule_course", frm.page.set_primary_action(__("Schedule Course"), function() {
doc:frm.doc frappe.call({
}) method: "schedule_course",
}); doc: frm.doc
})
});
}
}); });

View File

@ -24,6 +24,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "First Name", "label": "First Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -32,6 +33,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
@ -50,6 +52,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Middle Name", "label": "Middle Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -58,6 +61,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -76,6 +80,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Last Name", "label": "Last Name",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -84,6 +89,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -102,6 +108,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -109,6 +116,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -127,6 +135,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Naming Series", "label": "Naming Series",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -136,6 +145,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -154,6 +164,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Student Email ID", "label": "Student Email ID",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -162,6 +173,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -180,6 +192,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Student Mobile Number", "label": "Student Mobile Number",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -189,6 +202,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -208,6 +222,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Joining Date", "label": "Joining Date",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -216,6 +231,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -234,6 +250,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Image", "label": "Image",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -242,6 +259,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -262,6 +280,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Personal Details", "label": "Personal Details",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -270,6 +289,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -288,6 +308,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Date of Birth", "label": "Date of Birth",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -296,6 +317,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -314,6 +336,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Blood Group", "label": "Blood Group",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -323,6 +346,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -341,6 +365,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -348,6 +373,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -366,6 +392,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Gender", "label": "Gender",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -375,6 +402,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -393,6 +421,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Nationality", "label": "Nationality",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -402,6 +431,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -420,6 +450,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Student Applicant", "label": "Student Applicant",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -429,6 +460,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 1, "read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -447,6 +479,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Home Address", "label": "Home Address",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -455,6 +488,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -473,6 +507,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Address Line 1", "label": "Address Line 1",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -481,6 +516,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -499,6 +535,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Address Line 2", "label": "Address Line 2",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -507,6 +544,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -525,6 +563,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Pincode", "label": "Pincode",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -533,6 +572,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -551,6 +591,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
"permlevel": 0, "permlevel": 0,
@ -558,6 +599,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -576,6 +618,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "City", "label": "City",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -584,6 +627,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -602,6 +646,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "State", "label": "State",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -610,6 +655,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -628,6 +674,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Guardian Details", "label": "Guardian Details",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -636,6 +683,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -654,6 +702,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Guardians", "label": "Guardians",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -663,6 +712,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -681,6 +731,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Sibling Details", "label": "Sibling Details",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -690,6 +741,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -708,6 +760,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Siblings", "label": "Siblings",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -717,6 +770,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -736,6 +790,7 @@
"ignore_xss_filter": 0, "ignore_xss_filter": 0,
"in_filter": 0, "in_filter": 0,
"in_list_view": 0, "in_list_view": 0,
"in_standard_filter": 0,
"label": "Title", "label": "Title",
"length": 0, "length": 0,
"no_copy": 0, "no_copy": 0,
@ -744,6 +799,7 @@
"print_hide": 0, "print_hide": 0,
"print_hide_if_no_value": 0, "print_hide_if_no_value": 0,
"read_only": 0, "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0, "report_hide": 0,
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
@ -763,13 +819,34 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-10-26 12:24:10.533118", "modified": "2016-12-01 12:55:32.453131",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student", "name": "Student",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "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, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -2,10 +2,4 @@
// For license information, please see license.txt // For license information, please see license.txt
cur_frm.add_fetch("course_schedule", "schedule_date", "date"); cur_frm.add_fetch("course_schedule", "schedule_date", "date");
cur_frm.add_fetch("course_schedule", "student_batch", "student_batch"); cur_frm.add_fetch("course_schedule", "student_batch", "student_batch")
frappe.ui.form.on('Student Attendance', {
refresh: function(frm) {
}
});

View File

@ -252,13 +252,34 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-11-16 16:58:35.779867", "modified": "2016-12-01 12:56:21.537215",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Attendance", "name": "Student Attendance",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "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, "amend": 1,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -70,6 +70,35 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 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, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -280,7 +309,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-11-21 19:08:05.775954", "modified": "2016-12-01 13:18:12.024001",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Batch", "name": "Student Batch",
@ -307,6 +336,27 @@
"share": 1, "share": 1,
"submit": 0, "submit": 0,
"write": 1 "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, "quick_entry": 1,

View File

@ -8,12 +8,11 @@ from erpnext.schools.utils import validate_duplicate_student
import frappe import frappe
class StudentBatch(Document): class StudentBatch(Document):
def autoname(self): def autoname(self):
prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation") prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation")
if not prog_abb: if not prog_abb:
prog_abb = self.program prog_abb = self.program
self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year
def validate(self):
validate_duplicate_student(self.students)
def validate(self):
validate_duplicate_student(self.students)

View File

@ -3,126 +3,124 @@
frappe.provide("schools") frappe.provide("schools")
frappe.ui.form.on('Student Batch Attendance Tool', { frappe.ui.form.on('Student Batch Attendance Tool', {
refresh: function(frm) { refresh: function(frm) {
frm.disable_save(); frm.disable_save();
hide_field('attendance'); hide_field('attendance');
}, },
student_batch :function(frm) { student_batch: function(frm) {
if(frm.doc.student_batch && frm.doc.date) { if (frm.doc.student_batch && frm.doc.date) {
frappe.call({ frappe.call({
method: "erpnext.schools.api.check_attendance_records_exist", method: "erpnext.schools.api.check_attendance_records_exist",
args: { args: {
"student_batch": frm.doc.student_batch, "student_batch": frm.doc.student_batch,
"date": frm.doc.date "date": frm.doc.date
}, },
callback: function(r) { callback: function(r) {
if(r.message) { if (r.message) {
frappe.msgprint("Attendance already marked."); frappe.msgprint("Attendance already marked.");
hide_field('attendance'); hide_field('attendance');
} } else {
else { frappe.call({
frappe.call({ method: "erpnext.schools.api.get_student_batch_students",
method: "erpnext.schools.api.get_student_batch_students", args: {
args: { "student_batch": frm.doc.student_batch
"student_batch": frm.doc.student_batch },
}, callback: function(r) {
callback: function(r) { if (r.message) {
if (r.message) { unhide_field('attendance');
unhide_field('attendance'); frm.events.get_students(frm, r.message)
frm.events.get_students(frm, r.message) }
} }
} });
}); }
} }
} });
}); }
} },
},
date: function(frm) { date: function(frm) {
frm.trigger("student_batch"); frm.trigger("student_batch");
}, },
get_students: function(frm, students) { get_students: function(frm, students) {
if(!frm.students_area) { if (!frm.students_area) {
frm.students_area = $('<div>') frm.students_area = $('<div>')
.appendTo(frm.fields_dict.students_html.wrapper); .appendTo(frm.fields_dict.students_html.wrapper);
} }
frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
} }
}); });
schools.StudentsEditor = Class.extend({ schools.StudentsEditor = Class.extend({
init: function(frm, wrapper, students) { init: function(frm, wrapper, students) {
this.wrapper = wrapper; this.wrapper = wrapper;
this.frm = frm; this.frm = frm;
this.make(frm, students); this.make(frm, students);
}, },
make: function(frm, students) { make: function(frm, students) {
var me = this; var me = this;
$(this.wrapper).empty(); $(this.wrapper).empty();
var student_toolbar = $('<p>\ var student_toolbar = $('<p>\
<button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\ <button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
<button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\ <button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
<button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper)); <button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
student_toolbar.find(".btn-add") student_toolbar.find(".btn-add")
.html(__('Check all')) .html(__('Check all'))
.on("click", function() { .on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if(!$(check).is(":checked")) { if (!$(check).is(":checked")) {
check.checked = true; check.checked = true;
} }
}); });
}); });
student_toolbar.find(".btn-remove") student_toolbar.find(".btn-remove")
.html(__('Uncheck all')) .html(__('Uncheck all'))
.on("click", function() { .on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) { if ($(check).is(":checked")) {
check.checked = false; check.checked = false;
} }
}); });
}); });
student_toolbar.find(".btn-mark-att") student_toolbar.find(".btn-mark-att")
.html(__('Mark Attendence')) .html(__('Mark Attendence'))
.on("click", function() { .on("click", function() {
var students_present = []; var students_present = [];
var students_absent = []; var students_absent = [];
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) { $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) { if ($(check).is(":checked")) {
students_present.push(students[i]); students_present.push(students[i]);
} } else {
else { students_absent.push(students[i]);
students_absent.push(students[i]); }
} });
}); frappe.call({
frappe.call({ method: "erpnext.schools.api.mark_attendance",
method: "erpnext.schools.api.mark_attendance", args: {
args: { "students_present": students_present,
"students_present": students_present, "students_absent": students_absent,
"students_absent": students_absent, "student_batch": frm.doc.student_batch,
"student_batch": frm.doc.student_batch, "date": frm.doc.date
"date": frm.doc.date },
}, callback: function(r) {
callback: function(r) { hide_field('attendance');
hide_field('attendance'); }
} });
}); });
});
$.each(students, function(i, m) { $.each(students, function(i, m) {
$(repl('<div class="col-sm-6">\ $(repl('<div class="col-sm-6">\
<div class="checkbox">\ <div class="checkbox">\
<label><input type="checkbox" class="students-check" student="%(student)s">\ <label><input type="checkbox" class="students-check" student="%(student)s">\
%(student)s</label>\ %(student)s</label>\
</div></div>', {student: m.student_name})).appendTo(me.wrapper); </div></div>', { student: m.student_name })).appendTo(me.wrapper);
}); });
} }
}); });

View File

@ -163,13 +163,34 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-11-16 17:16:43.835693", "modified": "2016-12-01 12:58:31.822014",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Batch Attendance Tool", "name": "Student Batch Attendance Tool",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "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, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -1,31 +1,33 @@
cur_frm.add_fetch("student", "title", "student_name"); cur_frm.add_fetch("student", "title", "student_name");
frappe.ui.form.on("Student Group", "refresh", function(frm) { frappe.ui.form.on("Student Group", {
if(!frm.doc.__islocal) { refresh: function(frm) {
frm.add_custom_button(__("Course Schedule"), function() { if (!frm.doc.__islocal) {
frappe.route_options = { frm.add_custom_button(__("Course Schedule"), function() {
student_group: frm.doc.name frappe.route_options = {
} student_group: frm.doc.name
frappe.set_route("List", "Course Schedule"); }
}); frappe.set_route("List", "Course Schedule");
});
frm.add_custom_button(__("Assessment"), function() { frm.add_custom_button(__("Assessment"), function() {
frappe.route_options = { frappe.route_options = {
student_group: frm.doc.name student_group: frm.doc.name
} }
frappe.set_route("List", "Assessment"); frappe.set_route("List", "Assessment");
}); });
} }
}); },
frappe.ui.form.on("Student Group", "onload", function(frm){ onload: function(frm) {
cur_frm.set_query("academic_term",function(){ cur_frm.set_query("academic_term", function() {
return{ return {
"filters":{ "filters": {
"academic_year": (frm.doc.academic_year) "academic_year": (frm.doc.academic_year)
} }
}; };
}); });
}
}); });
//If Student Batch is entered, deduce program, academic_year and academic term from it //If Student Batch is entered, deduce program, academic_year and academic term from it

View File

@ -311,13 +311,34 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2016-11-07 05:26:38.673266", "modified": "2016-12-01 12:57:17.125085",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Schools", "module": "Schools",
"name": "Student Group", "name": "Student Group",
"name_case": "", "name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "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, "amend": 0,
"apply_user_permissions": 0, "apply_user_permissions": 0,

View File

@ -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) {
}
});

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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
}
]
}

View File

@ -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"
}

View File

@ -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

View File

@ -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
}]
}

View File

@ -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"
}

View File

@ -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

View File

@ -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);
}
});
}
}

View File

@ -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"
}

View File

@ -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)