RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
stream; ?>
FORM
Name
Stream
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report - Kisw
Report - Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
More (Kiswahili)
More (English)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
#################### SORTING STUDENTS ##############################
## sorting subjects in exam
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('exam');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('exam');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('exam');
$i=0;
$tempo = 0;
$position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('exam');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('exam',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('consolidated_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
}
## +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS (TERM I EXAM WITHOUT CA)';
}else{
$termm='ANNUAL EXAMINATIONS (TERM II EXAM WITHOUT CA';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('term_results');
foreach($get_link->result() as $link){?>
stream; ?>
Name
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report Kis
Report Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('consolidated_results');
foreach($get_link->result() as $link){?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Repport Kis
Repport Eng)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$reg_number = $this->input->post('reg_number');
$month = $this->input->post('month');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MONTHLY TEST - FORM
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('monthly_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
Anaglia zaidi...
View more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
STUDENT RESULTS FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia Zaid kwa Kiswahili
More (English)
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome/login');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
function roman_number($class){
if($class==4){
$class='IV';
}elseif($class==3){
$class='III';
}elseif($class==2){
$class='II';
}elseif($class==1){
$class='I';
}elseif($class==5){
$class='V';
}elseif($class==6){
$class='VI';
}
return $class;
}
}
public function update_access_level(){
$access = $this->uri->segment(3);
$exam_id = $this->uri->segment(4);
$status = $this->uri->segment(5);
$data = array(
$access=> $status
);
$this->db->where('examination_id',$exam_id);
$d = $this->db->update('examination',$data);
if($d){
echo "
Access changed successifully ";
}else{
echo "
Access change failed ";
}
}
//this function redirecting different pages after users loged in
public function index() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officers_home');
$this->load->view('includes/secondary/secondary_footer');
}
public function insert_periods_perweek(){
$data = array(
'class_level'=>$this->input->post('class_level'),
'subject_id'=>$this->input->post('subject_id'),
'category'=>$this->input->post('category'),
'periods'=>$this->input->post('period'),
);
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('subject_id',$this->input->post('subject_id'));
$this->db->where('category',$this->input->post('category'));
$count = $this->db->count_all_results('periods_perweek');
if($count){
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('subject_id',$this->input->post('subject_id'));
$this->db->where('category',$this->input->post('category'));
$this->db->update('periods_perweek',$data);
}else{
$this->db->insert('periods_perweek',$data);
}
}
public function top_100_subjects(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/officer/top_100_subjects');
$this->load->view('includes/secondary/secondary_footer');
}
public function print_untaught_periods(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_untaught_periods');
$this->load->view('includes/secondary/secondary_footer');
}
public function periods_officers() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/periods_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function periods_perweek() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/periods_perweek');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_period_reports_officer');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report_progressive() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_periods_report_progressive');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report_subject() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_periods_report_subject');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report_unresponded() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_periods_report_unresponded');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report_school() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_period_reports_officer_school');
$this->load->view('includes/secondary/uploading_footer');
}
public function register_exam() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/create_exam');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_missed_students_insubject() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_missed_students_insubject');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_report_wrong() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_report_wrong');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_report_missed() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_report_missed');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_report_incomplete() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_report_incomplete');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_reports() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_report');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_reports_olevel() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_reports_olevel');
$this->load->view('includes/secondary/secondary_footer');
}
public function acces_control() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/acces_control');
$this->load->view('includes/secondary/secondary_footer');
}
public function subject_sheet() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/subject_sheet');
$this->load->view('includes/secondary/secondary_footer');
}
public function school_sheets() {
// $this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/school_sheets');
//$this->load->view('includes/secondary/secondary_footer');
}
public function refresh() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/refresh');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_incomplete() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_incomplete');
$this->load->view('includes/secondary/secondary_footer');
}
public function error_report() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/error_report');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_exam() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_exam');
$this->load->view('includes/secondary/secondary_footer');
}
public function undo_suspend(){
$this->db->where('school_id',$_REQUEST['sc']);
$this->db->where('exam_id',$_REQUEST['ex']);
$this->db->delete('suspended_results');
redirect($_SERVER['HTTP_REFERER']);
}
public function do_suspend(){
$exam_id = $this->input->post('exam_id');
$school_id = $this->input->post('school_id');
$message = $this->input->post('message');
$this->db->where('school_id',$school_id)->where('exam_id',$exam_id);
$status = $this->db->count_all_results('suspended_results');
if($status > 0){
### Delete
$this->db->where('school_id',$rows->school_id)->where('exam_id',$exam_id)->delete('suspended_results');
}else{
## Insert
$this->db->insert('suspended_results',array('school_id'=>$school_id,'exam_id'=>$exam_id,'message'=>$message));
}
redirect($_SERVER['HTTP_REFERER']);
}
public function suspend_results() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/suspend_results');
$this->load->view('includes/secondary/secondary_footer');
}
public function edit_exam_name(){
$data=array(
'exam_name'=>$this->security->xss_clean($this->input->post('name')),
);
$this->db->where('examination_id',$this->security->xss_clean($this->input->post('id')));
$this->db->update('examination',$data);
redirect('Secondary_officers/view_exam?Sent');
}
public function insert_exam(){
if($_POST){
$year = date('Y');
if($this->input->post('category') == 'A'){
$year = $this->session->userdata('academic_year_a_level');
}
$group_id=0;
if($this->session->userdata('region')>0 && $this->session->userdata('district')==0){
$group_id='REO';
}elseif($this->session->userdata('district')>0 && $this->session->userdata('region')>0){
$group_id='DEO';
}
if($this->session->userdata('group_id')==0){
// $this->db->where('region',$this->session->userdata('region'));
// $this->db->where('district',$this->session->userdata('district'));
// $this->db->where('month',$this->input->post('month'));
// $this->db->where('class_level',$this->input->post('class'));
// $this->db->where('academic_year',$year);
// $this->db->where('category',$this->input->post('category'));
// $count = $this->db->count_all_results('examination');
$data = array(
'exam_name'=>$this->input->post('name'),
'heading'=>$this->input->post('name'),
'month'=>$this->input->post('month'),
'category'=>$this->input->post('category'),
'class_level'=>$this->input->post('class'),
'academic_year'=>$year,
'district'=>$this->session->userdata('district'),
'region'=>$this->session->userdata('region'),
'group_id'=>$group_id,
'school_type'=>'SS',
);
$data = $this->security->xss_clean($data);
$this->db->insert('examination',$data);
}else{
// $this->db->where('region',$this->session->userdata('region'));
// $this->db->where('district',$this->session->userdata('district'));
// $this->db->where('month',$this->input->post('month'));
// $this->db->where('class_level',$this->input->post('class'));
// $this->db->where('academic_year',$year);
// $this->db->where('category',$this->input->post('category'));
// $count = $this->db->count_all_results('examination');
$data = array(
'exam_name'=>$this->input->post('name'),
'heading'=>$this->input->post('name'),
'month'=>$this->input->post('month'),
'category'=>$this->input->post('category'),
'class_level'=>$this->input->post('class'),
'academic_year'=>$year,
'district'=>$this->session->userdata('district'),
'region'=>$this->session->userdata('region'),
'group_id'=>$this->session->userdata('group_id'),
'school_type'=>'SS',
);
$data = $this->security->xss_clean($data);
$this->db->insert('examination',$data);
}
redirect('Secondary_officers/register_exam?suc');
}
}
public function activate_deactive(){
$examination_id = $this->uri->segment(3);
$this->db->where('examination_id',$examination_id);
$this->db->where('status',0);
$count = $this->db->count_all_results('examination');
if($count == 0){
$this->db->where('examination_id',$examination_id);
$this->db->update('examination',array('status'=>0));
}else{
$this->db->where('examination_id',$examination_id);
$this->db->update('examination',array('status'=>1));
}
redirect('Secondary_officers/view_exam?changed');
}
public function change_password_officer() {
$pass1 = $this->input->post('password1');
$pass2 = $this->input->post('password2');
if ($pass1 == $pass2) {
$pass = $this->User_model->check_password_officers();
if ($pass > 0) {
$pass = $this->input->post('password');
$data1['password'] = MD5($pass);
if ($_POST) {
$this->User_model->change_passwords_officiers();
$this->User_model->change_passwords_reset_officers();
redirect('Secondary_officers?Changed');
} else {
redirect('Secondary_officers');
}
} else {
redirect('Secondary_officers?Error');
}
} else {
redirect('Secondary_officers?Error1');
}
}
public function recharge_sms() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/recharge_sms');
$this->load->view('includes/secondary/secondary_footer');
}
public function site_visit_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/site_visit_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function students_site_visit_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/students_site_visit_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_school_results() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_school_results');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function district_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/district_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function region_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/region_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function school_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_school_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function send_sms_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/send_sms_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_incomplete_ca_officiers() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_incomplete_ca_officiers');
$this->load->view('includes/secondary/secondary_footer');
}
public function settings_schools() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/settings_schools');
$this->load->view('includes/secondary/secondary_footer');
}
public function insert_school_settings(){
if($_POST){
$data = $this->input->post('type');
foreach($data as $type){
foreach($type as $school){
$t = explode('/',$school);
$school_id = $t[0];
$stype = '';
if($t[1] == '1'){
$stype = 'O';
}
elseif($t[1] == '2'){
$stype = 'A';
}
elseif($t[1] == '3'){
$stype = '2';
}
$data2 = array(
'school_id' => $school_id,
'students_type' => $stype,
'schoolars_type'=>'D'
);
$this->db->where('school_id',$school_id);
$count = $this->db->count_all_results('students_settings');
if($count == 0){
$this->db->insert('students_settings', $data2);
}else{
$this->db->where('school_id',$school_id);
$this->db->update('students_settings', $data2);
}
}
}
}
redirect('Secondary_officers/view_school_settings');
}
public function view_school_settings() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_school_settings');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_complete_ca_officiers() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_complete_ca_officiers');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_registered_subjects_officiers() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_registered_subjects_officiers');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_schools(){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('admin/schools');
$this->load->view('includes/secondary/secondary_footer');
}
public function district(){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('admin/district');
$this->load->view('includes/secondary/secondary_footer');
}
public function set_subject_absentees(){
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/set_subject_absentees');
$this->load->view('includes/flat_admin_footer');
}
public function insert_district(){
if($_POST){
$data = array(
'regions_id'=>$this->session->userdata('region'),
'district_name'=>$this->input->post('name'),
'heading'=>$this->input->post('heading'),
);
$data = $this->security->xss_clean($data);
$this->db->insert('regions_distrincts',$data);
redirect('Secondary_officers/district');
}
}
public function update_absent(){
if($_POST){
$absent=$this->input->post('absent');
$school_id=$this->input->post('school');
$reg_number=$this->input->post('reg_number');
$academic_year=$this->input->post('academic_year');
$class_level=$this->input->post('class_level');
if($absent == 1){
$absent = 0;
}else{
$absent = 1;
}
$data = array(
'absent'=>$absent,
);
$this->db->where('school_id',$school_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class_level);
$this->db->update('classes',$data);
}
}
public function update_absent_subjects(){
if($_POST){
$absent=$this->input->post('absent');
$school_id=$this->input->post('school');
$reg_number=$this->input->post('reg_number');
$academic_year=$this->input->post('academic_year');
$class_level=$this->input->post('class_level');
$subject_id=$this->input->post('subject_id');
if($absent == 0){
$absent = 1;
}else{
$absent = 0;
}
$data = array(
'school_id'=>$school_id,
'reg_number'=>$reg_number,
'class_level'=>$class_level,
'subject_id'=>$subject_id,
'academic_year'=>$academic_year,
);
$this->db->where('subject_id',$subject_id);
$this->db->where('school_id',$school_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class_level);
$count = $this->db->count_all_results('subject_absentees');
if($count == 0){
$this->db->insert('subject_absentees',$data);
}else{
$this->db->where('subject_id',$subject_id);
$this->db->where('school_id',$school_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class_level);
$this->db->delete('subject_absentees');
}
}
}
public function students_list_officers() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/students_list');
$this->load->view('includes/secondary/secondary_footer');
}
public function delete_schools() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/delete_schools');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_single_students() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/register_single_students');
$this->load->view('includes/secondary/secondary_footer');
}
public function get_schools_o(){
if($this->session->userdata('group_id')==0){
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','O');
$this->db->or_where('b.students_type','2');
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',date('Y'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','NC');
$st = $this->db->count_all_results('classes');
$district = "";
$this->db->where('id',$row->district);
foreach($this->db->get('regions_distrincts')->result() as $dist){
$district = str_replace('HALMASHAURI YA WILAYA YA ','',$dist->district_name);
}
if($st > 0){
?>
school_name." ".$row->school_reg_number." - ".$district;?>, (Registered: )
school_name." ".$row->school_reg_number." - ".$district;?>
db->where('group_id',$this->session->userdata('group_id'));
$gets = $this->db->get('group_schools');
foreach($gets->result() as $r){
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','O');
$this->db->where('a.school_id', $r->school_id);
$this->db->or_where('b.students_type','2');
$this->db->where('a.school_type', 'SS');
$this->db->where('a.school_id', $r->school_id);
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',date('Y'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','NC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
session->userdata('group_id')==0){
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','O');
$this->db->or_where('b.students_type','2');
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',date('Y'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','PC');
$st = $this->db->count_all_results('classes');
$disabled='disabled';
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
db->where('group_id',$this->session->userdata('group_id'));
$gets = $this->db->get('group_schools');
foreach($gets->result() as $r){
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','O');
$this->db->where('a.school_id', $r->school_id);
$this->db->or_where('b.students_type','2');
$this->db->where('a.school_type', 'SS');
$this->db->where('a.school_id', $r->school_id);
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',date('Y'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','PC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
session->userdata('group_id')==0){
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','A');
$this->db->or_where('b.students_type','2');
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','NC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
db->where('group_id',$this->session->userdata('group_id'));
$gets = $this->db->get('group_schools');
foreach($gets->result() as $r){
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','A');
$this->db->where('a.school_id', $r->school_id);
$this->db->or_where('b.students_type','2');
$this->db->where('a.school_type', 'SS');
$this->db->where('a.school_id', $r->school_id);
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','NC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
session->userdata('group_id')==0){
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','A');
$this->db->or_where('b.students_type','2');
if($this->session->userdata('district') > 0){
$this->db->where('district',$this->session->userdata('district'));
}
$this->db->where('a.region',$this->session->userdata('region'));
$this->db->where('a.school_type', 'SS');
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','PC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
db->where('group_id',$this->session->userdata('group_id'));
$gets = $this->db->get('group_schools');
foreach($gets->result() as $r){
$this->db->where('a.school_type', 'SS');
$this->db->where('b.students_type','A');
$this->db->where('a.school_id', $r->school_id);
$this->db->or_where('b.students_type','2');
$this->db->where('a.school_type', 'SS');
$this->db->where('a.school_id', $r->school_id);
$this->db->from('schools as a');
$this->db->join('students_settings as b','b.school_id=a.school_id');
$get=$this->db->get();
foreach($get->result() as $row){
$this->db->where('school_id',$row->school_id);
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('candidate','PC');
$st = $this->db->count_all_results('classes');
if($st > 0){
?>
school_name;?>, (Registered: )
school_name;?>
session->userdata('school_reg_number');
$name= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$academic_year=date('Y');
//echo $this->security->xss_clean($this->input->post('category'));
//exit();
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('admission_number',$this->security->xss_clean($this->input->post('admission_number')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary/register_students_o_level?Exists');
}else{
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student_o();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
$cl = date('Y');
//echo $name.' '.$cl;exit();
$current = $name.".".$cl .".".sprintf("%03s",($reg+1));
//dunping data to the database
// echo 'First '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_o_level?Sent');
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
// ECHO $reg;exit();
$current = $name.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
// echo 'Second '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_single_students?Sent');
}
}
}
}
public function schools() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/schools');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_students_o_level_officier() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_students_o_level_officier_update() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/register_students_o_level_officier_update');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_users() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/register_users');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_students_a_level_officier() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_o_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_o_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_o_level_officer2() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_by_excel_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_by_excel_a');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_officers_a_level() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_officers_o_level() {
if($this->session->userdata('school_id')){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/officer/upload_results_officers_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_officers_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
}
public function upload_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/upload_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function send_sms() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/send_sms');
$this->load->view('includes/secondary/secondary_footer');
}
public function buy_sms() {
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/officer/buy_sms');
$this->load->view('includes/secondary/uploading_footer');
}
public function upload_ca_officer() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/upload_ca');
$this->load->view('includes/flat_admin_footer');
}
public function upload_ca_single() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/upload_ca_single');
$this->load->view('includes/flat_admin_footer');
}
public function upload_ca_single1() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/upload_ca_single1');
$this->load->view('includes/flat_admin_footer');
}
public function upload_ca_single_questions() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/upload_ca_single_questions');
$this->load->view('includes/flat_admin_footer');
}
public function publish_results_o_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/publish_results_o_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function viewed_results_public() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/superuser/viewed_results_public');
$this->load->view('includes/secondary/secondary_footer');
}
public function viewed_results_stats() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/superuser/viewed_results_public_stats');
$this->load->view('includes/secondary/secondary_footer');
}
public function viewed_results_login() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/superuser/viewed_results_login');
$this->load->view('includes/secondary/secondary_footer');
}
public function publish_results_a_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/publish_results_a_level_officer');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_results_o_level_officer() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function publish_mock_results(){
$month = base64_decode($_REQUEST['month']);
$school = base64_decode($_REQUEST['school']);
$class = base64_decode($_REQUEST['class']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $school);
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary_officers/publish_results_o_level_officer?published');
}
public function undo_published_mock_results(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary_officers/publish_results_o_level_officer?undo');
}
public function publish_all_mock_results(){
$month = base64_decode($_REQUEST['month']);
$class = base64_decode($_REQUEST['class']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary_officers/publish_results_o_level_officer?published');
}
public function undo_all_published_mock_results(){
$month = base64_decode($_REQUEST['month']);
$class = base64_decode($_REQUEST['class']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary_officers/publish_results_o_level_officer?undo');
}
public function serach_sms_by_date(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary/sent_sms?date='.base64_encode($date).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&receiver='.base64_encode($receiver));
}
public function serach_sms_by_month(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary/sent_sms?monthh='.base64_encode($month).'&&yearr='.base64_encode($year).'&&receiverr='.base64_encode($receiver));
}
public function delete_sms_by_date(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('date',$date);
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function delete_sms_by_month(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function delete_sms_by_year(){
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function get_students(){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('full_name', $this->input->post('name'),"BOTH");
$this->db->limit(50);
$q = $this->db->get('students');
foreach($q->result() as $st){
$academic_year = date('Y');
$round=$this->input->post('round');
//$this->db->where('academic_year', $academic_year);
//$this->db->or_where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $st->reg_number);
$this->db->where('status', 0);
$this->db->limit(1);
$query = $this->db->get('classes');
foreach ($query->result() as $rows) {
$this->db->where('reg_number', $rows->reg_number);
$query = $this->db->get('students');
foreach ($query->result() as $rowws) {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year', $academic_year);
$this->db->or_where('academic_year', $this->session->userdata('academic_year_a_level'));
$querry = $this->db->get('classes');
foreach ($querry->result() as $row_amount) {
$reg = $rowws->reg_number;
$sch_type = $row_amount->schoolar_type;
$cat = $row_amount->category;
//$pay_type = $row_amount->payment_type;
$year = $row_amount->academic_year;
}
?>
category=='A'){?>
full_name).' - Form '.$rows->class_level . "-" . $rows->stream;
?>
Amount Required
Amount Paid
Amount Remained
session->userdata('academic_year_a_level');
$reg_number=$reg;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$this->db->where('reg_number',$reg_number);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//selecting fee from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
//selecting from reduced payement
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payment_id',$rows->payment_id);
$this->db->where('reg_number',$reg_number);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}
}
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
$total_required=$required1+$required2;
echo number_format($total_required);
echo ' ';
echo ' ';
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount1).' ';
echo ' ';
echo ' ';
} }
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount2).' ';
echo ' ';
echo ' ';
}}
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo ' ';
}else{
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo number_format($paid);
echo ' ';
echo ' ';
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//select from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
} else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
}
}
$total_remained=$required11+$required22;
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_remained>$paid){?>
TOTAL=
TOTAL=
' ;
echo '';
echo 'TOTAL = ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo '';
}
?>
full_name).' - Form '.$rows->class_level . "-" . $rows->stream;
?>
Amount Required
Amount Paid
Amount Remained
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$this->db->where('reg_number',$reg_number);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//selecting fee from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
//selecting from reduced payement
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payment_id',$rows->payment_id);
$this->db->where('reg_number',$reg_number);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}
}
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
$total_required=$required1+$required2;
echo number_format($total_required);
echo ' ';
echo ' ';
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount1).' ';
echo ' ';
echo ' ';
} }
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount2).' ';
echo ' ';
echo ' ';
}}
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo ' ';
}else{
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo number_format($paid);
echo ' ';
echo ' ';
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//select from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
} else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
}
}
$total_remained=$required11+$required22;
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_remained>$paid){?>
TOTAL=
TOTAL=
' ;
echo '';
echo 'TOTAL = ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo '';
}
?>
session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_by_excel_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_by_excel_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_by_excel_o() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_by_excel_o');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_by_excel_o');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function confirm_sms_payments(){
$transaction_id=trim($this->security->xss_clean($this->input->post('transaction_id')));
//echo $transaction_id;exit();
$url = 'http://www.afel.co.tz/Confirm_sms_payments_secondary';
$fields = array(
'key= '=>"179103@afel_1990/2017",
'transaction_id= '=>trim($this->security->xss_clean($this->input->post('transaction_id'))),
'paid_for= '=>"sms",
'payer_id= '=>$this->session->userdata('school_id'),
'payer_name= '=>$this->session->userdata('school_name'),
);
$fields_string = '';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if($result == 1){
redirect('Secondary/buy_sms?status=sent&&id='.base64_encode($transaction_id));
}else{
redirect('Secondary/buy_sms?status=error&&id='.base64_encode($transaction_id));
}
}
//this function redirecting different pages after users loged in
public function send_evaluation(){
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',date('Y'));
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_o_level?sent');
}
public function send_evaluation1(){
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',date('Y'));
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_o_level?sent');
}
public function send_evaluation_a(){
$academic_year=$this->session->userdata('academic_year_a_level');
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_a_level?sent');
}
public function send_evaluation_a1(){
$academic_year=$this->session->userdata('academic_year_a_level');
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_a_level?sent');
}
public function income_primary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/primary/income_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/primary/income_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_primary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function delete_revenue(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('revenue');
redirect('Secondary/income_secondary?deleted');
}
public function delete_students(){
$school_id=base64_decode($_GET['school']);
$type=base64_decode($_GET['type']);
$class=base64_decode($_GET['class']);
$year=base64_decode($_GET['year']);
$candidate=base64_decode($_GET['candidate']);
$this->db->where('school_id', $school_id);
$this->db->where('category', $type);
$this->db->where('admission_year', $year);
$this->db->where('class_admitted', $class);
$this->db->where('candidate', $candidate);
$this->db->delete('students');
redirect('Secondary_officers/delete_schools?deleted');
}
public function delete_expenditure(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('expenditures');
redirect('Secondary/expenditures_secondary?deleted');
}
public function insert_revenue() {
if($this->session->userdata('type')=="Admin"){
$issuer_title=$this->session->userdata('type');
} else{
$issuer_title=$this->session->userdata('title');
}
$date=$this->security->xss_clean($this->input->post('date'));
$month=substr($this->security->xss_clean($this->input->post('date')),0,2);
$year=substr($this->security->xss_clean($this->input->post('date')),6,10);
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $date,
'month' => $month,
'year' => $year,
'income' => $this->security->xss_clean($this->input->post('income')),
'issuer' => $this->session->userdata('full_name'),
'issuer_title' => $issuer_title,
);
$this->db->insert('revenue', $data);
redirect('Secondary/income_secondary?sent');
}
public function register_venue() {
$number=$this->security->xss_clean($this->input->post('number_of_rooms'));
$class_level= substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream= substr($this->security->xss_clean($this->input->post('class_level')),1);
//echo $class_level.' '.$stream;exit();
for($i=1;$i<=$number;$i++){
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'class_level' =>$class_level,
'stream' => $stream,
'room_name' => $stream.$i
);
$this->db->insert('venue', $data);
}
redirect('Secondary/create_venue?sent');
}
public function register_activity() {
$name=$this->security->xss_clean($this->input->post('name'));
//echo $class_level.' '.$stream;exit();
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'activity_name' =>$name,
);
$this->db->insert('timetable_activity', $data);
redirect('Secondary/create_activity?sent');
}
public function insert_user(){
$this->db->where('reg_number',$this->input->post('email'));
$count=$this->db->count_all_results('education_officers');
if($count>0){
redirect('Secondary_officers/register_users?Exist');
}else{
if($this->session->userdata('group_id')>0){
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>0,
'region'=>0,
'title'=>$this->input->post('title'),
'category'=>$this->input->post('category'),
'type'=>'Officer',
'school_type'=>'SS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>$this->session->userdata('group_id')
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
}else{
if($this->session->userdata('district') > 0){
$this->db->where('id',$this->session->userdata('district'));
$get=$this->db->get('regions_distrincts');
foreach($get->result() as $r){
$district=$this->session->userdata('district') ;
$region=$r->regions_id;
}
}else{
$region=$this->session->userdata('region') ;
$district=0 ;
}
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>$district,
'region'=>$region,
'title'=>$this->input->post('title'),
'category'=>$this->input->post('category'),
'type'=>'Officer',
'school_type'=>'SS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>0
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
}
redirect('Secondary_officers/register_users?Sent');
}
}
public function delete_user(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('education_officers');
redirect('Secondary_officers/register_users?Deleted');
}
public function delete_venue() {
$class= base64_decode($_GET['class_level']);
$stream= base64_decode($_GET['stream']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->delete('venue');
redirect('Secondary/create_venue?deleted');
}
public function delete_activity() {
$id= (int)base64_decode($_GET['id']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('id',$id);
$this->db->delete('timetable_activity');
redirect('Secondary/register_activity?deleted');
}
public function insert_expenditure() {
if($this->session->userdata('type')=="Admin"){
$issuer_title=$this->session->userdata('type');
} else{
$issuer_title=$this->session->userdata('title');
}
$date=$this->security->xss_clean($this->input->post('date'));
$month=substr($this->security->xss_clean($this->input->post('date')),0,2);
$year=substr($this->security->xss_clean($this->input->post('date')),6,10);
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $date,
'month' => $month,
'year' => $year,
'expenditure ' => $this->security->xss_clean($this->input->post('expenses')),
'issuer' => $this->session->userdata('full_name'),
'issuer_title' => $issuer_title,
);
$this->db->insert('expenditures', $data);
redirect('Secondary/expenditures_secondary?sent');
}
public function delete_postoponed(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('postpone_payments');
redirect('Secondary/postpone_payments_secondary?deleted');
}
public function delete_postoponed_a(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('postpone_payments');
redirect('Secondary/postpone_payments_secondary_a?deleted');
}
public function delete_transactionn(){
$no=base64_decode($_GET['no']);
$reg_number=base64_decode($_GET['reg']);
$this->db->where('school_receipt', $no);
$this->db->delete('transactions');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
public function delete_transactionn_a(){
$no=base64_decode($_GET['no']);
$reg_number=base64_decode($_GET['reg']);
$this->db->where('school_receipt', $no);
$this->db->delete('transactions');
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number));
}
public function delete_class_teacher(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('class_teachers');
redirect('Secondary/class_teachers_secondary?deleted');
}
public function register_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_groups() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_groups');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_groups');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_group(){
$data=array(
'name'=>$this->security->xss_clean($this->input->post('group_name')),
'school_id'=>$this->session->userdata('school_id'),
);
$this->db->insert('groups',$data);
redirect('Secondary/create_groups?sent');
}
public function delete_group(){
$group=base64_decode($_REQUEST['id']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('group_id',$group);
$this->db->delete('groups');
redirect('Secondary/create_groups?deleted');
}
public function add_members() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/add_members');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/add_members');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function notify_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/notify_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/notify_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function serach_sms_by_date1(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary_officers/sent_sms?date='.base64_encode($date).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&receiver='.base64_encode($receiver));
}
public function serach_sms_by_month1(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary_officers/sent_sms?monthh='.base64_encode($month).'&&yearr='.base64_encode($year).'&&receiverr='.base64_encode($receiver));
}
public function delete_sms_by_date1(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('date',$date);
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->delete('sent_sms');
redirect('Secondary_officers/delete_sms?deleted');
}
public function delete_sms_by_month1(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->delete('sent_sms');
redirect('Secondary_officers/delete_sms?deleted');
}
public function delete_sms_by_year1(){
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('year',$year);
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->delete('sent_sms');
redirect('Secondary_officers/delete_sms?deleted');
}
public function sent_sms() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/sent_sms_secondary');
$this->load->view('includes/secondary/secondary_footer');
}
public function delete_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/delete_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/delete_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function billing_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/billing_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/billing_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function site_visit() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/site_visit');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/site_visit');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_list_o_level() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_list_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function create_venue() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_venue');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_venue');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_activity() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_activity');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_activity');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_time_table() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_time_table');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/create_time_table');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_timetable() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_timetable');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_timetable');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function all_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/all_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/all_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function gender_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/gender_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/gender_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function income_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/income_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/income_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_reports_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/expenditures_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function balance_sheet_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/balance_sheet_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/balance_sheet_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function revenue_reports_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/revenue_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/revenue_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function schoolar_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/schoolar_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/scondary/schoolar_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function class_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function class_students_list_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_students_list_stream');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_students_list_stream');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_details_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_details_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_details_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_details_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_incomplete_ca() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_incomplete_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_incomplete_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_incomplete_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_incomplete_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_incomplete_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function delete_ca(){
$class= base64_decode($_REQUEST['class']);
$term= base64_decode($_REQUEST['term']);
$stream= base64_decode($_REQUEST['stream']);
$month= base64_decode($_REQUEST['month']);
$category= base64_decode($_REQUEST['category']);
$academic_year= base64_decode($_REQUEST['academic_year']);
$school= $_REQUEST['school'];
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->where('stream',$stream);
$this->db->where('status',0);
$this->db->delete('ca');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->where('stream',$stream);
//$this->db->where('status',0);
$this->db->delete('monthly_results');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->delete('schools_position');
redirect('Secondary_officers/upload_results_by_excel_officer?class_level='.base64_encode(4).'&month='.base64_encode($month).'&academic_year='.base64_encode(date('Y')).'&term='.base64_encode(1).'&&category='.base64_encode('O').'&school='.base64_encode($school).'&success');
}
public function view_uploaded_ca() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_uploaded_ca');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_ca() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_uploaded_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_uploaded_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_uploaded_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_results_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function results_statistics() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/results_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/results_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function evaluate_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/evaluate_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/evaluate_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_attendance_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_attendance_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',4);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_attendance_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function suspended_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/suspended_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/suspended_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function precautioned_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/precautioned_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/precautioned_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function dismissed_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/dismissed_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/dismissed_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function graduates_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/graduates_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/graduates_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function register_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_list_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_list_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_list_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_a_level_background() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/publish_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_monthly() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_monthly');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_monthly');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_mid() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_mid');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_mid');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_term');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/calculate_results_a_level_background_term');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_results_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function evaluate_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/evaluate_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/evaluate_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_evaluations_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_evaluations_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_evaluations_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_evaluations_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_evaluations_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_evaluations_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function edit_evaluation() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/edit_evaluation');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/edit_evaluation');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function edit_eva(){
$grade=$this->input->post('grade');
$academic_year=$this->input->post('academic_year');
$reg_number=$this->input->post('reg_number');
$term=$this->input->post('term');
$evaluation_id=$this->input->post('evaluation_id');
$data=array(
'grade'=>$grade
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$academic_year);
$this->db->where('term',$term);
$this->db->where('reg_number',$reg_number);
$this->db->where('evaluation_id',$evaluation_id);
$this->db->update('students_evaluation',$data);
redirect('Secondary/edit_evaluation?reg_number='.base64_encode($reg_number).'&&year='.base64_encode($academic_year).'&&term='.base64_encode($term).'&&edited=yes');
}
public function edit_comments(){
$comments=$this->input->post('comments');
$academic_year=$this->input->post('academic_year');
$reg_number=$this->input->post('reg_number');
$term=$this->input->post('term');
$id=$this->input->post('id');
$data=array(
'comments'=>$comments
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$academic_year);
$this->db->where('term',$term);
$this->db->where('reg_number',$reg_number);
$this->db->where('id',$id);
$this->db->update('teacher_comments',$data);
redirect('Secondary/edit_evaluation?reg_number='.base64_encode($reg_number).'&&year='.base64_encode($academic_year).'&&term='.base64_encode($term).'&&edited=yes');
}
public function students_attendance_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_attendance_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',4);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/students_attendance_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function suspended_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/suspended_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/suspended_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function precautioned_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/precautioned_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/precautioned_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function dismissed_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/dismissed_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/dismissed_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function graduates_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/graduates_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/graduates_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function testing_page() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/testing_page');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/testing_page');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function register_staffs_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_staffs_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/register_staffs_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function released_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/released_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/released_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_class_teachers(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,2);
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'stream'=>$stream,
'category'=>$this->security->xss_clean($this->input->post('category')),
'academic_year'=>date('Y'),
);
$this->db->insert('class_teachers',$data);
redirect('Secondary/class_teachers_secondary?sent');
}
public function insert_class_teachers_a(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1);
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'stream'=>$stream,
'category'=>$this->security->xss_clean($this->input->post('category')),
'academic_year'=>$this->session->userdata('academic_year_a_level'),
);
$this->db->insert('class_teachers',$data);
redirect('Secondary/class_teachers_secondary?sent');
}
public function class_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function subject_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/subject_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/subject_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_subject_teachers(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,1);
$subject_id=substr($this->security->xss_clean($this->input->post('class_level')),2);
//echo $this->security->xss_clean($this->input->post('class_level')).' '.$class.' '.$stream.' '.$subject_id;exit();
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'category' => $this->security->xss_clean($this->input->post('category')),
'class_level' => $class,
'stream' => $stream,
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'academic_year' => date('Y')
);
//echo $data;
$this->db->insert('subjects_assigned', $data);
redirect('Secondary/subject_teachers_secondary?sent');
}
public function insert_subject_teachers_a(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,3);
$subject_id=substr($this->security->xss_clean($this->input->post('class_level')),4);
//echo $this->security->xss_clean($this->input->post('class_level')).' '.$class.' '.$stream.' '.$subject_id;exit();
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'category' => $this->security->xss_clean($this->input->post('category')),
'class_level' => $class,
'stream' => $stream,
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'academic_year' => $this->session->userdata('academic_year_a_level')
);
//echo $data;
$this->db->insert('subjects_assigned', $data);
redirect('Secondary/subject_teachers_secondary?sent');
}
public function delete_subject_teacher(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->where('category', 'O');
$this->db->delete('subjects_assigned');
redirect('Secondary/subject_teachers_secondary?deleted');
}
public function delete_subject_teacher_a(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->where('category', 'A');
$this->db->delete('subjects_assigned');
redirect('Secondary/subject_teachers_secondary?deleted');
}
public function staffs_details_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/staffs_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/staffs_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/insert_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/insert_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_sms_receipt() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_sms_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_sms_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_score_sheet(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/officer/print_all_score_sheet');
$this->load->view('includes/secondary/uploading_footer');
}
public function print_receipt() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_receipt_o() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt_o');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt_o');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_postponed() {
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>$this->security->xss_clean($this->input->post('reg_number')),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $this->security->xss_clean($this->input->post('date')),
'month' => $this->security->xss_clean($this->input->post('month')),
'year' => $this->security->xss_clean($this->input->post('year')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => substr($this->security->xss_clean($this->input->post('reg_number')),0,1),
'payment_type' => $this->security->xss_clean($this->input->post('payment_type'))
);
$this->db->insert('postpone_payments', $data);
redirect('Secondary/postpone_payments_secondary?sent');
}
public function insert_postponed_a() {
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>$this->security->xss_clean($this->input->post('reg_number')),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $this->security->xss_clean($this->input->post('date')),
'month' => $this->security->xss_clean($this->input->post('month')),
'year' => $this->security->xss_clean($this->input->post('year')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => substr($this->security->xss_clean($this->input->post('reg_number')),0,1),
'payment_type' => $this->security->xss_clean($this->input->post('payment_type'))
);
$this->db->insert('postpone_payments', $data);
redirect('Secondary/postpone_payments_secondary_a?sent');
}
public function postpone_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/postpone_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/postpone_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function postpone_payments_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/postpone_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/postpone_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function inserts_payments_secondary_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/insert_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/insert_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function enter_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function enter_payments_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary_a');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary_a');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function clear_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/clear_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/clear_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function payments_statistics() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/payments_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/payments_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_type_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_type_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_type_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function receipt_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/receipt_reports');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/receipt_reports');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function a_receipt_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/receipt_reports_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/receipt_reports_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function search_receipt_report_a(){
$get=$this->security->xss_clean($this->input->post('year'));
redirect('Secondary/a_receipt_reports?year='.base64_encode($get));
}
public function search_receipt_report(){
$get=$this->security->xss_clean($this->input->post('year'));
redirect('Secondary/receipt_reports?year='.base64_encode($get));
}
public function view_payments_by_amount_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_bank_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_list_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_list_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_list_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_date_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_date_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_date_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
////
public function views_payments_by_type_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_type_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_type_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_amount_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_bank_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_list_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_list_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_list_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_date_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_date_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/view_payments_by_date_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
///
public function register_manager() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Manager',
'title' => 'Manager',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_teachers() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Teacher',
'title' => 'Teacher',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_secretary() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Secretary',
'title' => 'Secretary',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_accountants() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Accountant',
'title' => 'Accountant',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function change_position() {
$reg='';
$pos='';
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('title',$this->security->xss_clean($this->input->post('position')));
$get=$this->db->get('staffs');
foreach($get->result() as $row){
$reg=$row->reg_number;
$pos=$row->category;
}
$data = array(
'title' => $this->security->xss_clean($this->input->post('position')),
);
$data1 = array(
'title' =>$pos,
);
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data);
$this->db->where('reg_number', $reg);
$this->db->update('staffs', $data1);
redirect('Secondary/register_staffs_secondary?changed');
}
public function delete_staff(){
$data=array(
'status'=>1,
'released_year'=>date('Y')
);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->update('staffs',$data);
redirect('Primary/register_staffs_primary?deleted');
}
public function register_o_level_students(){
$this->db->where('school_id',$this->security->xss_clean($this->input->post('school_id')));
$get_s= $this->db->get('schools');
foreach($get_s->result() as $d){
$chool_name=$d->school_reg_number;
}
$region = $district = 0;
$this->db->where('school_id',$this->security->xss_clean($this->input->post('school_id')));
$sch = $this->db->get('schools');
foreach($sch->result() as $id){
$region = $id->region;
$district = $id->district;
}
$name= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$academic_year=date('Y');
//echo $this->security->xss_clean($this->input->post('category'));
//exit();
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('admission_number',$this->security->xss_clean($this->input->post('admission_number')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary_officers/register_students_o_level_officier?Exists');
}else{
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student_o_officers();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
if ($level == 1) {
$cl = date('Y');
} else if ($level == 2) {
$cl = (date('Y') - 1);
} else if ($level == 3) {
$cl = (date('Y') - 2);
} else if ($level == 4) {
$cl = (date('Y') - 3);
}else if ($level == 5) {
$cl = (date('Y') - 4);
}else if ($level == 6) {
$cl = (date('Y') - 5);
} else {
$cl = (date('Y') - 7);
}
//echo $name.' '.$cl;exit();
$current = "O".$name.".".$cl .".".sprintf("%03s",($reg+1));
//dunping data to the database
// echo 'First '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default',
'region'=>$region,
'district'=>$district,
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary_officers/register_students_o_level_officier?Sent');
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
// ECHO $reg;exit();
$current = "O".$name.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
// echo 'Second '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default',
'region'=>$region,
'district'=>$district,
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary_officers/register_students_o_level_officier?Sent');
}
}
}
}
public function register_advance_students(){
$chool_name=$this->session->userdata('school_reg_number');
$name= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$academic_year=$this->session->userdata('academic_year_a_level');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('admission_number',$this->security->xss_clean($this->input->post('admission_number')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary/register_students_a_level?Exists');
}else{
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
if($level == 5) {
$cl = (date('Y') - 0);
}elseif($level == 6) {
$cl = (date('Y') - 1);
}
//echo $name.' '.$cl;exit();
$current = "A".$name.".".$cl .".".sprintf("%03s",($reg+1));
//dunping data to the database
// echo 'First '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default',
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_a_level?Sent');
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
$current = "A".$name.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
//echo 'Second '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default',
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_a_level?Sent');
}
}
}
}
public function assigned_subjects() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/assigned_subjects');
$this->load->view('includes/secondary/secondary_footer');
}
public function assigned_class() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/assigned_class');
$this->load->view('includes/secondary/secondary_footer');
}
public function class_students_secondary() {
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/class_students_secondary');
$this->load->view('includes/secondary/secondary_footer');
}
public function edit_student_info(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
//echo $reg_number;exit();
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message1=error');
}else{
$data = array(
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile'))
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('students', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
}
public function edit_student_info_a(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data = array(
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'admission_number' => $this->security->xss_clean($this->input->post('admission_number')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile'))
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('students', $data);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function edit_staff_info(){
$reg_number=str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10)));
$data = array(
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'reg_number' => $reg_number,
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('staffs', $data);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function change_class(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'academic_year' => date('Y'),
);
$this->db->select('class_level');
$this->db->select('stream');
$this->db->select('academic_year');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_class_a(){
$academic_year=$this->session->userdata('academic_year_a_level');
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'academic_year' =>$academic_year,
);
$this->db->select('class_level');
$this->db->select('stream');
$this->db->select('academic_year');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year',$academic_year);
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_stream(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'stream' => $this->security->xss_clean($this->input->post('stream'))
);
$this->db->select('stream');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_stream_a(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'stream' => $this->security->xss_clean($this->input->post('stream'))
);
$this->db->select('stream');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_schoolar_type(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type'))
);
$this->db->select('schoolar_type');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function change_schoolar_type_a(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type'))
);
$this->db->select('schoolar_type');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&& message=edited');
}
public function publish_monthly_results_o(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function undo_publish_monthly_results_o(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function publish_results_o(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function undo_publish_results_o(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function publish_monthly_results_a(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function undo_publish_monthly_results_a(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function publish_results_a(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function undo_publish_results_a(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function dismiss_student(){
$reason=$this->security->xss_clean($this->input->post('reason'));
$reg_number =$this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'status' => 1
);
$data2 = array(
'school_id' =>$this->session->userdata('school_id'),
'reg_number' =>$reg_number,
'reason' => $reason
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->insert('dismissed_students', $data2);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function dismiss_student_a(){
$reason=$this->security->xss_clean($this->input->post('reason'));
$reg_number =$this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'status' => 1
);
$data2 = array(
'school_id' =>$this->session->userdata('school_id'),
'reg_number' =>$reg_number,
'reason' => $reason
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->insert('dismissed_students', $data2);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function restore_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_dismissed_a(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_secondary_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/dismissed_students_o_level');
}
public function restore_a_level_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/dismissed_students_a_level');
}
public function dismiss_teacher(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 1,
'released_year'=>date('Y')
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_teacher_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0,
'released_year'=>'--'
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_teacher_dismissedd(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0,
'released_year'=>'--'
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/released_teachers_secondary?restored');
}
public function search_graduate_a() {
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
?>
A-LEVEL GRADUATES LIST IN
A-LEVEL GRADUATES LIST IN
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('class_level',6);
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
$this->db->where('reg_number',$rows->reg_number);
$gety=$this->db->get('students');
foreach($gety->result() as $row){
$i++;
?>
reg_number;?>
reg_number;?>
full_name;?>
full_name;?>
gender;?>
class_level.' - '.$rows->stream;?>
schoolar_type=='D'){
echo 'Day';
}elseif($rows->schoolar_type=='B'){
echo 'Boarding';
}else{
echo 'Undifined schoolar type, Pleas contact your admin';
}
?>
mobile;?>
email;?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
?>
O-LEVEL GRADUATES LIST IN
O-LEVEL GRADUATES LIST IN
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('class_level',4);
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
$this->db->where('reg_number',$rows->reg_number);
$gety=$this->db->get('students');
foreach($gety->result() as $row){
$i++;
?>
reg_number;?>
reg_number;?>
full_name;?>
full_name;?>
gender;?>
class_level.' - '.$rows->stream;?>
schoolar_type=='D'){
echo 'Day';
}elseif($rows->schoolar_type=='B'){
echo 'Boarding';
}else{
echo 'Undifined schoolar type, Pleas contact your admin';
}
?>
mobile;?>
email;?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$this->db->where('bank',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN THIS DATE ()
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$this->db->where('bank',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN THIS DATE ()
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$rows->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date_received'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS RECEIVED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_received'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS RECEIVED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_deposited'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_deposited'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID ON
ACCOUNT LIST OF STUDENTS PAID ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID ON
ACCOUNT LIST OF STUDENTS PAID ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_received'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
?>
SCHOOL FEES PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_received'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
?>
SCHOOL FEES PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_deposited'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
?>
PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_deposited'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
?>
PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category='O';
?>
PAYMENTS RECORDS IN
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN
LIST OF STUDENTS PAID IN
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category='A';
?>
PAYMENTS RECORDS IN
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN
LIST OF STUDENTS PAID IN
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$date= $this->security->xss_clean($this->input->post('date'));
$category='O';
$type_name='';
if($import=='All'){
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$gety=$this->db->get('transactions');
$this->db->where('category',$category);
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$date= $this->security->xss_clean($this->input->post('date'));
$category='A';
$type_name='';
if($import=='All'){
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$gety=$this->db->get('transactions');
$this->db->where('category',$category);
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cas Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Class level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('class_level',$list);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cas Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Class level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('class_level',$list);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$import= $this->security->xss_clean($this->input->post('payment_type'));
$category='O';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$import= $this->security->xss_clean($this->input->post('payment_type'));
$category='A';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream
;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Required
Amount Paid
Amount Remained
Status
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
$reg_number=$name->reg_number;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '---';
}else{
echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
echo number_format($total_required-$paid);
}elseif($total_required==$paid){
echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
echo 'Complete';
}else{
echo 'Not complete';
}
?>
security->xss_clean($this->input->post('year'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Required
Amount Paid
Amount Remained
Status
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
$reg_number=$name->reg_number;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level.'-'.$row->stream;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '---';
}else{
echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
echo number_format($total_required-$paid);
}elseif($total_required==$paid){
echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
echo 'Complete';
}else{
echo 'Not complete';
}
?>
security->xss_clean($this->input->post('amount')));
$category='O';
if($amount=='' || $amount==0){
echo 'Fill Amount';
}else{
$year= date('Y');
?>
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Paid
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('category',$category);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid<$amount){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level;
}
?>
security->xss_clean($this->input->post('amount')));
$category='A';
if($amount=='' || $amount==0){
echo 'Fill Amount';
}else{
$year= $this->session->userdata('academic_year_a_level');
?>
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Paid
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('category',$category);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid<$amount){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level.'-'.$row->stream;
}
?>
security->xss_clean($this->input->post('year'));
$category='O';
?>
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
Total Number of Students
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$count=$this->db->count_all_results('classes');
echo $count;
?>
Total Amount Required
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get=$this->db->get('payers');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$row->payment_id);
$fee_type=$this->db->get('payments_type');
foreach($fee_type->result() as $ro){
$name=$ro->name;
}
if($row->schoolars_type==2){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt1=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_fee=$this->db->get('register_fees');
foreach($get_fee->result() as $rowf){
$total_amount1=$rowf->amount*$countt1;
// echo 'Total= '.number_format($total_amount1).' ';
// echo 'Amount = '.$rowf->amount.' Total= '.$total_amount1.' '. $name.' |'. $row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->students_type.' '.$row->schoolars_type.' both schoolar type = '.$countt1.' ';
$sum+= $total_amount1;
}
}else{
$total_amount2=0;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('schoolar_type',$row->schoolars_type);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt2=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$total_amount2=$rowff->amount*$countt2;
// echo ' Total= '.number_format($total_amount2).' '.' ';
// echo 'Amount = '.$rowff->amount.' Total= '.$total_amount2.' '. $name.' |'.$row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->schoolars_type.' schoolar ='.$countt2.' ';
$sum1+= $total_amount2;
}
}
}
$required=$sum+ $sum1;
echo 'Tsh '. number_format(($required)).' There is something to do';
?>
Amount Paid
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
foreach($this->db->get('transactions')->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Tsh '.number_format($amount->amount);
}
$paid_amount=$amount->amount;
}
?>
Amount Remained
$paid_amount){
echo 'Tsh '.number_format($required-$paid_amount);
}elseif($required=$paid_amount){
echo '---';
}else{
echo '---';
}
?>
security->xss_clean($this->input->post('year'));
$category='A';
?>
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
Total Number of Students
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$count=$this->db->count_all_results('classes');
echo $count;
?>
Total Amount Required
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get=$this->db->get('payers');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$row->payment_id);
$fee_type=$this->db->get('payments_type');
foreach($fee_type->result() as $ro){
$name=$ro->name;
}
if($row->schoolars_type==2){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt1=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_fee=$this->db->get('register_fees');
foreach($get_fee->result() as $rowf){
$total_amount1=$rowf->amount*$countt1;
// echo 'Total= '.number_format($total_amount1).' ';
// echo 'Amount = '.$rowf->amount.' Total= '.$total_amount1.' '. $name.' |'. $row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->students_type.' '.$row->schoolars_type.' both schoolar type = '.$countt1.' ';
$sum+= $total_amount1;
}
}else{
$total_amount2=0;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('schoolar_type',$row->schoolars_type);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt2=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$total_amount2=$rowff->amount*$countt2;
// echo ' Total= '.number_format($total_amount2).' '.' ';
// echo 'Amount = '.$rowff->amount.' Total= '.$total_amount2.' '. $name.' |'.$row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->schoolars_type.' schoolar ='.$countt2.' ';
$sum1+= $total_amount2;
}
}
}
$required=$sum+ $sum1;
echo 'Tsh '. number_format(($required)).' There is something to do';
?>
Amount Paid
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
foreach($this->db->get('transactions')->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Tsh '.number_format($amount->amount);
}
$paid_amount=$amount->amount;
}
?>
Amount Remained
$paid_amount){
echo 'Tsh '.number_format($required-$paid_amount);
}elseif($required=$paid_amount){
echo '---';
}else{
echo '---';
}
?>
security->xss_clean($this->input->post('class_level'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
$category='O';
$month_name;
$this->db->where('month_id', $month);
$gett=$this->db->get('secondary_months');
foreach($gett->result() as $rows){
$month_name=$rows->name;
}
?>
FORM MONTHLY TEST ()
FORM MONTHLY TEST
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type','O');
$get=$this->db->get('grading_method');
foreach($get->result() as $row){
if($row->grading=='Average'){
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$number_of_subjects=0;
$sum_of_marks=0;
$average_of_marks=0;
echo $row_reg->reg_number.'';
echo 'Average Calculations'.' ';
//finding subjects which are included in calculations
$this->db->where('class_level',$class);
$this->db->where('students_type', $category);
$this->db->where('school_id', $this->session->userdata('school_id'));
$gett= $this->db->get('subjects_calculations');
foreach($gett->result() as $rowt){
$this->db->where('subject_id',$rowt->subject_id);
$this->db->where('school_id', $this->session->userdata('school_id'));
$getf= $this->db->get('general_subjects');
foreach($getf->result() as $rowf){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $rowt->subject_id);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$number_of_subjects++;
$sum_of_marks=$sum_of_marks+$row_ca->mark;
echo $rowt->subject_id.' = '.$rowf->subject_name.' = ' .$row_ca->mark.' ';
}
}
}
$average_of_marks=($sum_of_marks/$number_of_subjects);
$average_of_marks=round($average_of_marks,2);
echo 'Number of subjects attempted = '.$number_of_subjects.' Sum of marks = '.$sum_of_marks.' Average = '.$average_of_marks.' ';
}
echo 'Number of students = '.$number_of_sudents;
}elseif($row->grading=='Division'){
echo 'Division calculations';
}elseif($row->grading=='GPA'){
echo 'GPA calculations';
}else{
echo 'Undifined calculations';
}
}
?>
security->xss_clean($this->input->post('class_level'));
$mid_term= $this->security->xss_clean($this->input->post('mid_term'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
?>
STANDARD MID-TERM TEST ( OF TERM )
STANDARD MID-TERM TEST ( OF TERM )
security->xss_clean($this->input->post('class_level'));
$term= $this->security->xss_clean($this->input->post('term'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
?>
STANDARD TERM RESULTS
STANDARD TERM RESULTS
security->xss_clean($this->input->post('date'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/reports_settings');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/reports_settings');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_insrtuctions(){
for($k=0; $k<=10;$k++){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$this->security->xss_clean($this->input->post('students_type')));
$this->db->where('class_level',$this->security->xss_clean($this->input->post('class_level')));
$this->db->where('term',$this->security->xss_clean($this->input->post('term')));
$this->db->where('academic_year',$this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('instructions',$this->security->xss_clean($this->input->post('instructions'.$k)));
$count=$this->db->count_all_results('instruction_reports');
if($count>0 || $this->security->xss_clean($this->input->post('instructions'.$k))==''){
continue;
}else{
$data1 = array(
'school_id' => $this->session->userdata('school_id'),
'class_level' =>$this->security->xss_clean($this->input->post('class_level')),
'students_type'=>$this->security->xss_clean($this->input->post('students_type')),
'instructions' => $this->security->xss_clean($this->input->post('instructions'.$k)),
'academic_year' => $this->security->xss_clean($this->input->post('academic_year')),
'term' => $this->security->xss_clean($this->input->post('term'))
);
$this->db->insert('instruction_reports', $data1);
}
}
redirect('Secondary/reports_settings?sent');
}
public function user_data_submit_instructions() {
$academic_year='';
$posted_data=$this->input->post('class_level');
$class_level=substr($posted_data,0,1);
$students_type=substr($posted_data,1,2);
$class_name=$this->input->post('class_name');
$term=$this->input->post('term');
if($students_type=='A'){
$academic_year=$this->session->userdata('academic_year_a_level');
}else{
$academic_year=date('Y');
}
//echo $students_type;exit();
$this->db->where('level',$class_level);
$this->db->where('students_type',$students_type);
$get=$this->db->get('class_levels');
foreach($get->result() as $ro){?>
db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('id',$id);
$this->db->delete('instruction_reports');
redirect('Secondary/reports_settings?deleted');
}
public function user_data_get_instructions() {
$academic_year='';
$posted_data=$this->input->post('class_level');
$class_level=substr($posted_data,0,1);
$students_type=substr($posted_data,1,2);
$class_name=$this->input->post('class_name');
$term=$this->input->post('term');
//echo $students_type;exit();
if($students_type=='A'){
$academic_year=$this->session->userdata('academic_year_a_level');
}else{
$academic_year=date('Y');
}
$this->db->where('level',$class_level);
$this->db->where('students_type',$students_type);
$get=$this->db->get('class_levels');
foreach($get->result() as $ro){?>
Instructions report To name?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$students_type);
$this->db->where('class_level',$class_level);
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$get=$this->db->get('instruction_reports');
foreach($get->result() as $ros){
$i++;
?>
'.$i.'. '.$ros->instructions ?>
Delete
input->post('password1');
$pass2 = $this->input->post('password2');
if ($pass1 == $pass2) {
$pass = $this->User_model->check_password1();
if ($pass > 0) {
$pass = $this->input->post('password');
$data1['password'] = MD5($pass);
if ($_POST) {
$this->User_model->change_passwords1();
$this->User_model->change_passwords_reset1();
redirect('Secondary?Changed');
} else {
redirect('Secondary');
}
} else {
redirect('Secondary?Error');
}
} else {
redirect('Secondary?Error1');
}
}
//function to logout and destroy sessions
public function logout() {
//finding url
$url='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$get=$this->db->get('schools');
foreach($get->result() as $row){
$url=$row->url;
}
if($this->session->userdata('type')=='Admin'){
$data = ['school_reg_number', 'school_reg_number'];
$this->session->unset_userdata($data);
if($url==''){
//redirecting to normal page
redirect('Welcome/login');
}else{
redirect('Welcome/login/'.$url);
}
}else{
$data = ['reg_number', 'reg_number'];
$this->session->unset_userdata($data);
if($url==''){
//redirecting to normal page
redirect('Welcome/login');
}else{
redirect('Welcome/login/'.$url);
}
}
}
}
PK ! =bg bg - Calculate_term_results_o_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_term_results_o_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','O');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Term Results (Terminal/Annual) ';
$ca=0;
$exam=0;
$ca_percent=0;
$exam_percent=0;
$year=date('Y');
$this->db->where('school_id',$school);
$this->db->where('students_type','O');
$getd=$this->db->get('assessment_settings');
foreach($getd->result() as $row_per){
$ca_percent=$row_per->ca_percent;
$exam_percent=$row_per->exam_percent;
}
$year=date('Y');
$number_of_sudents=0;
$term='';
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_term) {
$number_of_sudents=0;
$category='O';
$term=$row_term->term;
//echo '
Term'.$term.' ';
$sum_of_aveargess=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$reg_number=$row_reg->reg_number;
//echo $row_reg->reg_number.'';
$this->db->distinct();
$this->db->select('class_level');
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$query_all = $this->db->get('monthly_results');
foreach ($query_all->result() as $row_all) {
$class=$row_all->class_level;
$stream=$row_all->stream;
// echo 'Class = '.$class.' Combination = '.$stream.'
';
$number_of_months=0;
$sum_of_total=0;
$sum_of_avearges=0;
$average_of_averages=0;
$grade='';
$remark='';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year', $year);
$this->db->where('reg_number', $reg_number);
$query_month = $this->db->get('monthly_results');
foreach ($query_month->result() as $row_month) {
$number_of_months++;
$month=$row_month->month;
//finding subjects which are included in calculations
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_ca=$this->db->get('monthly_results');
foreach($get_ca->result() as $row_ca){
$sum_of_total=$sum_of_total+$row_ca->total_marks;
$sum_of_avearges=$sum_of_avearges+$row_ca->average;
// echo '
Month = '.$month.' Average = ' .$row_ca->average.'
';
}
}
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_averages=($sum_of_avearges/$number_of_months); //for considering total marks over total subjects required
$average_of_averages=round($average_of_averages);
//echo ' Number of months attempted = '.$number_of_months.'Sum of Total ='.$sum_of_total.' Sum of averages = '.$sum_of_avearges.' Average of averages = '.$average_of_averages.'
';
//finding percent of ca contribution
$ca= ($average_of_averages*$ca_percent)/100;
$ca=round($ca);
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_averages) && round($average_of_averages)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo $grade.'
';
// echo $remark.'
';
//no insertung into mid_term_results
}
}
}
// echo '
';
// echo '
Below are terminal or annual results ';
//calculating terminal/annual results
$term=$row_term->term;
//echo '
Term ='. $term.' Examination ';
$reg_number=$row_reg->reg_number;
$this->db->distinct();
$this->db->select('class_level');
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$query_all = $this->db->get('exam');
foreach ($query_all->result() as $row_all) {
$class=$row_all->class_level;
$stream=$row_all->stream;
$number_of_subjects=0;
$sum_of_marks=0;
$average_of_marks=0;
$grade='';
$remark='';
$required_subjects_for_calcultion1=0;
// echo $row_reg->reg_number.'';
//finding subjects which are included in calculations
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects_calculations');
foreach($gett->result() as $rowt){
$required_subjects_for_calcultion1++;
$this->db->where('subject_id',$rowt->subject_id);
$this->db->where('school_id',$school);
$getf= $this->db->get('general_subjects');
foreach($getf->result() as $rowf){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $rowt->subject_id);
$this->db->where('status', 0);
$get_ca=$this->db->get('exam');
foreach($get_ca->result() as $row_exam){
if($required_subjects_for_calcultion1==0){
//nothing to do because results calculations not set
}else{
$number_of_subjects++;
$sum_of_marks=$sum_of_marks+$row_exam->mark;
// echo $rowt->subject_id.' = '.$rowf->subject_name.' = ' .$row_exam->mark.'
'.'Combination= '.$stream.'
';
}
}
}
}
if($required_subjects_for_calcultion1==0){
//echo 'Combination = '.$stream.'
No results required, because results calcultions not set';
}else{
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion1); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//echo 'Required Subjects = '.$required_subjects_for_calcultion1. ' Number of subjects attempted = '.$number_of_subjects.' Sum of marks = '.$sum_of_marks.' Average = '.$average_of_marks.'
';
//finding exam percent of contribution
$exam= ($average_of_marks*$exam_percent)/100;
$exam=round($exam);
//adding ca_pecent and exa percent to get overall average
$overall_average=$ca+$exam;
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($overall_average) && round($overall_average)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo '
Overall average = '.$overall_average.' Overall grade = '.$grade.' Overall remark = '.$remark.' ';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$year,
'term'=>$term,
//'ca_total'=>$sum_of_avearges,
//'exam_total'=>$sum_of_marks,
'ca_average'=>$average_of_averages,
'exam_average'=>$average_of_marks,
'average'=>$overall_average,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results(' term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('term_results',$data);
}else{
$this->db->insert('term_results',$data);
}
}
}
}
}
//-------------------------finding division-------------------------------
$reg_number=$row_reg->reg_number;
// echo $reg_number.'
';
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $year);
$this->db->where('school_id',$school);
$getts= $this->db->get('classes');
foreach($getts->result() as $rowt){
$class=$rowt->class_level;
$stream=$rowt->stream;
$category=$rowt->category;
}
$point=0;
$sum_of_aveargess=0;
$number_sujects_required=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects_calculations_div');
foreach($gett->result() as $row_sub){
$required_subjects_for_calcultion_div++;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_subjects){
$this->db->select_sum('mark');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_marks=$this->db->get('ca');
foreach($get_marks->result() as $row_marks){
$number_of_months=0;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_months =$this->db->get('ca');
foreach($get_months->result() as $row_month){
$number_of_months++;
}
$exam_mark=0;
$exam_mark1=0;
$required_subjects_for_calcultion_div++;
$required_subjects_for_calcultion_div++;
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_exam_marks=$this->db->get('exam');
foreach($get_exam_marks->result() as $row_exam_marks){
$exam_mark1=$row_exam_marks->mark;
$exam_mark=$row_exam_marks->mark;
}
}
$total_marks_in_months=$row_marks->mark;
$average_in_months1=round($total_marks_in_months/$number_of_months);
$average_in_months=round($total_marks_in_months/$number_of_months);
if($average_in_months==''){
$sum_of_avearges=$exam_mark;
}else{
$average_in_months= ($average_in_months*$ca_percent)/100;
$exam_mark= ($exam_mark*$exam_percent)/100;
$sum_of_avearges=round($average_in_months + $exam_mark);
}
//-----------inserting into term_subjects_results------------------
$datass=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'academic_year'=>$year,
'term'=>$term,
'category'=>$category,
'subject_id'=>$row_subjects->subject_id,
'mark'=>$sum_of_avearges
);
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$getk_count=$this->db->count_all_results('term_subjects_results');
if($getk_count>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->update('term_subjects_results',$datass);
}else{
$this->db->insert('term_subjects_results',$datass);
}
//finding points for division------------------
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($sum_of_avearges) && round($sum_of_avearges)<=$row_grade->end_mark){
$grade1=$row_grade->grade;
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$this->db->where('grade',$grade1);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
//inserting into temporary table for points
$datas=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$year,
'term'=>$term,
'subject_id'=>$row_subjects->subject_id,
'point'=>$row_point->point
);
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$getk_count=$this->db->count_all_results('temporary_point_results');
if($getk_count>0){
}else{
$this->db->insert('temporary_point_results',$datas);
}
$sum_of_aveargess= $sum_of_aveargess+$sum_of_avearges;
// echo 'Exam mark = '.$exam_mark1. ' Subject_id = '.$row_subjects->subject_id.' Total marks in months = '.$row_marks->mark.' Average in months = '.$average_in_months1.
//' Average in months in percent = '.$average_in_months.' Avearage of exam in percent = '.$exam_mark.' Sum of averages = '.$sum_of_avearges.' Grade = '.$grade1.' Point = '.$row_point->point.' ,
';
}
}
}
}
}
//finding points from temporary_point_results
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->order_by('point','asc');
$this->db->limit(7);
$getk=$this->db->get('temporary_point_results');
foreach($getk->result() as $g){
//echo $g->point.'
';
$point= $point+$g->point;
// echo 'Single point = '.$point.'
';
}
// echo '
'.$point;
// echo '
';
$division=0;
$division_remark=0;
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
// echo 'Total Points = '.$point.' Division ='.$division.' Overall Total = '. $sum_of_aveargess.'
';
if($point<7){
$point='---';
$division='---';
}else{
$point=$point;
$division=$division;
}
$data=array(
'division'=>$division,
'total_marks'=>$sum_of_aveargess,
'point'=>$point,
'remark'=>$division_remark
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('term_results',$data);
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->delete('temporary_point_results');
}else{
//
}
}
// echo '
Number of students = '.$number_of_sudents.'
';
}
}
}
}?>PK ! X? ? 0 Arrange_results_positions_p_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Arrange_results_positions_p_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','P');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Monthly Results ';
// echo 'Monthly Test';
//stream positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$this->db->where('category','P');
$query_term = $this->db->get('monthly_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('category','P');
$get_month=$this->db->get('monthly_results');
foreach($get_month->result() as $row_month){
$class_position=0;
$month=$row_month->month;
// echo 'Month = '.$month.'
';
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('monthly_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
//....................Upadting subjects positions in ca table----------------------------------------->
$class=$row_class->class_level;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$sub_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->order_by('mark','desc');
$get_s=$this->db->get('ca');
foreach($get_s->result() as $row_s){
$sub_position++;
$datad=array(
'position'=>$sub_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('class_level',$class);
$count_entered= $this->db->count_all_results('ca');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->update('ca',$datad);
}else{
//
}
}
}
//-------- calculatin positions for streams and whole class level----------------->
$this->db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_stream=$this->db->get('monthly_results');
foreach($get_stream->result() as $row_stream){
$stream_position=0;
$stream=$row_stream->stream;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$stream_position++;
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('monthly_results');
foreach($get_av->result() as $row_av){
$average=$row_av->average;
//echo 'Reg Number = '.$reg_number.' '.$stream.' Average = '.$average.' Stream Position = '.$stream_position.'
';
$data=array(
'position'=>$stream_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('stream',$stream);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('monthly_results',$data);
}else{
//
}
}
}
//ECHO '
';
}
}
}
}
//class positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('category','P');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('monthly_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_month=$this->db->get('monthly_results');
foreach($get_month->result() as $row_month){
$class_position=0;
$month=$row_month->month;
// echo 'Month = '.$month.'
';
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('monthly_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
$class_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('monthly_results');
foreach($get_av->result() as $row_av){
$class_position++;
$average=$row_av->average;
// echo 'Reg Number = '.$reg_number.' Average = '.$average.' Class Position = '.$class_position.'
';
$data=array(
'all_position'=>$class_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('monthly_results',$data);
}else{
//
}
}
}
// ECHO '
';
}
}
}
//-------------------------------------------------------------------------------------------------------------------------//
// echo 'Mid-Term Test';
//stream positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('category','P');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('mid_term_results');
foreach ($query_term->result() as $row_term) {
//....................Upadting subjects positions in ca table----------------------------------------->
$term=$row_term->term;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('mid_term_subjects_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
//echo $class.'
';
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('mid_term_subjects_results');
foreach($get_sub->result() as $row_sub){
//echo $row_sub->subject_id.'
';
$sub_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->order_by('mark','desc');
$get_s=$this->db->get('mid_term_subjects_results');
foreach($get_s->result() as $row_s){
$sub_position++;
//echo $row_s->reg_number.' position= '.$sub_position.'
';
$datad=array(
'position'=>$sub_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('class_level',$class);
$count_entered= $this->db->count_all_results('mid_term_subjects_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->update('mid_term_subjects_results',$datad);
}else{
//
}
} //echo '
';
}
}//echo '
';
//-------- calculatin positions for streams and whole class level----------------->
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$class_position=0;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('monthly_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
$this->db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_stream=$this->db->get('monthly_results');
foreach($get_stream->result() as $row_stream){
$stream_position=0;
$stream=$row_stream->stream;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('mid_term_results');
foreach($get_reg->result() as $row_reg){
$stream_position++;
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('mid_term_results');
foreach($get_av->result() as $row_av){
$average=$row_av->average;
// echo 'Reg Number = '.$reg_number.' '.$stream.' Average = '.$average.' Stream Position = '.$stream_position.'
';
$data=array(
'position'=>$stream_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('stream',$stream);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('mid_term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('mid_term_results',$data);
}else{
//
}
}
}
//ECHO '
';
}
}
}
//class positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('category','P');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('mid_term_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$class_position=0;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('mid_term_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
$class_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('mid_term_results');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('mid_term_results');
foreach($get_av->result() as $row_av){
$class_position++;
$average=$row_av->average;
// echo 'Reg Number = '.$reg_number.' Average = '.$average.' Class Position = '.$class_position.'
';
$data=array(
'all_position'=>$class_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('mid_term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('mid_term_results',$data);
}else{
//
}
}
}
//ECHO '
';
}
}
//------------------------------------------------------------------------------------------------------------------------//
// echo 'Term Results';
//stream positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('category','P');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('mid_term_results');
foreach ($query_term->result() as $row_term) {
//....................Upadting subjects positions in ca table----------------------------------------->
$term=$row_term->term;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('mid_term_subjects_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
//echo $class.'
';
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('term_subjects_results');
foreach($get_sub->result() as $row_sub){
//echo $row_sub->subject_id.'
';
$sub_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->order_by('mark','desc');
$get_s=$this->db->get('term_subjects_results');
foreach($get_s->result() as $row_s){
$sub_position++;
//echo $row_s->reg_number.' position= '.$sub_position.'
';
$datad=array(
'position'=>$sub_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('class_level',$class);
$count_entered= $this->db->count_all_results('term_subjects_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','P');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->update('term_subjects_results',$datad);
}else{
//
}
} //echo '
';
}
}//echo '
';
//-------- calculatin positions for streams and whole class level----------------->
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$class_position=0;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('term_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
$this->db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_stream=$this->db->get('term_results');
foreach($get_stream->result() as $row_stream){
$stream_position=0;
$stream=$row_stream->stream;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('term_results');
foreach($get_reg->result() as $row_reg){
$stream_position++;
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('term_results');
foreach($get_av->result() as $row_av){
$average=$row_av->average;
// echo 'Reg Number = '.$reg_number.' '.$stream.' Average = '.$average.' Stream Position = '.$stream_position.'
';
$data=array(
'position'=>$stream_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('stream',$stream);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('stream',$stream);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('term_results',$data);
}else{
//
}
}
}
//ECHO '
';
}
}
}
//class positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('category','P');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('term_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$class_position=0;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$get_class=$this->db->get('term_results');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
$class_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->order_by('average','desc');
$get_reg=$this->db->get('term_results');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->order_by('average','desc');
$get_av=$this->db->get('term_results');
foreach($get_av->result() as $row_av){
$class_position++;
$average=$row_av->average;
// echo 'Reg Number = '.$reg_number.' Average = '.$average.' Class Position = '.$class_position.'
';
$data=array(
'all_position'=>$class_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category','P');
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('term_results',$data);
}else{
//
}
}
}
//ECHO '
';
}
}
//-------------------------------------------------------------------------------------------------------------------------//
}
}
}?>PK ! ejOQ7 7 0 Calculate_monthly_results_o_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_monthly_results_o_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','O');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Monthly Results ';
$year=date('Y');
$term='';
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('ca');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo '
Term ='. $term.' ';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year', $year);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_month) {
$number_of_sudents=0;
$month=$row_month->month;
//echo '
Month = '.$month.' ';
$category='O';
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$reg_number=$row_reg->reg_number;
$this->db->distinct();
$this->db->select('class_level');
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
$this->db->where('month', $month);
$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$query_all = $this->db->get('ca');
foreach ($query_all->result() as $row_all) {
$class=$row_all->class_level;
$stream=$row_all->stream;
$number_of_subjects=0;
$number_of_subjects_div=0;
$sum_of_marks=0;
$average_of_marks=0;
$grade='';
$remark='';
$division='';
$division_remark='';
$point='';
$grade1='';
$required_subjects_for_calcultion_div=0;
$required_subjects_for_calcultion=0;
$count_subjects_peformed=0;
// echo $row_reg->reg_number.' class = '.$class.' stream= '.$stream.'';
//finding subjects which are included in calculations for average
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects_calculations');
foreach($gett->result() as $rowt){
$required_subjects_for_calcultion++;
$this->db->where('subject_id',$rowt->subject_id);
$this->db->where('school_id',$school);
$getf= $this->db->get('general_subjects');
foreach($getf->result() as $rowf){
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $rowt->subject_id);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
if($required_subjects_for_calcultion==0){
//nothing to do because results calculations not set
}else{
$number_of_subjects++;
// $sum_of_marks=$sum_of_marks+$row_ca->mark;
// echo $rowt->subject_id.' = '.$rowf->subject_name.' = ' .$row_ca->mark.'
'.'Combination= '.$stream.'
';
}
}
}
}
//temporary/special ce for action for finding number of subjects performed by students from ca to avoid deviding subjects which are assigned but not performed
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
//$this->db->where('subject_id', $rowt->subject_id);
$this->db->where('status', 0);
$count_subjects_peformed=$this->db->count_all_results('ca');
///end of temporay/special case for mock
//finding subjects which are included in calculations for divisions
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->where('status', 0);
//$this->db->limit(7);
$this->db->order_by('mark','desc');
$get_caa=$this->db->get('ca');
$sub = 0;
foreach($get_caa->result() as $row_caa){
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('subject_id',$row_caa->subject_id);
$this->db->where('school_id',$school);
$count= $this->db->count_all_results('subjects_calculations_div');
if($count > 0){
if($sub < 7){
$sub++;
$required_subjects_for_calcultion_div++;
$sum_of_marks=$sum_of_marks+$row_caa->mark;
if($required_subjects_for_calcultion_div==0){
//nothing to do because results calculations not set
}else{
$number_of_subjects_div++;
$marks= round($row_caa->mark);
//echo 'Mark = '.$marks.'
';
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($marks) && round($marks)<=$row_grade->end_mark){
$grade1=$row_grade->grade;
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$this->db->where('grade',$grade1);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
// echo $row_reg->reg_number.' = '.$row_caa->subject_id.' Grades = '.$grade1.' Point = '.$row_point->point.'
';
$point= $point+$row_point->point;
// echo 'Single point = '.$point.'
';
}
}
}
}
}
}
}
echo '
';
if($required_subjects_for_calcultion==0 ||$required_subjects_for_calcultion_div==0){
//echo 'Combination = '.$stream.'
No results required, because results calcultions not set';
}else{
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
//this for normal schools $average_of_marks=($sum_of_marks/$required_subjects_for_calcultion); //for considering total marks over total subjects required
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_div); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding division
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
//echo 'Required subject for div = '.$number_of_subjects_div.' Required Subjects for average = '.$required_subjects_for_calcultion. ' Number of subjects attempted = '.$number_of_subjects.' Sum of marks = '.$sum_of_marks.' Average = '.$average_of_marks.
//' Total Point ='.$point.' Division ='.$division.'
';
if($point<7 || $required_subjects_for_calcultion_div<7){
$point=42;
$division='---';
}else{
$point=$point;
$division=$division;
}
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//echo $grade.'
';
// echo $remark.'
';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$year,
'month'=>$month,
'term'=>$term,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'division'=>$division,
'point'=>$point,
'gpa'=>round($point/7,4),
'remark'=>$division_remark,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$this->db->insert('monthly_results',$data);
}
}
}
}
}
}
}
}
}
}
}?>PK ! 4 Insert_payments_secondary.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
//this function redirecting different pages after users loged in
public function index() {
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
}
public function edit_payments(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data= array(
'amount'=>str_replace(',', '', $this->security->xss_clean($this->input->post('amount')))
);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('school_receipt', $this->security->xss_clean($this->input->post('receipt_number')));
$this->db->update('transactions', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
public function edit_payments_a(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data= array(
'amount'=>str_replace(',', '', $this->security->xss_clean($this->input->post('amount')))
);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('school_receipt', $this->security->xss_clean($this->input->post('receipt_number')));
$this->db->update('transactions', $data);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number));
}
public function edit_payments_required(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$academic_year=$this->security->xss_clean($this->input->post('academic_year'));
$amount_to_pay=$this->security->xss_clean($this->input->post('amount_to_pay'));
$payment_type=$this->security->xss_clean($this->input->post('payment_type'));
$school_id= $this->session->userdata('school_id');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$count=$this->db->count_all_results('reduced_payments');
if($count>0){
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$this->db->delete('reduced_payments');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}else{
$data= array(
'reg_number'=>$reg_number,
'academic_year'=>$academic_year,
'school_id'=>$school_id,
'payment_id'=>$payment_type,
'amount'=>str_replace(',', '', $amount_to_pay)
);
$this->db->insert('reduced_payments', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
}
public function edit_payments_required_a(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$academic_year=$this->security->xss_clean($this->input->post('academic_year'));
$amount_to_pay=$this->security->xss_clean($this->input->post('amount_to_pay'));
$payment_type=$this->security->xss_clean($this->input->post('payment_type'));
$school_id= $this->session->userdata('school_id');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$count=$this->db->count_all_results('reduced_payments');
if($count>0){
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$this->db->delete('reduced_payments');
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number));
}else{
$data= array(
'reg_number'=>$reg_number,
'academic_year'=>$academic_year,
'school_id'=>$school_id,
'payment_id'=>$payment_type,
'amount'=>str_replace(',', '', $amount_to_pay)
);
$this->db->insert('reduced_payments', $data);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number));
}
}
public function delete_transaction(){
$date=base64_decode($_GET['d']);
$reg_number=base64_decode($_GET['id']);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $reg_number);
$this->db->where('date_inserted', $date);
$this->db->delete('transactions');
redirect('Secondary/enter_payments_secondary');
}
public function send_payments(){
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
if(isset($_POST)){
//note C == Current and D==Debt
$reason='';
$payments_type='';
if($this->security->xss_clean($this->input->post('payment_type'))=='D'){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('name', 'School Fees');
$this->db->limit(1);
$get=$this->db->get('payments_type');
foreach($get->result() as $ry){
$payments_type=$ry->payment_id;
}
$reason='D';
$academic_year = $this->security->xss_clean($this->input->post('year'))-1;
}else{
$payments_type=$this->security->xss_clean($this->input->post('payment_type'));
$academic_year = $this->security->xss_clean($this->input->post('year'));
$reason='C';
}
///////end to set if is debt of current charges payements
$month = $this->input->post('date_deposited');
$monthNum = substr($month,3,2);
$dateObj = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F');
$month1 = $this->input->post('date_received');
$monthNum1 = substr($month1,3,2);
$dateObj1 = DateTime::createFromFormat('!m', $monthNum1);
$monthName1 = $dateObj1->format('F');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('amount', str_replace(',', '', $this->security->xss_clean($this->input->post('amount_posted'))));
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('date_deposited', $this->security->xss_clean($this->input->post('date_received')));
$this->db->where('payment_type', $payments_type);
$this->db->where('bank', $this->security->xss_clean($this->input->post('bank')));
//$this->db->where('round', $round);
$this->db->where('date_issued', $this->security->xss_clean($this->input->post('date_deposited')));
$c = $this->db->count_all_results('transactions');
//if($c < 1){
$issuer=$session_reg_number;
date_default_timezone_set('Africa/Nairobi');
$date_issued=$this->security->xss_clean($this->input->post('date_deposited'));
$date_inserted= date("l jS \of F Y ");
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$school_type= $this->security->xss_clean($this->input->post('school_type'));
$student_category= substr($reg_number,0,1);
$class_level= $this->security->xss_clean($this->input->post('classlevel'));
//$stream= $this->security->xss_clean($this->input->post('stream'));
$data = array(
'school_id' => $this->session->userdata('school_id'),
'reg_number' => $reg_number,
'category' => $student_category,
'class_level' => $class_level,
//'stream' => $stream,
'payment_type' => $payments_type,
'bank' => $this->security->xss_clean($this->input->post('bank')),
'payment_method' => $this->security->xss_clean($this->input->post('payment_method')),
'amount' => str_replace(',', '', $this->security->xss_clean($this->input->post('amount_posted'))),
'month' => $monthName,
'month_deposited'=>$monthName1,
'date_inserted'=>date("l jS \of F Y "),
'date_deposited'=> $this->security->xss_clean($this->input->post('date_received')),
'academic_year'=>$academic_year,
'paid_year'=>date('Y'),
'school_receipt'=>"R".time(),
'date_issued'=>$date_issued,
'issuer'=>$issuer,
'reason'=>$reason
);
if($this->db->insert('transactions', $data)){
echo "Data Saved Successfully";
}else{
echo "Error: Something went wrong, data not saved try again";
}
}
}
public function reload_payments(){
// $data=array(
// 'school_id'=>$this->session->userdata('school_id')
// );
// $this->db->insert('test',$data);
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->order_by('id','DESC');
$this->db->where('school_id',$this->session->userdata('school_id'));
$get = $this->db->get('transactions');
foreach($get->result() as $pay){?>
db->where('reg_number',$pay->reg_number);
$st = $this->db->get('students');
$student = '';
foreach($st->result() as $std){
$student = $std->full_name;
echo $student;
}?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('academic_year',date('Y'));
$getf=$this->db->get('classes');
foreach($getf->result() as $rt){
echo 'FORM '.$rt->class_level.' - '.$rt->stream;
}
?>
db->select_sum('amount');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_amount = $this->db->get('transactions');
foreach($get_amount->result() as $pay_amount){
echo number_format($pay_amount->amount);
}?>
db->distinct();
$this->db->select('payment_method');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_pp = $this->db->get('transactions');
foreach($get_pp->result() as $pay_pp){
echo $pay_pp->payment_method.', ';
}?>
db->distinct();
$this->db->select('bank');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_pb = $this->db->get('transactions');
foreach($get_pb->result() as $pay_pb){
if($pay_pb->bank=='none' || $pay_pb->bank==''){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$pay_pb->bank);
$gety=$this->db->get('banks');
foreach($gety->result() as $tt){
echo $tt->name;
}
}
}?>
db->distinct();
$this->db->select('date_issued');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_ppd = $this->db->get('transactions');
foreach($get_ppd->result() as $pay_ppd){
echo $pay_ppd->date_issued.' ';
}?>
"> Delete
" class="pull-right"> Print
db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('full_name', $this->input->post('name'),"BOTH");
$this->db->limit(10);
$q = $this->db->get('students');
foreach($q->result() as $st){
$academic_year =$this->input->post('year');
$round=$this->input->post('round');
$this->db->where('academic_year', $academic_year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $st->reg_number);
$this->db->where('status', 0);
$this->db->limit(1);
$query = $this->db->get('classes');
foreach ($query->result() as $rows) {
$this->db->where('reg_number', $rows->reg_number);
$query = $this->db->get('students');
foreach ($query->result() as $rowws) {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year', $academic_year);
$querry = $this->db->get('classes');
foreach ($querry->result() as $row_amount) {
$reg = $rowws->reg_number;
$sch_type = $row_amount->schoolar_type;
$cat = $row_amount->category;
//$pay_type = $row_amount->payment_type;
$year = $row_amount->academic_year;
}
?>
full_name; ?>
class_level . "-" . $rows->stream.'';
?>
-- Select --
Payslip
Cash
-- Select --
None
db->where('school_id',$this->session->userdata('school_id'));
$get=$this->db->get('banks');
foreach($get->result() as $t){?>
name; ?>
-- Select --
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',(date('Y')-1));
$count_r=$this->db->count_all_results('register_fees');
if($count_r==0){?>
Debt
db->distinct();
$this->db->select('academic_year');
$this->db->not_like('academic_year',date('Y'));
$this->db->where('reg_number',$reg_number);
$gety=$this->db->get('classes');
foreach($gety->result() as $r){
$year=$r->academic_year;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
//echo $name->full_name;
$reg_number=$name->reg_number;
}
?>category=='N'){
//echo 'Nursery '.$row->class_level.'- '.$year;
}elseif($row->category=='P'){
//echo 'Standard '.$row->class_level.'- '.$year;
}else{
//echo 'Form '.$row->class_level.'- '.$year;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $debt){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$debt->payer_id);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $debt){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$debt->payer_id);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
// echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
// echo '---';
}else{
// echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
$remained=$total_required-$paid;
//echo number_format($total_required-$paid);
}elseif($total_required==$paid){
$remained=0;
// echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
// echo 'Complete';
}else{
// echo 'Not complete';
}
?>
$paid_for_years){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$rows->class_level);
$this->db->where('students_type',$rows->category);
$this->db->where('schoolars_type',$rows->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rowss){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rowss->payment_id);
$this->db->where('payment_id',$rowss->payment_id);
$this->db->order_by('payment_id','asc');
$gets=$this->db->get('payments_type');
foreach($gets->result() as $t){?>
name; ?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$rows->class_level);
$this->db->where('students_type',$rows->category);
$this->db->where('schoolars_type',$rows->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rowsy){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rowsy->payment_id);
$this->db->order_by('payment_id','asc');
$gett=$this->db->get('payments_type');
foreach($gett->result() as $tt){?>
name; ?>
full_name; ?>
class_level; ?>
stream; ?>
Save
PK ! +$ $ Super_user.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
require_once APPPATH."/third_party/PHPExcel.php";
if (!$this->session->userdata('reg_number')) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}else{
if($this->session->userdata('type')!='super_user'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}
}
}
function index(){
$this->load->view('includes/super_header');
echo 'super user';
$this->load->view('includes/super_footer');
}
public function clean_sub_subjects(){
$exam = $_REQUEST['exam_id'];
$sql = "DELETE FROM ca
WHERE exam_id = $exam
AND subject_id IN (
SELECT subject_id FROM all_subjects WHERE is_sub = 1
)";
$this->db->query($sql);
redirect($_SERVER['HTTP_REFERER']);
}
public function angalia_ca_sub(){
$exam_id = 79;
foreach($this->db->distinct()->select('subject_id')->where('exam_id',$exam_id)->get('ca')->result() as $sub){
foreach($this->db->where('subject_id',$sub->subject_id)->where('is_sub',1)->get('all_subjects')->result() as $name){
if($name->is_sub == 1){
$count = $this->db->where('exam_id',$exam_id)->where('subject_id',$sub->subject_id)->count_all_results('ca');
if($count > 0){
echo $name->name." - ".$count."
";
//$this->db->where('subject_id',$name->subject_id)->where('exam_id',$exam_id)->delete('ca');
}
}
}
echo "
";
}
echo "
SCHOOL GPA ++++++++++++++";
foreach($this->db->where('exam_id',$exam_id)->get('subjects_school_gpa')->result() as $sub){
foreach($this->db->where('subject_id',$sub->subject_id)->get('all_subjects')->result() as $name){
if($name->is_sub == 1){
// tunadelete hapa
echo $name->name."
";
//$this->db->where('subject_id',$name->subject_id)->where('school_id',$sub->school_id)->where('exam_id',$exam_id)->delete('subjects_school_gpa');
}
}
echo "
";
}
}
public function futa_ca_sub1(){
$exam_id = 79;
foreach($this->db->distinct()->select('reg_number')->where('exam_id',$exam_id)->get('ca')->result() as $reg){
$comb = '';
foreach($this->db->where('reg_number',$reg->reg_number)->get('classes')->result() as $class){
$comb = $class->stream;
}
$getcasub = $this->db->distinct()->select('main_subject_id')->where('reg_number',$reg->reg_number)->where('exam_id',$exam_id)->get('ca_sub');
echo $reg->reg_number.' - '.$comb.'
';
foreach($getcasub->result() as $main_subject){
$countca = $this->db->where('subject_id',$main_subject->main_subject_id)->where('exam_id',$exam_id)->where('reg_number',$reg->reg_number)->count_all_results('ca');
if($countca == 0){
//d nothing
foreach($this->db->where('subject_id',$main_subject->main_subject_id)->get('all_subjects')->result() as $rowname){
$subject_name = $rowname->name;
}
echo 'Futa hili = '.$main_subject->main_subject_id.' '.$subject_name.'
';
}else{
//la kufuta hili
//tafuta jina la somo
}
}
echo '
';
}
}
public function futa_ca_sub(){
$exam_id = 79;
foreach($this->db->distinct()->select('reg_number')->where('exam_id',$exam_id)->get('ca')->result() as $reg){
foreach($this->db->where('reg_number',$reg->reg_number)->get('classes')->result() as $comb){
foreach($this->db->where('combination',$comb->stream)->get('combinations')->result() as $valid){
// find valid subjects;
$subids = explode(',',$valid->ids);
echo $comb->stream." ";
$sub = $this->db->distinct()->select('main_subject_id')->where('reg_number',$reg->reg_number)->where_not_in('main_subject_id',$subids)->get('ca_sub');
if($sub->num_rows() > 0){
echo "Invalid ca sub
";
foreach($sub->result() as $ss){
foreach($this->db->where('subject_id',$ss->main_subject_id)->get('all_subjects')->result() as $name){
echo $name->name.", ";
}
}
}
echo "";
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$ca = $this->db->distinct()->select('subject_id')->where('reg_number',$reg->reg_number)->where_not_in('subject_id',$subids)->where('exam_id',$exam_id)->get('ca');
if($ca->num_rows() > 0){
echo "Invalid ca
";
foreach($ca->result() as $ss){
foreach($this->db->where('subject_id',$ss->subject_id)->get('all_subjects')->result() as $name){
echo $name->name.", ";
}
}
}
}
}
// $count_sub = $this->db->distinct()->select('main_subject_id')->where('reg_number',$sub->reg_number)->where('exam_id',$exam_id)->count_all_results('ca_sub');
// $this->db->not_like('subject_id',26); ## GS
// $this->db->not_like('subject_id',28); ## BAM
// $this->db->not_like('subject_id',54); ## DIVINITY
// $this->db->not_like('subject_id',55); ## MUSIC
// $count_ca = $this->db->distinct()->select('subject_id')->where('reg_number',$sub->reg_number)->where('exam_id',$exam_id)->count_all_results('ca');
// $st = $count_ca > $count_sub ? 'style="color:red"':'style="color:green"';
// if($count_ca > $count_sub){
// echo '
';
// echo " count sub ".$count_sub." ". " count ca ".$count_ca." ";
// foreach($this->db->where('reg_number',$sub->reg_number)->get('classes')->result() as $comb){
// echo $sub->reg_number.' '.$comb->stream." - ";
// foreach($this->db->where('school_id',$comb->school_id)->get('schools')->result() as $sch){
// echo $sch->school_name." - ";
// }
// }
// echo "SUBJECTS ";
// $this->db->not_like('subject_id',26); ## GS
// $this->db->not_like('subject_id',28); ## BAM
// $this->db->not_like('subject_id',54); ## DIVINITY
// $this->db->not_like('subject_id',55); ## MUSIC
// $this->db->distinct()->select('subject_id')->where('reg_number',$sub->reg_number)->where('exam_id',$exam_id);
// foreach($this->db->get('ca')->result() as $main){
// foreach($this->db->where('subject_id',$main->subject_id)->get('all_subjects')->result() as $name){
// echo $name->name.", ";
// }
// }
// echo ' ';
// echo "
";
// echo "
";
// }
}
}
public function testing_endtime(){
$now = time();
$endtime = '';
foreach($this->db->limit(5)->where('examination_id',52)->get('examination')->result() as $exam){
echo "Exam ".$exam->end_time." ".$exam->upload_deadline."
";
$endtime = $exam->upload_deadline." ".$exam->end_time;
$endtime = strtotime($endtime);
echo "Now: ".$now." End: ".$endtime;
if($now > $endtime){
echo "Terminate";
}else{
echo "Allowed";
}
}
}
public function school_upload(){
$exam = $_REQUEST['exam_id'];
$status=0;
foreach($this->db->select('school_upload')->where('examination_id',$exam)->get('examination')->result() as $ex){
$status = $ex->school_upload;
}
if($status == 0){
$status = 1;
}else{
$status = 0;
}
$this->db->where('examination_id',$exam)->update('examination',array('school_upload'=>$status));
redirect($_SERVER['HTTP_REFERER']);
}
public function upload_questions(){
$exam = $_REQUEST['exam_id'];
$status=0;
foreach($this->db->select('upload_questions')->where('examination_id',$exam)->get('examination')->result() as $ex){
$status = $ex->upload_questions;
}
if($status == 0){
$status = 1;
}else{
$status = 0;
}
$this->db->where('examination_id',$exam)->update('examination',array('upload_questions'=>$status));
redirect($_SERVER['HTTP_REFERER']);
}
public function upload_deadline(){
$time12 = $this->input->post('time');
$time24 = date("H:i", strtotime($time12));
$this->db->where('examination_id',$this->input->post('exam_id'));
$this->db->update('examination',array('upload_deadline'=>$this->input->post('date'),'end_time'=>$time24));
redirect($_SERVER['HTTP_REFERER']);
}
public function school_report(){
$exam = $_REQUEST['exam_id'];
$status=0;
foreach($this->db->select('school_report')->where('examination_id',$exam)->get('examination')->result() as $ex){
$status = $ex->school_report;
}
if($status == 0){
$status = 1;
}else{
$status = 0;
}
$this->db->where('examination_id',$exam)->update('examination',array('school_report'=>$status));
redirect($_SERVER['HTTP_REFERER']);
}
public function create_combination(){
exit;
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
// echo $exam_id.' - '.$candidate;exit;
$students_updated=0;
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$category = $rows->category;
$group_id = $rows->group_id;
}
/*
$this->db->where('academic_year', $academic_year);
$this->db->where('stream', 'UNK');
$this->db->where('candidate',$candidate);
foreach($this->db->get('classes')->result() as $rt){;
echo $rt->reg_number.'
';
$this->db->select('s.full_name,c.school_name,s.id_number');
$this->db->where('s.reg_number',$rt->reg_number);
$this->db->from('students as s');
$this->db->join('schools as c','c.school_id=s.school_id');
$g = $this->db->get();
foreach($g->result() as $sc){
echo $sc->school_name." ".$sc->id_number."
";
}
}
exit;
*/
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('exam_id',$exam_id);
foreach($this->db->get('ca')->result() as $students){
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$students->reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->order_by('subject_id','asc');
$this->db->limit(3);
$subjects = $this->db->get('ca');
$sum = '';
foreach($subjects->result() as $subs){
$sum.= $subs->subject_id; // Concatinate the ID's
//echo $subs->subject_id;
}
//echo " ";
/*
$this->db->select('s.full_name,c.school_name,s.id_number');
$this->db->where('s.reg_number',$students->reg_number);
$this->db->from('students as s');
$this->db->join('schools as c','c.school_id=s.school_id');
$g = $this->db->get();
foreach($g->result() as $sc){
echo $sc->school_name." ".$sc->id_number." ";
}
echo $students->reg_number;
*/
$this->db->where('id_sum',$sum);
$c = $this->db->get('combinations');
foreach($c->result() as $comb){
$data_stream = array('stream'=>$comb->combination);
}
if($c->num_rows() == 0){
## UNK Combination
$data_stream = array('stream'=>'UNK');
if($subjects->num_rows() == 3 ){
//echo " UNK - ".$subjects->num_rows();
$data_stream = array('stream'=>'UNK');
}else{
// echo " Incomplete ".$subjects->num_rows();
$this->db->where('reg_number',$students->reg_number);
$this->db->where('academic_year', $academic_year);
$this->db->where('candidate',$candidate);
foreach($this->db->get('classes')->result() as $rt){;
$data_stream = array('stream'=>$rt->stream);
}
}
$this->db->where('reg_number',$students->reg_number);
$this->db->where('academic_year', $academic_year);
$this->db->where('candidate',$candidate);
$this->db->update('classes',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->update('ca',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data_stream);
}else{
$students_updated++;
//echo " ".$data['stream']." Complete";
$this->db->where('reg_number',$students->reg_number);
$this->db->where('academic_year', $academic_year);
$this->db->where('candidate',$candidate);
$this->db->update('classes',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->update('ca',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data_stream);
}
//echo "
";
}
?>
db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$category = $rows->category;
$group_id = $rows->group_id;
}
## Monthly results for each school
if($category == 'P'){
#######################################
$this->db->distinct();
$this->db->select('school_id');
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->order_by('id',"asc");
$this->db->limit($limit,$start);
$g = $this->db->get('ca');
foreach($g->result() as $schools){
$school = $schools->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $ddd){
$district = $ddd->district;
$region = $ddd->region;
$stream = 'A';
}
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select('SUM(mark) as mark, AVG(mark) as avg, reg_number');
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$this->db->group_by('reg_number');
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = round($row_ca->mark);
$average_of_marks = round($row_ca->avg);
$reg_number = $row_ca->reg_number;
## Select all entered and included to the calculations
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$required_subjects_for_calcultion=$this->db->count_all_results('ca');
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$subjects = 4;
if($category =='A'){
$subjects = 2;
}
if($required_subjects_for_calcultion>$subjects){
//complete results
$complete=1;
}else{
//incoplete results
$complete=0;
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'stream'=>$stream,
'candidate'=>$candidate,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
$subjects = 5;
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$point = 42; $gpa=8;$division = "---"; $division_remark="Pass";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
if($grade=='E'){
$division_remark="Fail";
}
$gpa = round($point/5,4);
$data = array(
//'division'=>$division,
//'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
//print_r($data);
//echo "
";
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$academic_year);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data);
}else{
$data = array(
// 'division'=>$division,
// 'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
}
}
#######################################
}
}else{
//echo $exam_name;exit;
$this->db->distinct();
//$this->db->where('school_id','SS5c3c69535aa4b');
$this->db->select('school_id');
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//$this->db->where('group_id',$group_id);
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->order_by('id',"asc");
$this->db->limit($limit,$start);
$g = $this->db->get('ca');
foreach($g->result() as $schools){
$school = $schools->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $ddd){
$district = $district_exam = $ddd->district;
$region = $ddd->region;
}
//echo $group_id.' '. $region.' '.$district_exam.' - '.$district;exit;
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
$subjects = 7;
if($category =='A'){
$subjects = 3;
}
## select sum of marks for this monly and this student for reqiured only
$this->db->select('SUM(mark) as mark, AVG(mark) as avg, reg_number');
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$this->db->group_by('reg_number');
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks=0;
$reg_number = $row_ca->reg_number;
//print_r($row_ca); echo "
";
$sum_of_marks = $row_ca->mark;
$average_of_marks = $row_ca->avg;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $classes){
$class = $classes->class_level;
$district = $classes->district;
$region = $classes->region;
$stream = $classes->stream;
}
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('status', 0);
$count_subjects=$this->db->count_all_results('ca');
$subjects = 6;
if($category =='A'){
$subjects = 2;
}
if($count_subjects > $subjects){
$complete=1;
}else{
$complete=0;
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
//$this->db->limit($subjects);
$required_subjects_for_calcultion = $this->db->count_all_results('ca');
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $classes){
$class = $classes->class_level;
$district = $classes->district;
$region = $classes->region;
$stream = $classes->stream;
}
if($category == 'P'){
$stream = 'A';
}
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'stream'=>$stream,
'candidate'=>$candidate,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>round($sum_of_marks),
'average'=>round($average_of_marks),
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data3);
}else{
$this->db->insert('monthly_results',$data3);
}
}
}
## Division calculation here
//echo "Division calculation here";
## Finding best seven subejcts which are included in div cal
$subjects = 7;
if($category =='A'){
$subjects = 3;
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$point = 42; $gpa=8;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
$gpa = round($point/7,4);
if($category =='A'){
$gpa = round($point/3,4);
}
$data = array(
'division'=>$division,
'point'=>$point,
'complete_sort'=>1,
'complete'=>$point==42 ? 0:1,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
//print_r($data);
//echo "
";
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$academic_year);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data);
}else{
if($region == 3){
$complete = 1;
$pointNew = 0;
// finding subject done and their grades
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$pointNew= $pointNew+$row_point->point;
}
}
// special case for dodoma division calculation for incomplete
if($subjects == 3){
$pointNew = $pointNew + 7*($subjects - $ca->num_rows());
}else{
$pointNew = $pointNew + 5*($subjects - $ca->num_rows());
}
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($pointNew) && round($pointNew)<=$row_div->end_point){
if($row_div->division != 0){
$division='IV';
}else{
$division = 0;
}
$division_remark=$row_div->remark;
}
}
if($point > 2){
$division = 'IV';
}else{
$division = 0;
}
}else{
$complete = $point==42 ? 0:1; // other regions
}
$data = array(
'division'=>$division,
'point'=>$point,
// 'complete'=>$point==42 ? 0:1,
'complete_sort'=>0,
'complete'=>$complete,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
/*
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<1){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
*/
}
}
}
}
## End monthly results
redirect($_SERVER['HTTP_REFERER']);
}
/*
public function calculate_results(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$limit = $_REQUEST['limit'];
$order = $_REQUEST['order'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$category = $rows->category;
}
## Monthly results for each school
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->order_by('id',$order);
$this->db->limit($limit);
$g = $this->db->get('ca');
foreach($g->result() as $schools){
$school = $schools->school_id;
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
$subjects = 7;
if($category =='A'){
$subjects = 3;
}
## select sum of marks for this monly and this student for reqiured only
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks=0;
$reg_number = $row_ca->reg_number;
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',60); ## AC
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
foreach($ca->result() as $cass){
$sum_of_marks = $sum_of_marks + $cass->mark;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $classes){
$class = $classes->class_level;
$district = $classes->district;
$region = $classes->region;
$stream = $classes->stream;
}
## Select all entered and included to the calculations
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$required_subjects_for_calcultion=$this->db->count_all_results('ca');
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$subjects = 6;
if($category =='A'){
$subjects = 2;
}
if($required_subjects_for_calcultion>$subjects){
//complete results
$complete=1;
}else{
//incoplete results
$complete=0;
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $classes){
$class = $classes->class_level;
$district = $classes->district;
$region = $classes->region;
$stream = $classes->stream;
}
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'stream'=>$stream,
'candidate'=>$candidate,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
//print_r($data3); echo "
";
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data3);
}else{
$this->db->insert('monthly_results',$data3);
}
}
}
## Division calculation here
//echo "Division calculation here";
## Finding best seven subejcts which are included in div cal
$subjects = 7;
if($category =='A'){
$subjects = 3;
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$point = 42; $gpa=8;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
$gpa = round($point/7,4);
if($category =='A'){
$gpa = round($point/3,4);
}
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
//print_r($data);
//echo "
";
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$academic_year);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('candidate',$candidate);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
}
}
## End monthly results
redirect($_SERVER['HTTP_REFERER']);
}
*/
public function calculate_sort_students_subjects(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$limit = $_REQUEST['limit'];
$order = $_REQUEST['order'];
$start = $_REQUEST['start'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$class=$rows->class_level;
$academic_year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$category = $rows->category;
}
## Monthly results for each school
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('id','asc');
$this->db->limit($limit,$start);
$g = $this->db->get('ca');
foreach($g->result() as $schools){
$school = $schools->school_id;
## Getting district id for REO
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
//....................Upadting subjects positions in ca table----------------------------------------->
$pos = $s = $new = $position=1;
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0;
$pos = $s = $new = $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_sort_students(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$limit = $_REQUEST['limit'];
$order = $_REQUEST['order'];
$start = $_REQUEST['start'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$class=$rows->class_level;
$academic_year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$category = $rows->category;
}
## Monthly results for each school
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('id','asc');
$this->db->limit($limit,$start);
$g = $this->db->get('monthly_results');
foreach($g->result() as $schools){
$school = $schools->school_id;
## Students sorting in class
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete_sort',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete_sort',"DESC");
$this->db->order_by('average',"DESC");
//$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_gpa(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$limit = $_REQUEST['limit'];
$start = $_REQUEST['start'];
$order = $_REQUEST['order'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$category=$rows->category;
$year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$group_id = $rows->group_id;
}
$this->db->distinct();
$this->db->select('school_id');
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->order_by('id',"asc");
$this->db->limit($limit,$start);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
## Finding the distrit Id
foreach($this->db->where('school_id',$school)->get('schools')->result() as $row_s){
$district = $row_s->district;
}
$average_gpa=8;
$avg=0;
$this->db->select('AVG(gpa) as gpa, AVG(average) as avg');
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
if($category == 'A'){
$this->db->where('gpa <', '8');
}else{
$this->db->where('gpa <', '6');
}
$sum_gpa=$this->db->get('monthly_results');
foreach($sum_gpa->result() as $row_sum_gpa){
$average_gpa= $row_sum_gpa->gpa;
$avg= $row_sum_gpa->avg;
}
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$students = $this->db->count_all_results('ca');
///inserting school average in database
$data_gpa=array(
'school_id'=>$school,
'class_level'=>$class,
'academic_year'=>$year,
'month'=>$month,
'category'=>$category,
'gpa'=>$average_gpa,
'average'=>$avg,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'district_id'=>$district,
'region_id'=>$region,
'students'=>$students,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$count_entered_gpa= $this->db->count_all_results('schools_position');
if($average_gpa > 0){
if($count_entered_gpa>0){
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('schools_position',$data_gpa);
}else{
$this->db->insert('schools_position',$data_gpa);
}
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_sort_schools(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$group_id = $rows->group_id;
}
//arranging school positions for region
$sub_position=0;
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'position'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('schools_position',$datad);
}
//arranging school positions fore region group wise > 40
$sub_position=0;
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('students >=',40);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'rp_by_category'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('schools_position',$datad);
}
//arranging school positions fore region group wise < 40
$sub_position=0;
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('students <',40);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'rp_by_category'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('schools_position',$datad);
}
//arranging school positions for district
$this->db->distinct();
$this->db->select('district_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_d=$this->db->get('schools_position');
foreach($get_d->result() as $dist){
$sub_position=0;
$this->db->where('district_id',$dist->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'district_position'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->update('schools_position',$datad);
}
}
//arranging school positions for district group wise
$this->db->distinct();
$this->db->select('district_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_d=$this->db->get('schools_position');
foreach($get_d->result() as $dist){
$sub_position=0;
$this->db->where('district_id',$dist->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('students >= ',40);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'dp_by_category'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->update('schools_position',$datad);
}
$sub_position=0;
$this->db->where('district_id',$dist->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('students < ',40);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'dp_by_category'=>$sub_position
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->update('schools_position',$datad);
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_sort_all_subjects(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$class = $rows->class_level;
$category = $rows->category;
$group_id=$rows->group_id;
}
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
## Finding the distrit Id
foreach($this->db->where('school_id',$school)->get('schools')->result() as $row_s){
$district = $row_s->district;
}
//finding subjects gpa for each school and sort and insert into the database-------------------------------
$this->db->select('AVG(gpa) as gpa, AVG(mark) as avg, subject_id');
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('candidate',$candidate);
$this->db->group_by('subject_id');
$this->db->order_by('gpa','asc');
$gg = $this->db->get('ca');
foreach($gg->result() as $ress){
$data_subject_gpa=array(
'school_id'=>$school,
'subject_id'=>$ress->subject_id,
'class_level'=>$class,
'academic_year'=>$year,
'month'=>$month,
'category'=>$category,
'average'=>$ress->avg,
'gpa'=>$ress->gpa,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'district_id'=>$district,
'region_id'=>$region
);
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$ress->subject_id);
$count_entered_gpa= $this->db->count_all_results('subjects_school_gpa');
if($count_entered_gpa>0){
$this->db->where('school_id',$school);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$ress->subject_id);
$this->db->update('subjects_school_gpa',$data_subject_gpa);
}else{
$this->db->insert('subjects_school_gpa',$data_subject_gpa);
}
}
}
## Sorting subjects by district
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
foreach($this->db->get('subjects_school_gpa')->result() as $subject){
$sub_position=0;
$this->db->distinct();
$this->db->select('district_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$subject->subject_id);
$this->db->where('candidate',$candidate);
foreach($this->db->get('subjects_school_gpa')->result() as $row_school){
$pos=0;
$this->db->where('subject_id',$subject->subject_id);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('district_id',$row_school->district_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
//$this->db->order_by('average','desc');
$this->db->order_by('gpa','asc');
$get_school=$this->db->get('subjects_school_gpa');
foreach($get_school->result() as $gg){
$pos++;
$this->db->where('id',$gg->id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('subject_id',$subject->subject_id);
$this->db->where('district_id',$row_school->district_id);
$this->db->update('subjects_school_gpa',array('district_position'=>$pos));
}
}
$pos=0;
$this->db->where('subject_id',$subject->subject_id);
$this->db->where('region_id',$region);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
//$this->db->order_by('average','desc');
$this->db->order_by('gpa','asc');
$get_school=$this->db->get('subjects_school_gpa');
foreach($get_school->result() as $gg){
$pos++;
$this->db->where('id',$gg->id);
if($group_id==0){
$this->db->where('region_id',$region);
}else{
//this fro group id
}
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subject->subject_id);
$this->db->update('subjects_school_gpa',array('position'=>$pos));
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function update_gender(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','');
foreach($this->db->get('monthly_results')->result() as $ss){
$this->db->select('gender,reg_number');
$this->db->where('reg_number',$ss->reg_number);
foreach($this->db->get('students')->result() as $students){
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$students->reg_number);
$this->db->update('ca',array('gender'=>$students->gender));
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$students->reg_number);
$this->db->update('monthly_results',array('gender'=>$students->gender));
}
}
## End gender
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_full_sheet(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$order = $_REQUEST['order'];
$limit = $_REQUEST['limit'];
foreach($this->db->where('examination_id',$exam_id)->get('examination')->result() as $ex){
$category = $ex->category;
$class_admitted = $ex->class_level;
if($category=='A'){
// $admission_year = substr($ex->academic_year,-4);
//echo $admission_year;exit;
$admission_year=$year = date('Y');;
}else{
$admission_year = $ex->academic_year;
}
}
//echo $admission_year;exit;
//$admission_year=2024;
$f_boys = $f_girls = $f_total = $s_boys = $s_girls = $s_total = 0;
$school_id = '';$o_iv_total = ''; $reg_boys = '';$reg_girls = '';$reg_total = '';$do_boys = '';$do_girls = '';$do_total = '';$a_boys = '';$a_girls = '';$a_total = '';$b_boys = '';$b_girls = '';$b_total = '';$c_boys = '';$c_girls = '';$c_total = '';$ac_boys = '';$ac_girls = '';$ac_total = '';$ac_percent = '';$d_boys = '';$d_girls = '';$d_total = '';$e_boys = '';$e_girls = '';$e_total = '';$de_percent = '';$fail_percent = '';$absent = '';$incomplete = '';$gpa = '';$dp = '';$rp = '';$dp_by_category = '';$rp_by_category = '';$district_id = '';$region_id = '';$i_boys = '';$i_girls = '';$i_total = '';$ii_boys = '';$ii_girls = '';$ii_total = '';$iii_boys = '';$iii_girls = '';$iii_total = '';$iv_boys = '';$iv_girls = '';$iv_total = '';$o_boys = '';$o_girls = '';$o_total = '';$i_iii_boys = '';$i_iii_girls = '';$i_iii_total = '';$o_iv_boys = '';$o_iv_girls = '';$o_iv_total;
#reg boys and girls
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('school_id',$order);
// $this->db->not_like('school_id',"SS5badbac5cda81");
$this->db->limit($limit);
$g = $this->db->get('schools_position');
foreach($g->result() as $schools){
$school_id = $schools->school_id;
#reg boys
$this->db->where('school_id',$school_id);
$this->db->where('gender','M');
$this->db->where('category',$category);
$this->db->where('admission_year',$admission_year);
$this->db->where('class_admitted',$class_admitted);
$this->db->where('candidate',$candidate);
$reg_boys = $this->db->count_all_results('students');
#reg girls
$this->db->where('school_id',$school_id);
$this->db->where('gender','F');
$this->db->where('category',$category);
$this->db->where('admission_year',$admission_year);
$this->db->where('class_admitted',$class_admitted);
$this->db->where('candidate',$candidate);
$reg_girls = $this->db->count_all_results('students');
$reg_total = $reg_boys+$reg_girls;
# do boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('candidate',$candidate);
$do_boys = $this->db->count_all_results('monthly_results');
# do girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('candidate',$candidate);
$do_girls = $this->db->count_all_results('monthly_results');
$do_total = $do_boys+$do_girls;
if($do_total <1){
$do_total = 1;
}
# a boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','A');
$this->db->where('candidate',$candidate);
$a_boys = $this->db->count_all_results('monthly_results');
# a girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','A');
$this->db->where('candidate',$candidate);
$a_girls = $this->db->count_all_results('monthly_results');
$a_total = $a_boys + $a_girls;
# b boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','B');
$this->db->where('candidate',$candidate);
$b_boys = $this->db->count_all_results('monthly_results');
# b girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','B');
$this->db->where('candidate',$candidate);
$b_girls = $this->db->count_all_results('monthly_results');
$b_total = $b_boys + $b_girls;
# c boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','C');
$this->db->where('candidate',$candidate);
$c_boys = $this->db->count_all_results('monthly_results');
# c girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','C');
$this->db->where('candidate',$candidate);
$c_girls = $this->db->count_all_results('monthly_results');
$c_total = $c_boys + $c_girls;
# d boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','D');
$this->db->where('candidate',$candidate);
$d_boys = $this->db->count_all_results('monthly_results');
# d girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','D');
$this->db->where('candidate',$candidate);
$d_girls = $this->db->count_all_results('monthly_results');
$d_total = $d_boys + $d_girls;
# e boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','E');
$this->db->where('candidate',$candidate);
$e_boys = $this->db->count_all_results('monthly_results');
# e girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','E');
$this->db->where('candidate',$candidate);
$e_girls = $this->db->count_all_results('monthly_results');
$e_total = $e_boys + $e_girls;
# f boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','F');
$this->db->where('candidate',$candidate);
$f_boys = $this->db->count_all_results('monthly_results');
# f girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','F');
$this->db->where('candidate',$candidate);
$f_girls = $this->db->count_all_results('monthly_results');
$f_total = $f_boys + $f_girls;
# S boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('grade','S');
$this->db->where('candidate',$candidate);
$s_boys = $this->db->count_all_results('monthly_results');
# S girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('grade','S');
$this->db->where('candidate',$candidate);
$s_girls = $this->db->count_all_results('monthly_results');
$s_total = $s_boys + $s_girls;
# i boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('division','I');
$this->db->where('candidate',$candidate);
$i_boys = $this->db->count_all_results('monthly_results');
# i girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('division','I');
$this->db->where('candidate',$candidate);
$i_girls = $this->db->count_all_results('monthly_results');
$i_total = $i_boys + $i_girls;
# ii boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('division','II');
$this->db->where('candidate',$candidate);
$ii_boys = $this->db->count_all_results('monthly_results');
# ii girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('division','II');
$this->db->where('candidate',$candidate);
$ii_girls = $this->db->count_all_results('monthly_results');
$ii_total = $ii_boys + $ii_girls;
# iii boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('division','III');
$this->db->where('candidate',$candidate);
$iii_boys = $this->db->count_all_results('monthly_results');
# iii girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('division','III');
$this->db->where('candidate',$candidate);
$iii_girls = $this->db->count_all_results('monthly_results');
$iii_total = $iii_boys + $iii_girls;
# iv boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('division','IV');
$this->db->where('candidate',$candidate);
$iv_boys = $this->db->count_all_results('monthly_results');
# iv girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('division','IV');
$this->db->where('candidate',$candidate);
$iv_girls = $this->db->count_all_results('monthly_results');
$iv_total = $iv_boys + $iv_girls;
# o boys
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','M');
$this->db->where('division','0');
$this->db->where('candidate',$candidate);
$o_boys = $this->db->count_all_results('monthly_results');
# o girls
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('gender','F');
$this->db->where('division','0');
$this->db->where('candidate',$candidate);
$o_girls = $this->db->count_all_results('monthly_results');
$o_total = $o_boys + $o_girls;
$ac_girls = $a_girls +$b_girls + $c_girls;
$ac_boys = $a_boys +$b_boys + $c_boys;
$ac_total = $ac_boys + $ac_girls;
$de_girls = $d_girls +$e_girls;
$de_boys = $d_boys +$e_boys;
$de_total = $de_boys + $de_girls;
$de_total = $de_boys + $de_girls;
$i_iii_girls = $i_girls +$ii_girls + $iii_girls;
$i_iii_boys = $i_boys +$ii_boys + $iii_boys;
$i_iii_total = $i_iii_boys + $i_iii_girls;
$o_iv_girls = $o_girls + $iv_girls;
$o_iv_boys = $o_boys + $iv_boys;
$o_iv_total = $o_total + $iv_total;
$ac_percent = round(($ac_total/$do_total),2)*100;
$de_percent = round(($de_total/$do_total),2)*100;
$fail_percent = round(($o_total/$do_total),2)*100;
$absent = $reg_total - $do_total;
// echo 'Total '.$reg_total.' Do '.$do_total.' = '.$absent;exit;
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('complete',0);
$inc = $this->db->count_all_results('monthly_results');
$incomplete = $inc;
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
foreach($this->db->get('schools_position')->result() as $sc){
$gpa = $sc->gpa;
$rp = $sc->position;
$dp= $sc->district_position;
$dp_by_category=$sc->dp_by_category;
$rp_by_category=$sc->rp_by_category;
$district_id=$sc->district_id;
$region_id=$sc->region_id;
$dp_by_ownership = $sc->dp_by_owner;
$rp_by_ownership = $sc->rp_by_owner;
$ownership = $sc->ownership;
}
$full_sheet_data = array(
'school_id'=>$school_id,
'reg_boys'=>$reg_boys,
'reg_girls'=>$reg_girls,
'reg_total'=>$reg_total,
'do_boys'=>$do_boys,
'do_girls'=>$do_girls,
'do_total'=>$do_total,
'a_boys'=>$a_boys,
'a_girls'=>$a_girls,
'a_total'=>$a_total,
'b_boys'=>$b_boys,
'b_girls'=>$b_girls,
'b_total'=>$b_total,
'c_boys'=>$c_boys,
'c_girls'=>$c_girls,
'c_total'=>$c_total,
'ac_boys'=>$ac_boys,
'ac_girls'=>$ac_girls,
'ac_total'=>$ac_total,
'ac_percent'=>$ac_percent,
'd_boys'=>$d_boys,
'd_girls'=>$d_girls,
'd_total'=>$d_total,
'e_boys'=>$e_boys,
'e_girls'=>$e_girls,
'e_total'=>$e_total,
'f_boys'=>$f_boys,
'f_girls'=>$f_girls,
'f_total'=>$f_total,
's_boys'=>$s_boys,
's_girls'=>$s_girls,
's_total'=>$s_total,
'de_percent'=>$de_percent,
'fail_percent'=>$fail_percent,
'absent'=>$absent,
'incomplete'=>$incomplete,
'gpa'=>$gpa,
'dp'=>$dp,
'rp'=>$rp,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'dp_by_category'=>$dp_by_category,
'rp_by_category'=>$rp_by_category,
'district_id'=>$district_id,
'region_id'=>$region_id,
'i_boys'=>$i_boys,
'i_girls'=>$i_girls,
'i_total'=>$i_total,
'ii_boys'=>$ii_boys,
'ii_girls'=>$ii_girls,
'ii_total'=>$ii_total,
'iii_boys'=>$iii_boys,
'iii_girls'=>$iii_girls,
'iii_total'=>$iii_total,
'iv_boys'=>$iv_boys,
'iv_girls'=>$iv_girls,
'iv_total'=>$iv_total,
'o_boys'=>$o_boys,
'o_girls'=>$o_girls,
'o_total'=>$o_total,
'i_iii_boys'=>$i_iii_boys,
'i_iii_girls'=>$i_iii_girls,
'i_iii_total'=>$i_iii_total,
'i_iv_total'=>($i_iii_total+$iv_total),
'i_iv_percent'=>(($i_iii_total+$iv_total)/$do_total)*100,
'o_iv_boys'=>$o_iv_boys,
'o_iv_girls '=>$o_iv_girls,
'o_iv_total'=>$o_iv_total,
'ownership'=>$ownership,
'dp_by_ownership'=>$dp_by_ownership,
'rp_by_ownership'=>$rp_by_ownership,
);
$this->db->where('exam_id',$exam_id);
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$exam = $this->db->count_all_results('result_full_sheet');
if($exam > 0){
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->update('result_full_sheet',$full_sheet_data);
}else{
$this->db->insert('result_full_sheet',$full_sheet_data);
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function set_sorting(){
$exam_id = $_REQUEST['exam_id'];
$sort = $_REQUEST['sort'];
if($sort == 'normal'){
$sort = "percent";
}else{
$sort = "normal";
}
$this->db->where('examination_id',$exam_id)->update('examination',array('sorting'=>$sort));
redirect($_SERVER['HTTP_REFERER']);
}
public function mkeka_clear(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->delete('mkeka');
redirect($_SERVER['HTTP_REFERER']);
}
public function sort_by_percent(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$i=0;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('i_iv_percent','desc')->order_by('gpa','asc');
foreach($this->db->get('result_full_sheet')->result() as $data){
$i++;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$data->school_id);
$this->db->update('schools_position',array('position_bypercent'=>$i));
echo "I-IV: ".$data->i_iv_percent." GPA: ".$data->gpa."
";
}
}
public function mkeka(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$order = $_REQUEST['order'];
$limit = $_REQUEST['limit'];
$start = $_REQUEST['start'];
$this->db->where('examination_id',$exam_id);
foreach($this->db->get('examination')->result() as $ex){
$class = $ex->class_level;
$category = $ex->category;
$month = $ex->month;
$year = $ex->academic_year;
}
$this->db->distinct();
$this->db->select('school_id');
// $this->db->where('school_id','SS5c3c6c316de83');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('id','asc');
$this->db->limit($limit,$start);
foreach($this->db->get('monthly_results')->result() as $sch){
$school = $sch->school_id;
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
if($category=='P'){
$data = file_get_contents(base_url('Calculate_results_primary_officers/print_full_sheet_officers_number?class=').base64_encode($class).'&candidate='.base64_encode($candidate).'&&exam_id='.base64_encode($exam_id).'&&school_id='.base64_encode($school).'&&stream='.base64_encode($category).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&category='.base64_encode($category).'&&language='.base64_encode('english'), false, stream_context_create($arrContextOptions));
}else{
$data = file_get_contents(base_url('Calculate_results_secondary_officers/print_full_sheet_officers_number?class=').base64_encode($class).'&candidate='.base64_encode($candidate).'&&exam_id='.base64_encode($exam_id).'&&school_id='.base64_encode($school).'&&stream='.base64_encode($category).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&category='.base64_encode($category).'&&language='.base64_encode('english'), false, stream_context_create($arrContextOptions));
}
$array = array(
'school_id'=>$school,
'mkeka'=>$data,
'candidate'=>$candidate,
'exam_id'=>$exam_id,
);
$this->db->where('exam_id',$exam_id);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$count = $this->db->count_all_results('mkeka');
if($count == 0){
$this->db->insert('mkeka',$array);
}else{
$this->db->where('exam_id',$exam_id);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->update('mkeka',$array);
}
}
## End
redirect($_SERVER['HTTP_REFERER']);
}
public function mkeka_verifiy(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$order = $_REQUEST['order'];
$limit = $_REQUEST['limit'];
$start = $_REQUEST['start'];
$this->db->where('examination_id',$exam_id);
foreach($this->db->get('examination')->result() as $ex){
$class = $ex->class_level;
$category = $ex->category;
$month = $ex->month;
$year = $ex->academic_year;
}
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
foreach($this->db->get('monthly_results')->result() as $sch){
$school = $sch->school_id;
$this->db->where('exam_id',$exam_id);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$count = $this->db->count_all_results('mkeka');
if($count == 0){
if($category=='P'){
$data = file_get_contents(base_url('Calculate_results_primary_officers/print_full_sheet_officers_number?class=').base64_encode($class).'&candidate='.base64_encode($candidate).'&&exam_id='.base64_encode($exam_id).'&&school_id='.base64_encode($school).'&&stream='.base64_encode($category).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&category='.base64_encode($category).'&&language='.base64_encode('english'));
}else{
$data = file_get_contents(base_url('Calculate_results_secondary_officers/print_full_sheet_officers_number?class=').base64_encode($class).'&candidate='.base64_encode($candidate).'&&exam_id='.base64_encode($exam_id).'&&school_id='.base64_encode($school).'&&stream='.base64_encode($category).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&category='.base64_encode($category).'&&language='.base64_encode('english'));
}
$array = array(
'school_id'=>$school,
'mkeka'=>$data,
'candidate'=>$candidate,
'exam_id'=>$exam_id,
);
$this->db->insert('mkeka',$array);
}
}
## End
redirect($_SERVER['HTTP_REFERER']);
}
public function calculate_insert_sort_district_positions(){
$exam_id = $_REQUEST['id'];
$candidate = $_REQUEST['cand'];
$position=0;
$region=0;
$district = $district_id = 0;
$this->db->select("region_id, district_id, SUM(do_total) as do_exam, SUM(a_total) as a, SUM(b_total) as b, SUM(c_total) as c, SUM(d_total) as d, SUM(e_total) as e, SUM(ac_total) as ac_total, AVG(ac_percent) as ac_percent, SUM(i_total) as i, SUM(ii_total) as ii, SUM(iii_total) as iii, SUM(iv_total) as iv, SUM(o_total) as o, SUM(i_iii_total) as i_iii_total, AVG(gpa) as gpa");
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->group_by('district_id');
foreach($this->db->get('result_full_sheet')->result() as $data){
$region=$data->region_id;
$district=$data->district_id;
$save_data = array(
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'district'=>$data->district_id,
'region'=>$data->region_id,
'a'=>$data->a,
'b'=>$data->b,
'c'=>$data->c,
'd'=>$data->d,
'e'=>$data->e,
'ac_total'=>$data->ac_total,
'ac_percent'=>$data->ac_percent,
'i'=>$data->i,
'ii'=>$data->ii,
'iii'=>$data->iii,
'iv'=>$data->iv,
'o'=>$data->o,
'i_iii'=>$data->i+$data->ii+$data->iii+$data->iv,
'i_iii_total'=>$data->i+$data->ii+$data->iii+$data->iv,
'i_iii_percent'=>round((($data->i+$data->ii+$data->iii+$data->iv)/$data->do_exam)*100),
'gpa'=>$data->gpa,
);
$this->db->where('region',$data->region_id);
$this->db->where('district',$data->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$exist = $this->db->count_all_results('district_position');
if($exist == 0){
$this->db->insert('district_position',$save_data);
}else{
$this->db->where('region',$data->region_id);
$this->db->where('district',$data->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('district_position',$save_data);
}
}
$position=0;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
//$this->db->order_by('i_iii_percent','desc');
$this->db->order_by('gpa','asc');
foreach($this->db->get('district_position')->result() as $dd){
$position++;
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('id',$dd->id);
$this->db->update('district_position',array('position'=>$position));
}
## Update ownership
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get = $this->db->get('schools_position');
foreach($get->result() as $results){
foreach($this->db->where('school_id',$results->school_id)->get('schools')->result() as $sch){
$own = strtoupper(substr(str_replace(' ','',$sch->school_ownership),0,1));
$data = array('ownership'=>$own);
$this->db->where('exam_id',$exam_id);
$this->db->where('school_id',$results->school_id);
$this->db->update('schools_position',$data);
}
}
## Sort ownership by region
$this->db->distinct();
$this->db->select('ownership');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get2 = $this->db->get('schools_position');
foreach($get2->result() as $res){
$position=0;
$this->db->where('ownership',$res->ownership);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('gpa','asc');
foreach($this->db->get('schools_position')->result() as $dpos){
$position++;
$this->db->where('ownership',$res->ownership);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$dpos->school_id);
$this->db->update('schools_position',array('rp_by_owner'=>$position));
}
}
## Sort ownership positions by district
$this->db->distinct();
$this->db->select('district_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get = $this->db->get('monthly_results');
foreach($get->result() as $results){
$this->db->distinct();
$this->db->select('ownership');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get2 = $this->db->get('schools_position');
foreach($get2->result() as $res){
$position=0;
$this->db->where('ownership',$res->ownership);
$this->db->where('district_id',$results->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->order_by('gpa','asc');
foreach($this->db->get('schools_position')->result() as $dpos){
$position++;
$this->db->where('ownership',$res->ownership);
$this->db->where('district_id',$results->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('school_id',$dpos->school_id);
$this->db->update('schools_position',array('dp_by_owner'=>$position));
}
}
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('district_id',$results->district_id);
$get=$this->db->get('ca');
foreach($get->result() as $subjects){
$this->db->select('AVG(mark) as mark, AVG(gpa) as gpa');
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subjects->subject_id);
$this->db->where('district_id',$results->district_id);
$get2=$this->db->get('ca');
foreach($get2->result() as $avg){
$this->db->where('district_id',$results->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subjects->subject_id);
$this->db->where('grade !=','F');
$pass = $this->db->count_all_results('ca');
$this->db->where('district_id',$results->district_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subjects->subject_id);
$total = $this->db->count_all_results('ca');
$percent = round(($pass/$total)*100,2);
$data = array(
'average'=>$avg->mark,
'gpa'=>$avg->gpa,
'district_id'=>$results->district_id,
'subject_id'=>$subjects->subject_id,
'candidate'=>$candidate,
'region_id'=>$region,
'exam_id'=>$exam_id,
'pass_a_d'=>$percent
);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subjects->subject_id);
$this->db->where('district_id',$results->district_id);
$c = $this->db->count_all_results('subject_average_mark_districts');
if($c == 0){
$this->db->insert('subject_average_mark_districts',$data);
}else{
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subjects->subject_id);
$this->db->where('district_id',$results->district_id);
$this->db->update('subject_average_mark_districts',$data);
}
}
}
}
## End sorting
redirect($_SERVER['HTTP_REFERER']);
}
public function check_ca(){
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',36);
$this->db->order_by('school_id','desc');
$this->db->limit(150);
$tt = $this->db->get('ca');
foreach($tt->result() as $school){
$this->db->where('school_id',$school->school_id);
$this->db->where('exam_id',36);
foreach($this->db->get('ca')->result() as $ca){
$mark_grade="";
$this->db->where('students_type','O');
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($ca->mark) && round($ca->mark)<=$row_grade->end_mark){
$mark_grade = $row_grade->grade;
}
}
$this->db->where('id',$ca->id);
$this->db->where('school_id',$school->school_id);
$this->db->update('ca',array('mark'=>round($ca->mark),'grade'=>$mark_grade));
}
}
}
public function insert_schools(){
$inputFileName = $_FILES["file"]["tmp_name"];
try {
/// it will be your file name that you are posting with a form or can pass static name $_FILES["file"]["name"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
}
catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$data = array();
$data2 = array();
$valid_student = 0;
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$i = 0;$title="";
$title = $allDataInSheet[1]['A'].$allDataInSheet[1]['B'].$allDataInSheet[1]['C'].$allDataInSheet[1]['D'].$allDataInSheet[1]['E'].$allDataInSheet[1]['F'].$allDataInSheet[1]['G'];
$title = str_replace(' ','',$title);
if($title == 'SCHOOLNAMESCHOOLTYPEOWNERSHIPSCHOOLREGNUMBEREMAILMOBILEADDRESS(BOX)'){
$i=0;
$region_name = "";
$rejected=0;
$registered=0;
$name_rejected="";
foreach($allDataInSheet as $schools){
if($i < 1){
$i++;
}else{
if(strlen(str_replace(' ','', $schools['A']))>1){
## Processing REGISTERING SCHOOLS
$r = explode('/',$this->input->post('region'));
$district = $r[0];
$region = $r[1];
foreach($this->db->where('id',$region)->get('regions')->result() as $re){
$region_name = $re->name;
}
$chool_type = $schools['B'];
$istrue = true;
while($istrue){
$school_id= $chool_type.uniqid();
$this->db->where('school_id',$school_id);
$count= $this->db->count_all_results('schools');
if($count == 0){
$istrue = false;
}
}
$this->db->where('school_reg_number',$schools['D']);
$countt = $this->db->count_all_results('schools');
if($countt>0){
$rejected++;
$name_rejected.=$rejected." ".$schools['A'].',
';
}else{
$data = array(
'school_id' => $school_id,
'school_name' =>$schools['A'],
'school_type' =>$schools['B'],
'school_email' => $schools['E'],
'school_mobile' => $schools['F'],
'school_address' => $schools['G'],
'school_location' => $region_name,
'country' => 'Tanzania',
'school_reg_number'=>$schools['D'],
'full_name'=>$schools['A'],
'school_ownership'=>$schools['C'],
'login_header'=>'JOINT EXAMINATION RESULTS '.$schools['A'],
'region'=>$region,
'district'=>$district,
'school_logo'=>'Not set',
'school_moto'=>'Not set',
'school_header'=>'Not set',
'password'=>MD5('default'),
'password_recover'=>'default',
'type'=>'Admin',
'year_registered'=>date('Y')
);
/// echo $this->security->xss_clean($this->input->post('group_id'));exit;
$ff = $this->db->insert('schools', $data);
//inserting schools to group if is set
if($this->security->xss_clean($this->input->post('group_id'))>0){
$data3 = array(
'group_id'=>$this->security->xss_clean($this->input->post('group_id')),
'school_id'=>$school_id,
'date_registered'=>date('M d Y'),
);
$this->db->insert('group_schools',$data3);
}
if($ff){
$registered++;
}
}
#######################################
}
}
}
redirect('Super_user/register_schools?registered='.$registered.'&rejected='.$rejected.'&name='.urlencode($name_rejected));
}else{
redirect('Super_user/register_schools?error_format');
}
}
public function remove_subject(){
$district_id = $this->uri->segment(3);
$subject_id = $this->uri->segment(4);
$group_id = $this->uri->segment(5);
if($group_id == 'G'){
$this->db->where('group_id',$district_id);
}else{
$this->db->where('district_id',$district_id);
}
$this->db->where('subject_id',$subject_id);
$delete = $this->db->delete('all_subjects_region');
redirect($_SERVER['HTTP_REFERER']);
}
public function register_region(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_region');
$this->load->view('includes/super_footer');
}
public function set_questions(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/set_questions');
$this->load->view('includes/super_footer');
}
public function set_questions_post(){
$ids = explode('.',$this->input->post('params'));
$exam_id = $this->input->post('exam_id');
$subject_id = $ids[1];
$type = $ids[2];
$qns = $this->input->post('qns');
$data = array(
'exam_id'=>$exam_id,
'subject_id'=>$subject_id,
'questions'=>$qns,
'type'=>$type,
);
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$subject_id);
$this->db->where('type',$type);
$count = $this->db->count_all_results('examination_questions');
if($count > 0) {
## Do update
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$subject_id);
$this->db->where('type',$type);
$this->db->update('examination_questions',$data);
}else{
$this->db->insert('examination_questions',$data);
}
}
public function register_schools(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_schools');
$this->load->view('includes/super_footer');
}
public function subject_subjects(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/subject_subjects');
$this->load->view('includes/super_footer');
}
public function register_sub_region(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_sub_region');
$this->load->view('includes/super_footer');
}
public function viewed_results_login(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/viewed_results_login');
$this->load->view('includes/super_footer');
}
public function viewed_results_public(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/viewed_results_public');
$this->load->view('includes/super_footer');
}
public function insert_regions(){
$data = array(
'name'=>$this->input->post('region'),
// 'heading' =>$this->input->post('heading')
);
$data= $this->security->xss_clean($data);
$this->db->insert('regions',$data);
redirect('Super_user/register_region');
}
public function insert_sub_regions(){
$data = array(
'regions_id'=>$this->input->post('region'),
'district_name' =>$this->input->post('sub_region'),
'heading' =>$this->input->post('heading')
);
$data= $this->security->xss_clean($data);
$this->db->insert('regions_distrincts',$data);
redirect('Super_user/register_sub_region');
}
public function insert_subjects(){
$data = array(
'name'=>$this->input->post('name'),
'short_name'=>$this->input->post('short_name'),
'is_sub'=>$this->input->post('type')
);
$this->db->like('name',$this->input->post('name'),'BOTH');
$count = $this->db->count_all_results('all_subjects');
if($count == 0){
$this->db->insert('all_subjects',$data);
}
redirect('Super_user/register_subjects?suc');
}
public function assign_subjects_olevel(){
$i=0;
if($_POST){
$sub = $this->input->post('subjects');
$r = explode(',',$this->input->post('region'));
$region = $r[0];
$district = $r[1];
//echo $region.' = '.$district;exit;
//kill district abd region but group id becomes region
if($district=='G'){
foreach($sub as $subject){
$this->db->where('region_id',0);
$this->db->where('district_id',0);
$this->db->where('subject_id',$subject);
$this->db->where('group_id',$region);
$this->db->where('category','O');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>0,
'group_id'=> $region,
'district_id'=>0,
'category'=>'O'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}else{
$this->db->where('regions_id',$region);
$get = $this->db->get('regions_distrincts');
foreach($get->result() as $opt){
foreach($sub as $subject){
$this->db->where('region_id',$region);
$this->db->where('district_id',$opt->id);
$this->db->where('subject_id',$subject);
$this->db->where('category','O');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>$region,
'district_id'=>$opt->id,
'category'=>'O'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}
}
}
redirect('Super_user/assign_subjects_o/'.$i);
}
public function assign_subjects_plevel(){
$i=0;
if($_POST){
$sub = $this->input->post('subjects');
$r = explode(',',$this->input->post('region'));
$region = $r[0];
$district = $r[1];
//echo $region.' = '.$district;exit;
//kill district abd region but group id becomes region
if($district=='G'){
foreach($sub as $subject){
$this->db->where('region_id',0);
$this->db->where('district_id',0);
$this->db->where('subject_id',$subject);
$this->db->where('group_id',$region);
$this->db->where('category','P');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>0,
'group_id'=> $region,
'district_id'=>0,
'category'=>'P'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}else{
$this->db->where('regions_id',$region);
$get = $this->db->get('regions_distrincts');
foreach($get->result() as $opt){
foreach($sub as $subject){
$this->db->where('region_id',$region);
$this->db->where('district_id',$opt->id);
$this->db->where('subject_id',$subject);
$this->db->where('category','P');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>$region,
'district_id'=>$opt->id,
'category'=>'P'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}
}
}
redirect('Super_user/assign_subjects_p/'.$i);
}
public function view_subjects(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_subjects');
$this->load->view('includes/super_footer');
}
public function assign_subjects_alevel(){
$i=0;
if($_POST){
$sub = $this->input->post('subjects');
$r = explode(',',$this->input->post('region'));
$region = $r[0];
$district = $r[1];
//echo $region.' = '.$district;exit;
//kill district abd region but group id becomes region
if($district=='G'){
foreach($sub as $subject){
$this->db->where('region_id',0);
$this->db->where('district_id',0);
$this->db->where('subject_id',$subject);
$this->db->where('group_id',$region);
$this->db->where('category','A');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>0,
'group_id'=> $region,
'district_id'=>0,
'category'=>'A'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}else{
$this->db->where('regions_id',$region);
$get = $this->db->get('regions_distrincts');
foreach($get->result() as $opt){
foreach($sub as $subject){
$this->db->where('region_id',$region);
$this->db->where('district_id',$opt->id);
$this->db->where('subject_id',$subject);
$this->db->where('category','A');
$count = $this->db->count_all_results('all_subjects_region');
if($count == 0){
$data = array(
'subject_id'=>$subject,
'region_id'=>$region,
'district_id'=>$opt->id,
'category'=>'A'
);
$this->db->insert('all_subjects_region',$data);
$i++;
}
}
}
}
}
redirect('Super_user/assign_subjects_a/'.$i);
}
public function load_subjects(){
$category = $this->input->post('category');
$sub = $this->input->post('subject_id');
$name = $this->input->post('name');
$contibution = $this->input->post('costibution');
$data = explode('/',$this->input->post('class_level'));
$exam_id = $data[0];
$class = $data[1];
$region = $data[2];
$district = $data[3];
$this->db->where('is_sub',1);
$gett=$this->db->get('all_subjects');
?>
Main subject:
input->post('category');
$contr = $this->input->post('contribution');
$sub = $this->input->post('sub');
$main = $this->input->post('main');
$data = explode('/',$this->input->post('data'));
$exam_id = $data[0];
$class = $data[1];
$region = $data[2];
$district = $data[3];
$percent_sum=0;
$count = 0;
if($contr == 'Custom'){
foreach($sub as $subject){
$count++;
$percent_sum = $percent_sum + $subject['percent'];
}
}else{
$percent_sum = 100;
$count = count($sub);
}
if($count < 2){
?>
Sub-subjects count must be greater than one!
Sum of Contribution percent must be exaclty 100%!
0){
$data = array(
'examination_id'=>$exam_id,
'main_subject_id'=>$main,
'sub_subject_id'=>$subject_id,
'max_mark'=>$max,
'contribution'=>$contribution,
'percent'=>$percent,
'class_level'=>$class,
'region_id'=>$region,
'district_id'=>$district,
'category'=>$category,
);
## validating duplications.
$this->db->where('main_subject_id',$main);
$this->db->where('sub_subject_id',$subject_id);
$this->db->where('category',$category);
$this->db->where('examination_id',$exam_id);
$count_sub = $this->db->count_all_results('sub_subjects');
if($count_sub == 0){
$insert = $this->db->insert('sub_subjects',$data);
}else{
$this->db->where('main_subject_id',$main);
$this->db->where('sub_subject_id',$subject_id);
$this->db->where('category',$category);
$this->db->where('examination_id',$exam_id);
$this->db->update('sub_subjects',$data);
}
}
}
?>
Data saved successfully!
load->view('includes/super_header');
$this->load->view('users/superuser/assign_subjects_o');
$this->load->view('includes/super_footer');
}
public function assign_subjects_p(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/assign_subjects_p');
$this->load->view('includes/super_footer');
}
public function assign_subjects_a(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/assign_subjects_a');
$this->load->view('includes/super_footer');
}
public function assign_sub_subjects_o(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/assign_sub_subjects_o');
$this->load->view('includes/super_footer');
}
public function assign_sub_subjects_a(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/assign_sub_subjects_a');
$this->load->view('includes/super_footer');
}
public function register_user(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_user');
$this->load->view('includes/super_footer');
}
public function primary_register_user(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/primary_register_user');
$this->load->view('includes/super_footer');
}
public function view_results_primary(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_results_primary');
$this->load->view('includes/super_footer');
}
public function view_results_O_level(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_results_O_level');
$this->load->view('includes/super_footer');
}
public function view_results_O_level_calculate(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_results_O_level_calculate');
$this->load->view('includes/super_footer');
}
public function set_exam_public(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/set_exam_public');
$this->load->view('includes/super_footer');
}
public function upload_results_o_level_officer(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/upload_results_o_level_officer');
$this->load->view('includes/super_footer');
}
public function upload_results_officers_o_level(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/upload_results_officers_o_level');
$this->load->view('includes/super_footer');
}
public function insert_results_O_level(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/insert_results_O_level');
$this->load->view('includes/super_footer');
}
public function view_results_a_level(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_results_a_level');
$this->load->view('includes/super_footer');
}
public function register_groups(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_groups');
$this->load->view('includes/super_footer');
}
public function primary_register_groups(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/primary_register_groups');
$this->load->view('includes/super_footer');
}
public function register_subjects(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/register_subjects');
$this->load->view('includes/super_footer');
}
public function view_users(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_users');
$this->load->view('includes/super_footer');
}
public function view_group_schools(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/view_group_schools');
$this->load->view('includes/super_footer');
}
public function load_category(){
$cat = $this->input->post('category');
if($cat == 1){
// region
?>
Select Region
db->get('regions')->result() as $row){
?>
name;?>
Select District
db->get('regions_distrincts')->result() as $row){
?>
regions_id?>'>db->where('id',$row->regions_id);
$reg = $this->db->get('regions');
foreach($reg->result() as $region){
echo $region->name." - ".$row->district_name;
}
?>
Select Group
db->get('exam_groups')->result() as $row){
?>
name; ?>
input->post('category');
$this->db->where('reg_number',$this->input->post('email'));
$count=$this->db->count_all_results('education_officers');
if($count>0){
redirect('Super_user/register_user?Exist');
}else{
if($cat == 1){
$category = "main";
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>0,
'region'=>$this->input->post('region'),
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'SS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>0
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}elseif($cat == 2){
$category = "sub";
$d = explode(',',$this->input->post('region'));
$sub_region = $d[0];
$region = $d[1];
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>$sub_region,
'region'=>$region,
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'SS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>0
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}else{
$category = "Group_admin";
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>0,
'region'=>0,
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'SS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>$this->input->post('group_id'),
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}
}
redirect('Super_user/register_user?Sent');
}
}
public function insert_user_primary(){
if($_POST){
$cat = $this->input->post('category');
$this->db->where('reg_number',$this->input->post('email'));
$count=$this->db->count_all_results('education_officers');
if($count>0){
redirect('Super_user/primary_register_user?Exist');
}else{
if($cat == 1){
$category = "main";
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>0,
'region'=>$this->input->post('region'),
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'PS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>0
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}elseif($cat == 2){
$category = "sub";
$d = explode(',',$this->input->post('region'));
$sub_region = $d[0];
$region = $d[1];
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>$sub_region,
'region'=>$region,
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'PS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>0
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}else{
$category = "Group_admin";
$data = array(
'full_name'=>$this->input->post('name'),
'reg_number'=>$this->input->post('email'),
'district'=>0,
'region'=>0,
'title'=>$this->input->post('title'),
'category'=>$category,
'type'=>'Officer',
'school_type'=>'PS',
'password'=>md5('default'),
'password_recover'=>'default',
'group_id'=>$this->input->post('group_id'),
);
$data = $this->security->xss_clean($data);
$this->db->insert('education_officers',$data);
echo 1;
}
}
redirect('Super_user/primary_register_user?Sent');
}
}
public function insert_group(){
$name = $this->security->xss_clean($this->input->post('name'));
$this->db->where('name',$name);
$count=$this->db->count_all_results('exam_groups');
if($count>0){
redirect('Super_user/register_groups?Exist');
}else{
$data=array(
'name'=>$this->security->xss_clean($this->input->post('name')),
'url'=>$this->security->xss_clean($this->input->post('url')),
'email'=>$this->security->xss_clean($this->input->post('email')),
'heading'=>$this->security->xss_clean($this->input->post('heading')),
'mobile'=>$this->security->xss_clean($this->input->post('mobile')),
'full_name'=>$this->security->xss_clean($this->input->post('full_name')),
'date_registered'=>date('M d Y'),
'group_type'=>'SS',
);
$this->db->insert('exam_groups',$data);
redirect('Super_user/register_groups?Sent');
}
}
public function insert_group_primary(){
$name = $this->security->xss_clean($this->input->post('name'));
$this->db->where('name',$name);
$count=$this->db->count_all_results('exam_groups');
if($count>0){
redirect('Super_user/register_groups?Exist');
}else{
$data=array(
'name'=>$this->security->xss_clean($this->input->post('name')),
'email'=>$this->security->xss_clean($this->input->post('email')),
'heading'=>$this->security->xss_clean($this->input->post('heading')),
'mobile'=>$this->security->xss_clean($this->input->post('mobile')),
'full_name'=>$this->security->xss_clean($this->input->post('full_name')),
'date_registered'=>date('M d Y'),
'group_type'=>'PS',
);
$this->db->insert('exam_groups',$data);
redirect('Super_user/primary_register_groups?Sent');
}
}
public function edit_group(){
$data=array(
'name'=>$this->security->xss_clean($this->input->post('name')),
'url'=>$this->security->xss_clean($this->input->post('url')),
'email'=>$this->security->xss_clean($this->input->post('email')),
// 'heading'=>$this->security->xss_clean($this->input->post('heading')),
'mobile'=>$this->security->xss_clean($this->input->post('mobile')),
'full_name'=>$this->security->xss_clean($this->input->post('full_name')),
// 'date_registered'=>date('M d Y'),
);
$this->db->where('group_id',$this->security->xss_clean($this->input->post('group_id')));
$this->db->update('exam_groups',$data);
redirect('Super_user/register_groups?Sent');
}
public function edit_group_primary(){
$data=array(
'name'=>$this->security->xss_clean($this->input->post('name')),
'email'=>$this->security->xss_clean($this->input->post('email')),
// 'heading'=>$this->security->xss_clean($this->input->post('heading')),
'mobile'=>$this->security->xss_clean($this->input->post('mobile')),
'full_name'=>$this->security->xss_clean($this->input->post('full_name')),
// 'date_registered'=>date('M d Y'),
);
$this->db->where('group_id',$this->security->xss_clean($this->input->post('group_id')));
$this->db->update('exam_groups',$data);
redirect('Super_user/primary_register_groups?Sent');
}
public function edit_heading(){
$data=array(
'heading'=>$this->security->xss_clean($this->input->post('heading')),
);
$this->db->where('group_id',$this->security->xss_clean($this->input->post('id')));
$this->db->update('exam_groups',$data);
redirect('Super_user/register_groups?Sent');
}
public function edit_heading_primary(){
$data=array(
'heading'=>$this->security->xss_clean($this->input->post('heading')),
);
$this->db->where('group_id',$this->security->xss_clean($this->input->post('id')));
$this->db->update('exam_groups',$data);
redirect('Super_user/primary_register_groups?Sent');
}
public function change_status(){
$no=base64_decode($_GET['id']);
$this->db->where('group_id', $no);
$get=$this->db->get('exam_groups');
foreach($get->result() as $row){
$status=$row->status;
if($status==0){
$data=array(
'status'=>1
);
}else{
$data=array(
'status'=>0
);
}
}
$this->db->where('group_id', $no);
$this->db->update('exam_groups',$data);
redirect('Super_user/register_groups?Changed');
}
public function change_publish(){
$no=$_GET['exam_id'];
$this->db->where('examination_id', $no);
$get=$this->db->get('examination');
foreach($get->result() as $row){
$status=$row->status;
if($status==0){
$data=array(
'status'=>1
);
}else{
$data=array(
'status'=>0
);
}
}
$this->db->where('examination_id', $no);
$this->db->update('examination',$data);
redirect('Super_user/set_exam_public?Changed');
}
public function change_public(){
$no=$_GET['exam_id'];
$this->db->where('examination_id', $no);
$get=$this->db->get('examination');
foreach($get->result() as $row){
$status=$row->public;
if($status==0){
$data=array(
'public'=>1
);
}else{
$data=array(
'public'=>0
);
}
}
$this->db->where('examination_id', $no);
$this->db->update('examination',$data);
redirect('Super_user/set_exam_public?Changed');
}
public function change_status_primary(){
$no=base64_decode($_GET['id']);
$this->db->where('group_id', $no);
$get=$this->db->get('exam_groups');
foreach($get->result() as $row){
$status=$row->status;
if($status==0){
$data=array(
'status'=>1
);
}else{
$data=array(
'status'=>0
);
}
}
$this->db->where('group_id', $no);
$this->db->update('exam_groups',$data);
redirect('Super_user/primary_register_groups?Changed');
}
public function delete_group(){
$no=base64_decode($_GET['id']);
$this->db->where('group_id', $no);
$this->db->delete('exam_groups');
redirect('Super_user/register_groups?Deleted');
}
public function delete_group_primary(){
$no=base64_decode($_GET['id']);
$this->db->where('group_id', $no);
$this->db->delete('exam_groups');
redirect('Super_user/primary_register_groups?Deleted');
}
public function delete_user(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('education_officers');
redirect('Super_user/register_user?Deleted');
}
public function delete_user_primary(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('education_officers');
redirect('Super_user/primary_register_user?Deleted');
}
public function load_members(){
$group_id = $this->input->post('id');
?>
S/NO
School Name
Center Number
Remove
db->where('group_id',$group_id);
$gtr=$this->db->get('group_schools');
foreach($gtr->result() as $rows){
$this->db->where('school_id',$rows->school_id);
$gtzz=$this->db->get('schools');
foreach($gtzz->result() as $row){
$i++;
?>
school_name));
?>
school_reg_number;
?>
school_id; ?>
input->post('school_id');
$id = $this->input->post('id');
$this->db->where('group_id',$id);
$this->db->where('school_id',$school_id);
$count = $this->db->count_all_results('group_schools');
if($count == 0){
$data = array(
'group_id'=>$id,
'school_id'=>$school_id,
'date_registered'=>date('M d Y'),
);
$this->db->insert('group_schools',$data);
}
}
}
public function remove_members(){
if($_POST){
$school_id = $this->input->post('school_id');
$id = $this->input->post('id');
$this->db->where('group_id',$id);
$this->db->where('school_id',$school_id);
$this->db->delete('group_schools');
echo "One member removed";
}
}
public function assignments(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/assignments');
$this->load->view('includes/super_footer');
}
public function error_report_excel(){
$this->load->view('includes/super_header');
$this->load->view('users/superuser/error_report_excel');
$this->load->view('includes/super_footer');
}
public function send_ca_excel(){
$inputFileName = $_FILES["file"]["tmp_name"];
$filename = $_FILES["file"]["name"];
$filetype = $_FILES["file"]["type"];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$allowed = array(
"xls" => array( "application/vnd.ms-excel" ),
"xlsx" => array(
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
);
$file_allowed = false;
// this checks also if mimetype of xlsx is just a mimetype of xlsx and nothing else
if ( isset( $allowed[$ext] ) && in_array( $filetype, $allowed[$ext] ) ) {
$file_allowed = true;
}
if(!$file_allowed){
redirect($_SERVER['HTTP_REFERER']."&error=".json_encode('The submited file is invalid'));
exit();
}
try {
/// it will be your file name that you are posting with a form or can pass static name $_FILES["file"]["name"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$data = array();
$data2 = array();
$valid_student = 0;
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$template = $allDataInSheet[1]['A'].$allDataInSheet[1]['B'].$allDataInSheet[1]['C'];
if($template != 'S/NCA/NOSCORE'){
redirect($_SERVER['HTTP_REFERER']."&error=".json_encode('The submited file format is invalid'));
exit();
}
$region = $this->input->post('region');
$subject_id = $this->input->post('subject_id');
$main_subject_id = $this->input->post('main_subject_id');
$school =$this->input->post('school_id');
$candidate = $this->input->post('candidate');
$exam_id = $this->input->post('exam_id');
$district = $this->input->post('district');
$table="";
$marks_entered=0;
$empty_fields = 0;
$data = array();
$this->db->where('examination_id', $exam_id);
$get=$this->db->get('examination');
foreach($get->result() as $row){
$month = $row->month;
$category = $row->category;
$academic_year = $row->academic_year;
$class = $row->class_level;
}
//S/N CA/NO SCORE
foreach($allDataInSheet as $result){
$reg_number=$stream="";
$this->db->where('school_id',$school);
$this->db->where('id_number',$result['B']);
$this->db->where('admission_year',$academic_year);
// $this->db->where('region',$region);
foreach($this->db->get('students')->result() as $student){
$reg_number = $student->reg_number;
foreach($this->db->where('reg_number',$reg_number)->where('school_id',$school)->where('academic_year',$academic_year)->get('classes')->result() as $cla){
$stream = $cla->stream;
}
}
$mark = $result['C'];
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($mark) && round($mark)<=$row_grade->end_mark){
$mark_grade = $row_grade->grade;
}
}
$point=10;
$this->db->where('students_type',$category);
$this->db->where('grade',$mark_grade);
$ff = $this->db->get('point_settings');
foreach($ff->result() as $p){
$point = $p->point;
}
if($mark !== NULL){
$mark = round($mark);
}
if($subject_id == $main_subject_id){
$table = 'ca'; ## This subject has NO sub subject
$data = array(
'school_id' => $school,
'district_id' => $district,
'region_id' => $region,
'exam_id' => $exam_id,
'reg_number' =>$reg_number,
'mark' =>round($mark),
'month' => $month,
'academic_year' => $academic_year,
'subject_id' => $subject_id,
'class_level' => $class,
'category' => $category,
'grade' => $mark_grade,
'gpa' => $point,
'stream' => $stream,
'candidate' => $candidate,
'entered_by' => $this->session->userdata('reg_number'),
'date_entered' => date('d-m-Y H:i:s'),
);
}else{
$new_mark=0;
$this->db->where('region_id',$region);
$this->db->where('category',$category);
$this->db->where('examination_id',$exam_id);
$this->db->where('main_subject_id',$main_subject_id);
$this->db->where('sub_subject_id',$subject_id);
$gg = $this->db->get('sub_subjects');
foreach($gg->result() as $new){
## select calculation criteria
if($new->contribution == 'Custom'){
$new_mark = round(($mark*$new->percent)/$new->max_mark);
}else{
$this->db->where('region_id',$region);
$this->db->where('category',$category);
$this->db->where('examination_id',$exam_id);
$this->db->where('main_subject_id',$main_subject_id);
$n = $this->db->count_all_results('sub_subjects');
if($n == 0){
$n = 1;
}
$new_mark = round(($mark*100)/($new->max_mark));
}
}
$table = 'ca_sub'; ## This is sub subjects
$data = array(
'school_id' => $school,
'district_id' => $district,
'region_id' => $region,
'reg_number' =>$reg_number,
'mark' =>$mark,
'new_mark' =>$new_mark,
'month' => $month,
'academic_year' => $academic_year,
'main_subject_id' => $main_subject_id,
'subject_id' => $subject_id,
'class_level' => $class,
'category' => $category,
'exam_id' => $exam_id,
'stream' => $stream,
'candidate' => $candidate,
'entered_by' => $this->session->userdata('reg_number'),
'date_entered' => date('d-m-Y H:i:s'),
);
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$count = $this->db->count_all_results($table);
if(strlen($reg_number) > 7){ ## Reg_number found in the database
if($mark !== NULL){
if($count == 0){
$marks_entered++;
$this->db->insert($table,$data);
}else{
$marks_entered++;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$subject_id);
$this->db->update($table,$data);
}
###########################################
$sum_mark=0;
if($subject_id !== $main_subject_id){
$mark_grade='';
$this->db->select_sum('new_mark');
$this->db->where('school_id', $school);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('main_subject_id', $main_subject_id);
$this->db->where('category', $category);
$this->db->where('candidate', $candidate);
$this->db->where('class_level', $class);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$get_new = $this->db->get('ca_sub');
foreach($get_new->result() as $nn){
$n=1;
$this->db->where('region_id',$region);
$this->db->where('category',$category);
$this->db->where('examination_id',$exam_id);
$this->db->where('main_subject_id',$main_subject_id);
$n = $this->db->count_all_results('sub_subjects');
if($n == 0){
$n = 1;
}
$sum_mark = round(($nn->new_mark/$n),0);
## Finding the grade of entered mark, we should find from our own table
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($sum_mark) && round($sum_mark)<=$row_grade->end_mark){
$mark_grade = $row_grade->grade;
}
}
$this->db->where('students_type',$category);
$this->db->where('grade',$mark_grade);
$ff = $this->db->get('point_settings');
foreach($ff->result() as $p){
$point = $p->point;
}
}
$data1 = array(
'school_id' => $school,
'district_id' => $district,
'region_id' => $region,
'exam_id' => $exam_id,
'reg_number' =>$reg_number,
'mark' =>round($sum_mark),
'month' => $month,
'academic_year' => $academic_year,
'subject_id' => $main_subject_id,
'class_level' => $class,
'category' => $category,
'grade' => $mark_grade,
'gpa' => $point,
'stream' => $stream,
'candidate' => $candidate,
'entered_by'=>$this->session->userdata('reg_number'),
'date_entered' => date('d-m-Y H:i:s'),
);
$this->db->where('school_id', $school);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('subject_id', $main_subject_id);
$this->db->where('category', $category);
$this->db->where('candidate', $candidate);
$this->db->where('class_level', $class);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$exist = $this->db->count_all_results('ca');
if($exist>0){
$this->db->where('school_id', $school);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('subject_id', $main_subject_id);
$this->db->where('category', $category);
$this->db->where('candidate', $candidate);
$this->db->where('class_level', $class);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->update('ca', $data1);
}else{
$this->db->insert('ca', $data1);
}
}
###########################################
}
}
}
redirect($_SERVER['HTTP_REFERER']."&uploaded=".$marks_entered);
}
catch(Exception $e) {
$error = pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage();
redirect($_SERVER['HTTP_REFERER']."&error=".json_encode($error));
}
}
public function send_ca_excel_all(){
$inputFileName = $_FILES["file"]["tmp_name"];
$filename = $_FILES["file"]["name"];
$filetype = $_FILES["file"]["type"];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$allowed = array(
"xls" => array( "application/vnd.ms-excel" ),
"xlsx" => array(
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
);
$file_allowed = false;
// this checks also if mimetype of xlsx is just a mimetype of xlsx and nothing else
if ( isset( $allowed[$ext] ) && in_array( $filetype, $allowed[$ext] ) ) {
$file_allowed = true;
}
if(!$file_allowed){
// redirect($_SERVER['HTTP_REFERER']."&error=".json_encode('The submited file is invalid'));
//exit();
}
try {
/// it will be your file name that you are posting with a form or can pass static name $_FILES["file"]["name"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$data = array();
$data2 = array();
$valid_student = 0;
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
// $template = $allDataInSheet[1]['A'].$allDataInSheet[1]['B'].$allDataInSheet[1]['C'];
$A = strtoupper(str_replace(' ','',$allDataInSheet[1]['A']));
$B = strtoupper(str_replace(' ','',$allDataInSheet[1]['B']));
$C = strtoupper(str_replace(' ','',$allDataInSheet[1]['C']));
$D = strtoupper(str_replace(' ','',$allDataInSheet[1]['D']));
$E = strtoupper(str_replace(' ','',$allDataInSheet[1]['E']));
$F = strtoupper(str_replace(' ','',$allDataInSheet[1]['F']));
if($A != "REGNUMBER" || $B != "FIRSTNAME" || $C != "MIDDLENAME" || $D != "LASTNAME" || $E != "GENDER" || $F != "PHONENUMBER" ){
redirect($_SERVER['HTTP_REFERER']."&error=".json_encode('The submited file format is invalid'));
exit();
}
$region = $this->input->post('region');
$subject_id = $this->input->post('subject_id');
$main_subject_id = $this->input->post('main_subject_id');
$school =$this->input->post('school_id');
$candidate = $this->input->post('candidate');
$exam_id = $this->input->post('exam_id');
$district = $this->input->post('district');
$ids = $alpha = array();
foreach(range('G','Y') as $index){
if(isset($allDataInSheet[1][$index])){
$subject = $allDataInSheet[1][$index];
$subject = explode(' ',$subject);
$subject = strtoupper(substr($subject[0],0,3));
if($subject == 'B/M' || $subject == 'BAS'){
$subject = "B/MATH";
}
if($subject == 'BOO' || $subject == 'B/K' ){
$subject = "B/KEEP";
}
if($subject == 'LIT'){
$subject = "LITERATURE";
}
if($subject == 'BIB'){
$subject = "B/KNOW";
}
if($subject == 'ISL'){
$subject = "I/KNOW";
}
if($subject == 'INF'){
$subject = "ICS";
}
if($subject == 'FOO' || $subject == 'F/N'){
$subject = "F/NUTR";
}
if($subject == 'ADD' || $subject == 'AD/'){
$subject = "AD/MATH";
}
if($subject == 'P/E'){
$subject = "P/EDU";
}
if($main_subject_id == $subject_id){
$this->db->where('is_sub',0);
}else{
$this->db->where('is_sub',1);
}
$this->db->where('short_name',$subject);
$get = $this->db->get('all_subjects');
if($get->num_rows() > 1){
//echo "Confusing, more than 1
";
}elseif($get->num_rows() == 1){
foreach($get->result() as $res){
$ids[] = $res->subject_id;
$alpha[] = $index;
// echo $subject." - ".$res->subject_id." ";
}
}else{
//echo $subject." not found
";
}
//echo $subject."
";
}
}
$table="";
$marks_entered=0;
$empty_fields = 0;
$data = array();
$this->db->where('examination_id', $exam_id);
$get=$this->db->get('examination');
foreach($get->result() as $row){
$month = $row->month;
$category = $row->category;
$academic_year = $row->academic_year;
$class = $row->class_level;
}
$academic_year = date('Y');
foreach($allDataInSheet as $result){
if($result['A'] == 'REG NUMBER') continue;
$reg_number=$stream="";
$this->db->where('school_id',$school);
$this->db->where('id_number',$result['A']);
$this->db->where('admission_year',$academic_year);
$this->db->where('class_admitted',$class);
foreach($this->db->get('students')->result() as $student){
$reg_number = $student->reg_number;
foreach($this->db->where('reg_number',$reg_number)->where('school_id',$school)->where('academic_year',$academic_year)->get('classes')->result() as $cla){
$stream = $cla->stream;
}
}
$i=0;
foreach($ids as $su_id){
$mark = $result[$alpha[$i]];
/*
if(!is_numeric($mark)){
continue;
}
*/
$subject_id = $su_id;
$i++;
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($mark) && round($mark)<=$row_grade->end_mark){
$mark_grade = $row_grade->grade;
}
}
$point=10;
$this->db->where('students_type',$category);
$this->db->where('grade',$mark_grade);
$ff = $this->db->get('point_settings');
foreach($ff->result() as $p){
$point = $p->point;
}
if($mark !== NULL && round($mark) ){
$mark = round($mark);
$table = 'ca'; ## This subject has NO sub subject
$data = array(
'school_id' => $school,
'district_id' => $district,
'region_id' => $region,
'exam_id' => $exam_id,
'reg_number' =>$reg_number,
'mark' =>$mark,
'month' => $month,
'academic_year' => $academic_year,
'subject_id' => $subject_id,
'class_level' => $class,
'category' => $category,
'grade' => $mark_grade,
'gpa' => $point,
'stream' => $stream,
'candidate' => $candidate,
'entered_by' => $this->session->userdata('reg_number'),
'date_entered' => date('d-m-Y H:i:s'),
);
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$count = $this->db->count_all_results($table);
if(strlen($reg_number) > 7){ ## Reg_number found in the database
if($mark !== NULL){
if($count == 0){
$marks_entered++;
$this->db->insert($table,$data);
}else{
$marks_entered++;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id',$subject_id);
$this->db->update($table,$data);
}
}
}
}
}
}
redirect($_SERVER['HTTP_REFERER']."&uploaded=".$marks_entered);
}
catch(Exception $e) {
$error = pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage();
redirect($_SERVER['HTTP_REFERER']."&error=".json_encode($error));
}
}
public function check_exam(){
$exam_id = 37;
$this->db->distinct()->select('reg_number');
$this->db->where('admission_year',2018);
$this->db->where('region',0);
$this->db->where('district',0);
$gg = $this->db->get('students');
foreach($gg->result() as $students){
$this->db->where('reg_number',$students->reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('region_id',3);
$this->db->where('district_id',6);
//$this->db->where('school_id','SS5ba8b376ed077');
//$this->db->delete('ca');
foreach($this->db->get('ca')->result() as $ca){
foreach($this->db->where('reg_number',$ca->reg_number)->get('students')->result() as $name){
echo $name->full_name." ".$ca->reg_number." ".$ca->school_id."
";
}
}
}
}
}PK ! pw 9 Arrange_schools_positions_subjects_o_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://results.afel.co.tz/Arrange_schools_positions_subjects_o_level_background
public function index() {
$category='O';
$sub_position=0;
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('academic_year', $year);
$query_term = $this->db->get('monthly_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$this->db->distinct();
$this->db->select('month');
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_month=$this->db->get('subjects_school_gpa');
foreach($get_month->result() as $row_month){
$class_position=0;
$month=$row_month->month;
// echo 'Month = '.$month.'
';
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_class=$this->db->get('subjects_school_gpa');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
//arranging positions of subjects for different schools------------
$average_subject_gpa=0;
$this->db->distinct();
$this->db->select('short_name');
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$get_short_name=$this->db->get('subjects_school_gpa');
foreach($get_short_name->result() as $row_short_name){
$total_subject_gpa=0;
$subject_gap_position=0;
$this->db->where('short_name',$row_short_name->short_name);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$this->db->order_by('gpa','asc');
$get_position=$this->db->get('subjects_school_gpa');
foreach($get_position->result() as $ro_po){
$subject_gap_position++;
$total_subject_gpa=$total_subject_gpa+$ro_po->gpa;
//echo $row_short_name->short_name.' '.$subject_gap_position.'
';
$data_pos=array(
'position'=>$subject_gap_position
);
$this->db->where('short_name',$row_short_name->short_name);
$this->db->where('school_id',$ro_po->school_id);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','O');
$this->db->update('subjects_school_gpa',$data_pos);
}
$average_subject_gpa=round($total_subject_gpa/$subject_gap_position,4);
$data_subject_gpa=array(
'short_name'=>$row_short_name->short_name,
'class_level'=>$class,
'academic_year'=>$year,
'month'=>$month,
'term'=>$term,
'category'=> $category,
'gpa'=>$average_subject_gpa
);
$this->db->where('short_name',$row_short_name->short_name);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$count_entered_gpa= $this->db->count_all_results('subjects_positions');
if($count_entered_gpa>0){
$this->db->where('short_name',$row_short_name->short_name);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$this->db->update('subjects_positions',$data_subject_gpa);
}else{
$this->db->insert('subjects_positions',$data_subject_gpa);
}
}
//updating overall subjects positions in the databse
$subject_position=0;
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$this->db->order_by('gpa','asc');
$get_position=$this->db->get('subjects_positions');
foreach($get_position->result() as $row_subject_short_name){
$subject_position++;
echo $row_subject_short_name->short_name.' '.$subject_position.'
';
$data_pos=array(
'position'=>$subject_position
);
$this->db->where('short_name',$row_subject_short_name->short_name);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','O');
$this->db->update('subjects_positions',$data_pos);
}
}
}
//-----------------------------------------------------------------------------------------------------------//
}
}
}?>PK ! ]"S "S , Calculate_mid_results_a_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_mid_results_a_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','A');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Monthly Results ';
$month_change=0;
foreach($this->db->get('a_level_month_change')->result() as $row){
$month_change=$row->month;
}
$academic_year = 0;
$month = date('m');
if ($month >= $month_change) {
$academic_year = (date('Y')) . "-" . (date('Y') + 1);
} else {
$academic_year = (date('Y') - 1) . "-" . date('Y');
}
echo '
Calculating Mid-Term Results ';
$class='';
$stream='';
$category='';
$number_of_sudents=0;
$term='';
$category='A';
$grade1='';
$required_subjects_for_calcultion_div=0;
$year=$academic_year;
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_term) {
//finding the divisions from average of marks of diffrent subjects in different months
$term=$row_term->term;
//echo '
Term'.$term.' ';
$number_of_sudents=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$reg_number=$row_reg->reg_number;
//echo $row_reg->reg_number.'';
//$this->db->distinct();
//$this->db->select('class_level');
//$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
//$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$query_all = $this->db->get('classes');
foreach ($query_all->result() as $row_all) {
$reg_number=$row_all->reg_number;
$category=$row_all->category;
$class=$row_all->class_level;
$stream=$row_all->stream;
// echo 'Class = '.$class.' Combination = '.$stream.'
';
$number_of_months=0;
$sum_of_total=0;
$sum_of_avearges=0;
$average_of_averages=0;
$grade='';
$remark='';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year', $year);
$this->db->where('reg_number', $reg_number);
$query_month = $this->db->get('monthly_results');
foreach ($query_month->result() as $row_month) {
$number_of_months++;
$month=$row_month->month;
//finding subjects which are included in calculations
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_ca=$this->db->get('monthly_results');
foreach($get_ca->result() as $row_ca){
$sum_of_total=$sum_of_total+$row_ca->total_marks;
$sum_of_avearges=$sum_of_avearges+$row_ca->average;
// echo '
Month = '.$month.' Average = ' .$row_ca->average.'
';
}
}
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_averages=($sum_of_avearges/$number_of_months); //for considering total marks over total subjects required
$average_of_averages=round($average_of_averages);
//echo ' Number of months attempted = '.$number_of_months.'Sum of Total ='.$sum_of_total.' Sum of averages = '.$sum_of_avearges.' Average of averages = '.$average_of_averages.'
';
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_averages) && round($average_of_averages)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo $grade.'
';
// echo $remark.'
';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$year,
'term'=>$term,
'total_marks'=>$sum_of_total,
'average'=>$average_of_averages,
'grade'=>$grade,
'remark'=>$remark,
'division'=>'---',
'point'=>'---',
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('mid_term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('mid_term_results',$data);
}else{
$this->db->insert('mid_term_results',$data);
}
}
}
}
//------------------------finding subjects position for mid terms fro their averages ------------
$required_subjects_for_calcultion_div=0;
$number_of_subjects_div=0;
$reg_number=$row_reg->reg_number;
// echo $reg_number.'
';
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $year);
$this->db->where('school_id',$school);
$getts= $this->db->get('classes');
foreach($getts->result() as $rowt){
$class=$rowt->class_level;
$stream=$rowt->stream;
$category=$rowt->category;
}
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
//$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->order_by('mark', 'desc');
$this->db->where('status', 0);
$get_subs=$this->db->get('ca');
foreach($get_subs->result() as $row_subjectss){
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('subject_id', $row_subjectss->subject_id);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects');
foreach($gett->result() as $row_sub){
$required_subjects_for_calcultion_div++;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_subjects){
$number_of_subjects_div++;
$this->db->select_sum('mark');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_marks=$this->db->get('ca');
foreach($get_marks->result() as $row_marks){
$number_of_months=0;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_months =$this->db->get('ca');
foreach($get_months->result() as $row_month){
$number_of_months++;
}
$total_marks_in_months=$row_marks->mark;
$average_in_months=round($total_marks_in_months/$number_of_months);
// echo 'Subjects = '.$row_subjects->subject_id.' Total marks = '.$row_marks->mark.' Average in months = '.$average_in_months.'
';
//insertung into mid_term_subjects_results
$datad=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'academic_year'=>$year,
'term'=>$term,
'subject_id'=>$row_subjects->subject_id,
'mark'=>$average_in_months,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('mid_term_subjects_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('mid_term_subjects_results',$datad);
}else{
$this->db->insert('mid_term_subjects_results',$datad);
}
}
}
}
}
// echo '
';
//--------------------------------------------------------------------finding division------------------------------------------
$reg_number=$row_reg->reg_number;
//echo $reg_number.'
';
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $year);
$this->db->where('school_id',$school);
$getts= $this->db->get('classes');
foreach($getts->result() as $rowt){
$class=$rowt->class_level;
$stream=$rowt->stream;
$category=$rowt->category;
}
$point=0;
$number_sujects_required=0;
$number_of_subjects_div=0;
$required_subjects_for_calcultion_div=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects_calculations_div');
foreach($gett->result() as $row_sub){
$required_subjects_for_calcultion_div++;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_subjects){
$number_of_subjects_div++;
$this->db->select_sum('mark');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_marks=$this->db->get('ca');
foreach($get_marks->result() as $row_marks){
$number_of_months=0;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_months =$this->db->get('ca');
foreach($get_months->result() as $row_month){
$number_of_months++;
}
$total_marks_in_months=$row_marks->mark;
$average_in_months=round($total_marks_in_months/$number_of_months);
$average_in_months= round($average_in_months);
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_in_months) && round($average_in_months)<=$row_grade->end_mark){
$grade1=$row_grade->grade;
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$this->db->where('grade',$grade1);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
// echo 'Subjects = '.$row_subjects->subject_id.' Total marks = '.$row_marks->mark.' Average in months = '.$average_in_months.
// ' Grade = '.$grade1.' Point = '.$row_point->point.' ,
';
$point= $point+$row_point->point;
// echo 'Single point = '.$point.'
';
}
}
}
}
}
}
$division=0;
$division_remark=0;
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
// echo 'Total Points = '.$point.' Division ='.$division.' Subjects = '.$number_of_subjects_div.'
';
if($point<3 || $number_of_subjects_div<3){
//echo 'ffgfg';exit();
$point='---';
$division='---';
}else{
$point=$point;
$division=$division;
}
//inserting values to the databse without positions
$data=array(
'remark'=>$division_remark,
'division'=>$division,
'point'=>$point
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('mid_term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('mid_term_results',$data);
}else{
//
}
}
//echo '
Number of students = '.$number_of_sudents;
}
}
}
}?>PK ! 4 4 Upload_results_secondary.phpnu [ load->model('User_model');
$this->load->model('Calculate_results_secondary','result');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
//this function redirecting different pages after users loged in
public function index() {
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
}
public function send_ca() {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('sub_subject_id',$this->input->post('subject_id'));
$this->db->where('stream',$this->input->post('stream'));
$this->db->where('students_type',$this->input->post('category'));
$sub = $this->db->get('sub_subjects');
$exceed=0;
foreach($sub->result() as $ma){
if($ma->max_mark < $this->input->post('mark')){
$exceed = 1;
}
}
echo $exceed;
if($exceed == 0){
$ca = $this->result->secondary_ca();
$cal_montly = $this->result->calculate_monthly();
$mid = $this->result->calculate_midterm_subjects_results();
$mid_result = $this->result->calculate_midterm_results();
}
}
public function send_ca_officers() {
/*
$this->db->where('district_id',$this->input->post('district'));
$this->db->where('region_id',$this->input->post('region'));
$this->db->where('sub_subject_id',$this->input->post('subject_id'));
$this->db->where('category',$this->input->post('category'));
$sub = $this->db->get('sub_subjects');
$exceed=0;
foreach($sub->result() as $ma){
if($this->input->post('max') < $this->input->post('mark')){
$exceed = 1;
}
}
*/
if($this->input->post('max') < $this->input->post('mark')){
$exceed = 1;
}
echo $exceed;
if($exceed == 0){
$ca = $this->result->secondary_ca_officers();
//$cal_montly = $this->result->calculate_monthly();
}
}
public function send_ca_officers_questions() {
$exceed=0;
if($this->input->post('max') < $this->input->post('mark')){
$exceed = 1;
}
echo $exceed;
if($exceed == 0){
$ca = $this->result->secondary_ca_officers_questions();
}
}
public function send_exam() {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$this->input->post('class_level'));
$this->db->where('stream',$this->input->post('stream'));
$this->db->where('sub_subject_id',$this->input->post('subject_id'));
$this->db->where('students_type',$this->input->post('category'));
$sub = $this->db->get('sub_subjects');
$exceed=0;
foreach($sub->result() as $ma){
if($ma->max_mark < $this->input->post('mark')){
$exceed = 1;
}
}
echo $exceed;
if($exceed == 0){
$this->result->send_exam();
$this->result->term_subject_result();
$this->result->term_result();
}
}
public function delete_ca(){
$class=base64_decode($_REQUEST['class']);
$month=base64_decode($_REQUEST['month']);
$category=base64_decode($_REQUEST['category']);
$academic_year=base64_decode($_REQUEST['academic_year']);
$term=base64_decode($_REQUEST['term']);
$stream=base64_decode($_REQUEST['stream']);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('ca');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('monthly_results');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('term',$term);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('mid_term_results');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('mid_term_subjects_results');
redirect('Secondary/upload_results_by_excel_a?term='.base64_encode($term).'&&type='.base64_encode($category));
}
public function delete_exam(){
$class=base64_decode($_REQUEST['class_level']);
$category=base64_decode($_REQUEST['category']);
$academic_year=base64_decode($_REQUEST['academic_year']);
$term=base64_decode($_REQUEST['term']);
$stream=base64_decode($_REQUEST['stream']);
$account=base64_decode($_REQUEST['acount']);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('term',$term);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('exam');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('term',$term);
$this->db->where('stream',$stream);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('term_results');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('status',0);
$this->db->delete('term_subjects_results');
redirect('Secondary/upload_results_by_excel_a?term='.base64_encode($term).'&&type='.base64_encode($category));
}
}PK ! ;{5( ( Register_advance.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
require_once APPPATH."/third_party/PHPExcel.php";
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
public function index(){
$chool_name=$this->session->userdata('school_reg_number');
$namee= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$chool_id=$this->session->userdata('school_id');
$academic_year=$this->session->userdata('academic_year_a_level');
$class_level_id = 0;
$msg = 'Record already exist.
';
$uploadedStatus = 0;
if ( isset($_POST["Submit"]) ) {
if ( isset($_FILES["file"])) {
//if there was an error uploading the file
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else {
if (file_exists($_FILES["file"]["name"])) {
unlink($_FILES["file"]["name"]);
}
$storagename = "./application/views/Excel_sheets/".$chool_id.'.xlsx';
move_uploaded_file($_FILES["file"]["tmp_name"], $storagename);
$uploadedStatus = 1;
}
} else {
echo "No file selected
";
}
}
$inputFileName = "./application/views/Excel_sheets/".$chool_id.'.xlsx';
try {
/// it will be your file name that you are posting with a form or can pass static name $_FILES["file"]["name"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
}
catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$data = array();
$data2 = array();
$valid_student = 0;
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$invalid_gender=0;
$invalid_type=0;
$name = " ";
$data_saved=0;
$j=0;
for ($i=1; $i < $totalrows+1; $i++) {
$title_name = str_replace(" ","",$allDataInSheet[$i]['A']);
$title_name = strtoupper($title_name);
$title_gender = str_replace(" ","",$allDataInSheet[$i]['B']);
$title_gender = strtoupper($title_gender);
if($title_name != "FULLNAME" || $title_gender != "GENDER"){
if(!is_null($allDataInSheet[$i]["K"]) || strtoupper(trim($allDataInSheet[$i]["K"])) == "BOARDING" || strtoupper(trim($allDataInSheet[$i]["K"])) == "DAY" ){
# do nothing, it is the supportde entry.
}else{
$j++;
$invalid_type++;
$name.="
".$j." ".$allDataInSheet[$i]["A"];
}
if(!is_null($allDataInSheet[$i]["B"]) || strtoupper(trim($allDataInSheet[$i]["B"])) == "F" || strtoupper(trim($allDataInSheet[$i]["B"])) == "M" || strtoupper(trim($allDataInSheet[$i]["B"])) == "FEMALE" || strtoupper(trim($allDataInSheet[$i]["B"])) == "MALE" ){
# do nothing, it is the supportde entry.
}else{
$j++;
$invalid_gender++;
$name.="
".$j." ".$allDataInSheet[$i]["A"];
}
}
}
$data_saved=0;#usiifute hii variable;
$A=strtoupper(str_replace(' ','',$allDataInSheet[1]['A']));
$B=strtoupper(str_replace(' ','',$allDataInSheet[1]['B']));
$C=strtoupper(str_replace(' ','',$allDataInSheet[1]['C']));
$D=strtoupper(str_replace(' ','',$allDataInSheet[1]['D']));
$E=strtoupper(str_replace(' ','',$allDataInSheet[1]['E']));
$F=strtoupper(str_replace(' ','',$allDataInSheet[1]['F']));
$G=strtoupper(str_replace(' ','',$allDataInSheet[1]['G']));
$H=strtoupper(str_replace(' ','',$allDataInSheet[1]['H']));
$I=strtoupper(str_replace(' ','',$allDataInSheet[1]['I']));
$J=strtoupper(str_replace(' ','',$allDataInSheet[1]['J']));
$K=strtoupper(str_replace(' ','',$allDataInSheet[1]['K']));
if($A != "FULLNAME" || $B != "GENDER" || $C != "BIRTHDATE" || $D != "ADMITTEDFROM" || $E != "ADMISSIONNUMBER" || $F != "LIVINGPLACE" || $G != "NATIONALITY" || $H != "PARENTEMAIL" || $I != "PHONENUMBER" || $J != "COMBINATION" || $K != "SCHOLARTYPE"){
redirect('Secondary/register_students_a_level?format_error');
}else if($invalid_gender > 0 || $invalid_type > 0){
$b = base64_encode($name);
redirect('Secondary/register_students_a_level/'.$invalid_type.'/'.$invalid_gender.'?err='.$b);
}else{
foreach($allDataInSheet as $import){
$title_name = str_replace(" ","",$import['A']);
$title_name = strtoupper($title_name);
$title_gender = str_replace(" ","",$import['B']);
$title_gender = strtoupper($title_gender);
if($title_name != "FULLNAME" || $title_gender != "GENDER"){
$A=str_replace("'","_",$import['A']);
$B=str_replace("'","_",$import['B']);
$C=str_replace("'","_",$import['C']);
$D=str_replace("'","_",$import['D']);
$E=str_replace("'","_",$import['E']);
$F=str_replace("'","_",$import['F']);
$G=str_replace("'","_",$import['G']);
$H=str_replace("'","_",$import['H']);
$I=str_replace("'","_",$import['I']);
$J=str_replace("'","_",$import['J']);
$K=str_replace("'","_",trim($import['K']));
$K= strtoupper(substr($K, 0,1));
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
if ($level == 1) {
$cl = date('Y');
} else if ($level == 2) {
$cl = (date('Y') - 1);
} else if ($level == 3) {
$cl = (date('Y') - 2);
} else if ($level == 4) {
$cl = (date('Y') - 3);
}else if ($level == 5) {
$cl = (date('Y') - 4);
}else if ($level == 6) {
$cl = (date('Y') - 5);
} else {
$cl = (date('Y') - 7);
}
$current = "A".$namee.".".$cl .".".sprintf("%03s",($reg+1));
// echo $current.'
';
//dunping data to the database
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $A,
'gender' => trim($B),
'birth_day' => $C,
'admitted_from' => $D,
'admission_number'=>$E,
'living_place' => $F,
'nationality' => $G,
'email' => $H,
'mobile' => $I,
'admission_year' => date('Y'),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'category' => $this->security->xss_clean($this->input->post('category')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' =>$academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $J,
'schoolar_type' => $K,
'category' => $this->security->xss_clean($this->input->post('category'))
);
$data_saved++;
$this->db->insert('students',$data);
$this->db->insert('classes',$data2);
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
$current = "A".$namee.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $A,
'gender' => $B,
'birth_day' => $C,
'admitted_from' => $D,
'admission_number'=>$E,
'living_place' => $F,
'nationality' => $G,
'email' => $H,
'mobile' => $I,
'admission_year' => date('Y'),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'category' => $this->security->xss_clean($this->input->post('category')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $J,
'schoolar_type' => $K,
'category' => $this->security->xss_clean($this->input->post('category'))
);
$data_saved++;
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
} // if school_type not set
}
}
}
redirect('Secondary/register_students_a_level/'.$data_saved.'?sent');
}
}
}
?>PK ! `
Secondary.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif($this->session->userdata('type')=='Parent'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
public function delete_staffss(){
$reg_number = base64_decode($_REQUEST['reg_number']);
$this->db->where('reg_number',$reg_number)->delete('staff_subjects');
$this->db->where('reg_number',$reg_number)->delete('staffs');
redirect($_SERVER['HTTP_REFERER']);
}
public function add_staffs(){
$mobile = "";
$replace = array('(',')','-');
$phone = str_replace($replace,'',$this->input->post('phone'));
$reg_number = '0'.substr($phone,-9);
$mobile = '255'.substr($phone,-9);
$data = array(
'reg_number'=>$reg_number,
'region'=>$this->session->userdata('region'),
'district'=>$this->session->userdata('district'),
'school_id'=>$this->session->userdata('school_id'),
'type'=>$this->session->userdata('school_type'),
'title'=>'Teacher',
'full_name'=>$this->input->post('name'),
'education'=>$this->input->post('education'),
'gender'=>$this->input->post('gender'),
'mobile'=>$mobile,
'email'=>'',
'registered_year'=>date('Y'),
'password'=>md5('default'),
'password_reset'=>'default',
'status'=>0,
);
$this->db->where('reg_number',$reg_number);
$count = $this->db->count_all_results('staffs');
if($count){
redirect(base_url('Secondary/staffs?exist'));
}else{
if($_REQUEST['edit']){
$original = $this->input->post('original');
$this->db->where('reg_number',$original);
$this->db->update('staffs',$data);
## Delete subjects and insert again
$this->db->where('reg_number',$original);
$this->db->delete('staff_subjects');
foreach($this->input->post('subjects') as $s){
$da = array(
'reg_number'=>$reg_number,
'region'=>$this->session->userdata('region'),
'district'=>$this->session->userdata('district'),
'subject_id'=>$s,
'category'=>$this->session->userdata('school_type'),
);
$this->db->insert('staff_subjects',$da);
}
}else{
$this->db->insert('staffs',$data);
foreach($this->input->post('subjects') as $s){
$da = array(
'reg_number'=>$reg_number,
'region'=>$this->session->userdata('region'),
'district'=>$this->session->userdata('district'),
'subject_id'=>$s,
'category'=>$this->session->userdata('school_type'),
);
$this->db->insert('staff_subjects',$da);
}
}
redirect(base_url('Secondary/staffs?added'));
}
}
//this function redirecting different pages after users loged in
public function index() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/home');
$this->load->view('includes/secondary/secondary_footer');
}
public function update_student_details(){
if($_POST){
$data = array('full_name'=>$this->security->xss_clean($this->input->post('name')));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->input->post('reg_number'));
$this->db->update('students',$data);
echo "Student edited";
}
}
public function update_student_details_mobile(){
if($_POST){
$data = array('mobile'=>$this->security->xss_clean($this->input->post('mobile')));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->input->post('reg_number'));
$this->db->update('students',$data);
echo "Student mobile edited";
}
}
public function insert_untaught_periods(){
if($_POST){
$date = $this->input->post('date');
$ym=explode('/',$date);
$year=$ym[2];
$month=$ym[1];
$dy=$ym[0];
$date = $year."-".$month."-".$dy;
$ddate = $date;
$year = substr($ddate,0,4);
$datew = new DateTime($ddate);
$week = $datew->format("W");
$day = $this->input->post('day');
$class_level = $this->input->post('class_level');
$subject_id = $this->input->post('subject_id');
$stream = $this->input->post('stream');
$category = $this->input->post('category');
$period = $this->input->post('period');
//get year and month
if($period == 0 || $period == '' || $period < 1){
#update periods
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('subject_id',$subject_id);
$this->db->where('category',$category);
$this->db->where('class_level',$class_level);
$this->db->where('stream',$stream);
$this->db->where('date',$date);
$this->db->delete('untaught_periods');
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('subject_id',$subject_id);
$this->db->where('category',$category);
$this->db->where('class_level',$class_level);
$this->db->where('stream',$stream);
$this->db->where('date',$date);
$count = $this->db->count_all_results('untaught_periods');
if($count == 0){
#insert values
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'subject_id'=>$subject_id,
'category'=>$category,
'class_level'=>$class_level,
'stream'=>$stream,
'periods'=>$period,
'date'=>$date,
'year'=>$year,
'month'=>$month,
'day'=>$day,
'region'=>$this->session->userdata('region'),
'district'=>$this->session->userdata('district'),
'week'=>$week,
);
$this->db->insert('untaught_periods',$data);
}else{
#update periods
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('subject_id',$subject_id);
$this->db->where('category',$category);
$this->db->where('class_level',$class_level);
$this->db->where('stream',$stream);
$this->db->where('date',$date);
$this->db->update('untaught_periods',array('periods'=>$period));
}
}
}
}
public function serach_sms_by_date(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary/sent_sms?date='.base64_encode($date).'&&month='.base64_encode($month).'&&year='.base64_encode($year).'&&receiver='.base64_encode($receiver));
}
public function serach_sms_by_month(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$receiver=$this->security->xss_clean($this->input->post('receiver'));
redirect('Secondary/sent_sms?monthh='.base64_encode($month).'&&yearr='.base64_encode($year).'&&receiverr='.base64_encode($receiver));
}
public function delete_sms_by_date(){
$date= $this->security->xss_clean($this->input->post('date'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('date',$date);
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function delete_sms_by_month(){
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function delete_sms_by_year(){
$year= $this->security->xss_clean($this->input->post('year'));
$this->db->where('year',$year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->delete('sent_sms');
redirect('Secondary/delete_sms?deleted');
}
public function get_students(){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('full_name', $this->input->post('name'),"BOTH");
$this->db->limit(50);
$q = $this->db->get('students');
foreach($q->result() as $st){
$academic_year = date('Y');
$round=$this->input->post('round');
//$this->db->where('academic_year', $academic_year);
//$this->db->or_where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $st->reg_number);
$this->db->where('status', 0);
$this->db->limit(1);
$query = $this->db->get('classes');
foreach ($query->result() as $rows) {
$this->db->where('reg_number', $rows->reg_number);
$query = $this->db->get('students');
foreach ($query->result() as $rowws) {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year', $academic_year);
$this->db->or_where('academic_year', $this->session->userdata('academic_year_a_level'));
$querry = $this->db->get('classes');
foreach ($querry->result() as $row_amount) {
$reg = $rowws->reg_number;
$sch_type = $row_amount->schoolar_type;
$cat = $row_amount->category;
//$pay_type = $row_amount->payment_type;
$year = $row_amount->academic_year;
}
?>
category=='A'){?>
full_name).' - Form '.$rows->class_level . "-" . $rows->stream;
?>
Amount Required
Amount Paid
Amount Remained
session->userdata('academic_year_a_level');
$reg_number=$reg;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$this->db->where('reg_number',$reg_number);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//selecting fee from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
//selecting from reduced payement
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payment_id',$rows->payment_id);
$this->db->where('reg_number',$reg_number);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}
}
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
$total_required=$required1+$required2;
echo number_format($total_required);
echo ' ';
echo ' ';
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount1).' ';
echo ' ';
echo ' ';
} }
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount2).' ';
echo ' ';
echo ' ';
}}
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo ' ';
}else{
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo number_format($paid);
echo ' ';
echo ' ';
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//select from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
} else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
}
}
$total_remained=$required11+$required22;
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_remained>$paid){?>
TOTAL=
TOTAL=
' ;
echo '';
echo 'TOTAL = ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo '';
}
?>
full_name).' - Form '.$rows->class_level . "-" . $rows->stream;
?>
Amount Required
Amount Paid
Amount Remained
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$this->db->where('reg_number',$reg_number);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//selecting fee from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($rowff->amount).' ';
?>
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
//selecting from reduced payement
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payment_id',$rows->payment_id);
$this->db->where('reg_number',$reg_number);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($rowffs->amount).' ';
?>
';
echo ' ';
}
}
}
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
$total_required=$required1+$required2;
echo number_format($total_required);
echo ' ';
echo ' ';
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount1).' ';
echo ' ';
echo ' ';
} }
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
echo number_format($trans_type_amount2).' ';
echo ' ';
echo ' ';
}}
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo ' ';
}else{
echo '' ;
echo '';
echo 'TOTAL= ';
echo ' ';
echo '';
echo number_format($paid);
echo ' ';
echo ' ';
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payment type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss){
$name= $rowss->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check=$this->db->count_all_results('reduced_payments');
if($check>0){
//select from reduced payments
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $rowff->amount;
$required11 = $required11 + $rowff->amount;
//finding paid amount for this payment type
$trans_type_amount1=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount1=$tr->amount;
}
//echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
echo '' ;
echo '';
echo $name.'= ';
echo ' ';
echo '';
if($required1>$trans_type_amount1){?>
Pay
';
echo ' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
//getting the name of payement type$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rows->payment_id);
foreach($this->db->get('payments_type')->result() as $rowss1){
$name1= $rowss1->name;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
} else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $rowffs->amount;
$required22 = $required22 + $rowffs->amount;
//finding paid amount for this payment type
$trans_type_amount2=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('payment_type',$rows->payment_id);
$get_trans_type=$this->db->get('transactions');
foreach($get_trans_type->result() as $tr){
$trans_type_amount2=$tr->amount;
}
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
echo '' ;
echo '';
echo $name1.'= ';
echo ' ';
echo '';
if($required2>$trans_type_amount2){?>
Pay
';
echo ' ';
}
}
}
$total_remained=$required11+$required22;
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_remained>$paid){?>
TOTAL=
TOTAL=
' ;
echo '';
echo 'TOTAL = ';
echo ' ';
echo '';
echo '---';
echo ' ';
echo '';
}
?>
session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_by_excel_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_by_excel_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_by_excel_o() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_by_excel_o');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_by_excel_o');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function confirm_sms_payments(){
$transaction_id=trim($this->security->xss_clean($this->input->post('transaction_id')));
//echo $transaction_id;exit();
$url = 'http://www.afel.co.tz/Confirm_sms_payments_secondary';
$fields = array(
'key= '=>"179103@afel_1990/2017",
'transaction_id= '=>trim($this->security->xss_clean($this->input->post('transaction_id'))),
'paid_for= '=>"sms",
'payer_id= '=>$this->session->userdata('school_id'),
'payer_name= '=>$this->session->userdata('school_name'),
);
$fields_string = '';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if($result == 1){
redirect('Secondary/buy_sms?status=sent&&id='.base64_encode($transaction_id));
}else{
redirect('Secondary/buy_sms?status=error&&id='.base64_encode($transaction_id));
}
}
//this function redirecting different pages after users loged in
public function send_evaluation(){
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',date('Y'));
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_o_level?sent');
}
public function send_evaluation1(){
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',date('Y'));
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_o_level?sent');
}
public function send_evaluation_a(){
$academic_year=$this->session->userdata('academic_year_a_level');
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_a_level?sent');
}
public function send_evaluation_a1(){
$academic_year=$this->session->userdata('academic_year_a_level');
$class='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('academic_year',$academic_year);
foreach($this->db->get('classes')->result() as $row){
$class=$row->class_level;
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$gett=$this->db->get('evalution_settings');
foreach($gett->result() as $ros){
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'evaluation_id'=>$this->security->xss_clean($this->input->post('evaluation'.trim($ros->evalution_id))),
'grade'=>$this->security->xss_clean($this->input->post('grade'.trim($ros->evalution_id))),
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year
);
$this->db->insert('students_evaluation',$data);
}
$data2=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'term'=>$this->security->xss_clean($this->input->post('term')),
'academic_year'=>$academic_year,
'comments'=>$this->security->xss_clean($this->input->post('comments'))
);
$this->db->insert('teacher_comments',$data2);
redirect('Secondary/evaluate_students_a_level?sent');
}
public function income_primary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/primary/income_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/primary/income_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_primary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_primary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function delete_revenue(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('revenue');
redirect('Secondary/income_secondary?deleted');
}
public function delete_expenditure(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('expenditures');
redirect('Secondary/expenditures_secondary?deleted');
}
public function insert_revenue() {
if($this->session->userdata('type')=="Admin"){
$issuer_title=$this->session->userdata('type');
} else{
$issuer_title=$this->session->userdata('title');
}
$date=$this->security->xss_clean($this->input->post('date'));
$month=substr($this->security->xss_clean($this->input->post('date')),0,2);
$year=substr($this->security->xss_clean($this->input->post('date')),6,10);
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $date,
'month' => $month,
'year' => $year,
'income' => $this->security->xss_clean($this->input->post('income')),
'issuer' => $this->session->userdata('full_name'),
'issuer_title' => $issuer_title,
);
$this->db->insert('revenue', $data);
redirect('Secondary/income_secondary?sent');
}
public function register_venue() {
$number=$this->security->xss_clean($this->input->post('number_of_rooms'));
$class_level= substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream= substr($this->security->xss_clean($this->input->post('class_level')),1);
//echo $class_level.' '.$stream;exit();
for($i=1;$i<=$number;$i++){
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'class_level' =>$class_level,
'stream' => $stream,
'room_name' => $stream.$i
);
$this->db->insert('venue', $data);
}
redirect('Secondary/create_venue?sent');
}
public function register_activity() {
$name=$this->security->xss_clean($this->input->post('name'));
//echo $class_level.' '.$stream;exit();
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'activity_name' =>$name,
);
$this->db->insert('timetable_activity', $data);
redirect('Secondary/create_activity?sent');
}
public function delete_venue() {
$class= base64_decode($_GET['class_level']);
$stream= base64_decode($_GET['stream']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->delete('venue');
redirect('Secondary/create_venue?deleted');
}
public function delete_activity() {
$id= (int)base64_decode($_GET['id']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('id',$id);
$this->db->delete('timetable_activity');
redirect('Secondary/register_activity?deleted');
}
public function insert_expenditure() {
if($this->session->userdata('type')=="Admin"){
$issuer_title=$this->session->userdata('type');
} else{
$issuer_title=$this->session->userdata('title');
}
$date=$this->security->xss_clean($this->input->post('date'));
$month=substr($this->security->xss_clean($this->input->post('date')),0,2);
$year=substr($this->security->xss_clean($this->input->post('date')),6,10);
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $date,
'month' => $month,
'year' => $year,
'expenditure ' => $this->security->xss_clean($this->input->post('expenses')),
'issuer' => $this->session->userdata('full_name'),
'issuer_title' => $issuer_title,
);
$this->db->insert('expenditures', $data);
redirect('Secondary/expenditures_secondary?sent');
}
public function delete_postoponed(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('postpone_payments');
redirect('Secondary/postpone_payments_secondary?deleted');
}
public function delete_postoponed_a(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('postpone_payments');
redirect('Secondary/postpone_payments_secondary_a?deleted');
}
public function delete_transactionn(){
$no=base64_decode($_GET['no']);
$reg_number=base64_decode($_GET['reg']);
$this->db->where('school_receipt', $no);
$this->db->delete('transactions');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
public function delete_transactionn_a(){
$no=base64_decode($_GET['no']);
$reg_number=base64_decode($_GET['reg']);
$this->db->where('school_receipt', $no);
$this->db->delete('transactions');
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number));
}
public function delete_class_teacher(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->delete('class_teachers');
redirect('Secondary/class_teachers_secondary?deleted');
}
public function register_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_groups() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_groups');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_groups');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_group(){
$data=array(
'name'=>$this->security->xss_clean($this->input->post('group_name')),
'school_id'=>$this->session->userdata('school_id'),
);
$this->db->insert('groups',$data);
redirect('Secondary/create_groups?sent');
}
public function delete_group(){
$group=base64_decode($_REQUEST['id']);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('group_id',$group);
$this->db->delete('groups');
redirect('Secondary/create_groups?deleted');
}
public function add_members() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/add_members');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/add_members');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function notify_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/notify_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/notify_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function sent_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/sent_sms_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/sent_sms_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function delete_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/delete_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/delete_sms');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function billing_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/billing_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/billing_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function site_visit() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/site_visit');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/site_visit');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function buy_sms() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/buy_sms');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',7);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/buy_sms');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_list_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_venue() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_venue');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_venue');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_activity() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_activity');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_activity');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function create_time_table() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_time_table');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/create_time_table');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_timetable() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_timetable');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',6);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_timetable');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function all_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/all_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/all_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function gender_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/gender_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/gender_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function income_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/income_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/income_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_reports_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function expenditures_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/expenditures_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function balance_sheet_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/balance_sheet_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/balance_sheet_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function revenue_reports_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/revenue_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/revenue_reports_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function schoolar_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/schoolar_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/scondary/schoolar_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function class_students_list() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_students_list');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function class_students_list_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_students_list_stream');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_students_list_stream');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_details_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_details_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_details_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_details_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_incomplete_ca() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_incomplete_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_incomplete_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_incomplete_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_incomplete_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_incomplete_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_uploaded_ca() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_uploaded_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_uploaded_ca');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_ca() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/upload_ca');
$this->load->view('includes/flat_admin_footer');
}
public function upload_ca_single() {
$this->load->view('includes/flat_admin_header');
$this->load->view('users/secondary/officer/upload_ca_single');
$this->load->view('includes/flat_admin_footer');
}
public function upload_ca_subject() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_ca_subject');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_ca_subject');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_uploaded_exam() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_uploaded_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_uploaded_exam');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_results_o_level() {
## calculating results
$this->load->view('users/secondary/calculate_gpa');
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function results_statistics() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/results_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/results_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function evaluate_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_attendance_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',4);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function suspended_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function precautioned_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function dismissed_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function graduates_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function register_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function students_list_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function selected_date(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/selected_date');
$this->load->view('includes/secondary/uploading_footer');
}
public function school_periods_report(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/school_periods_report');
$this->load->view('includes/secondary/uploading_footer');
}
public function staffs() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/staffs');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/staffs');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function periods() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/periods');
$this->load->view('includes/secondary/secondary_footer');
}
public function assign_subjects_periods(){
$this->db->where('region_id',$this->session->userdata('region'));
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->where('category',$this->security->xss_clean($this->input->post('students_type')));
$gett=$this->db->get('all_subjects_region');
foreach($gett->result() as $ros){
$subject_id= $this->security->xss_clean($this->input->post('subject'.trim($ros->subject_id)));
$students_type= $this->security->xss_clean($this->input->post('students_type'));
if($subject_id>0){
$this->db->where('students_type', $students_type);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('subject_id',$subject_id);
$cunty= $this->db->count_all_results('assign_subects_period');
if( $cunty>0){
// redirect('Secondary/assign_subject?subject_assigned_exist');
}else{
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'students_type'=>$students_type,
);
//echo $data;
$this->db->insert('assign_subects_period', $data);
}
}
}
redirect('Secondary/assign_subject?sent');
}
public function create_streams(){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$this->security->xss_clean($this->input->post('class_level')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$this->db->where('streams',$this->security->xss_clean($this->input->post('stream')));
$gett=$this->db->count_all_results('assign_stream_period');
if($gett>0){
// do nothing
}else{
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'class_level'=>$this->security->xss_clean($this->input->post('class_level')),
'streams'=>$this->security->xss_clean($this->input->post('stream')),
'category'=>$this->security->xss_clean($this->input->post('category')),
);
$this->db->insert('assign_stream_period',$data);
}
redirect('Secondary/register_streams?sent');
}
public function create_streams1(){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$this->security->xss_clean($this->input->post('class_level')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$this->db->where('streams',$this->security->xss_clean($this->input->post('stream')));
$gett=$this->db->count_all_results('assign_stream_period');
if($gett>0){
// do nothing
}else{
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'class_level'=>$this->security->xss_clean($this->input->post('class_level')),
'streams'=>$this->security->xss_clean($this->input->post('stream')),
'category'=>$this->security->xss_clean($this->input->post('category')),
);
$this->db->insert('assign_stream_period',$data);
}
redirect('Secondary/register_streams?sent');
}
public function assign_subjects_periods1(){
$this->db->where('region_id',$this->session->userdata('region'));
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->where('category',$this->security->xss_clean($this->input->post('students_type')));
$gett=$this->db->get('all_subjects_region');
foreach($gett->result() as $ros){
$subject_id= $this->security->xss_clean($this->input->post('subject'.trim($ros->subject_id)));
$students_type= $this->security->xss_clean($this->input->post('students_type'));
if($subject_id>0){
$this->db->where('students_type', $students_type);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('subject_id',$subject_id);
$cunty= $this->db->count_all_results('assign_subects_period');
if( $cunty>0){
// redirect('Secondary/assign_subject?subject_assigned_exist');
}else{
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'students_type'=>$students_type,
);
//echo $data;
$this->db->insert('assign_subects_period', $data);
}
}
}
redirect('Secondary/assign_subject?sent');
}
function remove_sub(){
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('subject_id', $this->uri->segment(3));
$this->db->where('students_type', $this->uri->segment(4));
$this->db->delete('assign_subects_period');
redirect('Secondary/assign_subject?deleted');
}
function remove_stream_period(){
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('id', $this->uri->segment(3));
$this->db->delete('assign_stream_period');
redirect('Secondary/register_streams?deleted');
}
public function assign_subject() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/assign_subject');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/assign_subject');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function register_streams() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_streams');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_streams');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function untaught_periods() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/untaught_periods');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/untaught_periods');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function upload_results_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function publish_results_a_level_background() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_monthly() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_monthly');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_monthly');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_mid() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_mid');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_mid');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function calculate_results_a_level_background_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_term');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/calculate_results_a_level_background_term');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_results_a_level() {
## calculating results
$this->load->view('users/secondary/calculate_gpa_a');
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function evaluate_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_evaluations_students_o_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_evaluations_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_evaluations_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_evaluations_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_evaluations_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_evaluations_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function edit_evaluation() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/edit_evaluation');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/edit_evaluation');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function edit_eva(){
$grade=$this->input->post('grade');
$academic_year=$this->input->post('academic_year');
$reg_number=$this->input->post('reg_number');
$term=$this->input->post('term');
$evaluation_id=$this->input->post('evaluation_id');
$data=array(
'grade'=>$grade
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$academic_year);
$this->db->where('term',$term);
$this->db->where('reg_number',$reg_number);
$this->db->where('evaluation_id',$evaluation_id);
$this->db->update('students_evaluation',$data);
redirect('Secondary/edit_evaluation?reg_number='.base64_encode($reg_number).'&&year='.base64_encode($academic_year).'&&term='.base64_encode($term).'&&edited=yes');
}
public function edit_comments(){
$comments=$this->input->post('comments');
$academic_year=$this->input->post('academic_year');
$reg_number=$this->input->post('reg_number');
$term=$this->input->post('term');
$id=$this->input->post('id');
$data=array(
'comments'=>$comments
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$academic_year);
$this->db->where('term',$term);
$this->db->where('reg_number',$reg_number);
$this->db->where('id',$id);
$this->db->update('teacher_comments',$data);
redirect('Secondary/edit_evaluation?reg_number='.base64_encode($reg_number).'&&year='.base64_encode($academic_year).'&&term='.base64_encode($term).'&&edited=yes');
}
public function students_attendance_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',4);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function suspended_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function precautioned_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',8);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function dismissed_students_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function graduates_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',1);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_a_level');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function testing_page() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/testing_page');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/testing_page');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function register_staffs_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_staffs_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_staffs_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function released_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/released_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/released_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_class_teachers(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,2);
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'stream'=>$stream,
'category'=>$this->security->xss_clean($this->input->post('category')),
'academic_year'=>date('Y'),
);
$this->db->insert('class_teachers',$data);
redirect('Secondary/class_teachers_secondary?sent');
}
public function insert_class_teachers_a(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1);
$data=array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number'=>$this->security->xss_clean($this->input->post('reg_number')),
'class_level'=>$class,
'stream'=>$stream,
'category'=>$this->security->xss_clean($this->input->post('category')),
'academic_year'=>$this->session->userdata('academic_year_a_level'),
);
$this->db->insert('class_teachers',$data);
redirect('Secondary/class_teachers_secondary?sent');
}
public function class_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function subject_teachers_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/subject_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/subject_teachers_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_subject_teachers(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,1);
$subject_id=substr($this->security->xss_clean($this->input->post('class_level')),2);
//echo $this->security->xss_clean($this->input->post('class_level')).' '.$class.' '.$stream.' '.$subject_id;exit();
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'category' => $this->security->xss_clean($this->input->post('category')),
'class_level' => $class,
'stream' => $stream,
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'academic_year' => date('Y')
);
//echo $data;
$this->db->insert('subjects_assigned', $data);
redirect('Secondary/subject_teachers_secondary?sent');
}
public function insert_subject_teachers_a(){
$class=substr($this->security->xss_clean($this->input->post('class_level')),0,1);
$stream=substr($this->security->xss_clean($this->input->post('class_level')),1,3);
$subject_id=substr($this->security->xss_clean($this->input->post('class_level')),4);
//echo $this->security->xss_clean($this->input->post('class_level')).' '.$class.' '.$stream.' '.$subject_id;exit();
$data = array(
'school_id' => $this->session->userdata('school_id'),
'subject_id' => $subject_id,
'category' => $this->security->xss_clean($this->input->post('category')),
'class_level' => $class,
'stream' => $stream,
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'academic_year' => $this->session->userdata('academic_year_a_level')
);
//echo $data;
$this->db->insert('subjects_assigned', $data);
redirect('Secondary/subject_teachers_secondary?sent');
}
public function delete_subject_teacher(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->where('category', 'O');
$this->db->delete('subjects_assigned');
redirect('Secondary/subject_teachers_secondary?deleted');
}
public function delete_subject_teacher_a(){
$no=base64_decode($_GET['id']);
$this->db->where('id', $no);
$this->db->where('category', 'A');
$this->db->delete('subjects_assigned');
redirect('Secondary/subject_teachers_secondary?deleted');
}
public function staffs_details_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/staffs_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',9);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/staffs_details_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/insert_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/insert_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_sms_receipt() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_sms_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_sms_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_receipt() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function period_comments(){
$class = $this->input->post('class_level');
$ddate = date("Y-m-d", strtotime($this->input->post('date')));
$year = substr($ddate,0,4);
$date = new DateTime($ddate);
$week = $date->format("W");
$dto = new DateTime();
$dto->setISODate($year, $week);
$week_start = $dto->format('Y-m-d');
$dto->modify('+6 days');
$week_end = $dto->format('Y-m-d');
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'district'=>$this->session->userdata('district'),
'region'=>$this->session->userdata('region'),
'week_start'=>$week_start,
'week_end'=>$week_end,
'week_number'=>$week,
'class_level'=>$class,
'commited_by'=>$this->session->userdata('reg_number') != '' ? $this->session->userdata('reg_number') : $this->session->userdata('school_reg_number'),
'date_commited'=>date('Y-m-d H:i:s'),
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('week_number',$week);
$this->db->where('class_level',$class);
$this->db->where('week_end',$week_end);
$cc = $this->db->count_all_results('periods_commits');
if(!$cc){
$this->db->insert('periods_commits',$data);
}
redirect($_SERVER['HTTP_REFERER']);
}
public function print_list_class(){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_list_class');
$this->load->view('includes/secondary/uploading_footer');
}
public function print_receipt_o() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt_o');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/print_receipt_o');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_postponed() {
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>$this->security->xss_clean($this->input->post('reg_number')),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $this->security->xss_clean($this->input->post('date')),
'month' => $this->security->xss_clean($this->input->post('month')),
'year' => $this->security->xss_clean($this->input->post('year')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => substr($this->security->xss_clean($this->input->post('reg_number')),0,1),
'payment_type' => $this->security->xss_clean($this->input->post('payment_type'))
);
$this->db->insert('postpone_payments', $data);
redirect('Secondary/postpone_payments_secondary?sent');
}
public function insert_postponed_a() {
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>$this->security->xss_clean($this->input->post('reg_number')),
'amount' => str_replace(',','',$this->security->xss_clean($this->input->post('amount'))),
'date' => $this->security->xss_clean($this->input->post('date')),
'month' => $this->security->xss_clean($this->input->post('month')),
'year' => $this->security->xss_clean($this->input->post('year')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => substr($this->security->xss_clean($this->input->post('reg_number')),0,1),
'payment_type' => $this->security->xss_clean($this->input->post('payment_type'))
);
$this->db->insert('postpone_payments', $data);
redirect('Secondary/postpone_payments_secondary_a?sent');
}
public function postpone_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/postpone_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/postpone_payments_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function postpone_payments_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/postpone_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/postpone_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function inserts_payments_secondary_a_level() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/insert_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/insert_payments_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function enter_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function enter_payments_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary_a');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/enter_payments_secondary_a');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function clear_payments_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/clear_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/uploading_header');
$this->load->view('users/secondary/clear_payments_secondary');
$this->load->view('includes/secondary/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function payments_statistics() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/payments_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/payments_statistics');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_type_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_type_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_type_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function receipt_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/receipt_reports');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/receipt_reports');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function a_receipt_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/receipt_reports_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/receipt_reports_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function search_receipt_report_a(){
$get=$this->security->xss_clean($this->input->post('year'));
redirect('Secondary/a_receipt_reports?year='.base64_encode($get));
}
public function search_receipt_report(){
$get=$this->security->xss_clean($this->input->post('year'));
redirect('Secondary/receipt_reports?year='.base64_encode($get));
}
public function view_payments_by_amount_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_bank_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_list_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_list_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_list_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_payments_by_date_secondary() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_date_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_date_secondary');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
////
public function views_payments_by_type_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_type_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_type_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_amount_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_amount_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_bank_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_bank_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_list_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_list_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_list_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function views_payments_by_date_secondary_a() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_date_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',5);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_payments_by_date_secondary_a');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
///
public function register_manager() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Manager',
'title' => 'Manager',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_teachers() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Teacher',
'title' => 'Teacher',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_secretary() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Secretary',
'title' => 'Secretary',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function register_accountants() {
$this->db->where('reg_number', str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))));
$count=$this->db->count_all_results('staffs');
$this->db->where('school_mobile', $this->security->xss_clean($this->input->post('mobile')));
$county=$this->db->count_all_results('schools');
if($count>0 || $county>0){
redirect('Secondary/register_staffs_secondary?Exists');
}else{
$data = array(
'school_id'=>$this->session->userdata('school_id'),
'reg_number' =>str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10))),
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
'category' => 'Accountant',
'title' => 'Accountant',
'type' => 'User',
'registered_year'=>date('Y')
);
$this->db->insert('staffs', $data);
redirect('Secondary/register_staffs_secondary?sent');
}
}
public function change_position() {
$reg='';
$pos='';
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('title',$this->security->xss_clean($this->input->post('position')));
$get=$this->db->get('staffs');
foreach($get->result() as $row){
$reg=$row->reg_number;
$pos=$row->category;
}
$data = array(
'title' => $this->security->xss_clean($this->input->post('position')),
);
$data1 = array(
'title' =>$pos,
);
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data);
$this->db->where('reg_number', $reg);
$this->db->update('staffs', $data1);
redirect('Secondary/register_staffs_secondary?changed');
}
public function delete_staff(){
$data=array(
'status'=>1,
'released_year'=>date('Y')
);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->update('staffs',$data);
redirect('Primary/register_staffs_primary?deleted');
}
public function register_o_level_students(){
$chool_name=$this->session->userdata('school_reg_number');
$name= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$academic_year=date('Y');
//echo $this->security->xss_clean($this->input->post('category'));
//exit();
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('admission_number',$this->security->xss_clean($this->input->post('admission_number')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary/register_students_o_level?Exists');
}else{
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student_o();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
$cl = date('Y');
//echo $name.' '.$cl;exit();
$current = $name.".".$cl .".".sprintf("%03s",($reg+1));
//dunping data to the database
// echo 'First '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_o_level?Sent');
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
// ECHO $reg;exit();
$current = $name.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
// echo 'Second '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_o_level?Sent');
}
}
}
}
public function register_advance_students(){
$chool_name=$this->session->userdata('school_reg_number');
$name= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$academic_year=$this->session->userdata('academic_year_a_level');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('full_name',$this->security->xss_clean($this->input->post('full_name')));
$this->db->where('class_admitted',$this->security->xss_clean($this->input->post('class_admitted')));
$this->db->where('admission_year',$this->security->xss_clean($this->input->post('admission_year')));
$this->db->where('admission_number',$this->security->xss_clean($this->input->post('admission_number')));
$this->db->where('category',$this->security->xss_clean($this->input->post('category')));
$count= $this->db->count_all_results('students');
if($count>0){
redirect('Secondary/register_students_a_level?Exists');
}else{
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
if($level == 5) {
$cl = (date('Y') - 0);
}elseif($level == 6) {
$cl = (date('Y') - 1);
}
//echo $name.' '.$cl;exit();
$current = "A".$name.".".$cl .".".sprintf("%03s",($reg+1));
//dunping data to the database
// echo 'First '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_a_level?Sent');
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
$current = "A".$name.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
//echo 'Second '.$current;exit();
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'category' => $this->security->xss_clean($this->input->post('category')),
'admission_number'=>$this->security->xss_clean($this->input->post('admission_number')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => $academic_year,
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
redirect('Secondary/register_students_a_level?Sent');
}
}
}
}
public function assigned_subjects() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/assigned_subjects');
$this->load->view('includes/secondary/secondary_footer');
}
public function assigned_class() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/assigned_class');
$this->load->view('includes/secondary/secondary_footer');
}
public function class_students_secondary() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/class_students_secondary');
$this->load->view('includes/secondary/secondary_footer');
}
public function edit_student_info(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data = array(
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile'))
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('students', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function edit_student_info_a(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data = array(
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'birth_day' => $this->security->xss_clean($this->input->post('birth_day')),
'admission_year' => $this->security->xss_clean($this->input->post('admission_year')),
'admission_number' => $this->security->xss_clean($this->input->post('admission_number')),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'admitted_from' => $this->security->xss_clean($this->input->post('admitted_from')),
'living_place' => $this->security->xss_clean($this->input->post('living_place')),
'nationality' => $this->security->xss_clean($this->input->post('nationality')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile'))
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('students', $data);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function edit_staff_info(){
$reg_number=str_replace("-","",('0'.substr($this->security->xss_clean($this->input->post('mobile')), -10)));
$data = array(
'education' => $this->security->xss_clean($this->input->post('education')),
'skills' => $this->security->xss_clean($this->input->post('skills')),
'full_name' => $this->security->xss_clean($this->input->post('full_name')),
'gender' => $this->security->xss_clean($this->input->post('gender')),
'email' => $this->security->xss_clean($this->input->post('email')),
'mobile' => $this->security->xss_clean($this->input->post('mobile')),
'reg_number' => $reg_number,
'password' => MD5($this->security->xss_clean($this->input->post('password'))),
'password_reset' => $this->security->xss_clean($this->input->post('password')),
);
$this->db->where('reg_number', $reg_number);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->update('staffs', $data);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function change_class(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'academic_year' => date('Y'),
);
$this->db->select('class_level');
$this->db->select('stream');
$this->db->select('academic_year');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_class_a(){
$academic_year=$this->session->userdata('academic_year_a_level');
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'academic_year' =>$academic_year,
);
$this->db->select('class_level');
$this->db->select('stream');
$this->db->select('academic_year');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year',$academic_year);
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_stream(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'stream' => $this->security->xss_clean($this->input->post('stream'))
);
$this->db->select('stream');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_stream_a(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'stream' => $this->security->xss_clean($this->input->post('stream'))
);
$this->db->select('stream');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function change_schoolar_type(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type'))
);
$this->db->select('schoolar_type');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function change_schoolar_type_a(){
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'schoolar_type' => $this->security->xss_clean($this->input->post('schoolar_type'))
);
$this->db->select('schoolar_type');
$this->db->where('reg_number', $reg_number);
$this->db->where('category', $this->security->xss_clean($this->input->post('category')));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&& message=edited');
}
public function publish_monthly_results_o(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function undo_publish_monthly_results_o(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function publish_results_o(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function undo_publish_results_o(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('category','O');
$this->db->where('academic_year', date('Y'));
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_o_level?published');
}
public function publish_monthly_results_a(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function undo_publish_monthly_results_a(){
$month = base64_decode($_REQUEST['month']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('month', $month);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('ca', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function publish_results_a(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 1
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function undo_publish_results_a(){
$term = base64_decode($_REQUEST['term']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('term', $term);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->where('category','A');
$this->db->update('exam', $data1);
redirect('Secondary/publish_results_a_level?published');
}
public function dismiss_student(){
$reason=$this->security->xss_clean($this->input->post('reason'));
$reg_number =$this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'status' => 1
);
$data2 = array(
'school_id' =>$this->session->userdata('school_id'),
'reg_number' =>$reg_number,
'reason' => $reason
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->insert('dismissed_students', $data2);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&&message=edited');
}
public function dismiss_student_a(){
$reason=$this->security->xss_clean($this->input->post('reason'));
$reg_number =$this->security->xss_clean($this->input->post('reg_number'));
$data1 = array(
'status' => 1
);
$data2 = array(
'school_id' =>$this->session->userdata('school_id'),
'reg_number' =>$reg_number,
'reason' => $reason
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->insert('dismissed_students', $data2);
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&&message=edited');
}
public function restore_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_dismissed_a(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/students_details_secondary_a?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_secondary_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', date('Y'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/dismissed_students_o_level');
}
public function restore_a_level_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $this->session->userdata('academic_year_a_level'));
$this->db->update('classes', $data1);
$this->db->where('reg_number', $reg_number);
$this->db->delete('dismissed_students');
redirect('Secondary/dismissed_students_a_level');
}
public function dismiss_teacher(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 1,
'released_year'=>date('Y')
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_teacher_dismissed(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0,
'released_year'=>'--'
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/staffs_details_secondary?id='.base64_encode($reg_number).'&& message=edited');
}
public function restore_teacher_dismissedd(){
$reg_number = base64_decode($_REQUEST['id']);
$data1 = array(
'status' => 0,
'released_year'=>'--'
);
$this->db->select('status');
$this->db->where('reg_number', $reg_number);
$this->db->update('staffs', $data1);
redirect('Secondary/released_teachers_secondary?restored');
}
public function search_graduate_a() {
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
?>
A-LEVEL GRADUATES LIST IN
A-LEVEL GRADUATES LIST IN
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('class_level',6);
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
$this->db->where('reg_number',$rows->reg_number);
$gety=$this->db->get('students');
foreach($gety->result() as $row){
$i++;
?>
reg_number;?>
reg_number;?>
full_name;?>
full_name;?>
gender;?>
class_level.' - '.$rows->stream;?>
schoolar_type=='D'){
echo 'Day';
}elseif($rows->schoolar_type=='B'){
echo 'Boarding';
}else{
echo 'Undifined schoolar type, Pleas contact your admin';
}
?>
mobile;?>
email;?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
?>
O-LEVEL GRADUATES LIST IN
O-LEVEL GRADUATES LIST IN
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
S/N
Reg Number
Name
Gnder
Class
Schoolar
Mobile
Email
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('class_level',4);
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
$this->db->where('reg_number',$rows->reg_number);
$gety=$this->db->get('students');
foreach($gety->result() as $row){
$i++;
?>
reg_number;?>
reg_number;?>
full_name;?>
full_name;?>
gender;?>
class_level.' - '.$rows->stream;?>
schoolar_type=='D'){
echo 'Day';
}elseif($rows->schoolar_type=='B'){
echo 'Boarding';
}else{
echo 'Undifined schoolar type, Pleas contact your admin';
}
?>
mobile;?>
email;?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$this->db->where('bank',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN THIS DATE ()
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$this->db->where('bank',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN THIS DATE ()
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$rows->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date_received'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS RECEIVED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_received'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS RECEIVED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total= Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total= Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_deposited'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('date_deposited'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_deposited',$date);
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Paid for
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_deposited',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID ON
ACCOUNT LIST OF STUDENTS PAID ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID ON
ACCOUNT LIST OF STUDENTS PAID ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_received'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
?>
SCHOOL FEES PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_received'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
?>
SCHOOL FEES PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS RECEIVED ON
LIST OF STUDENTS PAYMENTS RECEIVED ON()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_deposited'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
?>
PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('month_deposited'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
?>
PAYMENTS RECORDS DEPOSITED ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month_deposited',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAYMENTS DEPOSITED ON
LIST OF STUDENTS PAYMENTS DEPOSITED ON
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month_deposited',$month);
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category=$this->security->xss_clean($this->input->post('category'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$payment_type);
$getys=$this->db->get('payments_type');
foreach($getys->result() as $r){
$tp=$r->name;
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('payment_type',$payment_type);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('payment_type',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('bank_type'));
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$payment_type);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
$bankk= $b->name;
}
?>
ACCOUNT PAYMENTS RECORDS ON
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo ' Tsh '.number_format($amount->amount);
}
}
?>
ACCOUNT LIST OF STUDENTS PAID IN
ACCOUNT LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('bank',$payment_type);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category='O';
?>
PAYMENTS RECORDS IN
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN
LIST OF STUDENTS PAID IN
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$payment_type= $this->security->xss_clean($this->input->post('payment_type'));
$category='A';
?>
PAYMENTS RECORDS IN
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('paid_year',$year);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN
LIST OF STUDENTS PAID IN
Full Name
Class Level
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$date= $this->security->xss_clean($this->input->post('date'));
$category='O';
$type_name='';
if($import=='All'){
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$gety=$this->db->get('transactions');
$this->db->where('category',$category);
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$date= $this->security->xss_clean($this->input->post('date'));
$category='A';
$type_name='';
if($import=='All'){
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('category',$category);
$this->db->where('date_issued',$date);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('date'));
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$this->db->where('bank', $bank->bank);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$gety=$this->db->get('transactions');
$this->db->where('category',$category);
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID IN THIS DATE ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date_issued',$date);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='O';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cas Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Class level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('class_level',$list);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('payment_type'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$category='A';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cas Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Class level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$this->db->where('category',$category);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('class_level',$list);
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
STUDENTS LIST PAID ON ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$import= $this->security->xss_clean($this->input->post('payment_type'));
$category='O';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->paid_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$import= $this->security->xss_clean($this->input->post('payment_type'));
$category='A';
if($import=='All'){
$type_name='';
$list= substr($import,0,1);
$type= substr($import,1,2);
if($type=='N'){
$type_name='NURSERY ';
}elseif($type=='P'){
$type_name='STANDARD ';
}else{
$type_name='FORM ';
}
?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Class Level
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number);
$this->db->where('academic_year', $ro->academic_year);
$get=$this->db->get('classes');
foreach($get->result() as $rows){
if($rows->category=='N'){
echo 'Nursery '.$ro->class_level;
}elseif($rows->category=='P'){
echo 'Standard '.$ro->class_level;
}else{
echo 'Form '.$ro->class_level.'-'.$rows->stream
;
}
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
STUDENTS PAYMENTS RECORDS ON
Payslip Amount db->distinct();
$this->db->select('bank');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $bank){
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('bank', $bank->bank);
$this->db->where('category',$category);
$getys=$this->db->get('transactions');
foreach($getys->result() as $bankamount){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$bank->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name.' Account = '.number_format($bankamount->amount).' ';
}
}
}
echo ' ';
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Payslip');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Payslip Total = Tsh '.number_format($amount->amount);
}
}
?>
Cash Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_method','Cash');
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Cash Total = Tsh '.number_format($amount->amount);
}
}
?>
Total Amount
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$gety=$this->db->get('transactions');
foreach($gety->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Grand Total = Tsh '.number_format($amount->amount);
}
}
?>
LIST OF STUDENTS PAID IN THIS YEAR ()
LIST OF STUDENTS PAID ON ()
Full Name
Payment Type
Payment Method
Bank
Amount Paid (Tsh)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('paid_year',$year);
$this->db->where('class_level',$list);
$this->db->where('category',$category);
$get=$this->db->get('transactions');
foreach($get->result() as $ro){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $ro->reg_number );
$gety=$this->db->get('students');
foreach($gety->result() as $row){
echo $row->full_name;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$ro->payment_type);
foreach($this->db->get('payments_type')->result() as $rows){
echo $rows->name;
}
?>
payment_method; ?>
bank==''||$ro->bank=='none'){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$ro->bank);
$get_bank=$this->db->get('banks');
foreach($get_bank->result() as $b){
echo $b->name;
}}
?>
amount); ?>
security->xss_clean($this->input->post('year'));
$category='O';
?>
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Required
Amount Paid
Amount Remained
Status
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
$reg_number=$name->reg_number;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '---';
}else{
echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
echo number_format($total_required-$paid);
}elseif($total_required==$paid){
echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
echo 'Complete';
}else{
echo 'Not complete';
}
?>
security->xss_clean($this->input->post('year'));
$category='A';
?>
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
STUDENTS PAYMENTS RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Required
Amount Paid
Amount Remained
Status
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
$reg_number=$name->reg_number;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level.'-'.$row->stream;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rows){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$rows->payer_id);
$this->db->where('payment_id',$rows->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
echo '---';
}else{
echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
echo number_format($total_required-$paid);
}elseif($total_required==$paid){
echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
echo 'Complete';
}else{
echo 'Not complete';
}
?>
security->xss_clean($this->input->post('amount')));
$category='O';
if($amount=='' || $amount==0){
echo 'Fill Amount';
}else{
$year= date('Y');
?>
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Paid
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('category',$category);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid<$amount){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level;
}
?>
security->xss_clean($this->input->post('amount')));
$category='A';
if($amount=='' || $amount==0){
echo 'Fill Amount';
}else{
$year= $this->session->userdata('academic_year_a_level');
?>
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
STUDENTS LIST PAID BELOW Tsh. RECORDS FOR ACADEMIC YEAR
Full Name
Class Level
Amount Paid
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){
$paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$this->db->where('category',$category);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid<$amount){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
echo $name->full_name;
}
?>
category=='N'){
echo 'Nursery '.$row->class_level;
}elseif($row->category=='P'){
echo 'Standard '.$row->class_level;
}else{
echo 'Form '.$row->class_level.'-'.$row->stream;
}
?>
security->xss_clean($this->input->post('year'));
$category='O';
?>
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
Total Number of Students
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$count=$this->db->count_all_results('classes');
echo $count;
?>
Total Amount Required
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get=$this->db->get('payers');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$row->payment_id);
$fee_type=$this->db->get('payments_type');
foreach($fee_type->result() as $ro){
$name=$ro->name;
}
if($row->schoolars_type==2){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt1=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_fee=$this->db->get('register_fees');
foreach($get_fee->result() as $rowf){
$total_amount1=$rowf->amount*$countt1;
// echo 'Total= '.number_format($total_amount1).' ';
// echo 'Amount = '.$rowf->amount.' Total= '.$total_amount1.' '. $name.' |'. $row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->students_type.' '.$row->schoolars_type.' both schoolar type = '.$countt1.' ';
$sum+= $total_amount1;
}
}else{
$total_amount2=0;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('schoolar_type',$row->schoolars_type);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt2=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$total_amount2=$rowff->amount*$countt2;
// echo ' Total= '.number_format($total_amount2).' '.' ';
// echo 'Amount = '.$rowff->amount.' Total= '.$total_amount2.' '. $name.' |'.$row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->schoolars_type.' schoolar ='.$countt2.' ';
$sum1+= $total_amount2;
}
}
}
$required=$sum+ $sum1;
echo 'Tsh '. number_format(($required)).' There is something to do';
?>
Amount Paid
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
foreach($this->db->get('transactions')->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Tsh '.number_format($amount->amount);
}
$paid_amount=$amount->amount;
}
?>
Amount Remained
$paid_amount){
echo 'Tsh '.number_format($required-$paid_amount);
}elseif($required=$paid_amount){
echo '---';
}else{
echo '---';
}
?>
security->xss_clean($this->input->post('year'));
$category='A';
?>
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
GENERAL PAYMENTS REPORTS FOR ACADEMIC YEAR
Total Number of Students
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$count=$this->db->count_all_results('classes');
echo $count;
?>
Total Amount Required
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get=$this->db->get('payers');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$row->payment_id);
$fee_type=$this->db->get('payments_type');
foreach($fee_type->result() as $ro){
$name=$ro->name;
}
if($row->schoolars_type==2){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt1=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_fee=$this->db->get('register_fees');
foreach($get_fee->result() as $rowf){
$total_amount1=$rowf->amount*$countt1;
// echo 'Total= '.number_format($total_amount1).' ';
// echo 'Amount = '.$rowf->amount.' Total= '.$total_amount1.' '. $name.' |'. $row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->students_type.' '.$row->schoolars_type.' both schoolar type = '.$countt1.' ';
$sum+= $total_amount1;
}
}else{
$total_amount2=0;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('status',0);
$this->db->where('class_level',$row->class_level);
$this->db->where('schoolar_type',$row->schoolars_type);
$this->db->where('category',$row->students_type);
$this->db->where('academic_year',$year);
$countt2=$this->db->count_all_results('classes');
//selecting from the register fees table
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$row->payer_id);
$this->db->where('payment_id',$row->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$total_amount2=$rowff->amount*$countt2;
// echo ' Total= '.number_format($total_amount2).' '.' ';
// echo 'Amount = '.$rowff->amount.' Total= '.$total_amount2.' '. $name.' |'.$row->payment_id.' '.$row->payer_id.' '.$row->class_level.' '.$row->schoolars_type.' schoolar ='.$countt2.' ';
$sum1+= $total_amount2;
}
}
}
$required=$sum+ $sum1;
echo 'Tsh '. number_format(($required)).' There is something to do';
?>
Amount Paid
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
foreach($this->db->get('transactions')->result() as $amount){
if($amount->amount=='' || $amount->amount==0){
echo '---';
}else{
echo 'Tsh '.number_format($amount->amount);
}
$paid_amount=$amount->amount;
}
?>
Amount Remained
$paid_amount){
echo 'Tsh '.number_format($required-$paid_amount);
}elseif($required=$paid_amount){
echo '---';
}else{
echo '---';
}
?>
security->xss_clean($this->input->post('class_level'));
$month= $this->security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
$category='O';
$month_name;
$this->db->where('month_id', $month);
$gett=$this->db->get('secondary_months');
foreach($gett->result() as $rows){
$month_name=$rows->name;
}
?>
FORM MONTHLY TEST ()
FORM MONTHLY TEST
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type','O');
$get=$this->db->get('grading_method');
foreach($get->result() as $row){
if($row->grading=='Average'){
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$number_of_subjects=0;
$sum_of_marks=0;
$average_of_marks=0;
echo $row_reg->reg_number.'';
echo 'Average Calculations'.' ';
//finding subjects which are included in calculations
$this->db->where('class_level',$class);
$this->db->where('students_type', $category);
$this->db->where('school_id', $this->session->userdata('school_id'));
$gett= $this->db->get('subjects_calculations');
foreach($gett->result() as $rowt){
$this->db->where('subject_id',$rowt->subject_id);
$this->db->where('school_id', $this->session->userdata('school_id'));
$getf= $this->db->get('general_subjects');
foreach($getf->result() as $rowf){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $rowt->subject_id);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$number_of_subjects++;
$sum_of_marks=$sum_of_marks+$row_ca->mark;
echo $rowt->subject_id.' = '.$rowf->subject_name.' = ' .$row_ca->mark.' ';
}
}
}
$average_of_marks=($sum_of_marks/$number_of_subjects);
$average_of_marks=round($average_of_marks,2);
echo 'Number of subjects attempted = '.$number_of_subjects.' Sum of marks = '.$sum_of_marks.' Average = '.$average_of_marks.' ';
}
echo 'Number of students = '.$number_of_sudents;
}elseif($row->grading=='Division'){
echo 'Division calculations';
}elseif($row->grading=='GPA'){
echo 'GPA calculations';
}else{
echo 'Undifined calculations';
}
}
?>
security->xss_clean($this->input->post('class_level'));
$mid_term= $this->security->xss_clean($this->input->post('mid_term'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
?>
STANDARD MID-TERM TEST ( OF TERM )
STANDARD MID-TERM TEST ( OF TERM )
security->xss_clean($this->input->post('class_level'));
$term= $this->security->xss_clean($this->input->post('term'));
$year= $this->security->xss_clean($this->input->post('academic_year'));
?>
STANDARD TERM RESULTS
STANDARD TERM RESULTS
security->xss_clean($this->input->post('date'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
if($income_type=='All'){?>
REVENUE COLLECTED ON
db->distinct();
$this->db->select('income');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('revenue');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$row->income);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$row->income);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('income_id',$income_type);
$gety=$this->db->get('income');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
REVENUE COLLECTED ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('income',$income_type);
$gets=$this->db->get('revenue');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date',$date);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('date'));
$date1= $this->security->xss_clean($this->input->post('date1'));
$income_type= $this->security->xss_clean($this->input->post('income_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('date >=', $date);
$this->db->where('date <=', $date1);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
if($expenses_type=='All'){?>
EXPENDITURES ON
db->distinct();
$this->db->select('expenditure');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$get=$this->db->get('expenditures');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$row->expenditure);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
echo $t->name;
} ?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$row->expenditure);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
security->xss_clean($this->input->post('month'));
$year= $this->security->xss_clean($this->input->post('year'));
$expenses_type= $this->security->xss_clean($this->input->post('expenses_type'));
$name='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('expenses_id',$expenses_type);
$gety=$this->db->get('expenses');
foreach($gety->result() as $t){
$name= $t->name;
}
?>
EXPENDITURES ON
TOTAL
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
//$this->db->where('month',$month);
$this->db->where('year',$year);
$this->db->where('expenditure',$expenses_type);
$gets=$this->db->get('expenditures');
foreach($gets->result() as $r){
echo 'Tsh '.number_format($r->amount);
}
?>
session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/reports_settings');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->db->like('name',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',3);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/reports_settings');
$this->load->view('includes/secondary/secondary_footer');
}else{
redirect('Private_area');
}
}
}
}
public function insert_insrtuctions(){
for($k=0; $k<=10;$k++){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$this->security->xss_clean($this->input->post('students_type')));
$this->db->where('class_level',$this->security->xss_clean($this->input->post('class_level')));
$this->db->where('term',$this->security->xss_clean($this->input->post('term')));
$this->db->where('academic_year',$this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('instructions',$this->security->xss_clean($this->input->post('instructions'.$k)));
$count=$this->db->count_all_results('instruction_reports');
if($count>0 || $this->security->xss_clean($this->input->post('instructions'.$k))==''){
continue;
}else{
$data1 = array(
'school_id' => $this->session->userdata('school_id'),
'class_level' =>$this->security->xss_clean($this->input->post('class_level')),
'students_type'=>$this->security->xss_clean($this->input->post('students_type')),
'instructions' => $this->security->xss_clean($this->input->post('instructions'.$k)),
'academic_year' => $this->security->xss_clean($this->input->post('academic_year')),
'term' => $this->security->xss_clean($this->input->post('term'))
);
$this->db->insert('instruction_reports', $data1);
}
}
redirect('Secondary/reports_settings?sent');
}
public function user_data_submit_instructions() {
$academic_year='';
$posted_data=$this->input->post('class_level');
$class_level=substr($posted_data,0,1);
$students_type=substr($posted_data,1,2);
$class_name=$this->input->post('class_name');
$term=$this->input->post('term');
if($students_type=='A'){
$academic_year=$this->session->userdata('academic_year_a_level');
}else{
$academic_year=date('Y');
}
//echo $students_type;exit();
$this->db->where('level',$class_level);
$this->db->where('students_type',$students_type);
$get=$this->db->get('class_levels');
foreach($get->result() as $ro){?>
db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('id',$id);
$this->db->delete('instruction_reports');
redirect('Secondary/reports_settings?deleted');
}
public function user_data_get_instructions() {
$academic_year='';
$posted_data=$this->input->post('class_level');
$class_level=substr($posted_data,0,1);
$students_type=substr($posted_data,1,2);
$class_name=$this->input->post('class_name');
$term=$this->input->post('term');
//echo $students_type;exit();
if($students_type=='A'){
$academic_year=$this->session->userdata('academic_year_a_level');
}else{
$academic_year=date('Y');
}
$this->db->where('level',$class_level);
$this->db->where('students_type',$students_type);
$get=$this->db->get('class_levels');
foreach($get->result() as $ro){?>
Instructions report To name?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$students_type);
$this->db->where('class_level',$class_level);
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$get=$this->db->get('instruction_reports');
foreach($get->result() as $ros){
$i++;
?>
'.$i.'. '.$ros->instructions ?>
Delete
input->post('password1');
$pass2 = $this->input->post('password2');
if ($pass1 == $pass2) {
$pass = $this->User_model->check_password1();
if ($pass > 0) {
$pass = $this->input->post('password');
$data1['password'] = MD5($pass);
if ($_POST) {
$this->User_model->change_passwords1();
$this->User_model->change_passwords_reset1();
redirect('Secondary?Changed');
} else {
redirect('Secondary');
}
} else {
redirect('Secondary?Error');
}
} else {
redirect('Secondary?Error1');
}
}
//function to logout and destroy sessions
public function logout() {
//finding url
$url='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$get=$this->db->get('schools');
foreach($get->result() as $row){
$url=$row->url;
}
if($this->session->userdata('type')=='Admin'){
$data = ['school_reg_number', 'school_reg_number'];
$this->session->unset_userdata($data);
if($url==''){
//redirecting to normal page
redirect('Welcome/login');
}else{
redirect('Welcome/login/'.$url);
}
}else{
$data = ['reg_number', 'reg_number'];
$this->session->unset_userdata($data);
if($url==''){
//redirecting to normal page
redirect('Welcome/login');
}else{
redirect('Welcome/login/'.$url);
}
}
}
}
PK ! tr r Insert_payments_secondary_a.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
//this function redirecting different pages after users loged in
public function index() {
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
}
public function edit_payments(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$data= array(
'amount'=>str_replace(',', '', $this->security->xss_clean($this->input->post('amount')))
);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('school_receipt', $this->security->xss_clean($this->input->post('receipt_number')));
$this->db->update('transactions', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
public function edit_payments_required(){
$reg_number=$this->security->xss_clean($this->input->post('reg_number'));
$academic_year=$this->security->xss_clean($this->input->post('academic_year'));
$amount_to_pay=$this->security->xss_clean($this->input->post('amount_to_pay'));
$payment_type=$this->security->xss_clean($this->input->post('payment_type'));
$school_id= $this->session->userdata('school_id');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$count=$this->db->count_all_results('reduced_payments');
if($count>0){
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('payment_id', $payment_type);
$this->db->where('academic_year', $academic_year);
$this->db->delete('reduced_payments');
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}else{
$data= array(
'reg_number'=>$reg_number,
'academic_year'=>$academic_year,
'school_id'=>$school_id,
'payment_id'=>$payment_type,
'amount'=>str_replace(',', '', $amount_to_pay)
);
$this->db->insert('reduced_payments', $data);
redirect('Secondary/students_details_secondary?id='.base64_encode($reg_number));
}
}
public function delete_transaction(){
$date=base64_decode($_GET['d']);
$reg_number=base64_decode($_GET['id']);
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('reg_number', $reg_number);
$this->db->where('date_inserted', $date);
$this->db->delete('transactions');
redirect('Secondary/enter_payments_secondary_a');
}
public function send_payments(){
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
if(isset($_POST)){
//note C == Current and D==Debt
$reason='';
$payments_type='';
if($this->security->xss_clean($this->input->post('payment_type'))=='D'){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('name', 'School Fees');
$this->db->limit(1);
$get=$this->db->get('payments_type');
foreach($get->result() as $ry){
$payments_type=$ry->payment_id;
}
$reason='D';
$month_change=0;
foreach($this->db->get('a_level_month_change')->result() as $row){
$month_change=$row->month;
}
$month = date('m');
if ($month >= $month_change) {
$academic_year = ((date('Y'))-1) . "-" . ((date('Y') + 1)-1);
} else {
$academic_year = ((date('Y') - 1)-1) . "-" . (date('Y')-1);
}
}else{
$payments_type=$this->security->xss_clean($this->input->post('payment_type'));
$academic_year = $this->security->xss_clean($this->input->post('year'));
$reason='C';
}
///////end to set if is debt of current charges payements
$month = $this->input->post('date_deposited');
$monthNum = substr($month,3,2);
$dateObj = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F');
$month1 = $this->input->post('date_received');
$monthNum1 = substr($month1,3,2);
$dateObj1 = DateTime::createFromFormat('!m', $monthNum1);
$monthName1 = $dateObj1->format('F');
$this->db->where('school_id', $this->session->userdata('school_id'));
$this->db->where('amount', str_replace(',', '', $this->security->xss_clean($this->input->post('amount_posted'))));
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('date_deposited', $this->security->xss_clean($this->input->post('date_received')));
$this->db->where('payment_type', $payments_type);
$this->db->where('bank', $this->security->xss_clean($this->input->post('bank')));
//$this->db->where('round', $round);
$this->db->where('date_issued', $this->security->xss_clean($this->input->post('date_deposited')));
$c = $this->db->count_all_results('transactions');
//if($c < 1){
$issuer=$session_reg_number;
date_default_timezone_set('Africa/Nairobi');
$date_issued=$this->security->xss_clean($this->input->post('date_deposited'));
$date_inserted= date("l jS \of F Y ");
$reg_number = $this->security->xss_clean($this->input->post('reg_number'));
$school_type= $this->security->xss_clean($this->input->post('school_type'));
$student_category= substr($reg_number,0,1);
$class_level= $this->security->xss_clean($this->input->post('classlevel'));
//$stream= $this->security->xss_clean($this->input->post('stream'));
$data = array(
'school_id' => $this->session->userdata('school_id'),
'reg_number' => $reg_number,
'category' => 'A',
'class_level' => $class_level,
//'stream' => $stream,
'payment_type' => $payments_type,
'bank' => $this->security->xss_clean($this->input->post('bank')),
'payment_method' => $this->security->xss_clean($this->input->post('payment_method')),
'amount' => str_replace(',', '', $this->security->xss_clean($this->input->post('amount_posted'))),
'month' => $monthName,
'month_deposited'=>$monthName1,
'date_inserted'=>date("l jS \of F Y "),
'date_deposited'=> $this->security->xss_clean($this->input->post('date_received')),
'academic_year'=>$academic_year,
'paid_year'=>date('Y'),
'school_receipt'=>"R".time(),
'date_issued'=>$date_issued,
'issuer'=>$issuer,
'reason'=>$reason
);
if($this->db->insert('transactions', $data)){
echo "Data Saved Successfully";
}else{
echo "Error: Something went wrong, data not saved try again";
}
}
}
public function reload_payments(){
// $data=array(
// 'school_id'=>$this->session->userdata('school_id')
// );
// $this->db->insert('test',$data);
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->order_by('id','DESC');
$this->db->where('school_id',$this->session->userdata('school_id'));
$get = $this->db->get('transactions');
foreach($get->result() as $pay){?>
db->where('reg_number',$pay->reg_number);
$st = $this->db->get('students');
$student = '';
foreach($st->result() as $std){
$student = $std->full_name;
echo $student;
}?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$getf=$this->db->get('classes');
foreach($getf->result() as $rt){
echo 'FORM '.$rt->class_level.' - '.$rt->stream;
}
?>
db->select_sum('amount');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_amount = $this->db->get('transactions');
foreach($get_amount->result() as $pay_amount){
echo number_format($pay_amount->amount);
}?>
db->distinct();
$this->db->select('payment_method');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_pp = $this->db->get('transactions');
foreach($get_pp->result() as $pay_pp){
echo $pay_pp->payment_method.', ';
}?>
db->distinct();
$this->db->select('bank');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_pb = $this->db->get('transactions');
foreach($get_pb->result() as $pay_pb){
if($pay_pb->bank=='none' || $pay_pb->bank==''){
echo '---';
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('bank_id',$pay_pb->bank);
$gety=$this->db->get('banks');
foreach($gety->result() as $tt){
echo $tt->name;
}
}
}?>
db->distinct();
$this->db->select('date_issued');
$this->db->where('reg_number',$pay->reg_number);
$this->db->where('date_inserted', date("l jS \of F Y "));
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_ppd = $this->db->get('transactions');
foreach($get_ppd->result() as $pay_ppd){
echo $pay_ppd->date_issued.' ';
}?>
"> Delete
" class="pull-right"> Print
db->where('school_id',$this->session->userdata('school_id'));
$this->db->like('full_name', $this->input->post('name'),"BOTH");
$this->db->limit(10);
$q = $this->db->get('students');
foreach($q->result() as $st){
$academic_year =$this->input->post('year');
$round=$this->input->post('round');
$this->db->where('academic_year', $academic_year);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number', $st->reg_number);
$this->db->where('status', 0);
$this->db->limit(1);
$query = $this->db->get('classes');
foreach ($query->result() as $rows) {
$this->db->where('reg_number', $rows->reg_number);
$query = $this->db->get('students');
foreach ($query->result() as $rowws) {
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year', $academic_year);
$querry = $this->db->get('classes');
foreach ($querry->result() as $row_amount) {
$reg = $rowws->reg_number;
$sch_type = $row_amount->schoolar_type;
$cat = $row_amount->category;
//$pay_type = $row_amount->payment_type;
$year = $row_amount->academic_year;
}
?>
full_name; ?>
class_level . "-" . $rows->stream.'';
?>
-- Select --
Payslip
Cash
-- Select --
None
db->where('school_id',$this->session->userdata('school_id'));
$get=$this->db->get('banks');
foreach($get->result() as $t){?>
name; ?>
-- Select --
db->get('a_level_month_change')->result() as $row){
$month_change=$row->month;
}
$month = date('m');
if ($month >= $month_change) {
$last_year = ((date('Y'))-1) . "-" . ((date('Y') + 1)-1);
} else {
$last_year = ((date('Y') - 1)-1) . "-" . (date('Y')-1);
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year', $last_year);
$count_r=$this->db->count_all_results('register_fees');
if($count_r==0){?>
Debt
db->distinct();
$this->db->select('academic_year');
$this->db->not_like('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('reg_number',$reg_number);
$gety=$this->db->get('classes');
foreach($gety->result() as $r){
$year=$r->academic_year;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('status',0);
$get=$this->db->get('classes');
foreach($get->result() as $row){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('reg_number',$row->reg_number);
foreach($this->db->get('students')->result() as $name){
//echo $name->full_name;
$reg_number=$name->reg_number;
}
?>category=='N'){
//echo 'Nursery '.$row->class_level.'- '.$year;
}elseif($row->category=='P'){
//echo 'Standard '.$row->class_level.'- '.$year;
}else{
//echo 'Form '.$row->class_level.'- '.$year;
}
?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
// $this->db->where('schoolars_type',$row->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $debt){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$check1=$this->db->count_all_results('reduced_payments');
if($check1>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$debt->payer_id);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowff){
$required1 = $required1+$rowff->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowff->amount).' ';
}
}
}
/// finding amounts for different schoolars type
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$row->class_level);
$this->db->where('students_type',$row->category);
$this->db->where('schoolars_type',$row->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $debt){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$check2=$this->db->count_all_results('reduced_payments');
if($check2>0){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('reduced_payments');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}else{
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('payer_id',$debt->payer_id);
$this->db->where('payment_id',$debt->payment_id);
$get_feee=$this->db->get('register_fees');
foreach($get_feee->result() as $rowffs){
$required2 = $required2 + $rowffs->amount;
// echo 'Payer id = '. $rows->payer_id.', schoolar type = '.$rows->schoolars_type.' Amount ='.number_format($rowffs->amount).' ';
}
}
}
$total_required=$required1+$required2;
// echo number_format($total_required);
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
if($paid==0 || $paid==''){
// echo '---';
}else{
// echo number_format($paid);
}
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required>$paid){
$remained=$total_required-$paid;
//echo number_format($total_required-$paid);
}elseif($total_required==$paid){
$remained=0;
// echo '---';
}
?>
db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$row->reg_number);
$get_trans=$this->db->get('transactions');
foreach($get_trans->result() as $paid_amount){
$paid=$paid_amount->amount;
}
if($total_required<$paid){
// echo 'Complete';
}else{
// echo 'Not complete';
}
?>
$paid_for_years){?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$rows->class_level);
$this->db->where('students_type',$rows->category);
$this->db->where('schoolars_type',$rows->schoolar_type);
$this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rowss){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rowss->payment_id);
$this->db->where('payment_id',$rowss->payment_id);
$this->db->order_by('payment_id','asc');
$gets=$this->db->get('payments_type');
foreach($gets->result() as $t){?>
name; ?>
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('class_level',$rows->class_level);
$this->db->where('students_type',$rows->category);
$this->db->where('schoolars_type',$rows->schoolar_type);
// $this->db->where('schoolars_type',2);
$get=$this->db->get('payers');
foreach($get->result() as $rowsy){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('payment_id',$rowsy->payment_id);
$this->db->order_by('payment_id','asc');
$gett=$this->db->get('payments_type');
foreach($gett->result() as $tt){?>
name; ?>
full_name; ?>
class_level; ?>
stream; ?>
Save
PK ! "nK. Calculate_results_super.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
/*
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='PS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
*/
function myFieldSort($a, $b){
return $b['total'] - $a['total'];
}
function numhash($n) {
$value = ((0x0000FFFF & $n) << 16) + ((0xFFFF0000 & $n) >> 16);
if( ! $value){
//redirect('Login_controller');
}else{
return $value;
}
};
}
public function print_full_sheet_schools_report_best_subjects() {
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_schools_report_best_subjects');
$this->load->view('includes/uploading_footer');
}
public function subject_sheet_print() {
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/officer/subject_sheet_print');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_school_grade_report() {
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_school_grade_report');
$this->load->view('includes/uploading_footer');
}
public function index(){
}
public function view_single_mid_term_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_mid_term_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_mid_term_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/midterm_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_best_students_subjects_school() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_best_students_subjects_school');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_best_students_subjects_school');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_monthly_test() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_monthly_test');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_monthly_test');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_mid_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_mid_term');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_mid_term');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_term');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/export_term');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_monthly_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_monthly_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_monthly_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_term_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_term_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/view_single_term_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_monthly_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_mid_term_results_olevel() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/mid_term_result_single');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/mid_term_result_single');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports_olevel_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/mid_term_result_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('users/primary/mid_term_result_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/terminal_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports_olevel() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/olevel/mid_term_result_all');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/mid_term_result_all');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_mid_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_monthly_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/primary/print_all_stream_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function monthly_test(){
if($_POST){
$class = $this->input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$school= $this->session->userdata('school_id');
$this->db->where('region', $this->session->userdata('region'));
// $this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
$exam_status='';
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$exam_status = $rows->status;
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete',"DESC");
$this->db->order_by('average',"DESC");
//$this->db->order_by('gpa',"ASC");
//$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// if($category == 'A'){
// echo $row_sub->reg_number." ".$row_sub->total_marks." - ".$s." - ".$position." ".$str->stream."
";
// }
$tempo = $s;
$new = $row_sub->average;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
?>
input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$this->db->where('region', $this->session->userdata('region'));
//$this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('class_level',$class);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
?>
FORM
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
// $this->db->where('category',$category);
// $this->db->where('region_id',$region);
// $this->db->where('district_id',$district);
$this->db->where('exam_id',$exam_id);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
db->where('region_id',$region);
// $this->db->where('district_id',$district);
// $this->db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('division','I');
$count=$this->db->count_all_results('monthly_results');
echo 'I = '.$count.' , ';
## Finding division II
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','II');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'II = '.$count.' , ';
## Finding division III
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','III');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'III = '.$count.' , ';
## Finding division IV
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','IV');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'IV = '.$count.' , ';
## Finding division 0
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','0');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo '0 = '.$count;
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
View
input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
$candidate = $this->input->post('candidate');
$can='';
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
if($candidate=='PC'){
$can='Private Candidates';
}else{
$can='';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
//$this->db->where('region', $this->session->userdata('region'));
//$this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('class_level',$class);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
// $this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$new=$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('complete',$row_sub->complete);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete',"DESC");
$this->db->order_by('average',"DESC");
//$this->db->order_by('gpa',"ASC");
//$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
if($school=='SS5cb07974e47de'){
//echo $get_sub->num_rows();echo $school.' '.$str->stream;
//exit;
}
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('complete',$row_sub->complete);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
?>
db->where('group_id',$this->session->userdata('group_id'));
$get=$this->db->get('exam_groups');
foreach($get->result() as $rtt){
echo $rtt->name.' '. strtoupper($exam_name.' '.$can);
}
?>
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
Error Report
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
// $this->db->where('category',$category);
// $this->db->where('region_id',$region);
// $this->db->where('district_id',$district);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
db->where('region_id',$region);
// $this->db->where('district_id',$district);
// $this->db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('division','I');
$count=$this->db->count_all_results('monthly_results');
echo 'I = '.$count.' , ';
## Finding division II
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','II');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'II = '.$count.' , ';
## Finding division III
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','III');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'III = '.$count.' , ';
## Finding division IV
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','IV');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'IV = '.$count.' , ';
## Finding division 0
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','0');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo '0 = '.$count;
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
By Positions
Alphabetically
By Numbers
Subject Score Sheets
load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/primary/officer/subject_sheet');
$this->load->view('includes/secondary/secondary_footer');
}
public function subject_sheet_prints() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/subject_sheet_print');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_officers() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_officers');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_officers_alpha() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_officers_alpha');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_officers_number() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_officers_number');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools_report_best_subjectss() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_best_subjects');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools_report_best_subjects_deo() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_best_subjects_deo');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_officers_deo() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_officers_deo');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools() {
$exam_id = base64_decode($_GET['exam_id']);
$this->db->where('examination_id',$exam_id);
$ex = $this->db->get('examination');
foreach($ex->result() as $exam){
$distict = $exam->district;
$region = $exam->region;
if($distict == 0 && $region > 0){
## Huu mtihani ni wa REO
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools');
$this->load->view('includes/uploading_footer');
}else{
## Huu mtihani ni wa DEO au wa GROUP, sio shared
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_deo');
$this->load->view('includes/uploading_footer');
}
}
}
public function print_full_sheet_schools_report_gpa() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_gpa');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools_report_gpa_deo() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_gpa_deo');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools_report_best_students() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_best_students');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_schools_report_best_students_deo() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_schools_report_best_students_deo');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_school_grade_reports() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_school_grade_report');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_school_grade_report_deo() {
$this->load->view('includes/uploading_header');
$this->load->view('users/superuser/officer/print_full_sheet_school_grade_report_deo');
$this->load->view('includes/uploading_footer');
}
public function monthly_test_officer_reo(){
if($_POST){
$class = $this->input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
$candidate = $this->input->post('candidate');
$can='';
//echo $candidate;exit;
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}elseif($class==7){
$class_name='VII';
}
if($candidate=='PC'){
$can='Private Candidates';
}else{
$can='';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$status=0;
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$this->db->where('examination_id',$exam_id);
$this->db->where('class_level', $class);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
}
if($count==0){
echo '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
if($status == 0){ ## Only sort the results which are not published.
}
if($this->session->userdata('group_id')>0){?>
S/NO
C/NUMBER
SCHOOL
STUDENTS
AVERAGE
POSITION
VIEW MORE
db->where('group_id',$this->session->userdata('group_id'));
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
students?>
average;?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
0){ echo "REGIONAL - "; }else{
$this->db->where('id',$rows->district);
foreach($this->db->get('regions_distrincts')->result() as $dd){
echo strtoupper($dd->district_name." - ");
}
} echo strtoupper($exam_name).' '.$can;
?>
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
0){
?>
DISTRICT PERFORMANCE
DATA ENTRY REPORT
session->userdata('district')){
?>
Error Report
session->userdata('district') && $region > 0 || $this->session->userdata('district') == 0 && $region > 0){
?>
S/NO
C/NUMBER
SCHOOL
STUDENTS
AVERAGE
GPA
POSITION
VIEW MORE
db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
// $this->db->where('district_id',$this->session->userdata('district'));
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
average;?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
0){
?>
session->userdata('district') > 0){
?>
DISTRICT REPORTS
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
session->userdata('district') == 0){
?>
S/NO
Distrct
VIEW MORE
session->userdata('district') > 0){
$this->db->where('id',$this->session->userdata('district'));
}
$this->db->where('regions_id',$region);
$get_results=$this->db->get('regions_distrincts');
foreach($get_results->result() as $results){ $i++;?>
district_name;
?>
View
S/NO
C/NUMBER
SCHOOL
STUDENTS
AVERAGE
GPA
DP
RP
VIEW MORE
db->where('district_id',$this->session->userdata('district'));
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('district_id',$this->session->userdata('district'));
$this->db->where('candidate',$candidate);
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
db->where('district_id',$this->session->userdata('district'));
$this->db->select('AVG(average) average');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get = $this->db->get('monthly_results');
foreach($get->result() as $ag){
$avg = round($ag->average,2);
$data = array('average'=>$avg);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->update('schools_position',$data);
echo $avg;
}
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
district_position; ?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
### SORTING STUDENTS ###############################################
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('mid_term_subjects_results');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('mid_term_subjects_results');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('mid_term_subjects_results');
$i=0;
$tempo = 0;
$position = 1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_subjects_results');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('mid_term_subjects_results',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('mid_term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('mid_term_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('mid_term_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('mid_term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('mid_term_results',$data);
}
}
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','ASC');
$get_link=$this->db->get('mid_term_results');
foreach($get_link->result() as $link){?>
stream; ?>
Name
Stream
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report-Kisw
Report-Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','ASC');
$get_link=$this->db->get('mid_term_results');
foreach($get_link->result() as $link){?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report Kisw
Report Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
#################### SORTING STUDENTS ##############################
## sorting subjects in term_subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('term_subjects_results');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('term_subjects_results');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('term_subjects_results');
$i=0;
$tempo = 0;
$position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_subjects_results');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('term_subjects_results',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('term_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('term_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('term_results',$data);
}
}
## +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
stream; ?>
FORM
Name
Stream
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report - Kisw
Report - Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
More (Kiswahili)
More (English)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
#################### SORTING STUDENTS ##############################
## sorting subjects in exam
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('exam');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('exam');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('exam');
$i=0;
$tempo = 0;
$position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('exam');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('exam',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('consolidated_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
}
## +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS (TERM I EXAM WITHOUT CA)';
}else{
$termm='ANNUAL EXAMINATIONS (TERM II EXAM WITHOUT CA';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('term_results');
foreach($get_link->result() as $link){?>
stream; ?>
Name
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report Kis
Report Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('consolidated_results');
foreach($get_link->result() as $link){?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Repport Kis
Repport Eng)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$reg_number = $this->input->post('reg_number');
$month = $this->input->post('month');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MONTHLY TEST - FORM
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('monthly_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
Anaglia zaidi...
View more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
STUDENT RESULTS FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia Zaid kwa Kiswahili
More (English)
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
function myFieldSort($a, $b){
return $b['total'] - $a['total'];
}
function numhash($n) {
$value = ((0x0000FFFF & $n) << 16) + ((0xFFFF0000 & $n) >> 16);
if( ! $value){
//redirect('Login_controller');
}else{
return $value;
}
};
}
public function print_full_sheet_schools_report_best_subjects() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_schools_report_best_subjects');
$this->load->view('includes/uploading_footer');
}
public function subject_sheet_print() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/officer/subject_sheet_print');
$this->load->view('includes/uploading_footer');
}
public function print_full_sheet_school_grade_report() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_school_grade_report');
$this->load->view('includes/uploading_footer');
}
public function index(){
}
public function view_single_mid_term_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_mid_term_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_mid_term_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function midterm_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/midterm_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_best_students_insubjects() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_best_students_insubjects');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_best_students_subjects_school() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_best_students_subjects_school');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_best_students_subjects_school');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_subject_grade_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_subject_grade_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_monthly_test() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_monthly_test');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_monthly_test');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_mid_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_mid_term');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_mid_term');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function export_term() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_term');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/export_term');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_monthly_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_monthly_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_monthly_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_term_results() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_term_results');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_term_results');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_monthly_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function view_single_mid_term_results_olevel() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/mid_term_result_single');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/mid_term_result_single');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports_olevel_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/mid_term_result_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('users/secondary/mid_term_result_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_full_sheet_class() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_full_sheet_class');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function terminal_full_sheet_stream() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/terminal_full_sheet_stream');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_mid_term_reports_olevel() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/olevel/mid_term_result_all');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/mid_term_result_all');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_mid_term_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_mid_term_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function print_all_stream_monthly_reports() {
$type=$this->session->userdata('type');
$title=$this->session->userdata('title');
if($type=='Admin' || $title=='Manager'){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
$this->db->like('name',$title);
$this->db->or_like('assistant',$title);
$get=$this->db->get('general_accounts');
foreach($get->result() as $row){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('activity_id',2);
$this->db->where('account_id',$row->account_id);
$count=$this->db->count_all_results('access_levels');
if($count>0){
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/print_all_stream_monthly_reports');
$this->load->view('includes/uploading_footer');
}else{
redirect('Private_area');
}
}
}
}
public function monthly_test(){
if($_POST){
$class = $this->input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$school= $this->session->userdata('school_id');
$this->db->where('region', $this->session->userdata('region'));
// $this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
$exam_status='';
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$exam_status = $rows->status;
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete',"DESC");
$this->db->order_by('average',"DESC");
//$this->db->order_by('gpa',"ASC");
//$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// if($category == 'A'){
// echo $row_sub->reg_number." ".$row_sub->total_marks." - ".$s." - ".$position." ".$str->stream."
";
// }
$tempo = $s;
$new = $row_sub->average;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
?>
input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$school_report=0;
$this->db->where('region', $this->session->userdata('region'));
//$this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$school_report = $rows->school_report;
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('class_level',$class);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('district_id',$district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
?>
FORM
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
// $this->db->where('category',$category);
// $this->db->where('region_id',$region);
// $this->db->where('district_id',$district);
$this->db->where('exam_id',$exam_id);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
db->where('region_id',$region);
// $this->db->where('district_id',$district);
// $this->db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('category',$category);
$this->db->where('division','I');
$count=$this->db->count_all_results('monthly_results');
echo 'I = '.$count.' , ';
## Finding division II
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','II');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'II = '.$count.' , ';
## Finding division III
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','III');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'III = '.$count.' , ';
## Finding division IV
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','IV');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'IV = '.$count.' , ';
## Finding division 0
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('division','0');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo '0 = '.$count;
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
View
input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
$candidate = $this->input->post('candidate');
$can='';
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
if($candidate=='PC'){
$can='Private Candidates';
}else{
$can='';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
//$this->db->where('region', $this->session->userdata('region'));
//$this->db->where('district', $this->session->userdata('district'));
$this->db->where('category',$category);
$this->db->where('class_level',$class);
// $this->db->where('status', 1);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$school_report = $rows->school_report;
}
if($count==0){
ECHO '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('class_level',$class);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
//....................Upadting subjects positions in ca table----------------------------------------->
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('all_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
// $this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$new=$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('complete',$row_sub->complete);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('monthly_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete',"DESC");
$this->db->order_by('average',"DESC");
//$this->db->order_by('gpa',"ASC");
//$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
if($school=='SS5cb07974e47de'){
//echo $get_sub->num_rows();echo $school.' '.$str->stream;
//exit;
}
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('complete',$row_sub->complete);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
//$this->db->where('district_id',$district);
//$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
?>
db->where('group_id',$this->session->userdata('group_id'));
$get=$this->db->get('exam_groups');
foreach($get->result() as $rtt){
echo $rtt->name.' '. strtoupper($exam_name.' '.$can);
}
?>
PRINT FULL SHEET
PRINT BEST STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT BEST STUDENTS IN SUBJECTS
Error Report
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
// $this->db->where('category',$category);
// $this->db->where('region_id',$region);
// $this->db->where('district_id',$district);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$results->school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$count=$this->db->count_all_results('monthly_results');
echo $count;
?>
db->where('region_id',$region);
// $this->db->where('district_id',$district);
// $this->db->where('academic_year',$year);
// $this->db->where('month',$month);
// $this->db->where('class_level',$class);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('division','I');
$count=$this->db->count_all_results('monthly_results');
echo 'I = '.$count.' , ';
## Finding division II
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','II');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'II = '.$count.' , ';
## Finding division III
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','III');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'III = '.$count.' , ';
## Finding division IV
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','IV');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'IV = '.$count.' , ';
## Finding division 0
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','0');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo '0 = '.$count;
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
By Positions
Alphabetically
By Numbers
Subject Score Sheets
input->post('class_level');
$exam_id = $this->input->post('exam_id');
$category = $this->input->post('category');
$candidate = $this->input->post('candidate');
$can='';
//echo $candidate;exit;
if($class==6){
$class_name='VI';
}elseif($class==5){
$class_name='V';
}elseif($class==4){
$class_name='IV';
}elseif($class==3){
$class_name='III';
}elseif($class==2){
$class_name='II';
}elseif($class==1){
$class_name='I';
}
if($candidate=='PC'){
$can='Private Candidates';
}else{
$can='';
}
//echo $class. $exam_id.' '. $category; exit;
$month='';
$year='';
$status=0;
$region='';
$district='';
$exam_header='';
$exam_name='';
$monthName ='';
$school_report=0;
$this->db->where('examination_id',$exam_id);
$this->db->where('class_level', $class);
$gett=$this->db->get('examination');
$count=$gett->num_rows();
foreach($gett->result() as $rows){
$month=$rows->month;
$year=$rows->academic_year;
$region=$rows->region;
$district_exam=$rows->district;
$exam_header=$rows->heading;
$exam_name=$rows->exam_name;
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$status = $rows->status;
$school_report = $rows->school_report;
}
if($count==0){
echo '
NO RESULTS FOUND FOR YOUR SEARCH ';
}else{
if($status == 0){ ## Only sort the results which are not published.
}
if($this->session->userdata('group_id')>0){
?>
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
students;
?>
db->select('COUNT(division) as division_count, division');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->group_by('division');
$this->db->order_by('division','asc');
$count=$this->db->get('monthly_results');
$divI = $divII = $divIII = $divIV = $divO = 0;
foreach($count->result() as $div){
if($div->division == 'I'){
$divI = $div->division_count;
}elseif($div->division == 'II'){
$divII = $div->division_count;
}elseif($div->division == 'III'){
$divIII = $div->division_count;
}elseif($div->division == 'IV'){
$divIV = $div->division_count;
}elseif($div->division == '0'){
$divO = $div->division_count;
}
}
echo "I=".$divI.", II=".$divII.", III=".$divIII.", IV=".$divIV.", 0=".$divO;
?>
gpa==8 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
0){ echo "REGIONAL - "; }else{
$this->db->where('id',$rows->district);
foreach($this->db->get('regions_distrincts')->result() as $dd){
echo strtoupper($dd->english_name." - ");
}
} echo strtoupper($exam_name).' '.$can;
?>
FULL SHEET ALL SCHOOLS
FULL SHEET ABOVE 40 STUDENTS
FULL SHEET BELOW 40 STUDENTS
FULL SHEET GOVERNMENT SCHOOLS
FULL SHEET PRIVATE SCHOOLS
TOP TEN SCHOOLS
LAST TEN SCHOOLS
PRINT BEST TOP TEN STUDENTS
PRINT LAST TEN STUDENTS
PRINT BEST STUDENTS IN SUBJECTS
PRINT BEST TOP TEN BOYS STUDENTS
PRINT BEST TOP TEN GIRLS STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT DIVISIONS SUMMARY IN COMBINATIONS
0){
?>
DISTRICT PERFORMANCE
SUSPEND RESULTS
DATA ENTRY REPORT
session->userdata('district')){
?>
session->userdata('district') && $region > 0 || $this->session->userdata('district') == 0 && $region > 0){
?>
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
POSITION
VIEW MORE
db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
students;
?>
db->select('COUNT(division) as division_count, division');
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->group_by('division');
$this->db->order_by('division','asc');
$count=$this->db->get('monthly_results');
$divI = $divII = $divIII = $divIV = $divO = 0;
foreach($count->result() as $div){
if($div->division == 'I'){
$divI = $div->division_count;
}elseif($div->division == 'II'){
$divII = $div->division_count;
}elseif($div->division == 'III'){
$divIII = $div->division_count;
}elseif($div->division == 'IV'){
$divIV = $div->division_count;
}elseif($div->division == '0'){
$divO = $div->division_count;
}
}
echo "I=".$divI.", II=".$divII.", III=".$divIII.", IV=".$divIV.", 0=".$divO;
?>
gpa==8 ){
echo '---';
}else{
echo $results->gpa;
}
?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
0){
?>
session->userdata('district') > 0){
?>
DISTRICT REPORTS
FULL SHEET DISTRICT SCHOOLS
FULL SHEET ABOVE 40 STUDENTS
FULL SHEET BELOW 40 STUDENTS
FULL SHEET GOVERNMENT SCHOOLS
FULL SHEET PRIVATE SCHOOLS
TOP TEN SCHOOLS
LAST TEN SCHOOLS
PRINT BEST TOP TEN STUDENTS
PRINT LAST TEN STUDENTS
PRINT BEST STUDENTS IN SUBJECTS
PRINT BEST TOP TEN BOYS STUDENTS
PRINT BEST TOP TEN GIRLS STUDENTS
PRINT SUBJECTS RANKS
PRINT SUBJECTS GPA REPORT
PRINT SUBJECTS GRADE REPORT
PRINT DIVISIONS SUMMARY IN COMBINATIONS
session->userdata('district') == 0){
?>
S/NO
C/NUMBER
SCHOOL
STUDENTS
DIVISION SCORES
GPA
DP
RP
VIEW MORE
db->where('district_id',$this->session->userdata('district'));
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$get_results=$this->db->get('schools_position');
foreach($get_results->result() as $results){ $i++;?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_reg_number;
}?>
db->where('school_id',$results->school_id);
$get_s=$this->db->get('schools');
foreach($get_s->result() as $rs){
echo $rs->school_name;
}
?>
students;
?>
db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('category',$category);
$this->db->where('division','I');
$count=$this->db->count_all_results('monthly_results');
echo 'I = '.$count.' , ';
## Finding division II
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','II');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'II = '.$count.' , ';
## Finding division III
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','III');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'III = '.$count.' , ';
## Finding division IV
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','IV');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'IV = '.$count.' , ';
## Finding division 0
$this->db->where('school_id',$results->school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('division','0');
//$this->db->where('region_id',$region);
//$this->db->where('district_id',$district);
//$this->db->where('academic_year',$year);
//$this->db->where('month',$month);
//$this->db->where('class_level',$class);
//$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo '0 = '.$count;
?>
gpa==6 ){
echo '---';
}else{
echo $results->gpa;
}
?>
district_position; ?>
position; ?>
Positions
Alphabetically
Numbers
Subject Score Sheets
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
### SORTING STUDENTS ###############################################
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('mid_term_subjects_results');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('mid_term_subjects_results');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('mid_term_subjects_results');
$i=0;
$tempo = 0;
$position = 1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_subjects_results');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('mid_term_subjects_results',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('mid_term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('mid_term_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('mid_term_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('mid_term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('mid_term_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('mid_term_results',$data);
}
}
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','ASC');
$get_link=$this->db->get('mid_term_results');
foreach($get_link->result() as $link){?>
stream; ?>
Name
Stream
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report-Kisw
Report-Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','ASC');
$get_link=$this->db->get('mid_term_results');
foreach($get_link->result() as $link){?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report Kisw
Report Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
#################### SORTING STUDENTS ##############################
## sorting subjects in term_subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('term_subjects_results');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('term_subjects_results');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('term_subjects_results');
$i=0;
$tempo = 0;
$position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_subjects_results');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('term_subjects_results',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
// $this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
// $this->db->order_by('gpa',"ASC");
$this->db->order_by('average',"DESC");
$get_sub=$this->db->get('term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('average',$row_sub->average);
// $this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_results');
$i++;
if($i > 1){
if($new != $row_sub->average){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->average;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('term_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('term_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('term_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('term_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('term_results',$data);
}
}
## +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
stream; ?>
FORM
Name
Stream
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report - Kisw
Report - Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->order_by('stream','asc');
$get_link=$this->db->get('term_results');
$i=0;
foreach($get_link->result() as $link){
$i++;
?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
More (Kiswahili)
More (English)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$school = $this->session->userdata('school_id');
#################### SORTING STUDENTS ##############################
## sorting subjects in exam
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('exam');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position = 1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('exam');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('exam');
$i=0;
$tempo = 0;
$position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('exam');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
//echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";\
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('exam',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
//$this->db->where('status',0);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
## stream sorting
$this->db->distinct();
$this->db->select('stream');
//$this->db->where('status',0);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get = $this->db->get('consolidated_results');
foreach($get->result() as $str){
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('stream',$str->stream);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('average',"DESC");
$this->db->order_by('complete',"DESC");
$this->db->order_by('gpa',"ASC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('consolidated_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('stream',$str->stream);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('consolidated_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
// echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('consolidated_results',$data);
}
}
## +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS (TERM I EXAM WITHOUT CA)';
}else{
$termm='ANNUAL EXAMINATIONS (TERM II EXAM WITHOUT CA';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
RESULTS FORM
ALL STUDENTS
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('term_results');
foreach($get_link->result() as $link){?>
stream; ?>
Name
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Report Kis
Report Eng
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_link=$this->db->get('consolidated_results');
foreach($get_link->result() as $link){?>
FORM stream).' '.$year ?>
Name
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Stream Position
Class Position
Repport Kis
Repport Eng)
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('stream',$link->stream);
$get_results=$this->db->get('consolidated_results');
foreach($get_results->result() as $results){?>
reg_number;
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name);
}
?>
0 && $count2>0){?>
total_marks;?>
average;?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
division=='---'){
echo '---';
}else{
echo $results->point;
}
?>
division;?>
position;?>
all_position;?>
view...
view...
input->post('class_level');
$reg_number = $this->input->post('reg_number');
$month = $this->input->post('month');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MONTHLY TEST - FORM
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('monthly_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
Anaglia zaidi...
View more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$reg_number = $this->input->post('reg_number');
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
STUDENT RESULTS FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia Zaid kwa Kiswahili
More (English)
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Arrange_results_positions_o_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','O');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo 'Monthly Test';
//class positions
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_term = $this->db->get('monthly_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_month=$this->db->get('monthly_results');
foreach($get_month->result() as $row_month){
$class_position=0;
$month=$row_month->month;
// echo 'Month = '.$month.'
';
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_class=$this->db->get('monthly_results');
foreach($get_class->result() as $row_class){
//....................Upadting subjects positions in ca table----------------------------------------->
$class=$row_class->class_level;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$short_name='';
$sub_position=0;
$gpa='';
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->order_by('mark','desc');
$get_s=$this->db->get('ca');
foreach($get_s->result() as $row_s){
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('category','O');
$this->db->where('academic_year',$year);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->order_by('mark','desc');
$get_mark=$this->db->get('ca');
foreach($get_mark->result() as $row_mark){
$marks=$row_mark->mark;
//finding gpa for each subject for each student for each school
$this->db->where('school_id',$school);
$this->db->where('students_type','O');
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($marks) && round($marks)<=$row_grade->end_mark){
$grade1=$row_grade->grade;
$this->db->where('school_id',$school);
$this->db->where('students_type','O');
$this->db->where('grade',$grade1);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $row_point->point;
$gpa=$point;
}
}
}
$this->db->where('school_id',$school);
$this->db->where('subject_id',$row_sub->subject_id);
$get_short_name=$this->db->get('general_subjects');
foreach($get_short_name->result() as $row_short_name){
$short_name=trim($row_short_name->short_name);
}
$sub_position++;
$datad=array(
'position'=>$sub_position,
'gpa'=>$gpa,
'short_name'=>$short_name,
'grade'=>$grade1
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category','O');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('class_level',$class);
$count_entered= $this->db->count_all_results('ca');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','O');
$this->db->where('reg_number',$row_s->reg_number);
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->update('ca',$datad);
}else{
//
}
}
}
}
//....................Upadting students positions in monthly results table----------------------------------------->
$class=$row_class->class_level;
$class_position=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->order_by('point','asc');
$this->db->order_by('average','desc');
$this->db->order_by('total_marks','desc');
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$class_position++;
$data=array(
'all_position'=>$class_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->update('monthly_results',$data);
}else{
//
}
}
// ECHO '
';
}
}
}
//--------------------------------------------------------------------------------------------------------------//
}
}
}?>PK ! 8ߍ Pdf.phpnu [ load->library('pdf');
}
public function index(){
$html_content = "
This is sample PDF ";
}
}
PK ! zF% F% Register_olevel.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
require_once APPPATH."/third_party/PHPExcel.php";
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
public function index(){
$chool_name=$this->session->userdata('school_reg_number');
$namee= strtoupper(str_replace(array(':', '\\', '/', '*','.','-','_'),'',$chool_name));
$chool_id=$this->session->userdata('school_id');
$class_level_id = 0;
$msg = 'Record already exist.
';
$uploadedStatus = 0;
if ( isset($_POST["Submit"]) ) {
if ( isset($_FILES["file"])) {
//if there was an error uploading the file
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else {
if (file_exists($_FILES["file"]["name"])) {
unlink($_FILES["file"]["name"]);
}
$storagename = "./application/views/Excel_sheets/".$chool_id.'.xlsx';
move_uploaded_file($_FILES["file"]["tmp_name"], $storagename);
$uploadedStatus = 1;
}
} else {
echo "No file selected
";
}
}
$inputFileName = "./application/views/Excel_sheets/".$chool_id.'.xlsx';
try {
/// it will be your file name that you are posting with a form or can pass static name $_FILES["file"]["name"];
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
}
catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
$data = array();
$data2 = array();
$valid_student = 0;
$totalrows=$objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
$objWorksheet=$objPHPExcel->setActiveSheetIndex(0);
$allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
$invalid_gender=0;
$invalid_type=0;
$name = " ";
$data_saved=0;
$j=0;
for ($i=1; $i < $totalrows+1; $i++) {
$title_name = str_replace(" ","",$allDataInSheet[$i]['A']);
$title_name = strtoupper($title_name);
$title_gender = str_replace(" ","",$allDataInSheet[$i]['B']);
$title_gender = strtoupper($title_gender);
if($title_name != "FULLNAME" || $title_gender != "GENDER"){
if(!is_null($allDataInSheet[$i]["K"]) || strtoupper(trim($allDataInSheet[$i]["K"])) == "BOARDING" || strtoupper(trim($allDataInSheet[$i]["K"])) == "DAY" ){
# do nothing, it is the supportde entry.
}else{
$j++;
$invalid_type++;
$name.="
".$j." ".$allDataInSheet[$i]["A"];
}
if(!is_null($allDataInSheet[$i]["B"]) || strtoupper(trim($allDataInSheet[$i]["B"])) == "F" || strtoupper(trim($allDataInSheet[$i]["B"])) == "M" || strtoupper(trim($allDataInSheet[$i]["B"])) == "FEMALE" || strtoupper(trim($allDataInSheet[$i]["B"])) == "MALE" ){
# do nothing, it is the supportde entry.
}else{
$j++;
$invalid_gender++;
$name.="
".$j." ".$allDataInSheet[$i]["A"];
}
}
}
$data_saved=0;#usiifute hii variable;
$A=strtoupper(str_replace(' ','',$allDataInSheet[1]['A']));
$B=strtoupper(str_replace(' ','',$allDataInSheet[1]['B']));
$C=strtoupper(str_replace(' ','',$allDataInSheet[1]['C']));
$D=strtoupper(str_replace(' ','',$allDataInSheet[1]['D']));
$E=strtoupper(str_replace(' ','',$allDataInSheet[1]['E']));
$F=strtoupper(str_replace(' ','',$allDataInSheet[1]['F']));
$G=strtoupper(str_replace(' ','',$allDataInSheet[1]['G']));
$H=strtoupper(str_replace(' ','',$allDataInSheet[1]['H']));
$I=strtoupper(str_replace(' ','',$allDataInSheet[1]['I']));
$J=strtoupper(str_replace(' ','',$allDataInSheet[1]['J']));
$K=strtoupper(str_replace(' ','',$allDataInSheet[1]['K']));
if($A != "FULLNAME" || $B != "GENDER" || $C != "BIRTHDATE" || $D != "ADMITTEDFROM" || $E != "ADMISSIONNUMBER" || $F != "LIVINGPLACE" || $G != "NATIONALITY" || $H != "PARENTEMAIL" || $I != "PHONENUMBER" || $J != "STREAM" || $K != "SCHOLARTYPE"){
redirect('Secondary/register_students_o_level?format_error');
}else if($invalid_gender > 0 || $invalid_type > 0){
$b = base64_encode($name);
redirect('Secondary/register_students_o_level/'.$invalid_type.'/'.$invalid_gender.'?err='.$b);
}else{
foreach($allDataInSheet as $import){
$title_name = str_replace(" ","",$import['A']);
$title_name = strtoupper($title_name);
$title_gender = str_replace(" ","",$import['B']);
$title_gender = strtoupper($title_gender);
if($title_name != "FULLNAME" || $title_gender != "GENDER"){
$A=str_replace("'","_",$import['A']);
$B=str_replace("'","_",$import['B']);
$C=str_replace("'","_",$import['C']);
$D=str_replace("'","_",$import['D']);
$E=str_replace("'","_",$import['E']);
$F=str_replace("'","_",$import['F']);
$G=str_replace("'","_",$import['G']);
$H=str_replace("'","_",$import['H']);
$I=str_replace("'","_",$import['I']);
$J=str_replace("'","_",$import['J']);
$K=str_replace("'","_",trim($import['K']));
$K= strtoupper(substr($K, 0,1));
$cl = 0;
$new='';
$reg='';
$check = $this->User_model->check_student();
if (empty($check)) {
//Getting the Reg_number
$level = $this->security->xss_clean($this->input->post('class_admitted'));
$cl = date('Y');
$current = $namee.".".$cl .".".sprintf("%03s",($reg+1));
// echo $current.'
';
//dunping data to the database
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $A,
'gender' => trim($B),
'birth_day' => $C,
'admitted_from' => $D,
'admission_number'=>$E,
'living_place' => $F,
'nationality' => $G,
'email' => $H,
'mobile' => $I,
'admission_year' => date('Y'),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'category' => $this->security->xss_clean($this->input->post('category')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => date('Y'),
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $J,
'schoolar_type' => $K,
'category' => $this->security->xss_clean($this->input->post('category'))
);
$data_saved++;
$this->db->insert('students',$data);
$this->db->insert('classes',$data2);
}else{
foreach ($check as $num) {
$reg = $num->reg_number;
// echo $reg;exit();
$cl = $num->class_level;
$reg = $num->reg_number;
$cl = $num->class_level;
$new = substr($reg,-8,4);
$reg = substr($reg, -3,4);
$current = $namee.".".$new.'.'.sprintf("%03s",($reg+1));
// echo $num->reg_number.' => '. $current;exit();
//dunping data to the database
$data = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'full_name' => $A,
'gender' => $B,
'birth_day' => $C,
'admitted_from' => $D,
'admission_number'=>$E,
'living_place' => $F,
'nationality' => $G,
'email' => $H,
'mobile' => $I,
'admission_year' => date('Y'),
'class_admitted' => $this->security->xss_clean($this->input->post('class_admitted')),
'category' => $this->security->xss_clean($this->input->post('category')),
'password'=>MD5('default'),
'password_recover'=>'default'
);
$data2 = array(
'reg_number' => $current,
'school_id' => $this->session->userdata('school_id'),
'academic_year' => date('Y'),
'class_level' => $this->security->xss_clean($this->input->post('class_admitted')),
'stream' => $J,
'schoolar_type' => $K,
'category' => $this->security->xss_clean($this->input->post('category'))
);
$data_saved++;
$this->db->insert('students', $data);
$this->db->insert('classes', $data2);
} // if school_type not set
}
}
}
redirect('Secondary/register_students_o_level/'.$data_saved.'?sent');
}
}
}
?>PK ! 8 ^ Secondary_parents.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
//this function redirecting different pages after users loged in
public function index() {
$expiry_date='';
$start_date='';
$trial_days='';
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_trial=$this->db->get('trial');
foreach($get_trial->result() as $row_trial){
$trial_days=$row_trial->days;
$start_date=$row_trial->start_date;
$expiry_date=$row_trial->expiry_date;
}
$today = date("d-M-Y",time());
$date1 = date_create($start_date);
$date2 = date_create($today);
//difference between two dates
$diff = date_diff($date1,$date2);
//count days
$days_spent=$diff->format("%a");
if($days_spent>=$trial_days){
//trial expired
//inserting required school payemnts
$amount=0;
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',date('Y'));
$this->db->where('status',0);
$count_list1=$this->db->count_all_results('classes');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$this->session->userdata('academic_year_a_level'));
$this->db->where('status',0);
$count_list2=$this->db->count_all_results('classes');
$count_list=$count_list1+$count_list2;
//$count_list=2000;
if($count_list==0){
$amount=0;
}else{
//finding the required amount
$this->db->where('max_list >=', $count_list);
$this->db->where('start <=', $count_list);
$count_larger=$this->db->count_all_results('pricing');
if($count_larger>0){
$this->db->where('max_list >=', $count_list);
$this->db->where('start <=', $count_list);
$get_price=$this->db->get('pricing');
foreach($get_price->result() as $row){
$list=$row->max_list;
$price=$row->amount;
$amount=$price;
}
}else{
$this->db->where('max_list <=', $count_list);
$get_price1=$this->db->get('pricing');
foreach($get_price1->result() as $rows){
$list=$rows->max_list;
$price=$rows->amount;
$amount= $price;
}
}
}
//echo $count_list.' = '.$amount;
//exit();
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('year',date('Y'));
$this->db->where('status',0);
$check=$this->db->count_all_results('school_pyaments_required');
if($check==0){
$data1 = array(
'school_id' => $this->session->userdata('school_id'),
'year' => date('Y'),
'students' =>$count_list,
'amount' =>$amount,
'month_started' =>date('m'),
'category' =>'Normal',
);
$this->db->insert('school_pyaments_required', $data1);
}else{
$data=array(
'students'=>$count_list,
'amount'=>$amount
);
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('year',date('Y'));
$this->db->where('status',0);
$this->db->where('category','Normal');
$this->db->update('school_pyaments_required',$data);
}
$amount_required=0;
$month_started=0;
$half_required=0;
$current_month=date('m');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('year',date('Y'));
$get=$this->db->get('school_pyaments_required');
foreach($get->result() as $row_amount_required){
$amount_required=$row_amount_required->amount;
if($amount_required==0){
$half_required=0;
}else{
$half_required=$amount_required/2;
}
$month_started=$row_amount_required->month_started;
}
$amount_paid=0;
$this->db->select_sum('amount');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('year',date('Y'));
$get=$this->db->get('school_payments_transactions');
foreach($get->result() as $row_amount_paid){
if($row_amount_paid->amount=='' || $row_amount_paid->amount==0){
$amount_paid=0;
}else{
$amount_paid=$row_amount_paid->amount;
}
}
//checking time of payments
if($current_month<04){
// echo 'Not Paid and time to block not reached';exit();
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/parents_home');
$this->load->view('includes/secondary/parents_footer');
}elseif($month_started>=01 && $month_started<=05){
if($current_month>=04 && $amount_paid>=$half_required){
//half paid continue
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/parents_home');
$this->load->view('includes/secondary/parents_footer');
}elseif($current_month>=10 && $amount_paid>=$amount_required){
//full paid continue
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/parents_home');
$this->load->view('includes/secondary/parents_footer');
}else{
//not paid block
$this->load->view('includes/uploading_header');
$this->load->view('admin/account_suspended');
$this->load->view('includes/uploading_footer');
}
}elseif($month_started>=06){
if($current_month>6 && $current_month>=10 && $amount_paid>=$half_required){
// paid continue
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/parents_home');
$this->load->view('includes/secondary/parents_footer');
}else{
// not paid block
$this->load->view('includes/uploading_header');
$this->load->view('admin/account_suspended');
$this->load->view('includes/uploading_footer');
}
}
}else{
//continue usingg trial
if($school_type=='PS'){
redirect('Private_area');
}elseif($school_type=='SS'){
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/parents_home');
$this->load->view('includes/secondary/parents_footer');
}
}
}
// public function index(){
// $this->load->view('includes/secondary/parents_header');
// $this->load->view('users/secondary/parents_home');
// $this->load->view('includes/secondary/parents_footer');
// }
public function students_profile(){
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/students_profile');
$this->load->view('includes/secondary/parents_footer');
}
public function students_payments(){
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/students_payments');
$this->load->view('includes/secondary/parents_footer');
}
public function students_results(){
$this->load->view('includes/secondary/parents_header');
$this->load->view('users/secondary/students_results');
$this->load->view('includes/secondary/parents_footer');
}
public function view_single_monthly_results() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_monthly_results');
$this->load->view('includes/uploading_footer');
}
public function view_single_term_results() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_term_results');
$this->load->view('includes/uploading_footer');
}
public function view_single_mid_term_results() {
$this->load->view('includes/uploading_header');
$this->load->view('users/secondary/view_single_mid_term_results');
$this->load->view('includes/uploading_footer');
}
public function monthly_test(){
if($_POST){
$class = $this->input->post('class_level');
$month = $this->input->post('month');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$dateObj = DateTime::createFromFormat('!m', $month);
$monthName = $dateObj->format('F');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MONTHLY TEST - FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('monthly_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
anaglia zaidi...
view more..
MONTHLY TEST - FORM
db->distinct();
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$coun=$this->db->count_all_results('monthly_results');
if($coun>0){?>
0 && $count2>0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('grade',$div->grade);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo ' '. $div->grade.' = ' .$count.' , ';
}
?>
0){?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('grade',$div->grade);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo ' '.$div->grade.' = ' .$count.' , ';
}
?>
0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('monthly_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Reg Number
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('monthly_results');
foreach($get_results->result() as $results){?>
reg_number==$this->session->userdata('reg_number')){?>
reg_number;?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
reg_number;?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
MID-TERM TEST RESULTS (TERM- ) FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia zaid kwa Kiswahili
View More in English
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
MID-TERM TEST RESULTS (TERM- ) FORM
db->distinct();
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$coun=$this->db->count_all_results('mid_term_results');
if($coun>0){?>
0 && $count2>0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('mid_term_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->order_by('end_mark','desc');
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->grade);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('mid_term_results');
echo ' '.$div->grade.' = ' .$count.' , ';
}
?>
0){?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->order_by('end_mark','desc');
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->grade);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('mid_term_results');
echo ' '.$div->grade.' = ' .$count.' , ';
}
?>
0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('mid_term_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Reg Number
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('mid_term_results');
foreach($get_results->result() as $results){
if($results->reg_number==$this->session->userdata('reg_number')){?>
reg_number;?>
stream;?>
<0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
reg_number;
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
input->post('class_level');
$term = $this->input->post('term');
$year = $this->input->post('academic_year');
$category = $this->input->post('category');
$termm='';
if($term==1){
$termm='TERMINAL EXAMINATIONS ';
}else{
$termm='ANNUAL EXAMINATIONS ';
}
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('average','Yes');
$count1=$this->db->count_all_results('grading_method');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->where('division','Yes');
$count2=$this->db->count_all_results('grading_method');
?>
STUDENT RESULTS FORM
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('classes');
foreach($get_results->result() as $results){
$stream=$results->stream;
}
$this->db->where('reg_number',$reg_number);
$this->db->where('school_id',$this->session->userdata('school_id'));
$get_students=$this->db->get('students');
foreach($get_students->result() as $tudent){
echo strtoupper($tudent->full_name).' FORM '.strtoupper($class).'-'.$stream;
}
?>
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
Angalia Zaid kwa Kiswahili
More (English)
session->userdata('reg_number');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){?>
total_marks;?>
average;?>
point;?>
division;?>
position;?>
all_position;?>
angalia zaid...
view more...
RESULTS FORM
db->distinct();
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$coun=$this->db->count_all_results('term_results');
if($coun>0){?>
0 && $count2>0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('term_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->order_by('end_mark','desc');
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('grade',$div->grade);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('term_results');
echo ' '.$div->grade.' = ' .$count.' , ';
}
?>
0){?>
Average Grades: db->distinct();
$this->db->select('grade');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$this->db->order_by('end_mark','desc');
$get_divisions=$this->db->get('grade_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('grade',$div->grade);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('term_results');
echo ' '.$div->grade.' = ' .$count.' , ';
}
?>
0){?>
db->distinct();
$this->db->select('division');
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('students_type',$category);
$get_divisions=$this->db->get('division_settings');
foreach($get_divisions->result() as $div){
$this->db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('division',$div->division);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$count=$this->db->count_all_results('term_results');
echo 'Division '.$div->division.' = ' .$count.' , ';
}
?>
Reg Number
Combination
0 && $count2>0){?>
Total
Average
Point
Division
0){?>
Total
Average
0){?>
Point
Division
Classroom Position
Overall Position
db->where('school_id',$this->session->userdata('school_id'));
$this->db->where('academic_year',$year);
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$get_results=$this->db->get('term_results');
foreach($get_results->result() as $results){
if($results->reg_number==$this->session->userdata('reg_number')){?>
reg_number;
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
reg_number;
?>
stream;?>
0 && $count2>0){?>
total_marks;?>
average;?>
point;?>
division;?>
0){?>
total_marks;?>
average;?>
0){?>
point;?>
division;?>
position;?>
all_position;?>
session->userdata('id')) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}
//convert numeric number to roman
function numberToRomanRepresentation($number) {
$map = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'x' => 10, 'ix' => 9, 'v' => 5, 'iv' => 4, 'i' => 1);
$returnValue = '';
while ($number > 0) {
foreach ($map as $roman => $int) {
if($number >= $int) {
$number -= $int;
$returnValue .= $roman;
break;
}
}
}
return $returnValue;
}
}
public function addUser()
{
$p=trim(str_replace(' ' ,"",$this->input->post('phone')));
$s=str_replace('-' ,"", $p);
$s=str_replace('(' ,"", $s);
$s=str_replace(')' ,"", $s);
$t=substr($s, -9);
$phone='255'.$t;
$count = $this->db->where('email',$this->input->post('email'))->count_all_results('officers');
if($count>0){
redirect('admin/registerUsers?exists');
}else{
$data = array(
'name'=>$this->input->post('name'),
'phone'=>$phone,
'email'=>$this->input->post('email'),
'council'=>$this->input->post('council'),
'region'=>$this->input->post('region'),
'user_type'=>$this->input->post('user_type'),
'date'=>date('Y-m-d H:i:s'),
'password_recover'=>'uhakiki',
'password'=>md5('uhakiki'),
'registeredBy'=>$this->session->userdata('id'),
);
$this->db->insert('officers',$data);
redirect('admin/registerUsers?sent');
}
}
public function editUser()
{
$p=trim(str_replace(' ' ,"",$this->input->post('phone')));
$s=str_replace('-' ,"", $p);
$s=str_replace('(' ,"", $s);
$s=str_replace(')' ,"", $s);
$t=substr($s, -9);
$phone='255'.$t;
if($_POST){
$data = array(
'name'=>$this->input->post('name'),
'phone'=>$phone,
'email'=>$this->input->post('email'),
'user_type'=>$this->input->post('user_type'),
'registeredBy'=>$this->session->userdata('id'),
);
$this->db->where('id',base64_decode($_REQUEST['id']))->update('officers',$data);
redirect($_SERVER['HTTP_REFERER']);
}else{
redirect($_SERVER['HTTP_REFERER']);
}
}
public function delete_user()
{
$this->db->where('id',base64_decode($_REQUEST['id']))->delete('officers');
redirect($_SERVER['HTTP_REFERER']);
}
public function changePassword(){
$user_id =$this->session->userdata('id');
$this->db->where('id',$user_id);
$get_member=$this->db->get('officers');
foreach($get_member->result() as $row_member){
$oldpass=$row_member->password_recover;
}
if($this->input->post('password')=='' | $this->input->post('oldpassword')!=$oldpass){
redirect('settings/accountSettings?no');
}elseif($this->input->post('password')==$oldpass){
redirect('settings/accountSettings?old');
}else{
$data_ary = array(
'password_recover'=>$this->input->post('password'),
'password'=>md5($this->input->post('password')),
);
$data_ary = $this->security->xss_clean($data_ary);
$this->db->where('id',$user_id);
$this->db->update('officers',$data_ary);
redirect('settings/accountSettings?sent');
}
}
public function getDistrict()
{
foreach($this->db->where('region',$this->input->post('id'))->get('council')->result() as $row){
?>
name;?>
input->post('sababu');
$extra=$this->input->post('extra');
$hati=$this->input->post('hati');
$to=$this->input->post('to');
$p=trim(str_replace(' ' ,"", $to));
$s=str_replace('-' ,"", $p);
$s=str_replace('(' ,"", $s);
$s=str_replace(')' ,"", $s);
$t=substr($s, -9);
$to='255'.$t;
//sms
$txt=$sab.'. '.$extra;
$data_ary = array(
'hatiId' => $hati,
'to' => $to,
'text' => $txt,
'date' => date('Y-m-d H:i:s'),
'registeredBy' => $this->session->userdata('id'),
);
//print_r($data_ary);exit;
$data_ary = $this->security->xss_clean($data_ary);
$this->db->insert('sms', $data_ary);
//send sms
$header="AFELSMS";
$this->Login_model->send($txt,$to,$header);
redirect($_SERVER['HTTP_REFERER']);
}
public function resend(){
//sms
$req=base64_decode($_REQUEST['id']);
foreach($this->db->where('id',$req)->get('sms')->result() as $sms){
$to=$sms->to;
$txt=$sms->text;
$no=$sms->resend+1;
$data_ary = array(
'resend' => $no,
);
$data_ary = $this->security->xss_clean($data_ary);
$this->db->where('id',$req)->update('sms', $data_ary);
}
//send sms
$header="AFELSMS";
$this->Login_model->send($txt,$to,$header);
redirect($_SERVER['HTTP_REFERER']);
}
}
PK ! ˌ=J J 0 Arrange_schools_positions_o_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://results.afel.co.tz/Arrange_schools_positions_o_level_background
public function index() {
$sub_position=0;
$year=date('Y');
$term=0;
$this->db->distinct();
$this->db->select('term');
$this->db->where('academic_year', $year);
$query_term = $this->db->get('monthly_results');
foreach ($query_term->result() as $row_term) {
$term=$row_term->term;
//echo 'Term = '.$row_term->term.'
';
$this->db->distinct();
$this->db->select('month');
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_month=$this->db->get('schools_position');
foreach($get_month->result() as $row_month){
$class_position=0;
$month=$row_month->month;
// echo 'Month = '.$month.'
';
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$get_class=$this->db->get('schools_position');
foreach($get_class->result() as $row_class){
$class=$row_class->class_level;
//arranging positions of subjects for different schools------------
//-----------------------------------------------------------
$class=$row_class->class_level;
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','O');
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->order_by('gpa','asc');
$get_schools=$this->db->get('schools_position');
foreach($get_schools->result() as $row_school){
//....................Upadting schools positions in ca table----------------------------------------->
$class=$row_class->class_level;
$school=$row_school->school_id;
$sub_position++;
$datad=array(
'position'=>$sub_position
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('category','O');
$this->db->where('class_level',$class);
$count_entered= $this->db->count_all_results('schools_position');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category','O');
$this->db->update('schools_position',$datad);
}else{
//
}
}
}
}
//-----------------------------------------------------------------------------------------------------------//
}
}
}?>PK ! } Sms.phpnu [ load->library('session');
$this->load->model('Login_model');
if($this->session->userdata('type')){
if($this->session->userdata('type') == 'officer'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Officer');
}
}else{
redirect('login');
}
}
public function index(){
$this->load->view('includes/header');
$this->load->view('pages/dashboard');
$this->load->view('includes/footer');
}
public function send(){
$txt = $this->input->post('txt');
$to = $this->input->post('phone');
$type = $this->input->post('type');
$this->UserModel->send($txt,$to,$type);
redirect($_SERVER['HTTP_REFERER']);
}
}
PK ! 5(X X Confirm_sms_payments.phpnu [ load->database();
}
public function index(){
date_default_timezone_set('Africa/Nairobi');
$school_id = '';
$amount = '';
$mobile = '';
$transaction_id = '';
$school_name ='';
$count1='';
$customer_id='';
$customer_name='';
if($_POST){
//echo $this->security->xss_clean($this->input->post('key'))."
";
//echo "179103@afel_1990/2017
";
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$this->db->where('payer_id','no');
$this->db->where('payer_name','no');
$this->db->where('paid_for','Normal');
$count1=$this->db->count_all_results('money_collection');
if(trim($this->security->xss_clean($this->input->post('key'))) == '179103@afel_1990/2017'){
if( $count1>0){
$data= array(
"paid_for"=> $this->security->xss_clean($this->input->post('paid_for')),
"payer_id"=> $this->security->xss_clean($this->input->post('payer_id')),
"payer_name"=> $this->security->xss_clean($this->input->post('payer_name')),
);
$data = array_map('trim', $data);
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$this->db->update('money_collection',$data);
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$get=$this->db->get('money_collection');
foreach($get->result() as $row){
$school_id = $this->security->xss_clean($this->input->post('payer_id'));
$school_name = $this->security->xss_clean($this->input->post('payer_name'));
$amount = $row->amount;
$mobile = $row->mobile;
$transaction_id = $row->transaction_id;
$payment_method = $row->payment_method;
$date_paid = $row->date_paid;
}
$this->db->where('reg_number',trim($this->security->xss_clean($this->input->post('payer_id'))));
$gets=$this->db->get('billing_update');
foreach($gets->result() as $rows){
$customer_id = $rows->customer_id;
$customer_name = $rows->customer_name;
}
//will be inserting to afel database while the url will be inserting to afelschool, therefore i will coppy code from insert_confirmed_sms_payments of inserttion
$url = 'http://www.afel.co.tz/Insert_confirmed_sms_payments';
$fields = array(
'key= '=>"179103@afel_1990/2017",
'school_id= '=>$school_id,
'customer_id= '=>$customer_id,
'customer_name= '=>$customer_name,
'transaction_id= '=>$transaction_id,
'mobile= '=>$mobile ,
'amount= '=>$amount,
'payment_method= '=>$payment_method ,
'date_paid= '=>$date_paid ,
);
$fields_string = '';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if($result == 1){
}
}else{
//do nothing
}
}else{
redirect('http://afel.co.tz');
}
}else{
redirect('http://afel.co.tz');
}
}
}
PK ! ř- - 0 Calculate_monthly_results_p_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_monthly_results_p_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','P');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Monthly Results ';
$academic_year=date('Y');
$category='P';
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->where('status',0);
$get_term=$this->db->get('ca');
foreach($get_term->result() as $row_term){
$term=$row_term->term;
// echo $term;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('category',$category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_month) {
$month=$row_month->month;
//echo $month;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month', $month);
$this->db->where('category',$category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_class = $this->db->get('ca');
foreach ($query_class->result() as $row_class) {
$class= $row_class->class_level;
//echo $class.'
';
$this->db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->where('category',$category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_stream = $this->db->get('ca');
foreach ($query_stream->result() as $row_stream) {
$stream= $row_stream->stream;
//echo $stream;
$this->db->distinct();
$this->db->select('category');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('stream', $stream);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->where('category',$category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_category = $this->db->get('ca');
foreach ($query_category->result() as $row_category) {
$category= $row_category->category;
//echo $category;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('category', $category);
$this->db->where('term', $term);
$this->db->where('stream', $stream);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->where('category',$category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_reg_number = $this->db->get('ca');
foreach ($query_reg_number->result() as $row_reg_number) {
$reg_number= $row_reg_number->reg_number;
//echo $reg_number.' class= '.$class.' category= '.$category.' stream='.$stream.'
';
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$get_required= $this->db->get('subjects_calculations');
foreach($get_required->result() as $row_sub_cal){
$main_subjects=$row_sub_cal->subject_id;
$required_subjects_for_calcultion++;
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$count=$this->db->count_all_results('ca');
if($count==0){
$sum_of_marks1=0;
// echo $main_subjects.'indirect main
';
$this->db->where('school_id',$school);
$this->db->where('main_subject_id',$main_subjects);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type',$category);
$geet_sub=$this->db->get('sub_subjects');
foreach($geet_sub->result() as $rt){
//finding marks from ca for sub subjects and make sum for their percent
$mark_from_sub=0;
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id',$rt->sub_subject_id);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$mark_from_sub=$mark_from_sub+(($row_ca->mark*$rt->percent)/100);
}
//echo $main_subjects.' indirect main = '.$mark_from_sub.'
';
$month_ca = $mark_from_sub;
$sum_of_marks1=$sum_of_marks1+ $month_ca;
}
}else{
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
// echo $row_ca->subject_id.' direct main = '.$row_ca->mark.'
';
$month_ca = $row_ca->mark;
$sum_of_marks2=$sum_of_marks2+ $month_ca;
}
}
}
$sum_of_marks=$sum_of_marks1+$sum_of_marks2;
echo $reg_number.' = '.$sum_of_marks.'
';
if($required_subjects_for_calcultion==0){
//echo 'Combination = '.$stream.'
No results required, because results calcultions not set';
}else{
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//echo $sum_of_marks.' Number of subjects'.$required_subjects_for_calcultion.' = '.$average_of_marks.'
';
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo $grade.' = '.$remark.'
';
// echo .'
';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'term'=>$term,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
//'remark'=>$division_remark,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$this->db->insert('monthly_results',$data);
}
}
}
}
//----------------
}
}
}
}
}
}
}
}
}?>PK ! R sec.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!($this->session->userdata('school_reg_number')||$this->session->userdata('reg_number'))) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}elseif($this->session->userdata('school_type')!='SS'){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Private_area');
}elseif(!$this->session->userdata('type')){
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Parents_area');
}
}
//this function redirecting different pages after users loged in
public function index() {
if($this->session->userdata('type')=='Admin'){
$session_reg_aumber = $this->session->userdata('school_reg_aumber');
}else{
$session_reg_aumber=$this->session->userdata('reg_aumber');
}
$school_id=$this->session->userdata('school_id');
$id = $this->session->userdata('id');
$type = $this->session->userdata('type');
$school_type = $this->session->userdata('school_type');
$reg_aumber_session = $session_reg_aumber;
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/home');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_students_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function students_list_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function publish_results_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_results_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function evaluate_students_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function students_attendance_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function suspended_students_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function precautioned_students_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function dismissed_students_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function graduates_o_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_o_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_students_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/register_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function students_list_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_list_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function upload_results_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/upload_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function publish_results_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/publish_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function view_results_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/view_results_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function evaluate_students_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/evaluate_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function students_attendance_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/students_attendance_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function suspended_students_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/suspended_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function precautioned_students_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/precautioned_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function dismissed_students_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/dismissed_students_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function graduates_a_level() {
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/graduates_a_level');
$this->load->view('includes/secondary/secondary_footer');
}
public function register_staffs_secondary() {
$this->load->view('includes/primary/primary_header');
$this->load->view('users/primary/register_staffs_secondary');
$this->load->view('includes/primary/primary_footer');
}
//function to logout and destroy sessions
public function logout() {
if($this->session->userdata('type')=='Admin'){
$data = ['school_reg_aumber', 'school_reg_aumber'];
$this->session->unset_userdata($data);
redirect('Welcome');
}else{
$data = ['reg_aumber', 'reg_aumber'];
$this->session->unset_userdata($data);
redirect('Welcome');
}
}
}
PK ! D0m m - Calculate_term_results_p_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_term_results_p_level_background
public function index() {
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('category','P');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Term Results (Terminal/Annual) ';
$ca=0;
$exam=0;
$ca_percent=0;
$exam_percent=0;
$this->db->where('school_id',$school);
$this->db->where('students_type','P');
$getd=$this->db->get('assessment_settings');
foreach($getd->result() as $row_per){
$ca_percent=$row_per->ca_percent;
$exam_percent=$row_per->exam_percent;
}
$year=date('Y');
$number_of_sudents=0;
$term='';
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->where('academic_year', $year);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_term) {
$number_of_sudents=0;
$category='P';
$term=$row_term->term;
//echo '
Term'.$term.' ';
$sum_of_aveargess=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$number_of_sudents++;
$reg_number=$row_reg->reg_number;
//echo $row_reg->reg_number.'';
$this->db->distinct();
$this->db->select('class_level');
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$query_all = $this->db->get('monthly_results');
foreach ($query_all->result() as $row_all) {
$class=$row_all->class_level;
$stream=$row_all->stream;
// echo 'Class = '.$class.' Combination = '.$stream.'
';
$number_of_months=0;
$sum_of_total=0;
$sum_of_avearges=0;
$average_of_averages=0;
$grade='';
$remark='';
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('academic_year', $year);
$this->db->where('reg_number', $reg_number);
$query_month = $this->db->get('monthly_results');
foreach ($query_month->result() as $row_month) {
$number_of_months++;
$month=$row_month->month;
//finding subjects which are included in calculations
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('status', 0);
$get_ca=$this->db->get('monthly_results');
foreach($get_ca->result() as $row_ca){
$sum_of_total=$sum_of_total+$row_ca->total_marks;
$sum_of_avearges=$sum_of_avearges+$row_ca->average;
// echo '
Month = '.$month.' Average = ' .$row_ca->average.'
';
}
}
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_averages=($sum_of_avearges/$number_of_months); //for considering total marks over total subjects required
$average_of_averages=round($average_of_averages);
//echo ' Number of months attempted = '.$number_of_months.'Sum of Total ='.$sum_of_total.' Sum of averages = '.$sum_of_avearges.' Average of averages = '.$average_of_averages.'
';
//finding percent of ca contribution
$ca= ($average_of_averages*$ca_percent)/100;
$ca=$ca;
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_averages) && round($average_of_averages)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo $grade.'
';
// echo $remark.'
';
//no insertung into mid_term_results
}
}
}
// echo '
';
// echo '
Below are terminal or annual results ';
//calculating terminal/annual results
$term=$row_term->term;
//echo '
Term ='. $term.' Examination ';
$reg_number=$row_reg->reg_number;
$this->db->distinct();
$this->db->select('class_level');
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('reg_number', $reg_number);
$this->db->where('term', $term);
$this->db->where('status', 0);
$this->db->where('academic_year', $year);
$this->db->where('category', $category);
$query_all = $this->db->get('exam');
foreach ($query_all->result() as $row_all) {
$class=$row_all->class_level;
$stream=$row_all->stream;
$number_of_subjects=0;
$sum_of_marks=0;
$average_of_marks=0;
$grade='';
$remark='';
$required_subjects_for_calcultion1=0;
// echo $row_reg->reg_number.'';
//finding subjects which are included in calculations
$sum_of_marks2=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$get_required= $this->db->get('subjects_calculations');
foreach($get_required->result() as $row_sub_cal){
$main_subjects=$row_sub_cal->subject_id;
$required_subjects_for_calcultion1++;
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$count=$this->db->count_all_results('exam');
if($count==0){
$sum_of_marks1=0;
// echo $main_subjects.'indirect main
';
$this->db->where('school_id',$school);
$this->db->where('main_subject_id',$main_subjects);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type',$category);
$geet_sub=$this->db->get('sub_subjects');
foreach($geet_sub->result() as $rt){
//finding marks from ca for sub subjects and make sum for their percent
$mark_from_sub=0;
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id',$rt->sub_subject_id);
$this->db->where('status', 0);
$get_exam=$this->db->get('exam');
foreach($get_exam->result() as $row_exam){
$mark_from_sub=$mark_from_sub+(($row_exam->mark*$rt->percent)/100);
}
//echo $main_subjects.' indirect main = '.$mark_from_sub.'
';
$exam_mark = $mark_from_sub;
$sum_of_marks1=$sum_of_marks1+ $exam_mark;
}
}else{
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$get_exam=$this->db->get('exam');
foreach($get_exam->result() as $row_exam){
// echo $row_ca->subject_id.' direct main = '.$row_ca->mark.'
';
$exam_mark = $row_exam->mark;
$sum_of_marks2=$sum_of_marks2+ $exam_mark;
}
}
}
$sum_of_marks=$sum_of_marks1+$sum_of_marks2;
echo $reg_number.' = '.$sum_of_marks.'
';
//up to hreee--- end hreee end hereee enf heree--------------------------------------
if($required_subjects_for_calcultion1==0){
//echo 'Combination = '.$stream.'
No results required, because results calcultions not set';
}else{
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion1); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//echo 'Required Subjects = '.$required_subjects_for_calcultion1. ' Number of subjects attempted = '.$number_of_subjects.' Sum of marks = '.$sum_of_marks.' Average = '.$average_of_marks.'
';
//finding exam percent of contribution
$exam= ($average_of_marks*$exam_percent)/100;
$exam=$exam;
//adding ca_pecent and exa percent to get overall average
$overall_average=round($ca+$exam);
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($overall_average) && round($overall_average)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo '
Overall average = '.$overall_average.' Overall grade = '.$grade.' Overall remark = '.$remark.' ';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$year,
'term'=>$term,
//'ca_total'=>$sum_of_avearges,
//'exam_total'=>$sum_of_marks,
'ca_average'=>$average_of_averages,
'exam_average'=>$average_of_marks,
'average'=>$overall_average,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results(' term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('term_results',$data);
}else{
$this->db->insert('term_results',$data);
}
}
}
}
}
$reg_number=$row_reg->reg_number;
// echo $reg_number.'
';
$this->db->where('reg_number', $reg_number);
$this->db->where('academic_year', $year);
$this->db->where('school_id',$school);
$getts= $this->db->get('classes');
foreach($getts->result() as $rowt){
$class=$rowt->class_level;
$stream=$rowt->stream;
$category=$rowt->category;
}
//inserting subjects to subjects positioin table
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects');
foreach($gett->result() as $row_sub){
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_subjects){
$this->db->select_sum('mark');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_marks=$this->db->get('ca');
foreach($get_marks->result() as $row_marks){
$number_of_months=0;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_months =$this->db->get('ca');
foreach($get_months->result() as $row_month){
$number_of_months++;
}
$exam_mark=0;
$exam_mark1=0;
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_exam_marks=$this->db->get('exam');
foreach($get_exam_marks->result() as $row_exam_marks){
$exam_mark1=$row_exam_marks->mark;
$exam_mark=$row_exam_marks->mark;
}
$total_marks_in_months=$row_marks->mark;
$average_in_months1=round($total_marks_in_months/$number_of_months);
$average_in_months=round($total_marks_in_months/$number_of_months);
if($average_in_months==''){
$sum_of_avearges=$exam_mark;
}else{
$average_in_months= ($average_in_months*$ca_percent)/100;
$exam_mark= ($exam_mark*$exam_percent)/100;
$sum_of_avearges=round($average_in_months + $exam_mark);
}
//-----------inserting into term_subjects_results------------------
$datass=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'academic_year'=>$year,
'term'=>$term,
'category'=>$category,
'subject_id'=>$row_subjects->subject_id,
'mark'=>$sum_of_avearges
);
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$getk_count=$this->db->count_all_results('term_subjects_results');
if($getk_count>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category', $category);
$this->db->where('subject_id',$row_subjects->subject_id);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->update('term_subjects_results',$datass);
}else{
$this->db->insert('term_subjects_results',$datass);
}
}
}
}
//calculating and inserting division
$point=0;
$sum_of_aveargess=0;
$number_sujects_required=0;
$required_subjects_for_calcultion_div=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$gett= $this->db->get('subjects_calculations');
foreach($gett->result() as $row_sub){
$required_subjects_for_calcultion_div++;
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_sub->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_subjects){
$this->db->select_sum('mark');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_marks=$this->db->get('ca');
foreach($get_marks->result() as $row_marks){
$number_of_months=0;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_months =$this->db->get('ca');
foreach($get_months->result() as $row_month){
$number_of_months++;
}
$exam_mark=0;
$exam_mark1=0;
$required_subjects_for_calcultion_div++;
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('subject_id', $row_subjects->subject_id);
$this->db->where('academic_year',$year);
$this->db->where('category', $category);
$this->db->where('reg_number', $reg_number);
$this->db->where('status', 0);
$get_exam_marks=$this->db->get('exam');
foreach($get_exam_marks->result() as $row_exam_marks){
$exam_mark1=$row_exam_marks->mark;
$exam_mark=$row_exam_marks->mark;
}
$total_marks_in_months=$row_marks->mark;
$average_in_months1=round($total_marks_in_months/$number_of_months);
$average_in_months=round($total_marks_in_months/$number_of_months);
if($average_in_months==''){
$sum_of_avearges=$exam_mark;
}else{
$average_in_months= ($average_in_months*$ca_percent)/100;
$exam_mark= ($exam_mark*$exam_percent)/100;
$sum_of_avearges=$average_in_months + $exam_mark;
}
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($sum_of_avearges) && round($sum_of_avearges)<=$row_grade->end_mark){
$grade1=$row_grade->grade;
$sum_of_aveargess= round($sum_of_aveargess+$sum_of_avearges);
// echo 'Exam mark = '.$exam_mark1. ' Subjects = '.$row_subjects->subject_id.' Total marks in months = '.$row_marks->mark.' Average in months = '.$average_in_months1.
// ' Average in months in percent = '.$average_in_months.' Avearage of exam in percent = '.$exam_mark.' Sum of averages = '.$sum_of_avearges.' Grade = '.$grade1.' Point = '.$row_point->point.' ,
';
}
}
}
}
}
// echo 'Total Points = '.$point.' Division ='.$division.' Overall Total = '. $sum_of_aveargess.'
';
$data=array(
'total_marks'=>$sum_of_aveargess,
);
$this->db->where('school_id',$school);
$this->db->where('term',$term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('term_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$this->db->update('term_results',$data);
}else{
//
}
}
// echo '
Number of students = '.$number_of_sudents.'
';
}
}
}
}?>PK ! t-}-. -. 0 Calculate_monthly_results_n_level_background.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
// curl --silent http://school.afel.co.tz/Calculate_monthly_results_n_level_background
public function index() {
$not_category='P';
$this->db->distinct();
$this->db->select('school_id');
$this->db->not_like('category',$not_category);
$this->db->not_like('category','A');
$get_schools=$this->db->get('classes');
foreach($get_schools->result() as $row_school){
$school=$row_school->school_id;
// echo $school.'
';
// echo '
Calculating Monthly Results ';
$academic_year=date('Y');
$not_category='P';
$this->db->distinct();
$this->db->select('term');
$this->db->where('school_id',$school);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year',$academic_year);
$this->db->where('status',0);
$get_term=$this->db->get('ca');
foreach($get_term->result() as $row_term){
$term=$row_term->term;
// echo $term;
$this->db->distinct();
$this->db->select('month');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_month = $this->db->get('ca');
foreach ($query_month->result() as $row_month) {
$month=$row_month->month;
//echo $month;
$this->db->distinct();
$this->db->select('class_level');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('month', $month);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_class = $this->db->get('ca');
foreach ($query_class->result() as $row_class) {
$class= $row_class->class_level;
//echo $class.'
';
$this->db->distinct();
$this->db->select('stream');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_stream = $this->db->get('ca');
foreach ($query_stream->result() as $row_stream) {
$stream= $row_stream->stream;
//echo $stream;
$this->db->distinct();
$this->db->select('category');
$this->db->where('school_id',$school);
$this->db->where('term', $term);
$this->db->where('stream', $stream);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_category = $this->db->get('ca');
foreach ($query_category->result() as $row_category) {
$category= $row_category->category;
//echo $category;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('school_id',$school);
$this->db->where('category', $category);
$this->db->where('term', $term);
$this->db->where('stream', $stream);
$this->db->where('class_level', $class);
$this->db->where('month', $month);
$this->db->not_like('category',$not_category);
$this->db->where('academic_year', $academic_year);
$this->db->where('status',0);
$query_reg_number = $this->db->get('ca');
foreach ($query_reg_number->result() as $row_reg_number) {
$reg_number= $row_reg_number->reg_number;
//echo $reg_number.' class= '.$class.' category= '.$category.' stream='.$stream.'
';
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type', $category);
$this->db->where('school_id',$school);
$get_required= $this->db->get('subjects_calculations');
foreach($get_required->result() as $row_sub_cal){
$main_subjects=$row_sub_cal->subject_id;
$required_subjects_for_calcultion++;
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$count=$this->db->count_all_results('ca');
if($count==0){
$sum_of_marks1=0;
// echo $main_subjects.'indirect main
';
$this->db->where('school_id',$school);
$this->db->where('main_subject_id',$main_subjects);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('students_type',$category);
$geet_sub=$this->db->get('sub_subjects');
foreach($geet_sub->result() as $rt){
//finding marks from ca for sub subjects and make sum for their percent
$mark_from_sub=0;
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id',$rt->sub_subject_id);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$mark_from_sub=$mark_from_sub+(($row_ca->mark*$rt->percent)/100);
}
//echo $main_subjects.' indirect main = '.$mark_from_sub.'
';
$month_ca = $mark_from_sub;
$sum_of_marks1=$sum_of_marks1+ $month_ca;
}
}else{
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('subject_id', $main_subjects);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
// echo $row_ca->subject_id.' direct main = '.$row_ca->mark.'
';
$month_ca = $row_ca->mark;
$sum_of_marks2=$sum_of_marks2+ $month_ca;
}
}
}
$sum_of_marks=$sum_of_marks1+$sum_of_marks2;
// echo $reg_number.' = '.$sum_of_marks.'
';
if($required_subjects_for_calcultion==0){
//echo 'Combination = '.$stream.'
No results required, because results calcultions not set';
}else{
//$average_of_marks=($sum_of_marks/$number_of_subjects); for considering total marks over number of subjects attempted
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
echo $sum_of_marks.' Number of subjects'.$required_subjects_for_calcultion.' = '.$average_of_marks.'
';
//finding the grades from the score
$this->db->where('school_id',$school);
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
// echo $grade.' = '.$remark.'
';
// echo .'
';
//inserting values to the databse without positions
$data=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'term'=>$term,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
//'remark'=>$division_remark,
'category'=>$category
);
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term',$term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('month',$month);
$this->db->where('term', $term);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('stream',$stream);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$this->db->insert('monthly_results',$data);
}
}
}
}
//----------------
}
}
}
}
}
}
}
}
}?>PK ! R==$@ $@ Calculate_mock.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
public function get_schools(){
$i=0;
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('exam_id',35);
foreach($this->db->get('monthly_results')->result() as $sc){
$this->db->where('school_id',$sc->school_id);
$this->db->where('exam_id',35);
$count = $this->db->count_all_results('view_results');
if($count == 0){
$i++;
echo $i."-".$sc->school_id." ";
$class= 7;
$month= 5;
$year= 2019;
$school= $sc->school_id;
$exam_id= 35;
$category= 'P';
$district=0;
$region=17;
$candidate = 'NC';
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('school_id',$school);
// $this->db->where('status',0);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$get_sub=$this->db->get('ca');
foreach($get_sub->result() as $row_sub){
$pos = $s = $new = $position=1;
$this->db->where('subject_id',$row_sub->subject_id);
$gg = $this->db->get('general_subjects')->row();
//echo $gg->subject_name."
";
## Sorting subjects
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('subject_id',$row_sub->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$sub = $this->db->get('ca');
foreach($sub->result() as $marks){
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('mark', 'desc');
$suba = $this->db->get('ca');
$i=0;
$tempo = 0; $position=1;
foreach($suba->result() as $marksa){
$i++;
$this->db->where('mark',$marksa->mark);
$this->db->where('subject_id',$marks->subject_id);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('ca');
if($i > 1){
if($new != $marksa->mark){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
echo $marksa->reg_number." ".$marksa->mark." ".$pos."
";
$datad=array(
'position'=>$position
);
$tempo = $s;
$new = $marksa->mark;
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('reg_number',$marksa->reg_number);
$this->db->where('subject_id',$marks->subject_id);
$this->db->update('ca',$datad);
}
}
// echo "
";
}
## Students sorting in class
$this->db->where('school_id',$school);
// $this->db->where('status',0);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$this->db->order_by('complete',"DESC");
$this->db->order_by('total_marks',"DESC");
$get_sub=$this->db->get('monthly_results');
$pos = $s = $new = $position = 1;
$i=$tempo=0;
foreach($get_sub->result() as $row_sub){
$this->db->where('total_marks',$row_sub->total_marks);
$this->db->where('school_id',$school);
$this->db->where('class_level',$class);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('category',$category);
$this->db->where('academic_year',$year);
$s = $this->db->count_all_results('monthly_results');
$i++;
if($i > 1){
if($new != $row_sub->total_marks){
$pos = $pos + $tempo;
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
}else{
if($s>1){
$position = $pos+0.5;
}else{
$position = $pos;
}
}
echo $row_sub->reg_number." ".$row_sub->total_marks." ".$pos." Status:".$row_sub->complete."
";
$tempo = $s;
$new = $row_sub->total_marks;
$data = array('all_position'=>$position);
$this->db->where('school_id',$school);
$this->db->where('category',$category);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_sub->reg_number);
$this->db->update('monthly_results',$data);
}
}
}
}
public function find_students(){
$i=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('exam_id',35);
//$this->db->where('district_id',26);
$this->db->where('region_id',17);
foreach($this->db->get('monthly_results')->result() as $reg){
echo $reg->rg_number."
";
$this->db->where('reg_number',$reg->reg_number);
$count = $this->db->count_all_results('students');
if($count == 0){
$i++;
echo $i." - Delete ".$reg->reg_number."
";
}
}
}
public function index() {
$exam_id=6;
$category='A';
$this->db->where('category','A');
$this->db->where('status', 0);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
}
$total_students=0;
// echo $exam_id.' - '.$year.'
';
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('category','A');
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
$school_id=$row_school->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
$c=0;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category','A');
$get_reg=$this->db->get('monthly_results');
foreach($get_reg->result() as $row_reg){
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca>0){
}else{
// echo $row_reg->reg_number.' - '.$school_id.'
';
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$row_reg->reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
//$this->db->delete('monthly_results');
}
}
// echo $c;exit;
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category','A');
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$school=$row_school->school_id;
$total_students++;
$this->db->where('school_id',$school);
$this->db->where('academic_year',$year);
$this->db->where('category','A');
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_stream=$this->db->get('classes');
foreach($get_stream->result() as $row_stream){
$stream = $row_stream->stream;
}
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select_sum('mark');
// $this->db->where('month',$month);
// $this->db->where('district_id', $district);
// $this->db->where('region_id',$region);
// $this->db->where('academic_year',$academic_year);
// $this->db->where('class_level',$class);
//$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = $row_ca->mark;
}
## Select all entered and included to the calculations
//$this->db->where('district_id', $district);
//$this->db->where('region_id',$region);
//$this->db->where('academic_year',$academic_year);
//$this->db->where('category', $category);
//$this->db->where('class_level',$class);
//$this->db->where('month',$month);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('subject_id !=',26); ## BAM
$this->db->where('subject_id !=',28); ## GS
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$get_subss=$this->db->get('ca');
$required_subjects_for_calcultion=$get_subss->num_rows();
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
if($required_subjects_for_calcultion>2){
//complete results
$complete=1;
}else{
//incoplete results
$complete=0;
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
// exit;
## Division calculation here
## Finding best seven subejcts which are included in div cal
$subjects = 3;
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('reg_number',$reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit(3);
$ca = $this->db->get('ca');
$gpa=8;$point = 42;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
$gpa = round($point/7,4);
if($category =='A'){
$gpa = round($point/3,4);
}
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<=1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
$sum=0;
$com='UNK';
$subjects_ids='';
foreach($get_subss->result() as $row_subjects){
$subjects_ids.=$row_subjects->subject_id.' , ';
$sum=$sum+$row_subjects->subject_id;
}
$get_c=$this->db->where('id_sum',$sum)->get('combinations');
if($get_c->num_rows()>0){
foreach($get_c->result() as $row_c){
$com=$row_c->combination;
}
}
// echo results for each student
if($complete==1 && $stream=='UNK'){
echo 'Reg Number = '.$reg_number.' School = '.$school.' Stream = '.$stream.' Total Marks = '.$sum_of_marks.' Divided by = '.$required_subjects_for_calcultion_average.' Average = '.$average_of_marks.' Division = '.$division.' Point = '.$point.' GPA = '.$gpa.' Complete = '.$complete.' Subjects = '.$subjects_ids.' Sum ='.$sum.' = '.$com.'
';
$data_c = array(
'stream'=>$com,
);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_c);
}
}
}
echo '
';
echo 'Total Students'.$total_students;
}
public function officer_primary() {
$id = $this->input->post('id');
$district = $this->input->post('district');
$r = explode(',',$id);
$exam_id=$r[0];
$category=$r[1];
//echo $id.' '.$exam_id.' '.$category.' d = '.$district;exit;
$this->db->where('category',$category);
$this->db->where('status', 0);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
}
$total_students=0;
// echo $exam_id.' - '.$year.'
';
$candidate = 'NC';
$nostream=array();
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('district_id', $district);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
$school_id=$row_school->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
$this->db->distinct();
$this->db->select('reg_number');
//$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$school=$row_school->school_id;
$total_students++;
$this->db->where('school_id',$school);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_stream=$this->db->get('classes');
foreach($get_stream->result() as $row_stream){
$stream = $row_stream->stream;
}
//update grades and points\
/*
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('grade','F');
$this->db->where('reg_number',$reg_number);
$get=$this->db->get('ca');
foreach($get->result() as $ca){
$mark_grade='';
$mark=$ca->mark;
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($mark) && round($mark)<=$row_grade->end_mark){
$mark_grade = $row_grade->grade;
}
$point=10;
$this->db->where('students_type',$category);
$this->db->where('grade',$mark_grade);
$ff = $this->db->get('point_settings');
foreach($ff->result() as $p){
$point = $p->point;
}
}
echo $reg_number.' '. $mark.' '.$mark_grade.' '.$point.'
';
$data=array(
'grade'=>$mark_grade,
'gpa'=>$point,
);
$this->db->where('school_id',$school);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
//$this->db->where('mark',$mark);
$this->db->update('ca',$data);
}
*/
//exit;
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select_sum('mark');
// $this->db->where('month',$month);
// $this->db->where('district_id', $district);
// $this->db->where('region_id',$region);
// $this->db->where('academic_year',$academic_year);
// $this->db->where('class_level',$class);
//$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = $row_ca->mark;
}
## Select all entered and included to the calculations
//$this->db->where('district_id', $district);
//$this->db->where('region_id',$region);
//$this->db->where('academic_year',$academic_year);
//$this->db->where('class_level',$class);
//$this->db->where('month',$month);
$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id !=',26); ## BAM
$this->db->where('subject_id !=',28); ## GS
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$get_subss=$this->db->get('ca');
$required_subjects_for_calcultion=$get_subss->num_rows();
//echo $school." ".$required_subjects_for_calcultion; exit;
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$complete=0;
if($category == 'A'){
if($required_subjects_for_calcultion==3){
//complete results
$complete=1;
}
}else{
if($required_subjects_for_calcultion >=4){
//complete results
$complete=1;
}
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
// exit;
## Division calculation here
// exit;
## Division calculation here
$subjects = 0;
## Finding best seven subejcts which are included in div cal
if($category == 'A'){
$subjects = 3;
}else if($category == 'P'){
$subjects = 5;
}else{
// Primary level, do nothing
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('reg_number',$reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$gpa=8;$point = 42;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$gpa = 8;
if($category =='A'){
$gpa = round($point/3,4);
}else{
$gpa = round($point/5,4);
}
$data = array(
'gpa'=>$gpa,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'gpa'=>$gpa,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<=1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
$sum=0;
$com='UNK';
$subjects_ids='';
foreach($get_subss->result() as $row_subjects){
$subjects_ids.=$row_subjects->subject_id.' , ';
$sum=$sum+$row_subjects->subject_id;
}
if($category == 'A'){
$get_c=$this->db->where('id_sum',$sum)->get('combinations');
if($get_c->num_rows()>0){
foreach($get_c->result() as $row_c){
$com=$row_c->combination;
}
}
// echo results for each student
if($complete==1 && $stream=='UNK'){
$nostream[] = array('reg_number'=>$reg_number,'school_id'=>$school);
$data_c = array(
'stream'=>$com,
);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_c);
}
}
}
}
## This is for Private candnidate
/* $candidate = 'PC';
$nostream=array();
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
$school_id=$row_school->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
$this->db->distinct();
$this->db->select('reg_number');
//$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$school=$row_school->school_id;
$total_students++;
$this->db->where('school_id',$school);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_stream=$this->db->get('classes');
foreach($get_stream->result() as $row_stream){
$stream = $row_stream->stream;
}
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select_sum('mark');
// $this->db->where('month',$month);
// $this->db->where('district_id', $district);
// $this->db->where('region_id',$region);
// $this->db->where('academic_year',$academic_year);
// $this->db->where('class_level',$class);
//$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = $row_ca->mark;
}
## Select all entered and included to the calculations
//$this->db->where('district_id', $district);
//$this->db->where('region_id',$region);
//$this->db->where('academic_year',$academic_year);
//$this->db->where('class_level',$class);
//$this->db->where('month',$month);
$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id !=',26); ## BAM
$this->db->where('subject_id !=',28); ## GS
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$get_subss=$this->db->get('ca');
$required_subjects_for_calcultion=$get_subss->num_rows();
//echo $school." ".$required_subjects_for_calcultion; exit;
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$complete=0;
if($category == 'A'){
if($required_subjects_for_calcultion==3){
//complete results
$complete=1;
}
}else{
if($required_subjects_for_calcultion >=4){
//complete results
$complete=1;
}
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
// exit;
## Division calculation here
// exit;
## Division calculation here
$subjects = 0;
## Finding best seven subejcts which are included in div cal
if($category == 'A'){
$subjects = 3;
}else if($category == 'P'){
$subjects = 5;
}else{
// Primary level, do nothing
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('reg_number',$reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$gpa=8;$point = 42;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$gpa = 8;
if($category =='A'){
$gpa = round($point/3,4);
}else{
$gpa = round($point/5,4);
}
$data = array(
'gpa'=>$gpa,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'gpa'=>$gpa,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<=1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
$sum=0;
$com='UNK';
$subjects_ids='';
foreach($get_subss->result() as $row_subjects){
$subjects_ids.=$row_subjects->subject_id.' , ';
$sum=$sum+$row_subjects->subject_id;
}
if($category == 'A'){
$get_c=$this->db->where('id_sum',$sum)->get('combinations');
if($get_c->num_rows()>0){
foreach($get_c->result() as $row_c){
$com=$row_c->combination;
}
}
// echo results for each student
if($complete==1 && $stream=='UNK'){
$nostream[] = array('reg_number'=>$reg_number,'school_id'=>$school);
$data_c = array(
'stream'=>$com,
);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_c);
}
}
}
}
*/
?>
Info! Results recalculated successifully. Total Students:
input->post('id');
$r = explode(',',$id);
$exam_id=$r[0];
$category=$r[1];
//echo $id.' '.$exam_id.' '.$category;exit;
$this->db->where('category',$category);
$this->db->where('status', 0);
$this->db->where('examination_id',$exam_id);
$gett=$this->db->get('examination');
foreach($gett->result() as $rows){
$month=$rows->month;
$class=$rows->class_level;
$year=$rows->academic_year;
$academic_year=$rows->academic_year;
$region=$rows->region;
}
$total_students=0;
// echo $exam_id.' - '.$year.'
';
$candidate = 'NC';
$nostream=array();
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
$school_id=$row_school->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
$this->db->distinct();
$this->db->select('reg_number');
//$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$school=$row_school->school_id;
$total_students++;
$this->db->where('school_id',$school);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_stream=$this->db->get('classes');
foreach($get_stream->result() as $row_stream){
$stream = $row_stream->stream;
}
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select_sum('mark');
// $this->db->where('month',$month);
// $this->db->where('district_id', $district);
// $this->db->where('region_id',$region);
// $this->db->where('academic_year',$academic_year);
// $this->db->where('class_level',$class);
//$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = $row_ca->mark;
}
## Select all entered and included to the calculations
//$this->db->where('district_id', $district);
//$this->db->where('region_id',$region);
//$this->db->where('academic_year',$academic_year);
//$this->db->where('class_level',$class);
//$this->db->where('month',$month);
$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id !=',26); ## BAM
$this->db->where('subject_id !=',28); ## GS
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$get_subss=$this->db->get('ca');
$required_subjects_for_calcultion=$get_subss->num_rows();
//echo $school." ".$required_subjects_for_calcultion; exit;
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$complete=0;
if($category == 'A'){
if($required_subjects_for_calcultion==3){
//complete results
$complete=1;
}
}else{
if($required_subjects_for_calcultion >=7){
//complete results
$complete=1;
}
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
// exit;
## Division calculation here
$subjects = 0;
## Finding best seven subejcts which are included in div cal
if($category == 'A'){
$subjects = 3;
}else if($category == 'O'){
$subjects = 7;
}else{
// Primary level, do nothing
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('reg_number',$reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$gpa=8;$point = 42;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
$gpa = 8;
if($category =='A'){
$gpa = round($point/3,4);
}else{
$gpa = round($point/7,4);
}
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<=1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
$sum=0;
$com='UNK';
$subjects_ids='';
foreach($get_subss->result() as $row_subjects){
$subjects_ids.=$row_subjects->subject_id.' , ';
$sum=$sum+$row_subjects->subject_id;
}
if($category == 'A'){
$get_c=$this->db->where('id_sum',$sum)->get('combinations');
if($get_c->num_rows()>0){
foreach($get_c->result() as $row_c){
$com=$row_c->combination;
}
}
// echo results for each student
if($complete==1 && $stream=='UNK'){
$nostream[] = array('reg_number'=>$reg_number,'school_id'=>$school);
$data_c = array(
'stream'=>$com,
);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_c);
}
}
}
}
## This is for Private candnidate
$candidate = 'PC';
$nostream=array();
$this->db->distinct();
$this->db->select('school_id');
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('class_level',$class);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_school=$this->db->get('ca');
foreach($get_school->result() as $row_school){
$school=$row_school->school_id;
$school_id=$row_school->school_id;
foreach($this->db->where('school_id',$school)->get('schools')->result() as $dist){
$district = $dist->district;
}
$this->db->distinct();
$this->db->select('reg_number');
//$this->db->where('region_id',$region);
$this->db->where('school_id',$school_id);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$get_reg=$this->db->get('ca');
foreach($get_reg->result() as $row_reg){
$reg_number=$row_reg->reg_number;
$school=$row_school->school_id;
$total_students++;
$this->db->where('school_id',$school);
$this->db->where('academic_year',$year);
$this->db->where('category',$category);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_stream=$this->db->get('classes');
foreach($get_stream->result() as $row_stream){
$stream = $row_stream->stream;
}
$sum_of_marks=0;
$required_subjects_for_calcultion=0;
$required_subjects_for_calcultion_average=0;
$average_of_marks=0;
$grade='';
$remark='';
$grade1='';
$sum_of_marks2=0;
$mark_grade='';
$avg_cal='';
$div_cal='';
$complete='';
## select sum of marks for this monly and this student for reqiured only
$this->db->select_sum('mark');
// $this->db->where('month',$month);
// $this->db->where('district_id', $district);
// $this->db->where('region_id',$region);
// $this->db->where('academic_year',$academic_year);
// $this->db->where('class_level',$class);
//$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('status', 0);
$get_ca=$this->db->get('ca');
foreach($get_ca->result() as $row_ca){
$sum_of_marks = $row_ca->mark;
}
## Select all entered and included to the calculations
//$this->db->where('district_id', $district);
//$this->db->where('region_id',$region);
//$this->db->where('academic_year',$academic_year);
//$this->db->where('class_level',$class);
//$this->db->where('month',$month);
$this->db->where('category', $category);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('subject_id !=',26); ## BAM
$this->db->where('subject_id !=',28); ## GS
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$get_subss=$this->db->get('ca');
$required_subjects_for_calcultion=$get_subss->num_rows();
//echo $school." ".$required_subjects_for_calcultion; exit;
//this for average take all subjects
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('status', 0);
$required_subjects_for_calcultion_average=$this->db->count_all_results('ca');
$complete=0;
if($category == 'A'){
if($required_subjects_for_calcultion==3){
//complete results
$complete=1;
}
}else{
if($required_subjects_for_calcultion >=7){
//complete results
$complete=1;
}
}
if($required_subjects_for_calcultion==0){
// No results calculations, because subjects for results calcultions not set';
}else{
$average_of_marks=($sum_of_marks/$required_subjects_for_calcultion_average); //for considering total marks over total subjects required
$average_of_marks=round($average_of_marks);
//finding the grades from the score
$this->db->where('students_type',$category);
$get_grades=$this->db->get('grade_settings');
foreach($get_grades->result() as $row_grade){
if($row_grade->start_mark<=round($average_of_marks) && round($average_of_marks)<=$row_grade->end_mark){
$grade=$row_grade->grade;
$remark=$row_grade->remark;
//inserting values to the databse without positions
$data3=array(
'school_id'=>$school,
'reg_number'=>$reg_number,
'class_level'=>$class,
'district_id'=>$district,
'region_id'=>$region,
'exam_id'=>$exam_id,
'candidate'=>$candidate,
'stream'=>$stream,
'academic_year'=>$academic_year,
'month'=>$month,
'total_marks'=>$sum_of_marks,
'average'=>$average_of_marks,
'grade'=>$grade,
'remark'=>$remark,
'category'=>$category,
'division'=>'---',
'complete'=>$complete,
);
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$count_entered= $this->db->count_all_results('monthly_results');
if($count_entered>0){
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('candidate',$candidate);
$this->db->where('exam_id',$exam_id);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data3);
//there should be updating on mid term results
}else{
$this->db->insert('monthly_results',$data3);
//there should be inserting into mid term results
}
}
}
// exit;
## Division calculation here
$subjects = 0;
## Finding best seven subejcts which are included in div cal
if($category == 'A'){
$subjects = 3;
}else if($category == 'O'){
$subjects = 7;
}else{
// Primary level, do nothing
}
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('reg_number',$reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->where('status', 0);
$this->db->order_by('mark', 'desc');
$this->db->limit($subjects);
$ca = $this->db->get('ca');
$gpa=8;$point = 42;$division = "---"; $division_remark="Fail";
if($ca->num_rows() == $subjects){
$point = 0;
foreach($ca->result() as $mark){
$this->db->where('students_type',$category);
$this->db->where('grade',$mark->grade);
$get_points=$this->db->get('point_settings');
foreach($get_points->result() as $row_point){
$point= $point+$row_point->point;
}
}
//finding division
$this->db->where('students_type',$category);
$get_div=$this->db->get('division_settings');
foreach($get_div->result() as $row_div){
if($row_div->start_point<=round($point) && round($point)<=$row_div->end_point){
$division=$row_div->division;
$division_remark=$row_div->remark;
}
}
$gpa = 8;
if($category =='A'){
$gpa = round($point/3,4);
}else{
$gpa = round($point/7,4);
}
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}else{
$data = array(
'division'=>$division,
'point'=>$point,
'gpa'=>$gpa,
'remark'=>$division_remark,
);
$this->db->where('school_id',$school);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->update('monthly_results',$data);
}
//deleting monthly results if all ca for the specific month have been deleted
$this->db->where('school_id',$school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('month',$month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level',$class);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$check_from_ca= $this->db->count_all_results('ca');
if($check_from_ca<=1 || $sum_of_marks==0){
$this->db->where('school_id', $school);
$this->db->where('district_id', $district);
$this->db->where('region_id',$region);
$this->db->where('exam_id',$exam_id);
$this->db->where('candidate',$candidate);
$this->db->where('reg_number',$reg_number);
$this->db->where('month', $month);
$this->db->where('academic_year',$academic_year);
$this->db->where('class_level', $class);
$this->db->where('category', $category);
$this->db->delete('monthly_results');
}
}
$sum=0;
$com='UNK';
$subjects_ids='';
foreach($get_subss->result() as $row_subjects){
$subjects_ids.=$row_subjects->subject_id.' , ';
$sum=$sum+$row_subjects->subject_id;
}
if($category == 'A'){
$get_c=$this->db->where('id_sum',$sum)->get('combinations');
if($get_c->num_rows()>0){
foreach($get_c->result() as $row_c){
$com=$row_c->combination;
}
}
// echo results for each student
if($complete==1 && $stream=='UNK'){
$nostream[] = array('reg_number'=>$reg_number,'school_id'=>$school);
$data_c = array(
'stream'=>$com,
);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_c);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_c);
}
}
}
}
?>
Info! Results recalculated successifully. Total Students:
input->post('school');
$reg_number = $this->input->post('reg_number');
$category = $this->input->post('category');
$academic_year = $this->input->post('academic_year');
$stream = strtoupper($this->input->post('stream'));
$data_stream = array('stream'=>$stream);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_stream);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('ca',$data_stream);
$this->db->where('school_id',$school);
$this->db->where('reg_number',$reg_number);
$this->db->where('category', $category);
$this->db->where('academic_year', $academic_year);
$this->db->update('monthly_results',$data_stream);
}
public function create_combination(){
$exam = explode(',',$this->input->post('exam_id'));
$students_updated=0;
$exam_id = $exam[0];
$academic_year = $exam[1];
$this->db->distinct();
$this->db->select('reg_number');
$this->db->where('exam_id',$exam_id);
foreach($this->db->get('ca')->result() as $students){
$this->db->distinct();
$this->db->select('subject_id');
$this->db->where('exam_id',$exam_id);
$this->db->where('reg_number',$students->reg_number);
$this->db->not_like('subject_id',26); ## GS
$this->db->not_like('subject_id',28); ## BAM
$this->db->not_like('subject_id',54); ## DIVINITY
$this->db->not_like('subject_id',55); ## MUSIC
$this->db->order_by('subject_id','asc');
$this->db->limit(3);
$subjects = $this->db->get('ca');
$sum = '';
foreach($subjects->result() as $subs){
$sum.= $subs->subject_id; // Concatinate the ID's
//echo $subs->subject_id;
}
//echo " ";
/*
$this->db->select('s.full_name,c.school_name,s.id_number');
$this->db->where('s.reg_number',$students->reg_number);
$this->db->from('students as s');
$this->db->join('schools as c','c.school_id=s.school_id');
$g = $this->db->get();
foreach($g->result() as $sc){
echo $sc->school_name." ".$sc->id_number." ";
}
echo $students->reg_number;
*/
$this->db->where('id_sum',$sum);
$c = $this->db->get('combinations');
foreach($c->result() as $comb){
$data_stream = array('stream'=>$comb->combination);
}
if($c->num_rows() == 0){
## UNK Combination
//$data_stream = array('stream'=>'UNK');
if($subjects->num_rows() == 3 ){
//echo " UNK - ".$subjects->num_rows();
}else{
// echo " Incomplete ".$subjects->num_rows();
}
}else{
$students_updated++;
//echo " ".$data['stream']." Complete";
$this->db->where('reg_number',$students->reg_number);
$this->db->where('academic_year', $academic_year);
$this->db->update('classes',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->update('ca',$data_stream);
$this->db->where('reg_number',$students->reg_number);
$this->db->where('exam_id',$exam_id);
$this->db->update('monthly_results',$data_stream);
}
//echo "
";
}
?>
PK ! q Confirm_payments.phpnu [ load->database();
}
public function index(){
date_default_timezone_set('Africa/Nairobi');
$school_id = '';
$amount = '';
$mobile = '';
$transaction_id = '';
$school_name ='';
$count1='';
if($_POST){
//echo $this->security->xss_clean($this->input->post('key'))."
";
//echo "179103@afel_1990/2017
";
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$this->db->where('payer_id','no');
$this->db->where('payer_name','no');
$this->db->where('paid_for','Normal');
$count1=$this->db->count_all_results('money_collection');
if(trim($this->security->xss_clean($this->input->post('key'))) == '179103@afel_1990/2017'){
if( $count1>0){
$data= array(
"paid_for"=> $this->security->xss_clean($this->input->post('paid_for')),
"payer_id"=> $this->security->xss_clean($this->input->post('payer_id')),
"payer_name"=> $this->security->xss_clean($this->input->post('payer_name')),
);
$data = array_map('trim', $data);
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$this->db->update('money_collection',$data);
$this->db->where('transaction_id',trim($this->security->xss_clean($this->input->post('transaction_id'))));
$get=$this->db->get('money_collection');
foreach($get->result() as $row){
$school_id = $this->security->xss_clean($this->input->post('payer_id'));
$school_name = $this->security->xss_clean($this->input->post('payer_name'));
$amount = $row->amount;
$mobile = $row->mobile;
$transaction_id = $row->transaction_id;
$payment_method = $row->payment_method;
$date_paid = $row->date_paid;
}
$url = 'http://www.afel.co.tz/Insert_confirmed_payments';
$fields = array(
'key= '=>"179103@afel_1990/2017",
'school_id= '=>$school_id,
'school_name= '=>$school_name,
'transaction_id= '=>$transaction_id,
'mobile= '=>$mobile ,
'amount= '=>$amount,
'payment_method= '=>$payment_method ,
'date_paid= '=>$date_paid ,
);
$fields_string = '';
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if($result == 1){
}
}else{
//do nothing
}
}else{
redirect('http://afel.co.tz');
}
}else{
redirect('http://afel.co.tz');
}
}
}
PK ! YlB( ( % Upload_results_secondary_officers.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
}
//this function redirecting different pages after users loged in
public function index() {
if($this->session->userdata('type')=='Admin'){
$session_reg_number = $this->session->userdata('school_reg_number');
}else{
$session_reg_number=$this->session->userdata('reg_number');
}
}
public function delete_ca(){
$class= base64_decode($_REQUEST['class']);
$term= base64_decode($_REQUEST['term']);
$stream= base64_decode($_REQUEST['stream']);
$month= base64_decode($_REQUEST['month']);
$category= base64_decode($_REQUEST['category']);
$academic_year= base64_decode($_REQUEST['academic_year']);
$this->db->where('school_id',$this->security->xss_clean($this->input->post('school_id')));
$this->db->where('term',$term);
$this->db->where('month',$month);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->where('stream',$stream);
$this->db->where('status',0);
$this->db->delete('ca');
redirect('Secondary/upload_results_by_excel_a?term='.base64_encode($term).'&&type='.base64_encode($category));
}
public function delete_exam(){
$class= base64_decode($_REQUEST['class']);
$term= base64_decode($_REQUEST['term']);
$stream= base64_decode($_REQUEST['stream']);
$category= base64_decode($_REQUEST['category']);
$academic_year= base64_decode($_REQUEST['academic_year']);
$this->db->where('school_id',$this->security->xss_clean($this->input->post('school_id')));
$this->db->where('term',$term);
$this->db->where('class_level',$class);
$this->db->where('category',$category);
$this->db->where('academic_year',$academic_year);
$this->db->where('stream',$stream);
$this->db->where('status',0);
$this->db->delete('exam');
redirect('Secondary/upload_results_by_excel_a?term='.base64_encode($term).'&&type='.base64_encode($category));
}
public function send_ca() {
$mark= $this->security->xss_clean($this->input->post('mark'));
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
$this->db->like('month', $this->security->xss_clean($this->input->post('month')), 'BOTH');
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->where('status', 0);
$get_mark = $this->db->count_all_results('ca');
//$mark=$row_mark->mark;
if ($get_mark > 0) {
if(!empty($mark)){
if($mark > 100){
// continue;
}else{
$data = array(
'mark' => $this->security->xss_clean($this->input->post('mark'))
);
$this->db->select('mark');
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('month', $this->security->xss_clean($this->input->post('month')));
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->update('ca', $data);
}}else{
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('month', $this->security->xss_clean($this->input->post('month')));
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->delete('ca');
}}else {
if($mark > 100){
// continue;
}else{
$data1 = array(
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'mark' => $this->security->xss_clean($this->input->post('mark')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
'month' => $this->security->xss_clean($this->input->post('month')),
'academic_year' => $this->security->xss_clean($this->input->post('academic_year')),
'term' => $this->security->xss_clean($this->input->post('term')),
'subject_id' => $this->security->xss_clean($this->input->post('subject_id')),
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('ca', $data1);
return $this->db->insert_id();
}}
}
public function send_exam() {
$mark= $this->security->xss_clean($this->input->post('mark'));
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
// $this->db->like('month', $this->security->xss_clean($this->input->post('month')), 'BOTH');
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->where('status', 0);
$get_mark = $this->db->count_all_results('exam');
//$mark=$row_mark->mark;
if ($get_mark > 0) {
if(!empty($mark)){
if($mark > 100){
// continue;
}else{
$data = array(
'mark' => $this->security->xss_clean($this->input->post('mark'))
);
$this->db->select('mark');
$this->db->where('school_id', $this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
//$this->db->where('month', $this->security->xss_clean($this->input->post('month')));
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->update('exam', $data);
}}else{
$this->db->where('school_id', $$this->security->xss_clean($this->input->post('school_id')));
$this->db->where('reg_number', $this->security->xss_clean($this->input->post('reg_number')));
//$this->db->where('month', $this->security->xss_clean($this->input->post('month')));
$this->db->where('academic_year', $this->security->xss_clean($this->input->post('academic_year')));
$this->db->where('term', $this->security->xss_clean($this->input->post('term')));
$this->db->where('subject_id', $this->security->xss_clean($this->input->post('subject_id')));
$this->db->where('class_level', $this->security->xss_clean($this->input->post('class_level')));
$this->db->delete('exam');
}}else {
if($mark > 100){
// continue;
}else{
$data1 = array(
'school_id' => $this->security->xss_clean($this->input->post('school_id')),
'reg_number' => $this->security->xss_clean($this->input->post('reg_number')),
'mark' => $this->security->xss_clean($this->input->post('mark')),
'stream' => $this->security->xss_clean($this->input->post('stream')),
//'month' => $this->security->xss_clean($this->input->post('month')),
'academic_year' => $this->security->xss_clean($this->input->post('academic_year')),
'term' => $this->security->xss_clean($this->input->post('term')),
'subject_id' => $this->security->xss_clean($this->input->post('subject_id')),
'class_level' => $this->security->xss_clean($this->input->post('class_level')),
'category' => $this->security->xss_clean($this->input->post('category'))
);
$this->db->insert('exam', $data1);
return $this->db->insert_id();
}}
}
}PK ! u61y y Exam_creator.phpnu [ load->model('User_model');
$this->load->helper("url");
$this->load->library("pagination");
if (!$this->session->userdata('reg_number')) {
$this->session->set_flashdata('flash_data', 'You don\'t have access!');
redirect('Welcome');
}
function class_level($cat,$number){
if($cat =='P'){
$level = "Standard ";
}else{
$level = "Form ";
}
//$map = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1);
$map = array('V' => 5, 'IV' => 4, 'I' => 1);
$returnValue = '';
while ($number > 0) {
foreach ($map as $roman => $int) {
if($number >= $int) {
$number -= $int;
$returnValue .= $roman;
break;
}
}
}
return $level.$returnValue;
}
function toString($number) {
$alphabet = array( 'a', 'b', 'c', 'd', 'e','f', 'g', 'h', 'i', 'j','k', 'l', 'm', 'n', 'o','p', 'q', 'r', 's', 't','u', 'v', 'w', 'x', 'y','z');
if($number < 27){
return strtoupper($alphabet[$number]);
}else return false;
}
}
public function index() {
if($this->session->userdata('school_type') == 'PS'){
$this->load->view('includes/primary/primary_officer_header');
$this->load->view('users/secondary/officer/exam_creator');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/exam_creator');
$this->load->view('includes/secondary/secondary_footer');
}
}
public function setter_area(){
if($this->session->userdata('school_type') == 'PS'){
$this->load->view('includes/primary/primary_header');
$this->load->view('users/secondary/officer/exams/setter_area');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->load->view('includes/secondary/secondary_header');
$this->load->view('users/secondary/officer/exams/setter_area');
$this->load->view('includes/secondary/secondary_footer');
}
}
public function preview_insert(){
if($this->session->userdata('school_type') == 'PS'){
$this->load->view('includes/primary/primary_officer_header');
$this->load->view('users/secondary/officer/exams/preview_insert');
$this->load->view('includes/secondary/secondary_footer');
}else{
$this->load->view('includes/secondary/secondary_officer_header');
$this->load->view('users/secondary/officer/exams/preview_insert');
$this->load->view('includes/secondary/secondary_footer');
}
}
public function moderate_question(){
if(isset($_REQUEST['m'])){
$question = base64_decode($_REQUEST['question']);
$exam_id = base64_decode($_REQUEST['exam_id']);
$subject_id = base64_decode($_REQUEST['subject_id']);
$copy = base64_decode($_REQUEST['copy']);
$moderated = $_REQUEST['m'];
## Validating the moderated question
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('question_number',$question);
$this->db->where('moderated',$moderated);
$count = $this->db->count_all_results('exam_questions');
if($count == 0){
## Not set, then set this as official
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('question_number',$question);
$this->db->where('copy',$copy);
$this->db->update('exam_questions',array('moderated'=>$moderated));
}
redirect($_SERVER['HTTP_REFERER']);
}
}
public function moderate_question_undo(){
if(isset($_REQUEST['m'])){
$question = base64_decode($_REQUEST['question']);
$exam_id = base64_decode($_REQUEST['exam_id']);
$subject_id = base64_decode($_REQUEST['subject_id']);
$copy = base64_decode($_REQUEST['copy']);
$moderated = $_REQUEST['m'];
## Validating the moderated question
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('question_number',$question);
$this->db->where('copy',$copy);
$this->db->update('exam_questions',array('moderated'=>0));
redirect($_SERVER['HTTP_REFERER']);
}
}
public function publish_subject_undo(){
$main_subject_id = base64_decode($_REQUEST['main_subject_id']);
$exam_id = base64_decode($_REQUEST['exam_id']);
$subject_id = base64_decode($_REQUEST['subject_id']);
$moderated = $_REQUEST['mode'];
$this->db->where('subject_id',$subject_id);
$this->db->where('exam_id',$exam_id);
$this->db->where('moderated',$moderated);
$this->db->delete('exam_published');
redirect($_SERVER['HTTP_REFERER']);
}
public function publish_subject(){
$main_subject_id = base64_decode($_REQUEST['main_subject_id']);
$exam_id = base64_decode($_REQUEST['exam_id']);
$subject_id = base64_decode($_REQUEST['subject_id']);
$moderated = $_REQUEST['mode'];
$exam = "";
$temp = $this->db->where('exam_id',$exam_id)->where('subject_id',$subject_id)->where('copy',1)->order_by('section','asc')->get('exam_templates');
foreach($temp->result() as $template){
$exam .= "
SECTION ".$template->section.", ".$template->questions." QUESTIONS ";
foreach($this->db->where('exam_id',$exam_id)->where('subject_id',$subject_id)->where('moderated',$moderated)->where('section',$template->section)->order_by('question_number','asc')->get('exam_questions')->result() as $question){
$exam .= "
".$question->question_number.". ".str_replace('