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"),
"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"
}
]
},

View File

@ -6,9 +6,9 @@ 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" ,"");
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",
@ -30,18 +30,18 @@ frappe.ui.form.on("Assessment" ,{
}
});
frappe.ui.form.on("Assessment Result" ,{
result : function(frm, cdt, cdn) {
if(frm.doc.grading_structure){
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:{
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){
callback: function(r) {
if (r.message) {
frappe.model.set_value(cdt, cdn, 'grade', r.message);
}
}

View File

@ -1,6 +1,6 @@
frappe.provide("schools")
frappe.ui.form.on("Course Schedule" ,{
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);
@ -11,19 +11,18 @@ frappe.ui.form.on("Course Schedule" ,{
}
},
refresh :function(frm) {
if(!frm.doc.__islocal && frm.doc.student_group) {
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) {
if (r.message) {
hide_field('attendance');
frm.events.view_attendance(frm)
}
else {
} else {
frappe.call({
method: "erpnext.schools.api.get_student_group_students",
args: {
@ -38,8 +37,7 @@ frappe.ui.form.on("Course Schedule" ,{
}
}
});
}
else {
} else {
hide_field('attendance');
}
},
@ -55,7 +53,7 @@ frappe.ui.form.on("Course Schedule" ,{
},
get_students: function(frm, students) {
if(!frm.students_area) {
if (!frm.students_area) {
frm.students_area = $('<div>')
.appendTo(frm.fields_dict.students_html.wrapper);
}
@ -83,7 +81,7 @@ schools.StudentsEditor = Class.extend({
.html(__('Check all'))
.on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if(!$(check).is(":checked")) {
if (!$(check).is(":checked")) {
check.checked = true;
}
});
@ -93,7 +91,7 @@ schools.StudentsEditor = Class.extend({
.html(__('Uncheck all'))
.on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) {
if ($(check).is(":checked")) {
check.checked = false;
}
});
@ -105,10 +103,9 @@ schools.StudentsEditor = Class.extend({
var students_present = [];
var students_absent = [];
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) {
if ($(check).is(":checked")) {
students_present.push(students[i]);
}
else {
} else {
students_absent.push(students[i]);
}
});
@ -131,7 +128,7 @@ schools.StudentsEditor = Class.extend({
<div class="checkbox">\
<label><input type="checkbox" class="students-check" student="%(student)s">\
%(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,
"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,

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_term", "academic_term");
frappe.ui.form.on("Course Scheduling Tool", "refresh", function(frm) {
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
doc: frm.doc
})
});
}
});

View File

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

View File

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

View File

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

View File

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

View File

@ -16,4 +16,3 @@ class StudentBatch(Document):
def validate(self):
validate_duplicate_student(self.students)

View File

@ -8,8 +8,8 @@ frappe.ui.form.on('Student Batch Attendance Tool', {
hide_field('attendance');
},
student_batch :function(frm) {
if(frm.doc.student_batch && frm.doc.date) {
student_batch: function(frm) {
if (frm.doc.student_batch && frm.doc.date) {
frappe.call({
method: "erpnext.schools.api.check_attendance_records_exist",
args: {
@ -17,11 +17,10 @@ frappe.ui.form.on('Student Batch Attendance Tool', {
"date": frm.doc.date
},
callback: function(r) {
if(r.message) {
if (r.message) {
frappe.msgprint("Attendance already marked.");
hide_field('attendance');
}
else {
} else {
frappe.call({
method: "erpnext.schools.api.get_student_batch_students",
args: {
@ -45,7 +44,7 @@ frappe.ui.form.on('Student Batch Attendance Tool', {
},
get_students: function(frm, students) {
if(!frm.students_area) {
if (!frm.students_area) {
frm.students_area = $('<div>')
.appendTo(frm.fields_dict.students_html.wrapper);
}
@ -73,7 +72,7 @@ schools.StudentsEditor = Class.extend({
.html(__('Check all'))
.on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if(!$(check).is(":checked")) {
if (!$(check).is(":checked")) {
check.checked = true;
}
});
@ -83,7 +82,7 @@ schools.StudentsEditor = Class.extend({
.html(__('Uncheck all'))
.on("click", function() {
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) {
if ($(check).is(":checked")) {
check.checked = false;
}
});
@ -95,10 +94,9 @@ schools.StudentsEditor = Class.extend({
var students_present = [];
var students_absent = [];
$(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
if($(check).is(":checked")) {
if ($(check).is(":checked")) {
students_present.push(students[i]);
}
else {
} else {
students_absent.push(students[i]);
}
});
@ -122,7 +120,7 @@ schools.StudentsEditor = Class.extend({
<div class="checkbox">\
<label><input type="checkbox" class="students-check" student="%(student)s">\
%(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,
"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,

View File

@ -1,7 +1,8 @@
cur_frm.add_fetch("student", "title", "student_name");
frappe.ui.form.on("Student Group", "refresh", function(frm) {
if(!frm.doc.__islocal) {
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
@ -16,16 +17,17 @@ frappe.ui.form.on("Student Group", "refresh", function(frm) {
frappe.set_route("List", "Assessment");
});
}
});
},
frappe.ui.form.on("Student Group", "onload", function(frm){
cur_frm.set_query("academic_term",function(){
return{
"filters":{
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

View File

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

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)