Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 27 |
CRAP | |
0.00% |
0 / 587 |
| SupplyExamService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 27 |
6006.00 | |
0.00% |
0 / 587 |
| __construct | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 2 |
|||
| __clone | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 1 |
|||
| getInstance | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 4 |
|||
| getSupplyExams | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 9 |
|||
| insertbatches | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 19 |
|||
| getSupplyList | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| insertNotifications | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 22 |
|||
| checkThisExamRegisSpecialExam | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| checkThisStudentHasSpecialExam | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 14 |
|||
| getSupplySemId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
| getFailedStudents | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 78 |
|||
| addSupplyImproveStudentSubjectDetails | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 21 |
|||
| getRegisteredSupplyExamSubjectsByStudentIdAndRegId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| getIssupplyByExamTypeId | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| getCommonFeeTypesForSupplyExamRegisterApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 22 |
|||
| getSubjectFeeTypesForSupplyExamRegisterApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 21 |
|||
| getSumOfSubjectFeesForSupplyExamRegisterApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 16 |
|||
| getFeesWithMaxFeeLimitForSupplyExamRegisterApplication | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 26 |
|||
| getSupplyImproveExamFine | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 17 |
|||
| verifyStudentSupplyExamPayment | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 25 |
|||
| supplyExamMonthAndYearSemesterWise | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 41 |
|||
| addRemarksStudentSupplyExamPayment | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
| editStudentSupplyExamPayment | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 30 |
|||
| getSupplyImproveRegistrationStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 11 |
|||
| subjectSupplyAttemptCountOfStudent | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 30 |
|||
| supplyExamMonthAndYearStudentWise | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 43 |
|||
| supplyExamMonthAndYearSemesterWiseByStudent | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 45 |
|||
| <?php | |
| namespace com\linways\core\ams\professional\service; | |
| use com\linways\core\ams\professional\service\ExamSupplementaryService; | |
| use com\linways\core\ams\professional\service\examcontroller\finalMarkList\ConsolidatedMarkReportService; | |
| use com\linways\core\ams\professional\request\examcontroller\ConsolidatedMarkReportRequest; | |
| use com\linways\core\ams\professional\exception\ProfessionalException; | |
| use com\linways\core\ams\professional\mapper\SupplyExamServiceMapper; | |
| use com\linways\core\ams\professional\dto\Department; | |
| class SupplyExamService extends BaseService | |
| { | |
| private static $_instance = null; | |
| // /Condition 2 - Locked down the constructor | |
| private function __construct() { | |
| $this->mapper = SupplyExamServiceMapper::getInstance()->getMapper(); | |
| } | |
| // Prevent any oustide instantiation of this class | |
| // /Condition 3 - Prevent any object or instance of that class to be cloned | |
| private function __clone() { | |
| } | |
| // Prevent any copy of this object | |
| // /Condition 4 - Have a single globally accessible static method | |
| public static function getInstance() { | |
| if (! is_object ( self::$_instance )) // or if( is_null(self::$_instance) ) or if( self::$_instance == null ) | |
| self::$_instance = new self (); | |
| return self::$_instance; | |
| } | |
| /** | |
| * @author Ranjith | |
| * get Supply Exam List | |
| * return Supply Exams | |
| */ | |
| public function getSupplyExams($sortBy = 'supplyDesc',$sortOrder = 'ASC') { | |
| $supplyExams = null; | |
| $sql = "SELECT id as Id,supplyDesc as supplyDesc FROM exam_supplementary ORDER BY $sortBy $sortOrder"; | |
| try { | |
| $supplyExams = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $supplyExams; | |
| } | |
| /** | |
| * Insert batchID to supply_improve_batches | |
| * @author Aswin | |
| * @param $batchID | |
| * @param $supplyID | |
| * @throws ProfessionalException | |
| * @return string | |
| */ | |
| public function insertbatches($batchID,$supplyID) | |
| { | |
| $batchID=$this->realEscapeString($batchID); | |
| $supplyID=$this->realEscapeString($supplyID); | |
| $query="delete from supply_improve_batches where batchID=$batchID and exam_supplementary_id=$supplyID and current_semID=(select semID from batches where batchID=$batchID)"; | |
| try{ | |
| $response=$this->executeQuery($query); | |
| }catch (\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| $query="insert into supply_improve_batches(batchID,exam_supplementary_id,current_semID) values ($batchID,$supplyID,(select semID from batches where batchID=$batchID))"; | |
| try{ | |
| $response=$this->executeQuery($query); | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return "inserted"; | |
| } | |
| /** | |
| * get supplyids from supply_improve_batches of a batch | |
| * @author Aswin | |
| * @param $batchID | |
| * @param $semID | |
| * @throws ProfessionalException | |
| * @return object|array|\com\linways\base\util\$objectList[] | |
| */ | |
| public function getSupplyList($batchID,$semID) | |
| { | |
| $batchID=$this->realEscapeString($batchID); | |
| $semID=$this->realEscapeString($semID); | |
| $query="SELECT exam_supplementary_id from supply_improve_batches where batchID=$batchID and current_semID <= ".$semID.""; | |
| try{ | |
| $response=$this->executeQueryForList($query); | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $response; | |
| } | |
| /** | |
| * insert studentids into student_message_alerts | |
| * @author Aswin | |
| * @param unknown $studentIDs | |
| * @param unknown $supimp | |
| * @param unknown $supplyID | |
| * @throws ProfessionalException | |
| * @return object|NULL|\com\linways\base\util\$objectList[] | |
| */ | |
| public function insertNotifications($studentIDs,$supimp,$supplyID) | |
| { | |
| $supimp=$this->realEscapeString($supimp); | |
| $supplyID=$this->realEscapeString($supplyID); | |
| foreach ($studentIDs as $r) | |
| { | |
| $query = "delete from student_message_alerts where studentID=$r->studentID and type=$supimp and typeID=$supplyID"; | |
| try{ | |
| $response=$this->executeQueryForObject($query); | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| $query = "INSERT INTO student_message_alerts (studentID, type, typeID) VALUES (".$r->studentID.",".$supimp.",".$supplyID.")"; | |
| try{ | |
| $response=$this->executeQueryForObject($query,true); | |
| }catch(\Exception $e) | |
| { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| } | |
| return "inserted"; | |
| } | |
| /** | |
| * Method for checking whether this supply examis special exam or not | |
| * @param unknown $supplyExamRegId | |
| * @throws ProfessionalException | |
| * @return unknown | |
| * @author Ranjith Balachandran | |
| */ | |
| public function checkThisExamRegisSpecialExam($supplyExamRegId) | |
| { | |
| $sql = ''; | |
| $supplyExamRegId = $this->realEscapeObject($supplyExamRegId); | |
| $isSpecialExam = null; | |
| try{ | |
| $sql = "SELECT isSpecialExam AS isSpecialExam,considerFlag AS considerFlag FROM exam_supplementary WHERE id = $supplyExamRegId"; | |
| $isSpecialExam = $this->executeQueryForObject($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $isSpecialExam; | |
| } | |
| /** | |
| * Method for checking whether this student has written this special exam or not | |
| * @param unknown $supplyExamRegId | |
| * @param unknown $supplyExamId | |
| * @param unknown $studentId | |
| * @throws ProfessionalException | |
| * @return unknown | |
| * @author Ranjith Balachandran | |
| */ | |
| public function checkThisStudentHasSpecialExam($supplyExamRegId,$supplyExamId,$studentId) | |
| { | |
| $supplyExamRegId = $this->realEscapeObject($supplyExamRegId); | |
| $supplyExamId = $this->realEscapeObject($supplyExamId); | |
| $studentId = $this->realEscapeObject($studentId); | |
| $sql = ''; | |
| $studentSpecialExamPresent = null; | |
| try{ | |
| $sql = "SELECT studentaccount_id AS studentId,regularExamId AS regularExamId FROM student_reverted_special_exam_mark_details WHERE special_exam_id = $supplyExamRegId AND supplyExamId = $supplyExamId AND studentaccount_id = $studentId"; | |
| $studentSpecialExamPresent = $this->executeQueryForObject($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $studentSpecialExamPresent; | |
| } | |
| /** | |
| * Method for getting semester for a supply exam registration | |
| * @param unknown $supplyExamId | |
| * @throws ProfessionalException | |
| * @return unknown | |
| * @author Ranjith Balachandran | |
| */ | |
| public function getSupplySemId($supplyExamId) | |
| { | |
| $sql = ''; | |
| $supplyExamId = $this->realEscapeString($supplyExamId); | |
| $supplySemId = null; | |
| try{ | |
| $sql = "SELECT semID AS supplySemId FROM exam_supplementary WHERE id = $supplyExamId"; | |
| $supplySemId = $this->executeQueryForObject($sql)->supplySemId; | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $supplySemId; | |
| } | |
| /** | |
| * Method for getting failed studets of batch for supply | |
| * @param unknown $supplyExamId | |
| * @throws ProfessionalException | |
| */ | |
| public function getFailedStudents($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = ""; | |
| $conditions = ""; | |
| if (!empty($request->supplyRegId)) { | |
| $supplyRegIdString = is_array($request->supplyRegId) ? implode(",", $request->supplyRegId) : $request->supplyRegId; | |
| $conditions .= "AND es.id IN ($supplyRegIdString) "; | |
| } | |
| else{ | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Supplimentary Registration is empty'); | |
| } | |
| if (!empty($request->batchId)) { | |
| $batchIdString = is_array($request->batchId) ? implode(",", $request->batchId) : $request->batchId; | |
| $conditions .= " AND ex.batchID IN ($batchIdString) "; | |
| } | |
| try{ | |
| $sql = "SELECT | |
| DISTINCT ex.subjectID AS subjectId, | |
| ex.batchID AS batchId, | |
| ex.examregID, | |
| es.semID, | |
| es.id, | |
| ex.examID | |
| FROM | |
| exam_supplementary es | |
| INNER JOIN sbs_relation sbsr ON | |
| sbsr.semID = es.semID | |
| INNER JOIN exam ex ON | |
| ex.batchID = sbsr.batchID | |
| AND ex.semID = sbsr.semID | |
| AND ex.subjectID = sbsr.subjectID | |
| AND ex.semID = es.semID | |
| WHERE | |
| ex.examregID IS NOT NULL | |
| $conditions"; | |
| $supplyExamSubjects = $this->executeQueryForList($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| $examSupplementary = ExamSupplementaryService::getInstance()->getExamSupplementaryById ($request->supplyRegId); | |
| $failedStudents = []; | |
| foreach ($supplyExamSubjects as $subject) { | |
| $supplyExamBatches[$subject->batchId]->id = $subject->batchId; | |
| $supplyExamBatches[$subject->batchId]->examRegId = $subject->examregID; | |
| $supplyExamBatches[$subject->batchId]->semId = $subject->semID; | |
| $supplyExamBatches[$subject->batchId]->supplyRegId = $subject->id; | |
| $supplyExamBatches[$subject->batchId]->subjects[$subject->subjectId]= $subject->examID; | |
| } | |
| $markReportRequest = new ConsolidatedMarkReportRequest(); | |
| foreach ($supplyExamBatches as $batch) { | |
| $markReportRequest->examRegId = $batch->examRegId; | |
| $markReportRequest->batchId = $batch->id; | |
| $markReportRequest->semId = $batch->semId; | |
| // $markReportRequest->subjectIds = $batch->subjects; | |
| $examDetails = ConsolidatedMarkReportService::getInstance()->getStudentRegularExamMarkDetails($markReportRequest); | |
| if ( !empty ( $examDetails ) ) { | |
| $studentDetails = ConsolidatedMarkReportService::getInstance()->getStudentsOverallMarkReport($markReportRequest, $examDetails); | |
| // $batch->students = array_search(true,array_column($studentDetails,"isFailed")); | |
| $batch->students = array_filter($studentDetails, function($a){ return $a->isFailed == true; }); | |
| foreach ($batch->students as $student) { | |
| $student->failedSubject = array_values(array_filter | |
| ($student->semMarks[$batch->semId]->subject, function($a){ return $a->isFailed == true; })); | |
| $student->semMarks = null; | |
| $student->semId = $batch->semId; | |
| $student->supplyRegId = $batch->supplyRegId; | |
| $student->examName = $examSupplementary->supplyDesc; | |
| $registerdSubjects = ExamSupplementaryService::getInstance()->getSupplyImproveRegisteredStudentSubjectDetails ($request->supplyRegId, $student->studentId); | |
| foreach ($student->failedSubject as $failedSub) { | |
| if (in_array($failedSub->subjectId,array_column($registerdSubjects,"subjectID"))) { | |
| $failedSub->isRegisteredForSupply = true; | |
| $failedSub->isChecked = true; | |
| } | |
| else{ | |
| $failedSub->isRegisteredForSupply = false; | |
| } | |
| } | |
| } | |
| $failedStudents = array_merge($failedStudents, $batch->students); | |
| } | |
| } | |
| return $failedStudents; | |
| } | |
| public function addSupplyImproveStudentSubjectDetails ( $supplyImprove ) { | |
| $values = []; | |
| $supplyImprove = $this->realEscapeObject($supplyImprove); | |
| try { | |
| $sqlCheck = "SELECT id FROM exam_supplementary_student_details WHERE exam_supplementary_id = $supplyImprove->supplyId AND studentID = $supplyImprove->studentId"; | |
| $studentRegDetails = $this->executeQueryForObject($sqlCheck); | |
| if (empty($studentRegDetails)) { | |
| $sqlDetails = "INSERT IGNORE INTO exam_supplementary_student_details ( exam_supplementary_id, studentID, total_fees, challanNo, isSupply ) VALUES ( $supplyImprove->supplyId, $supplyImprove->studentId,$supplyImprove->totalFees, '$supplyImprove->challanNo', $supplyImprove->isSupply )"; | |
| $this->executeQuery($sqlDetails); | |
| } | |
| $sqlSubjects = "INSERT IGNORE INTO exam_supplementary_student_subjects (exam_supplementary_id, studentID, examID) VALUES "; | |
| foreach ( $supplyImprove->supplyImproveExamIds as $examId ) { | |
| $values[] = "($supplyImprove->supplyId, $supplyImprove->studentId, $examId)"; | |
| } | |
| $sqlSubjects .= implode ( ",", $values ); | |
| $this->executeQuery($sqlSubjects); | |
| } | |
| catch(\Exception $e) { | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /** | |
| * Method for getting semester for a supply exam registration | |
| * @param $supplyExamregId,studentId | |
| * @throws ProfessionalException | |
| * @return $segExamSubjects | |
| * @author Sibin | |
| */ | |
| public function getRegisteredSupplyExamSubjectsByStudentIdAndRegId($studentId, $examRegId) | |
| { | |
| $sql = null; | |
| $studentId = $this->realEscapeString($studentId); | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $regExamSubjects = []; | |
| $sql = "SELECT | |
| s.subjectID, | |
| s.subjectName, | |
| s.subjectDesc, | |
| s.syllabusName, | |
| s.subjectPriority, | |
| s.isTheory | |
| FROM | |
| exam_supplementary_student_subjects ess | |
| INNER JOIN | |
| exam e ON e.examID = ess.examID | |
| INNER JOIN | |
| subjects s ON s.subjectID = e.subjectID | |
| INNER JOIN studentaccount sa ON sa.studentID = ess.studentID | |
| WHERE | |
| ess.exam_supplementary_id = '$examRegId' | |
| AND | |
| ess.studentID = '$studentId'"; | |
| try { | |
| $regExamSubjects = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $regExamSubjects; | |
| } | |
| /** | |
| * Method for checking isSupply by examType Id | |
| * @param unknown $typeID | |
| * @throws ProfessionalException | |
| * @return unknown | |
| * @author Sibin | |
| */ | |
| public function getIssupplyByExamTypeId($typeID) | |
| { | |
| $typeID = $this->realEscapeObject($typeID); | |
| try{ | |
| $sql = "SELECT | |
| isSupply from exam_type where typeID = '$typeID'"; | |
| $isSupply = $this->executeQueryForObject($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $isSupply; | |
| } | |
| //end checking isSupply by examType Id | |
| /** | |
| * get exam registration fees types | |
| * | |
| * @param int $examRegId | |
| * @param string $examType | |
| * | |
| * @throws ProfessionalException | |
| * @return list $regFeeTypes | |
| */ | |
| public function getCommonFeeTypesForSupplyExamRegisterApplication($examRegId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $examCommonFees = ""; | |
| $sql = "SELECT eft.examfeesID AS id, | |
| eft.examfeesName AS name, | |
| erf.supply_feesAmount AS supplyAmount, | |
| erf.improve_feesAmount AS improveAmount | |
| FROM | |
| exam_feestype eft | |
| INNER JOIN | |
| supply_improve_exam_fees erf ON erf.examfeesID = eft.examfeesID | |
| AND erf.exam_supplementary_id = '$examRegId' | |
| WHERE | |
| eft.examfeesID IS NOT NULL | |
| AND eft.everySubject = 0 "; | |
| try { | |
| $examCommonFees = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $examCommonFees; | |
| } | |
| /** | |
| * get supply exam registration fees types | |
| * | |
| * @param int $examRegId | |
| * @param string $examType | |
| * | |
| * @throws ProfessionalException | |
| * @return list $regFeeTypes | |
| */ | |
| public function getSubjectFeeTypesForSupplyExamRegisterApplication($examRegId, $studentId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $studentId = $this->realEscapeString($studentId); | |
| $examFees = ""; | |
| $sql = "SELECT distinct (ersf.examfeesID) as id, | |
| eft.examfeesName as name | |
| from supply_improve_exam_fees ersf | |
| INNER JOIN exam_feestype eft ON ersf.examfeesID=eft.examfeesID | |
| INNER JOIN supply_improve_subject_fees sisf | |
| ON sisf.examfeesID = ersf.examfeesID AND sisf.exam_supplementary_id = ersf.exam_supplementary_id | |
| INNER JOIN exam_supplementary_student_subjects esss | |
| ON esss.exam_supplementary_id = sisf.exam_supplementary_id AND esss.examID = sisf.examID | |
| WHERE ersf.exam_supplementary_id='$examRegId' | |
| AND esss.studentID='$studentId'"; | |
| try { | |
| $examFees = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $examFees; | |
| } | |
| /** | |
| * get sum of supply exam registration fees | |
| * @param $examRegId,studentId | |
| * | |
| * @throws ProfessionalException | |
| * @return list $regFeeTypes | |
| */ | |
| public function getSumOfSubjectFeesForSupplyExamRegisterApplication($examRegId, $studentId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $studentId = $this->realEscapeString($studentId); | |
| $examFees = ""; | |
| $sql = "SELECT sum(supply_subject_amount) as supplyFees , sum(improve_subject_amount) as improveFees from supply_improve_subject_fees sief | |
| INNER JOIN exam_supplementary_student_subjects esss | |
| ON esss.exam_supplementary_id=sief.exam_supplementary_id AND esss.examID=sief.examID | |
| WHERE esss.exam_supplementary_id='$examRegId' | |
| AND esss.studentID='$studentId'"; | |
| try { | |
| $examFees = $this->executeQueryForObject($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $examFees; | |
| } | |
| /** | |
| * get supply exam registration fees WithMaxFeeLimit | |
| * @param $examRegId,studentId | |
| * | |
| * @throws ProfessionalException | |
| * @return list $regFeeTypes | |
| */ | |
| public function getFeesWithMaxFeeLimitForSupplyExamRegisterApplication($examRegId) | |
| { | |
| $examRegId = $this->realEscapeString($examRegId); | |
| $examFees = ""; | |
| $sql = "SELECT | |
| eft.examfeesID AS id, | |
| eft.examfeesName AS name, | |
| erf.supply_feesAmount AS supplyAmount, | |
| erf.improve_feesAmount AS improveAmount, | |
| erf.supply_maxFees as supplyMaxFees, | |
| erf.improve_maxFees as improveMaxFees | |
| FROM | |
| exam_feestype eft | |
| INNER JOIN | |
| supply_improve_exam_fees erf ON erf.examfeesID = eft.examfeesID | |
| AND erf.exam_supplementary_id = '$examRegId' | |
| WHERE | |
| eft.examfeesID IS NOT NULL | |
| AND eft.everySubject = 1 | |
| and eft.isSubject_fee_limit = 1"; | |
| try { | |
| $examFees = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $examFees; | |
| } | |
| /**to get dupply improve examfine | |
| * @author Sibin | |
| */ | |
| public function getSupplyImproveExamFine($isSupply,$examSupplementaryId,$regAppliedDate) | |
| { | |
| $examSupplementaryId = $this->realEscapeString($examSupplementaryId); | |
| $isSupply = $this->realEscapeString($isSupply); | |
| $regAppliedDate= $this->realEscapeString($regAppliedDate); | |
| $fineAmount = 0; | |
| if ($isSupply) { | |
| $sql = "SELECT supply_fineAmount as fineAmount FROM supply_improve_exam_fine WHERE supply_startDate <= '$regAppliedDate' AND supply_endDate >= '$regAppliedDate' AND exam_supplementary_id = '$examSupplementaryId' "; | |
| } else { | |
| $sql = "SELECT improve_fineAmount as fineAmount FROM supply_improve_exam_fine WHERE improve_startDate <= '$regAppliedDate' AND improve_endDate >= '$regAppliedDate' AND exam_supplementary_id = '$examSupplementaryId' "; | |
| } | |
| try { | |
| $fineAmount = $this->executeQueryForObject($sql)->fineAmount; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $fineAmount; | |
| } | |
| /**to verify student supply exam payment | |
| * @param $studentID, $examregID,$isPaid, $updated_by, $updated_date | |
| * @throws ProfessionalException | |
| * @author Sibin | |
| */ | |
| public function verifyStudentSupplyExamPayment($studentID, $examregID, $isPaid, $approve, $updated_by, $updated_date) | |
| { | |
| $studentId = $this->realEscapeString($studentID); | |
| $examRegId = $this->realEscapeString($examregID); | |
| $isPaid = $this->realEscapeString($isPaid); | |
| $approve = $this->realEscapeString($approve); | |
| $updated_by = $this->realEscapeString($updated_by); | |
| $updated_date = $this->realEscapeString($updated_date); | |
| $sql = null; | |
| $status = 0; | |
| try { | |
| $sql = "UPDATE exam_supplementary_student_details | |
| set paid='$isPaid', | |
| approved ='$approve', | |
| updated_by='$updated_by', | |
| updated_date='$updated_date' , | |
| fee_paidDate ='$updated_date' , | |
| payment_method = 'BACK_END' | |
| where studentID='$studentId' and exam_supplementary_id='$examRegId'"; | |
| $this->executeQuery($sql); | |
| $status = 1; | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return $status; | |
| } | |
| /** list of supplementary exam's month and year semsterwise | |
| * @param $studentID, $examregID,$isPaid, $updated_by, $updated_date | |
| * @throws ProfessionalException | |
| */ | |
| public function supplyExamMonthAndYearSemesterWise($batchId) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| if(empty($batchId)){ | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Batch id is empty'); | |
| } | |
| $sql = null; | |
| try { | |
| $sql = "SELECT DISTINCT | |
| e.semID AS semId, | |
| es.id, | |
| es.examMonth, | |
| es.examYear | |
| FROM | |
| exam e | |
| INNER JOIN exam_supplementary es ON | |
| es.id = e.supply_examreg_id | |
| INNER JOIN exam_supplementary_student_details essd ON | |
| essd.exam_supplementary_id = e.supply_examreg_id | |
| AND essd.exam_supplementary_id = es.id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = essd.studentID | |
| AND sa.batchID = e.batchID | |
| WHERE | |
| e.batchID = $batchId | |
| GROUP BY | |
| e.supply_examreg_id | |
| HAVING | |
| SUM(essd.isSupply) > 0 | |
| ORDER BY | |
| es.examYear, | |
| CAST(es.examMonth AS UNSIGNED ) ASC"; | |
| $examDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| $semesterWiseDetails = []; | |
| foreach ($examDetails as $examDetail) { | |
| $semesterWiseDetails[$examDetail->semId]->exams[] = $examDetail; | |
| } | |
| return $semesterWiseDetails; | |
| } | |
| /**to add remarks to student supply exam payment | |
| * @param $request | |
| * @throws ProfessionalException | |
| * @author Sibin | |
| */ | |
| public function addRemarksStudentSupplyExamPayment($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $sql = null; | |
| try { | |
| $sql = "UPDATE exam_supplementary_student_details | |
| set remarks='$request->remarks' ,updated_by='$request->updatedBy',updated_date = '$request->updatedDate' | |
| where studentID='$request->studentId' and exam_supplementary_id='$request->examRegId'"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /**Edit student supply exam payment | |
| * @param $request | |
| * @throws ProfessionalException | |
| */ | |
| public function editStudentSupplyExamPayment($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $remarks = new \stdClass(); | |
| $remarks->oldMark = $request->oldMark; | |
| $remarks->remarks = $request->remarks; | |
| $remarks->updatedBy = $request->updatedBy; | |
| $remarks->updatedDate = $request->updatedDate; | |
| $json = json_encode($remarks); | |
| $sql = null; | |
| try { | |
| $sql = "UPDATE exam_supplementary_student_details | |
| set total_fees='$request->examFee' , | |
| payment_remarks = IF( | |
| `payment_remarks` IS NULL OR | |
| JSON_TYPE(`payment_remarks`) != 'ARRAY', | |
| JSON_ARRAY(), | |
| `payment_remarks` | |
| ), | |
| `payment_remarks` = JSON_ARRAY_APPEND( | |
| `payment_remarks`, | |
| '$', | |
| CAST('$json' AS JSON) | |
| ) | |
| where studentID='$request->studentId' and exam_supplementary_id='$request->examRegId'"; | |
| $this->executeQuery($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| return true; | |
| } | |
| /** | |
| * for getting supply or improve reg status | |
| * @param $supplyExamRegId | |
| * @throws ProfessionalException | |
| */ | |
| public function getSupplyImproveRegistrationStatus($supplyExamRegId, $studentId) | |
| { | |
| $supplyExamRegId = $this->realEscapeObject($supplyExamRegId); | |
| $studentId = $this->realEscapeObject($studentId); | |
| try{ | |
| $sql = "SELECT isSupply FROM exam_supplementary_student_details WHERE studentID = $studentId AND exam_supplementary_id = $supplyExamRegId"; | |
| $supplyStatus = $this->executeQueryForObject($sql); | |
| }catch (\Exception $e){ | |
| throw new ProfessionalException($e->getCode(),$e->getMessage()); | |
| } | |
| return $supplyStatus; | |
| } | |
| /** | |
| * @param $studentId | |
| * @param $subjectId | |
| * @param $semId | |
| * @return mixed | |
| * @throws ProfessionalException | |
| */ | |
| public function subjectSupplyAttemptCountOfStudent($studentId, $subjectId, $semId) | |
| { | |
| $studentId = $this->realEscapeString($studentId); | |
| $subjectId = $this->realEscapeString($subjectId); | |
| $semId = $this->realEscapeString($semId); | |
| if (empty($studentId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, "Invalid student"); | |
| } | |
| if (empty($subjectId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, "Invalid subject"); | |
| } | |
| $sql = "SELECT | |
| COUNT(esss.exam_supplementary_id) AS supplyAttemptCount | |
| FROM | |
| exam_supplementary_student_subjects esss | |
| INNER JOIN exam e ON | |
| e.examID = esss.examID | |
| INNER JOIN exam_supplementary_student_details essd ON | |
| essd.studentID = esss.studentID | |
| AND essd.exam_supplementary_id = esss.exam_supplementary_id | |
| WHERE | |
| essd.isSupply = 1 | |
| AND esss.studentID = $studentId | |
| AND e.semID = $semId | |
| AND e.subjectID = $subjectId"; | |
| try { | |
| return $this->executeQueryForObject($sql)->supplyAttemptCount; | |
| } catch (Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| } | |
| /** list of supplementary exam's month and year studentWise | |
| * @param $studentIds, $bachId | |
| * @throws ProfessionalException | |
| */ | |
| public function supplyExamMonthAndYearStudentWise($batchId,$studentIds) | |
| { | |
| $batchId = $this->realEscapeString($batchId); | |
| $studentIds = $this->realEscapeString($studentIds); | |
| if(empty($batchId)){ | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Batch id is empty'); | |
| } | |
| $sql = null; | |
| try { | |
| $sql = "SELECT DISTINCT | |
| e.semID AS semId, | |
| es.id, | |
| es.examMonth, | |
| es.examYear | |
| FROM | |
| exam e | |
| INNER JOIN exam_supplementary es ON | |
| es.id = e.supply_examreg_id | |
| INNER JOIN exam_supplementary_student_details essd ON | |
| essd.exam_supplementary_id = e.supply_examreg_id | |
| AND essd.exam_supplementary_id = es.id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = essd.studentID | |
| AND sa.batchID = e.batchID | |
| WHERE | |
| e.batchID = $batchId | |
| AND sa.studentID IN ('$studentIds') | |
| GROUP BY | |
| e.supply_examreg_id | |
| HAVING | |
| SUM(essd.isSupply) > 0 | |
| ORDER BY | |
| es.examYear, | |
| CAST(es.examMonth AS UNSIGNED ) ASC"; | |
| $examDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| $semesterWiseDetails = []; | |
| foreach ($examDetails as $examDetail) { | |
| $semesterWiseDetails[$examDetail->semId]->exams[] = $examDetail; | |
| } | |
| return $semesterWiseDetails; | |
| } | |
| /** list of supplementary exam's month and year semsterwise by student | |
| * @param $studentID, $examregID,$isPaid, $updated_by, $updated_date | |
| * @throws ProfessionalException | |
| */ | |
| public function supplyExamMonthAndYearSemesterWiseByStudent($request) | |
| { | |
| $request = $this->realEscapeObject($request); | |
| $batchId = $request->batchId; | |
| $condition =""; | |
| if (empty($batchId)) { | |
| throw new ProfessionalException(ProfessionalException::INVALID_REQUEST, 'Batch id is empty'); | |
| } | |
| if($request->studentId){ | |
| $condition .=" AND sa.studentID IN ($request->studentId) "; | |
| } | |
| $sql = null; | |
| try { | |
| $sql = "SELECT DISTINCT | |
| e.semID AS semId, | |
| es.id, | |
| es.examMonth, | |
| es.examYear | |
| FROM | |
| exam e | |
| INNER JOIN exam_supplementary es ON | |
| es.id = e.supply_examreg_id | |
| INNER JOIN exam_supplementary_student_details essd ON | |
| essd.exam_supplementary_id = e.supply_examreg_id | |
| AND essd.exam_supplementary_id = es.id | |
| INNER JOIN studentaccount sa ON | |
| sa.studentID = essd.studentID | |
| WHERE | |
| 1=1 $condition | |
| GROUP BY | |
| e.supply_examreg_id | |
| HAVING | |
| SUM(essd.isSupply) > 0 | |
| ORDER BY | |
| es.examYear, | |
| CAST(es.examMonth AS UNSIGNED ) ASC"; | |
| $examDetails = $this->executeQueryForList($sql); | |
| } catch (\Exception $e) { | |
| throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
| } | |
| $semesterWiseDetails = []; | |
| foreach ($examDetails as $examDetail) { | |
| $semesterWiseDetails[$examDetail->semId]->exams[] = $examDetail; | |
| } | |
| return $semesterWiseDetails; | |
| } | |
| } |