?
Current Path : /home1/savoy/public_html/savoyglobal.net/koolkids/school/application/models/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/koolkids/school/application/models/reportmodel.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ class Reportmodel extends Model { function Reportmodel() { parent::Model(); } function searchstudentreport($postdata,$pagenum) { $data=array(); $this->db->from('studentreport'); $count= $this->db->count_all_results(); $arr=$this->fpaginate->paginate($pagenum,$count); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $start=$arr[2]; $perpage=$arr[3]; $data['count']=$count; $postdata=$_SESSION['searchdata']; if(!empty($postdata)) { $searchtext=$postdata['searchtext']; $searchfield=$postdata['searchvalue']; $this->db->like($searchfield, $searchtext); } $this->db->select('id,report_label,description,target'); $this->db->from('studentreport'); $this->db->order_by('id'); $data['results']=$this->db->get(); return $data; } function searchemployeereport($postdata,$pagenum) { $data=array(); $this->db->from('employeereport'); $count= $this->db->count_all_results(); $arr=$this->fpaginate->paginate($pagenum,$count); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $start=$arr[2]; $perpage=$arr[3]; $data['count']=$count; $postdata=$_SESSION['searchdata']; if(!empty($postdata)) { $searchtext=$postdata['searchtext']; $searchfield=$postdata['searchvalue']; $this->db->like($searchfield, $searchtext); } $this->db->select('id,report_label,description,target'); $this->db->from('employeereport'); $this->db->order_by('id'); $data['results']=$this->db->get(); return $data; } function searchfeereport($postdata,$pagenum) { $data=array(); $this->db->from('feereport'); $count= $this->db->count_all_results(); $arr=$this->fpaginate->paginate($pagenum,$count); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $start=$arr[2]; $perpage=$arr[3]; $data['count']=$count; $postdata=$_SESSION['searchdata']; if(!empty($postdata)) { $searchtext=$postdata['searchtext']; $searchfield=$postdata['searchvalue']; $this->db->like($searchfield, $searchtext); } $this->db->select('id,report_label,description,target'); $this->db->from('feereport'); $data['results']=$this->db->get(); return $data; } function get_payment_report($feecollection_id) { $data['results']=$this->db->query("SELECT CONCAT(`student`.`first_name`,' ' , `student`.`last_name`) as StudentName , GROUP_CONCAT('<td>',`fee_particular`.`fee_category`,'</td><td>',`fee_particular`.`fee_amount`,'</td>') as Particulars ,`fee`.`fee_date` , `fee`.`total_amount` , `fee`.`payment_mode` , `fee`.`remarks` , count(`fee_particular`.`fee_category`) as rowspan ,classlevel.classlevel_code ,student.reg_no FROM `fee_particular` INNER JOIN `fee` ON (`fee_particular`.`fee_id` = `fee`.`fee_id`) INNER JOIN `feecollection` ON (`feecollection`.`feecollection_id` = `fee`.`feecollection_id`) INNER JOIN `feecreate` ON (`feecollection`.`feecollection_feecreate_id` = `feecreate`.`feecreate_id`) INNER JOIN `student` ON (`fee`.`student_id` = `student`.`student_id`) INNER JOIN `master` ON (`master`.`masterid` = `fee`.`fee_id`) INNER JOIN classlevel on classlevel.classlevel_id = student.classlevel_id WHERE master.deleted = 0 and fee.feecollection_id='". $feecollection_id ."' and student.tc=0 GROUP BY fee_particular.fee_id;"); return $data['results']; } function get_defaulter_report($feecollection_id,$classlevel_id) { $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1'); $query="SELECT Reg_no,CONCAT(first_name,' ',last_name) AS student_name ,gender,contact_no ,email ,classlevel_code FROM student join master on master.masterid = student.student_id join classlevel on classlevel.classlevel_id = student.classlevel_id WHERE student_id NOT IN ( SELECT student_id FROM fee INNER JOIN master ON (master.masterid = fee.fee_id) WHERE master.ayear = '$ayear' and fee.feecollection_id = '$feecollection_id' ) and deleted=0 and tc=0 and student.classlevel_id='$classlevel_id' order by student.classlevel_id"; return $this->db->query($query); } function studentyearlyattendancereport($fromdate,$todate,$classlevel_id="") { $wherecondition=""; if($classlevel_id!="") $wherecondition =" and `student`.classlevel_id='$classlevel_id' "; $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1'); $query="SELECT `student`.`reg_no` , `student`.`first_name` , `student`.`last_name` , `student`.`gender` , `classlevel`.`classlevel_code` , `attendance_register`.`date` , `attendance_register`.`reason` FROM `attendance_register` INNER JOIN `student` ON (`attendance_register`.`student_id` = `student`.`student_id`) INNER JOIN `master` ON (`student`.`student_id` = `master`.`masterid`) INNER JOIN `classlevel` ON (`student`.`classlevel_id` = `classlevel`.`classlevel_id`) WHERE `attendance_register`.`date` BETWEEN '$fromdate' and '$todate' and `master`.deleted=0 and `master`.ayear=$ayear $wherecondition and `student`.tc=0 order by student.classlevel_id"; return $this->db->query($query); } function teacheryearlyattendancereport($fromdate,$todate) { $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1'); $query="SELECT `teacher`.`teacher_no` , `teacher`.`first_name` , `teacher`.`last_name` , `teacher`.`gender` , `teacher_attendance`.`leave_from_date` , `teacher_attendance`.`leave_to_date` , `teacher_attendance`.`reason` FROM `teacher` INNER JOIN `master` ON (`teacher`.`teacher_id` = `master`.`masterid`) INNER JOIN `teacher_attendance` ON (`teacher_attendance`.`teacher_id` = `teacher`.`teacher_id`) WHERE `teacher_attendance`.`leave_from_date` BETWEEN '$fromdate' and '$todate' and `master`.deleted=0 and `master`.ayear=$ayear "; return $this->db->query($query); } function staffyearlyattendancereport($fromdate,$todate) { $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1'); $query="SELECT `staff`.`staff_no` , `staff`.`name` , `staff_attendance`.`leave_from_date`, `staff_attendance`.`leave_to_date` , `staff_attendance`.`reason` FROM `staff` INNER JOIN `master` ON (`staff`.`staff_id` = `master`.`masterid`) INNER JOIN `staff_attendance` ON (`staff_attendance`.`staff_id` = `staff`.`staff_id`) WHERE `staff_attendance`.`leave_from_date` BETWEEN '$fromdate' and '$todate' and `master`.deleted=0 and `master`.ayear=$ayear "; return $this->db->query($query); } function getstudentclassreport($classlevel_id) { $ayear = $this->mastermodel->getsinglefieldvalue('academicyear','ayear','current','1'); $query="SELECT `student`.`reg_no` ,`student`.`first_name` ,`student`.`last_name` ,`student`.`gender` ,`classlevel`.`classlevel_code` ,`parent`.`name` ,`parent`.`relationship_type` ,`parent`.`mobile_no` ,`parent`.`email` ,`parent`.`profession` ,`parent_student`.`student_id` FROM `student` INNER JOIN `master` ON (`student`.`student_id` = `master`.`masterid`) INNER JOIN `classlevel` ON (`student`.`classlevel_id` = `classlevel`.`classlevel_id`) LEFT JOIN `parent_student` ON (`parent_student`.`student_id` = `student`.`student_id`) LEFT JOIN `parent` ON (`parent`.`parent_id`=`parent_student`.`parent_id`) WHERE master.ayear = '$ayear' and student.classlevel_id='$classlevel_id' and deleted=0 and tc=0 group by student.student_id order by student.classlevel_id"; return $this->db->query($query); } function getteacherdetailreport($classlevel_id) { $query="SELECT * FROM `teacher` INNER JOIN `teacher_address` ON (`teacher`.`teacher_id` = `teacher_address`.`teacher_id`) INNER JOIN `master` ON (`teacher`.`teacher_id` = `master`.`masterid`) LEFT JOIN `teacher_subject` ON (`teacher`.`teacher_id` = `teacher_subject`.`teacher_id`) LEFT JOIN `subject` ON (`teacher_subject`.`subject_id` = `subject`.`subject_id`) WHERE deleted=0 "; if($classlevel_id!="") $query .=" and subject.classlevel_id='$classlevel_id'"; $query .=" group by teacher.teacher_id order by teacher.teacher_id"; return $this->db->query($query); } function getnonteacherdetailreport($department_id='',$designation_id='') { $query="SELECT * FROM `staff` INNER JOIN `staff_address` ON (`staff`.`staff_id` = `staff_address`.`staff_id`) INNER JOIN `master` ON (`staff`.`staff_id` = `master`.`masterid`) INNER JOIN `department` ON (`staff`.`department_id` = `department`.`department_id`) INNER JOIN `designation` ON (`staff`.`designation_id` = `designation`.`designation_id`) WHERE deleted=0 "; if($department_id!="") $query .=" and `staff`.`department_id`='$department_id'"; if($designation_id!="") $query .=" and `staff`.`designation_id`='$designation_id'"; $query .=" order by staff.staff_id"; return $this->db->query($query); } }