<?php
class ComboMgmt
{
//combo_STUDENT
    function getbranch($condition)
    {

        $qry = "SELECT * FROM cms_branchmaster WHERE 1=1 and college_id= '" . $_SESSION["VedantnrCollegeId"] . "'";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getbranch1($condition)
    {

        $qry = "SELECT * FROM cms_branchmaster WHERE college_id = '" . $_SESSION["VedantnrCollegeId"] . "' AND branch_id IN (4, 5)";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getsemester($condition)
    {

        $qry = "SELECT *  FROM cms_semestermaster where 1 = 1 AND
	college_id = '" . $_SESSION["VedantnrCollegeId"] . "' ";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getdisplay($condition)
    {

        $qry = "SELECT * FROM cms_displaytable WHERE displaytype = 'S' AND displayactive='1' ORDER BY displayorder ASC";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getbranchsemester($condition)
    {

        $qry = "SELECT *
				FROM cms_branchsemester 
				WHERE college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' ";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getcast($condition)
    {

        $qry = "SELECT DISTINCT student_cast FROM cms_studentmaster WHERE student_cast != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_cast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getsubcast($condition)
    {

        $qry ="SELECT DISTINCT student_subcast FROM cms_studentmaster WHERE student_subcast != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_subcast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getadmdate($condition)
    {

        $qry ="SELECT DISTINCT YEAR(`student_admdate`) as AYEAR FROM `cms_studentmaster` WHERE YEAR(`student_admdate`) != 0;";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getemp($condition)
    {

        $qry ="SELECT employee_id,employee_name,branch_id FROM cms_employeemaster WHERE employee_active='Yes'";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function gettime($condition)
    {

        $qry = "SELECT * from cms_timemaster";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getlec($condition)
    {
        $qry = "SELECT * from cms_lecmaster";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getbatch($condition)
    {
        $qry = "SELECT * FROM cms_batchmaster WHERE 1=1 and college_id= '" . $_SESSION["VedantnrCollegeId"] . "' ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function gettaluko($condition)
    {
        $qry = "SELECT DISTINCT taluko_nameeng FROM cms_studentmaster WHERE taluko_nameeng != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_cast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getstate($condition)
    {
        $qry = "SELECT DISTINCT state_nameeng FROM cms_studentmaster WHERE state_nameeng != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_cast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function gettaluko1($condition)
    {
        $qry = "SELECT DISTINCT taluko_nameeng1 FROM cms_studentmaster WHERE taluko_nameeng1 != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_cast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getstate1($condition)
    {
        $qry = "SELECT DISTINCT state_nameeng1 FROM cms_studentmaster WHERE state_nameeng1 != '' AND college_id = '" . $_SESSION["VedantnrCollegeId"] . "' order by student_cast ASC ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getscholarship($condition)
    {
        $qry = "SELECT * FROM scholarship_master WHERE 1=1";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    //combo_BRANCHYEAR
    function getbranchyear($condition)
    {
        $qry = "SELECT bry.*, b.branch_name,b.branch_id
        FROM cms_branchyear AS bry
        INNER JOIN cms_branchmaster AS b ON bry.branch_id = b.branch_id
		where bry.college_id='".$_SESSION["VedantnrCollegeId"]."' ";

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }



    //comdo_SEMESTER

    function getempid($condition)
    {
        $qry = "select employee_id from cms_employeemaster where user_id ='".$_SESSION["VedantnrUserId"]."'";
			

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getsubjectallocation($condition)
    {
        $qry = "select GROUP_CONCAT(branch_id) as branch_id,GROUP_CONCAT(semester_id) as semester_id,
		count(div_id) as div_id,GROUP_CONCAT(batch_id) as batch_id,GROUP_CONCAT(lectype) as lectype			
		from cms_subject_allocation where  college_id = ".$_SESSION["VedantnrCollegeId"]."";
		
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getbank($condition)
    {
        $qry = "SELECT DISTINCT bank_name FROM cms_feesreceivemaster WHERE bank_name != '' ORDER BY bank_name ASC";
	
		
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getgroup($condition)
    {
        $qry = "SELECT DISTINCT group_name FROM cms_contact WHERE group_name != '' ORDER BY group_name ASC";
	
		
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getmessage($condition)
    {
        $qry = "SELECT message_title,message_content FROM cms_message";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getdivsubject($condition)
    {
        $qry ="select distinct(div_id) as div_id,sa.* from cms_subject_allocation as sa ";
		
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getgtufeetype($condition)
    {

        $qry = "SELECT distinct gtufee_type FROM cms_gtufeeshead";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getheadname($condition)
    {

        $qry = "SELECT distinct gtuhead_name FROM cms_gtufeeshead";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getempname($condition)
    {

        $qry ="SELECT distinct employee_id,employee_name FROM cms_employeemaster where employee_designation = 23 "; // 23 for faculty only

        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getisteaching($condition)
    {

        $qry = "SELECT * FROM `cms_employeemaster` WHERE employee_isteaching ='Teaching Staff' AND employee_active = 'YES' order by employee_name ASC";
	
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getlectype($condition)
    {

        $qry = "SELECT * FROM cms_lectype";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getyear($condition)
    {

        $qry = "SELECT year_name,year_id FROM cms_yearmaster";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getroute($condition)
    {

        $qry = "SELECT * FROM cms_routemaster";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }

    function getfeeshead($condition)
    {

        $qry = "SELECT * FROM cms_feeshead where fees_type='Transport'";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }


    function getroom($condition)
    {

        $qry = "SELECT * from cms_roommaster";
        if ($condition != "") {
            $qry .= $condition;
        }

        $out = dbQuery($qry);

        if (dbRows($out) > 0) {
            return $out;
        }
        return $out;
    }
}
?>