SetQuery("select studentCode from StudentMaster where studentId='$xKey' "); } //-- The end -- // This function use on page processGenTotalPoint.php function RSStudentMasterGenTotalPoint(){ $this->SetQuery("select * from StudentMaster where studentCode!='' and studentStatus='1' and totalPoint!=100 "); } function RSStudentMasterCountStudGenTP(){ $this->SetQuery("select count(studentId) as num from StudentMaster where studentCode!='' and studentStatus='1' and totalPoint!=100 "); $result=$this->GetResult(); return $result['num']; } //-- The end -- // This function on file studentTable.php function RSStudentMasterLimit($start, $pageSize){ $this->SetQuery("select * from StudentMaster where studentCode!='' and studentStatus='1' limit $start, $pageSize"); } function RSStudentMasterLimitByStudCode($sKey, $start, $pageSize){ $this->SetQuery("select * from StudentMaster where studentCode LIKE '%$sKey%' and studentStatus='1' Limit $start, $pageSize"); } function RSStudentMasterByStudCode(){ $this->SetQuery("select * from StudentMaster where studentCode!='' and studentStatus='1' order by studentId"); } function RSStudentMasterCountStudByOffIdStudIdND($aKey, $bKey){ $this->SetQuery("select count(studentId) as num from StudentMaster where studentId='$aKey' and programId='$bKey' and officerId1!='NULL' and studentStatus='1' "); $result=$this->GetResult(); return $result['num']; } /** The End **/ /*function RSStudentMasterByPgIdGroupAdY($xKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' group by admitAcadYear"); }*/ function RSStudentMasterByPgIdGroupAdY($xKey){ $sql="select admitAcadYear, max(studentYear) as studentYear from StudentMaster where programId='$xKey' and genStatus='Y' group by admitAcadYear"; $this->SetQuery($sql); } function RSStudentMasterByPgIdAndAdY($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and admitAcadYear='$yKey' order by studentCode"); } function RSStudentMasterByPgIdAndStYAndAdY($xKey, $yKey, $zKey){ //$programId, $studentYear, $admitAcadYear $sql="select * from StudentMaster where programId='$xKey' and studentYear='$yKey' and admitAcadYear='$zKey' order by studentCode"; $this->SetQuery($sql); } function RSStudentMasterByPgIdAndAdYLimit($xKey, $yKey, $start, $pageSize){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and admitAcadYear='$yKey' limit $start, $pageSize"); } function GetNextCodeByPgIdAndAdY($xKey, $yKey){ $this->SetQuery("select max(studentCode) as num from StudentMaster where programId='$xKey' and admitAcadYear='$yKey'"); if ($result=$this->GetResult()) { return $result['num']+1; } } function RSStudentMasterByPgIdAndAdYGS($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and admitAcadYear='$yKey' and genStatus='Y'"); } function RSStudentMasterByGSGroupPgIdAndAdY($xKey){ $this->SetQuery("select programId, admitAcadYear from StudentMaster where genStatus='$xKey' group by programId, admitAcadYear"); } function RSStudentMasterByGSGroupPgIdAndAdYLimit($xKey, $start, $pageSize){ $this->SetQuery("select programId, admitAcadYear from StudentMaster where genStatus='$xKey' group by programId, admitAcadYear limit $start, $pageSize"); } function RSStudentMasterByPgIdAndAdYOrderStNm($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and admitAcadYear='$yKey' order by studentName"); } function RSStudentMasterByPgIdAndGeId($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and generationId= '$yKey' order by studentId"); } function RSStudentMasterByPgIdAndStY($xKey, $yKey){ // รหัสหลักสูตร, ปีที่เข้า $sql="select * from StudentMaster where programId='$xKey' and studentYear='$yKey' group by admitAcadYear"; $this->SetQuery($sql); } function RSStudentMasterByPgIdAndAdYAndExpectGD($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and admitAcadYear='$yKey' and studentStatus='3' and finishDate=0000-00-00 and graduateYear='0'"); } function RSStudentMasterByPgIdAndAdYAndExpectGDAndGD($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and admitAcadYear='$yKey' and ((studentStatus='3'and finishDate=0000-00-00 and graduateYear='0') or studentStatus='4')"); } function RSStudentMasterByPgIdAndAdYAndGD($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and admitAcadYear='$yKey' and studentStatus='4' and finishDate<>0000-00-00 and graduateYear<>'0'"); } function RSStudentMasterByPgIdAndAdYAndStYAndStudying($xKey, $yKey, $zKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and admitAcadYear='$yKey' and studentYear='$zKey' and studentStatus='1' and finishDate=0000-00-00 and graduateYear='0'"); } function RSStudentMasterByPgIdAndAdYOrderGPATtPt($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and admitAcadYear='$yKey' order by GPA desc, totalPoint desc"); } function RSStudentMasterGroupGdY(){ $this->SetQuery("select graduateYear from StudentMaster group by graduateYear"); } function RSStudentMasterByPgIdAndFinishDateAndGdY($wKey, $xKey, $yKey, $zKey){ $this->SetQuery("select * from StudentMaster where programId='$wKey' and finishDate>='$xKey' and finishDate<='$yKey' and graduateYear='$zKey'"); } // Get by ProgramId function RSStudentMasterByPgId($xKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' order by studentId"); } function RSStudentMasterByPgIdOrderByStdNameAndStdStatus($xKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and studentStatus != 6 order by studentName"); } function RSStudentMasterByPgIdGroupByStYAndStdStatus($xKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and studentStatus != 6 group by studentYear"); } function RSStudentMasterByPgIdOrderByStdName($xKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' order by studentName"); } function RSCountStudentMaster($xKey, $yKey){ $this->SetQuery("select count(studentId) as countStudent from StudentMaster where programId='$xKey' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countStudent']; } function RSCountStudentSexM($xKey, $yKey){ $this->SetQuery("select count(studentSex) as countStudentSexM from StudentMaster where programId='$xKey' and studentSex='M' and studentYear='$yKey' group by programId, studentYear "); $result=$this->GetResult(); return $result['countStudentSexM']; } function RSCountStudentSexF($xKey, $yKey){ $this->SetQuery("select count(studentSex) as countStudentSexF from StudentMaster where programId='$xKey' and studentSex='F' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countStudentSexF']; } //Count EntryType function RSCountEntryType1($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType1 from StudentMaster where programId='$xKey' and entryTypeId='1' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType1']; } function RSCountEntryType2($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType2 from StudentMaster where programId='$xKey' and entryTypeId='2' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType2']; } function RSCountEntryType3($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType3 from StudentMaster where programId='$xKey' and entryTypeId='3' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType3']; } function RSCountEntryType4($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType4 from StudentMaster where programId='$xKey' and entryTypeId='4' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType4']; } function RSCountEntryType5($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType5 from StudentMaster where programId='$xKey' and entryTypeId='5' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType5']; } function RSCountEntryType6($xKey, $yKey){ $this->SetQuery("select count(entryTypeId) as countEntryType6 from StudentMaster where programId='$xKey' and entryTypeId='6' and studentYear='$yKey' group by programId, studentYear"); $result=$this->GetResult(); return $result['countEntryType6']; } // Get num student by programId and studentYear=1 function RSCountStudentSexM11($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM1 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId='1' and studentYear='1' "); $result=$this->GetResult(); return $result['countStudentSexM1']; } function RSCountStudentSexM21($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM2 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId != '1' and studentYear='1' "); $result=$this->GetResult(); return $result['countStudentSexM2']; } function RSCountStudentSexF11($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF1 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId='1' and studentYear='1' "); $result=$this->GetResult(); return $result['countStudentSexF1']; } function RSCountStudentSexF21($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF2 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId != '1' and studentYear='1' "); $result=$this->GetResult(); return $result['countStudentSexF2']; } //----------------------------------------------- // Get num student by programId and studentYear=2 function RSCountStudentSexM12($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM1 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId='1' and studentYear='2' "); $result=$this->GetResult(); return $result['countStudentSexM1']; } function RSCountStudentSexM22($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM2 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId != '1' and studentYear='2' "); $result=$this->GetResult(); return $result['countStudentSexM2']; } function RSCountStudentSexF12($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF1 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId='1' and studentYear='2' "); $result=$this->GetResult(); return $result['countStudentSexF1']; } function RSCountStudentSexF22($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF2 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId != '1' and studentYear='2' "); $result=$this->GetResult(); return $result['countStudentSexF2']; } //----------------------------------------------- // Get num student by programId and studentYear=3 function RSCountStudentSexM13($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM1 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId='1' and studentYear='3' "); $result=$this->GetResult(); return $result['countStudentSexM1']; } function RSCountStudentSexM23($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM2 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId != '1' and studentYear='3' "); $result=$this->GetResult(); return $result['countStudentSexM2']; } function RSCountStudentSexF13($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF1 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId='1' and studentYear='3' "); $result=$this->GetResult(); return $result['countStudentSexF1']; } function RSCountStudentSexF23($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF2 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId != '1' and studentYear='3' "); $result=$this->GetResult(); return $result['countStudentSexF2']; } //----------------------------------------------- // Get num student by programId and studentYear=4 function RSCountStudentSexM14($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM1 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId='1' and studentYear='4' "); $result=$this->GetResult(); return $result['countStudentSexM1']; } function RSCountStudentSexM24($xKey){ $this->SetQuery("select count(studentId) as countStudentSexM2 from StudentMaster where programId='$xKey' and studentSex='M' and entryTypeId != '1' and studentYear='4' "); $result=$this->GetResult(); return $result['countStudentSexM2']; } function RSCountStudentSexF14($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF1 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId='1' and studentYear='4' "); $result=$this->GetResult(); return $result['countStudentSexF1']; } function RSCountStudentSexF24($xKey){ $this->SetQuery("select count(studentId) as countStudentSexF2 from StudentMaster where programId='$xKey' and studentSex='F' and entryTypeId != '1' and studentYear='4' "); $result=$this->GetResult(); return $result['countStudentSexF2']; } //----------------------------------------------- // Get by ProgramId Limit function RSStudentMasterByPgIdLimit($xKey, $start, $pageSize){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' order by studentId limit $start, $pageSize"); } function RSStudentMasterByPgIdAndGeIdOrderStCd($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and generationId= '$yKey' order by studentCode"); } function RSStudentMasterByPgIdAndGeIdOrderStNm($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId= '$xKey' and generationId= '$yKey' order by studentName"); } function RSStudentMasterByStCdAndNmAndSm($xKey, $yKey, $zKey){ $this->SetQuery("select * from StudentMaster where studentCode like '$xKey%' and studentName like '$yKey%' and studentSurname like '$zKey%' order by studentCode"); } // Get num of officerId1 and officerId2 use on page addOfficerMeeting.php function RSStudentMasterByOffId1($aKey){ $this->SetQuery("select count(studentId) as num from StudentMaster where officerId1='$aKey' and studentStatus='1' order by studentId"); $result=$this->GetResult(); return $result['num']; } // Get by OfficerId1 Limit use on page addOfficerMeeting.php function RSStudentMasterByOfIdAndDateLimit($xKey, $start, $pageSize){ $this->SetQuery("select * from StudentMaster where officerId1='$xKey' and studentStatus='1' order by studentId limit $start, $pageSize"); } //-- The End -- // Get num student by programId and studentYear and nowDate use on page addClass.php and processClass.php function RSStudentMasterCountStudByPgIdStudYearNowDate($aKey, $bKey){ $this->SetQuery("select count(studentId) as num from StudentMaster where studentCode!='' and programId='$aKey' and studentYear='$bKey' and studentStatus='1' order by studentId"); $result=$this->GetResult(); return $result['num']; } //-- The End -- // Get num of officerId2 use on page showOfficerClass.php and addOfficerClass.php function RSStudentMasterCountStud($aKey, $bKey){ $this->SetQuery("select count(officerId2) as num from StudentMaster where officerId2!=0 and programId='$aKey' and studentYear='$bKey' and studentStatus='1' group by officerId2"); $result=$this->GetResult(); return $result['num']; } function RSStudentMasterByPgIdStudYearAndND($aKey, $bKey){ $this->SetQuery("select officerId2 from StudentMaster where officerId2!=0 and programId='$aKey' and studentYear='$bKey' and studentStatus='1' group by officerId2"); } function Edit2($aKey,$bKey,$cKey){ $sql = "update StudentMaster set officerId2='$aKey' where programId='$bKey' and studentYear='$cKey' and studentStatus='1' "; $this->SetQuery($sql); } //--The end -- // Get student by programId StudentYear and nowDate use on page editStudentUpStatusProg.php function RSStudentMasterByPgIdSySsNd($aKey,$bKey){ $this->SetQuery("select * from StudentMaster where studentCode!='' and programId='$aKey' and studentYear='$bKey' and studentStatus='1' order by studentId"); } //-- The End -- // Use on page addResultExamOcc.php function RSStudentMasterByPgIdAndGdY($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and graduateYear='$yKey' and studentStatus='4'"); } //-- The end -- // Use on page addDebt.php function SearchByStCodeAndStudying($xKey){ /*$sql="select * from StudentMaster where studentCode='$xKey' and studentStatus='1'"; die($sql);*/ if ($this->SetQuery("select * from StudentMaster where studentCode='$xKey' and studentStatus='1'")){ return 1; }else { return 0; } } //-- The end -- function SearchByStCodeAndStudyingAndTransferSt($xKey){ if ($this->SetQuery("select * from StudentMaster where studentCode='$xKey' and studentStatus='1' and entryTypeId2='2'")){ return 1; }else { return 0; } } function SearchByStCode($xKey){ if ($this->SetQuery("select * from StudentMaster where studentCode='$xKey'")){ return 1; }else { return 0; } } function RSStudentMasterByPgIdAndStuY($PgId,$StuY) { if($this->SetQuery("Select * From StudentMaster Where programId='$PgId' And studentYear='$StuY' Order By studentCode")) { return 1; } else { return 0; } } //-- Use on page processChgStudYProg.php -- function SearchByStudID($StID){ $this->SetQuery("select * from StudentMaster where studentId= '$StID'"); } function CountGPANoZero($PgID, $AmaY){ $this->SetQuery("select count(studentId) as num from StudentMaster where programId= '$PgID' and admitAcadYear='$AmaY' and GPA!=0 and creditAttempt!=0 and creditSatisfy!=0 order by studentCode"); $result=$this->GetResult(); return $result['num']; } function RSStudentMasterGroupAdY(){ $this->SetQuery("select admitAcadYear from StudentMaster group by admitAcadYear"); } function RSStudentMasterGroupGenNo($PgId, $AmAcY){ $this->SetQuery("select genNo from StudentMaster where programId='$PgId' and admitAcadYear='$AmAcY' group by genNo"); } function sumOverYearProgram($PgID, $StID){ include_once "../link/function.php"; include_once "clsAcadYearConfig.php"; include_once "clsProgram.php"; $oPg = new Program(); $oAy = new AcadYearConfig(); // Get date $oAy->RSAcadYearConfigByDate(getNowDateTh()); $oAy->GetRecord(); $this->SearchByStudID($StID); $this->GetRecord(); $overYear=$oAy->acadYear - $this->admitAcadYear; $oPg->SearchByKey($PgID); $oPg->GetRecord(); if($oPg->studyYearMax < $overYear){ // เรียนเกินไปแล้ว return 1; }else{ // เรียนพอดีแล้ว return 0; } } //-- The end -- // Use on page addResultExitExam.php function RSStudentBioByStudIdNonEx($StID){ $this->SetQuery("select count(exitExam) as num from StudentMaster where studentId='$StID' and exitExam='N' "); if ($result=$this->GetResult()) { return $result['num']; } } //-- The End -- function CheckCredit($stId, &$msg){ include_once "clsStudentMaster.php"; include_once "clsProgramStructure.php"; include_once "clsEnrollItem.php"; $obj1 = new StudentMaster(); $obj2 = new ProgramStructure(); $obj3 = new ProgramStructure(); $obj4 = new EnrollItem(); $obj1->SearchByKey($stId); $obj1->GetRecord(); $flag = 1; // Find conditionId1 $obj2->RSProgramStructureByPgIdAndCdId2IsH($obj1->programId); while($obj2->GetRecord()) { // Find conditionId2 $obj3->RSProgramStructureByPgIdAndCd1($obj1->programId, $obj2->conditionId1); while($obj3->GetRecord()) { // Check credit of conditionId2 $sumCrAtCdId2 = $obj4->GetSumCrAtByStIdAndCdIdAndCdId2($stId, $obj2->conditionId1, $obj3->conditionId2); if($sumCrAtCdId2 >= $obj3->creditTotal) $msg[$obj3->conditionId2] = intval($sumCrAtCdId2).':PASS'; else { $msg[$obj3->conditionId2] = intval($sumCrAtCdId2).':FAIL'; $flag = 0; } } // Check credit of conditionId1 $sumCrAtCdId = $obj4->GetSumCrAtByStIdAndCdId($stId, $obj2->conditionId1); if($sumCrAtCdId >= $obj2->creditTotal) $msg[$obj2->conditionId1] = intval($sumCrAtCdId).':PASS'; else { $msg[$obj2->conditionId1] = intval($sumCrAtCdId).':FAIL'; $flag = 0; } } return $flag; } //-- Use on page searchStudReStatus.php -- function SearchByStCodeAndStudyingReStatus($StCode){ $this->SetQuery("select * from StudentMaster where studentCode='$StCode' and (studentStatus='2' or studentStatus='7' or studentStatus='8' or studentStatus='9')"); } //-- The end -- //-- Use on page printRepRis128.php-- function RSStudentMasterByPgIdAndLvId($programId,$levelId){ $this->SetQuery("select * from StudentMaster where programId='$programId' and levelId='$levelId' and studentStatus=1 "); } //-- The end -- //-- Use on page beforeShowClassStudy.php -- function SearchByStCodeStNStSn($StC,$StN,$StSn){ $this->SetQuery("select * from StudentMaster where studentCode='$StC' or studentName='$StN' or studentSurname='$StSn' "); } //-- The end -- //-- Use on page showStudentMB.php-- function RSStudentMasterByPgIdAndStY2($xKey, $yKey){ $this->SetQuery("select * from StudentMaster where programId='$xKey' and studentYear='$yKey' order by studentCode"); } //-- The end -- } //--End class StudentMaster-- ?>