Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 40 |
CRAP | |
0.00% |
0 / 1204 |
SessionalExamService | |
0.00% |
0 / 1 |
|
0.00% |
0 / 40 |
37442.00 | |
0.00% |
0 / 1204 |
__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 |
|||
createSessionalExamRegistration | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 48 |
|||
updateSessionalExamRegistration | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 38 |
|||
deleteSessionalExamRegistration | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 14 |
|||
getSessionalExamRegistrationDetailsById | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 57 |
|||
getAllSessionalExamRegistrations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 22 |
|||
assignSubjectCategoryFees | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 38 |
|||
updateSubjectCategoryFees | |
0.00% |
0 / 1 |
72.00 | |
0.00% |
0 / 28 |
|||
deleteSubjectCategoryFees | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 15 |
|||
assignBatches | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 35 |
|||
deleteRegisterdBatches | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 15 |
|||
getSessionalExamRegisteredBatch | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 24 |
|||
assignSubjectCategoryFine | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 42 |
|||
updateSessionalExamRegistrationFine | |
0.00% |
0 / 1 |
156.00 | |
0.00% |
0 / 39 |
|||
deleteSessionalExamRegistrationFine | |
0.00% |
0 / 1 |
30.00 | |
0.00% |
0 / 17 |
|||
getOpenSessionalExamRegistrations | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 29 |
|||
getSessionalExamRegistrationSubjects | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 58 |
|||
saveSessionalExamStudentRegistrationDetails | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 36 |
|||
getSessionalExamStudentRegisteredSubjectDetails | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 56 |
|||
getSessionalExamRegistrationStudentDetails | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 32 |
|||
getSessionalExamRegistrationStudentSubjects | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 17 |
|||
calculateStudentSessionalExamFeesFine | |
0.00% |
0 / 1 |
56.00 | |
0.00% |
0 / 64 |
|||
getSessionalExamSubjectWiseReportDetails | |
0.00% |
0 / 1 |
210.00 | |
0.00% |
0 / 92 |
|||
getSessionalExamDefinedSubjects | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 42 |
|||
searchSessionalExams | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 31 |
|||
getSessionalExamRegistrationsOfStudent | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 32 |
|||
getStudentRegisteredSessioanlExams | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 27 |
|||
requestSessionalExamStudentRegApproval | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 12 |
|||
getSessionalExamStudentRegApprovalStatus | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getStaffAssignedAsWelfareOfficer | |
0.00% |
0 / 1 |
12.00 | |
0.00% |
0 / 15 |
|||
getStudentsForSessionalExamRegistration | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 18 |
|||
setStudentApprovalForSessionalExamRegistration | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 15 |
|||
getSessionalExamMarkSubmissionDates | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 15 |
|||
updatePaymentStatusSessionalExamReg | |
0.00% |
0 / 1 |
20.00 | |
0.00% |
0 / 15 |
|||
getSessionalExamStudentDetails | |
0.00% |
0 / 1 |
42.00 | |
0.00% |
0 / 74 |
|||
getAssessmentComponentRuleByBatchSem | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 13 |
|||
getStudentSubjectAttendanceByComponentRule | |
0.00% |
0 / 1 |
90.00 | |
0.00% |
0 / 34 |
|||
calculateIndividualRule | |
0.00% |
0 / 1 |
132.00 | |
0.00% |
0 / 25 |
<?php | |
namespace com\linways\core\ams\professional\service\examcontroller\sessionalExam; | |
use com\linways\core\ams\professional\service\BaseService; | |
use com\linways\core\ams\professional\exception\ProfessionalException; | |
use com\linways\core\ams\professional\dto\examcontroller\sessionalExam\SessionalExamRegistration; | |
use com\linways\core\ams\professional\dto\report\examcontroller\sessionalexam\SubjectWiseSessionalExamReportResponse; | |
use com\linways\core\ams\professional\service\ExamService; | |
use com\linways\core\ams\professional\service\SemesterService; | |
use com\linways\core\ams\professional\mapper\examcontroller\SessionalExamServiceMapper; | |
use com\linways\core\ams\professional\service\AttendanceService; | |
class SessionalExamService extends BaseService | |
{ | |
private static $_instance = null; | |
// /Condition 2 - Locked down the constructor | |
private function __construct() { | |
$this->mapper = SessionalExamServiceMapper::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; | |
} | |
/** | |
* Method for Creating new Sessional exam registraion | |
* @param SessionalExamRegistration $sessionalExamRegistration | |
* @throws ProfessionalException | |
* @return Boolean | |
*/ | |
public function createSessionalExamRegistration($sessionalExamRegistration){ | |
$sessionalExamRegistration = $this->realEscapeObject($sessionalExamRegistration); | |
$sql = ''; | |
$sessionalExamRegistration->createdBy = $_SESSION['adminID']; | |
if (!$sessionalExamRegistration->name) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam name can not be null'); | |
} | |
if (!$sessionalExamRegistration->examType->id) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam Type can not be null'); | |
} | |
if (!$sessionalExamRegistration->startDate) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam start date can not be null'); | |
} | |
if (!$sessionalExamRegistration->endDate) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam end date can not be null'); | |
} | |
if (!$sessionalExamRegistration->withOutFineDate) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'With out fine date can not be null'); | |
} | |
if (!$sessionalExamRegistration->createdBy) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'User can not be null'); | |
} | |
try{ | |
$sql = "INSERT INTO ec_sessional_exam_registration | |
( | |
name, | |
description, | |
exam_type_id, | |
start_date, | |
end_date, | |
with_out_fine_date, | |
created_by | |
) | |
VALUES | |
( | |
'$sessionalExamRegistration->name', | |
'$sessionalExamRegistration->description',". | |
$sessionalExamRegistration->examType->id.", | |
'$sessionalExamRegistration->startDate', | |
'$sessionalExamRegistration->endDate', | |
'$sessionalExamRegistration->withOutFineDate', | |
$sessionalExamRegistration->createdBy | |
)"; | |
$sessionalExamRegId = $this->executeQuery($sql,true); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $sessionalExamRegId; | |
} | |
/** | |
* Method for update Sessional exam registraion | |
* @param SessionalExamRegistration $sessionalExamRegistration | |
* @throws ProfessionalException | |
* @return Boolean | |
*/ | |
public function updateSessionalExamRegistration($sessionalExamRegistration){ | |
$sessionalExamRegistration = $this->realEscapeObject($sessionalExamRegistration); | |
$sql = ''; | |
$updateSetSql = ''; | |
$updateSetSqlArray = NULL; | |
if ($sessionalExamRegistration->name) { | |
$updateSetSqlArray[] = "name = '$sessionalExamRegistration->name'"; | |
} | |
if ($sessionalExamRegistration->description) { | |
$updateSetSqlArray[] = "description = '$sessionalExamRegistration->description'"; | |
} | |
if ($sessionalExamRegistration->examType) { | |
$updateSetSqlArray[] = "exam_type_id = ".$sessionalExamRegistration->examType->id; | |
} | |
if ($sessionalExamRegistration->startDate) { | |
$updateSetSqlArray[] = "start_date = '$sessionalExamRegistration->startDate'"; | |
} | |
if ($sessionalExamRegistration->endDate) { | |
$updateSetSqlArray[] = "end_date = '$sessionalExamRegistration->endDate'"; | |
} | |
if ($sessionalExamRegistration->withOutFineDate) { | |
$updateSetSqlArray[] = "with_out_fine_date = '$sessionalExamRegistration->withOutFineDate'"; | |
} | |
if ($sessionalExamRegistration->updatedBy) { | |
$updateSetSqlArray[] = "updated_by = $sessionalExamRegistration->updatedBy"; | |
} | |
$updateSetSql = $updateSetSqlArray ? implode(',',$updateSetSqlArray) : ""; | |
try{ | |
if ($updateSetSql) { | |
$sql = "UPDATE ec_sessional_exam_registration | |
SET | |
$updateSetSql | |
WHERE id = $sessionalExamRegistration->id"; | |
$this->executeQuery($sql); | |
} | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method for delete Sessional exam registraion | |
* @param $sessionalExamRegId | |
* @throws ProfessionalException | |
* @return Boolean | |
*/ | |
public function deleteSessionalExamRegistration($sessionalExamRegId){ | |
$sessionalExamRegId = $this->realEscapeString($sessionalExamRegId); | |
$sql = ''; | |
if (!$sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration is required'); | |
} | |
try{ | |
$sql = "DELETE FROM ec_sessional_exam_registration | |
WHERE | |
id = $sessionalExamRegId"; | |
$this->executeQuery($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method to get Sessional exam registraion details by sessional exam reg id | |
* @param $sessionalExamRegId | |
* @throws ProfessionalException | |
* @return $sessionalExamRegDetails | |
*/ | |
public function getSessionalExamRegistrationDetailsById($sessionalExamRegId){ | |
$sessionalExamRegId = $this->realEscapeString($sessionalExamRegId); | |
$sql = ''; | |
$sessionalExamRegDetails = NULL; | |
if (!$sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam reg id required'); | |
} | |
try{ | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date, | |
ser.end_date, | |
ser.with_out_fine_date, | |
sc.subjectcatID, | |
sc.subjectcatName, | |
sc.subjectcatCode, | |
et.typeID, | |
et.typeName, | |
et.typeDesc, | |
et.isInternal, | |
et.isSupply, | |
sescf.amount, | |
b.batchID, | |
b.batchName, | |
b.batchDesc, | |
eft.examfineID, | |
eft.examfineName, | |
sef.amount AS fine_amount, | |
sef.start_date AS exam_fine_start_date, | |
sef.end_date AS exam_fine_end_date, | |
sef.verification_date AS exam_fine_verification_date | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
exam_type et ON et.typeID = ser.exam_type_id | |
LEFT JOIN | |
ec_sessional_exam_subject_category_fees sescf ON ser.id = sescf.sessional_exam_reg_id | |
INNER JOIN | |
subject_category sc ON sc.subjectcatID = sescf.subject_category_id | |
LEFT JOIN | |
ec_sessional_exam_registered_batch serb ON ser.id = serb.sessional_exam_reg_id | |
LEFT JOIN | |
batches b ON b.batchID = serb.batch_id | |
LEFT JOIN | |
ec_sessional_exam_fine sef ON ser.id = sef.sessional_exam_reg_id | |
LEFT JOIN | |
exam_finetype eft ON eft.examfineID = sef.exam_fine_type_id | |
AND sc.subjectcatID = sef.subject_category_id | |
WHERE | |
ser.id = $sessionalExamRegId"; | |
$sessionalExamRegDetails = $this->executeQueryForList($sql, $this->mapper [SessionalExamServiceMapper::GET_SESSIONAL_EXAM_DETAILS]); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $sessionalExamRegDetails; | |
} | |
/** | |
* Method to get All Sessional exam registraions | |
* @throws ProfessionalException | |
* @return $sessionalExamRegistrations | |
*/ | |
public function getAllSessionalExamRegistrations(){ | |
$sql = ''; | |
$sessionalExamRegistrations = NULL; | |
try{ | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date AS startDate, | |
ser.end_date AS endDate, | |
ser.with_out_fine_date, | |
et.typeName, | |
et.typeDesc | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
exam_type et ON et.typeID = ser.exam_type_id"; | |
$sessionalExamRegistrations = $this->executeQueryForList($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $sessionalExamRegistrations; | |
} | |
/** | |
* Method for assign subject category fees for Sessional Exam | |
* @param $subjectCatFeesRequest | |
* @throws ProfessionalException | |
* @return $id | |
*/ | |
public function assignSubjectCategoryFees($subjectCatFeesRequest){ | |
$subjectCatFeesRequest = $this->realEscapeObject($subjectCatFeesRequest); | |
$sql = ''; | |
$valueArray = NULL; | |
$valueSql = ""; | |
$subjectCatFeesRequest->createdBy = $_SESSION['adminID']; | |
if (!$subjectCatFeesRequest->sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam id can not be null'); | |
} | |
if (!$subjectCatFeesRequest->createdBy) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'User can not be null'); | |
} | |
if (empty($subjectCatFeesRequest->subjectCatFees)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Fees can not be null'); | |
} | |
else { | |
foreach ($subjectCatFeesRequest->subjectCatFees as $subjectCatFee) { | |
$valueArray[] = "($subjectCatFeesRequest->sessionalExamRegId,$subjectCatFee->subjectCatId,$subjectCatFee->amount,$subjectCatFeesRequest->createdBy)"; | |
} | |
} | |
if ($valueArray) { | |
$valueSql = implode(',',$valueArray); | |
} | |
try{ | |
$sql = "INSERT INTO ec_sessional_exam_subject_category_fees | |
( | |
sessional_exam_reg_id, | |
subject_category_id, | |
amount, | |
created_by | |
) | |
VALUES | |
$valueSql"; | |
$id = $this->executeQuery($sql,true); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $id; | |
} | |
/** | |
* Method for update Sessional exam registraion fees for subject category | |
* @param SessionalExamSubjectCategoryFees $sessionalExamSubjectCategoryFeesObject | |
* @throws ProfessionalException | |
* | |
*/ | |
public function updateSubjectCategoryFees($sessionalExamSubjectCategoryFeesObject){ | |
$sessionalExamSubjectCategoryFeesObject = $this->realEscapeObject($sessionalExamSubjectCategoryFeesObject); | |
$sql = ''; | |
$updateSetSql = ''; | |
$updateSetSqlArray = NULL; | |
if (!$sessionalExamSubjectCategoryFeesObject->sessionalExamRegistration->id || !$sessionalExamSubjectCategoryFeesObject->subjectCategory->id) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration, Subject Category are required'); | |
} | |
if ($sessionalExamSubjectCategoryFeesObject->amount) { | |
$updateSetSqlArray[] = "amount = $sessionalExamSubjectCategoryFeesObject->amount"; | |
} | |
if ($sessionalExamSubjectCategoryFeesObject->updatedBy) { | |
$updateSetSqlArray[] = "updated_by = $sessionalExamSubjectCategoryFeesObject->updatedBy"; | |
} | |
$updateSetSql = $updateSetSqlArray ? implode(',',$updateSetSqlArray) : ""; | |
try{ | |
if ($updateSetSql) { | |
$sql = "UPDATE ec_sessional_exam_subject_category_fees | |
SET | |
$updateSetSql | |
WHERE | |
sessional_exam_reg_id = $sessionalExamSubjectCategoryFeesObject->sessionalExamRegistration->id | |
AND subject_category_id = $sessionalExamSubjectCategoryFeesObject->subjectCategory->id"; | |
$this->executeQuery($sql); | |
} | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method for delete Sessional exam registraion fees for subject category | |
* @param SessionalExamSubjectCategoryFees $sessionalExamSubjectCategoryFeesObject | |
* @throws ProfessionalException | |
* | |
*/ | |
public function deleteSubjectCategoryFees($sessionalExamSubjectCategoryFeesObject){ | |
$sessionalExamSubjectCategoryFeesObject = $this->realEscapeObject($sessionalExamSubjectCategoryFeesObject); | |
$sql = ''; | |
if (!$sessionalExamSubjectCategoryFeesObject->sessionalExamRegistration->id || !$sessionalExamSubjectCategoryFeesObject->subjectCategory->id) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration, Subject Category are required'); | |
} | |
try{ | |
$sql = "DELETE FROM ec_sessional_exam_subject_category_fees | |
WHERE | |
sessional_exam_reg_id = $sessionalExamSubjectCategoryFeesObject->sessionalExamRegistration->id | |
AND subject_category_id = $sessionalExamSubjectCategoryFeesObject->subjectCategory->id"; | |
$this->executeQuery($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method for assign batches to Sessional Exam | |
* @param $subjectCatFeesRequest | |
* @throws ProfessionalException | |
* | |
*/ | |
public function assignBatches($batchAssignRequest){ | |
$batchAssignRequest = $this->realEscapeObject($batchAssignRequest); | |
$sql = ''; | |
$valueArray = NULL; | |
$valueSql = ""; | |
if (!$batchAssignRequest->sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam id can not be null'); | |
} | |
if (!$batchAssignRequest->createdBy) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'User can not be null'); | |
} | |
if (empty($batchAssignRequest->batches)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Batches can not be null'); | |
} | |
else { | |
foreach ($batchAssignRequest->batches as $batchId) { | |
$valueArray[] = "($batchAssignRequest->sessionalExamRegId,$batchId,$batchAssignRequest->createdBy)"; | |
} | |
} | |
if ($valueArray) { | |
$valueSql = implode(',',$valueArray); | |
} | |
try{ | |
$sql = "INSERT INTO ec_sessional_exam_registered_batch | |
( | |
sessional_exam_reg_id, | |
batch_id, | |
created_by | |
) | |
VALUES | |
$valueSql"; | |
$sessionalExamRegId = $this->executeQuery($sql,true); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method for delete Sessional exam registraion asssigned batches | |
* @param $request | |
* @throws ProfessionalException | |
* | |
*/ | |
public function deleteRegisterdBatches($request){ | |
$request = $this->realEscapeObject($request); | |
$sql = ''; | |
if (!$request->sessionalExamRegId || !$request->batchId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration, Batch Id are required'); | |
} | |
try{ | |
$sql = "DELETE FROM ec_sessional_exam_registered_batch | |
WHERE | |
sessional_exam_reg_id = $request->sessionalExamRegId | |
AND batch_id = $request->batchId"; | |
$this->executeQuery($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method to get batches for a sessional exam | |
* @param $sessionalExamRegId | |
* @throws ProfessionalException | |
* @return Array $registeredBatches | |
*/ | |
public function getSessionalExamRegisteredBatch($sessionalExamRegId){ | |
$sessionalExamRegId = $this->realEscapeString($sessionalExamRegId); | |
$sql = ''; | |
$sessionalExamRegDetails = NULL; | |
if (!$sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam reg id is null'); | |
} | |
try{ | |
$sql = "SELECT | |
serb.id AS batch_reg_id, | |
b.batchID, | |
b.batchName, | |
b.batchDesc | |
FROM | |
ec_sessional_exam_registered_batch serb | |
INNER JOIN | |
batches b ON b.batchID = serb.batch_id | |
WHERE | |
serb.sessional_exam_reg_id = $sessionalExamRegId"; | |
$registeredBatches = $this->executeQueryForList($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $registeredBatches; | |
} | |
/** | |
* Method for assign subject category fine for Sessional Exam | |
* @param $subjectCatFeesRequest | |
* @throws ProfessionalException | |
* @return $id | |
*/ | |
public function assignSubjectCategoryFine($subjectCatFineRequest){ | |
$subjectCatFineRequest = $this->realEscapeObject($subjectCatFineRequest); | |
$sql = ''; | |
$valueArray = NULL; | |
$valueSql = ""; | |
$subjectCatFineRequest->createdBy = $_SESSION['adminID']; | |
if (!$subjectCatFineRequest->sessionalExamRegId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Exam id can not be null'); | |
} | |
if (!$subjectCatFineRequest->createdBy) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'User can not be null'); | |
} | |
if (empty($subjectCatFineRequest->subjectCatFine)) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Fine can not be null'); | |
} | |
else { | |
foreach ($subjectCatFineRequest->subjectCatFine as $subjectCatFine) { | |
$valueArray[] = "($subjectCatFineRequest->sessionalExamRegId,$subjectCatFine->subjectCatId,$subjectCatFine->examFineTypeId,$subjectCatFine->amount,'$subjectCatFine->startDate','$subjectCatFine->endDate','$subjectCatFine->verificationDate',$subjectCatFineRequest->createdBy)"; | |
} | |
if ($valueArray) { | |
$valueSql = implode(',',$valueArray); | |
} | |
} | |
try{ | |
$sql = "INSERT INTO ec_sessional_exam_fine | |
( | |
sessional_exam_reg_id, | |
subject_category_id, | |
exam_fine_type_id, | |
amount, | |
start_date, | |
end_date, | |
verification_date, | |
created_by | |
) | |
VALUES | |
$valueSql"; | |
$sessionalExamFineId = $this->executeQuery($sql,true); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $sessionalExamFineId; | |
} | |
/** | |
* Method for update Sessional exam registraion fine | |
* @param SessionalExamFine $sessionalExamRegistrationFine | |
* @throws ProfessionalException | |
* | |
*/ | |
public function updateSessionalExamRegistrationFine($subjectCatFineRequest){ | |
$subjectCatFineRequest = $this->realEscapeObject($subjectCatFineRequest); | |
$sql = ''; | |
$updateSetSql = ''; | |
$updateSetSqlArray = NULL; | |
if (!$subjectCatFineRequest->sessionalExamRegId || !$subjectCatFineRequest->subjectCatId || !$subjectCatFineRequest->examFineTypeId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration, Subject Category and Exam Type are required'); | |
} | |
if ($subjectCatFineRequest->amount) { | |
$updateSetSqlArray[] = "amount = $subjectCatFineRequest->amount"; | |
} | |
if ($subjectCatFineRequest->startDate) { | |
$updateSetSqlArray[] = "start_date = '$subjectCatFineRequest->startDate'"; | |
} | |
if ($subjectCatFineRequest->endDate) { | |
$updateSetSqlArray[] = "end_date = '$subjectCatFineRequest->endDate'"; | |
} | |
if ($subjectCatFineRequest->verificationDate) { | |
$updateSetSqlArray[] = "verification_date = '$subjectCatFineRequest->verificationDate'"; | |
} | |
if ($subjectCatFineRequest->updatedBy) { | |
$updateSetSqlArray[] = "updated_by = $subjectCatFineRequest->updatedBy"; | |
} | |
$updateSetSql = $updateSetSqlArray ? implode(',',$updateSetSqlArray) : ""; | |
try{ | |
if ($updateSetSql) { | |
$sql = "UPDATE ec_sessional_exam_fine | |
SET | |
$updateSetSql | |
WHERE | |
sessional_exam_reg_id = $subjectCatFineRequest->sessionalExamRegId | |
AND subject_category_id = $subjectCatFineRequest->subjectCatId | |
AND exam_fine_type_id = $subjectCatFineRequest->examFineTypeId | |
"; | |
$this->executeQuery($sql); | |
} | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* Method for delete Sessional exam registraion fine | |
* @param $subjectCatFineRequest | |
* @throws ProfessionalException | |
* | |
*/ | |
public function deleteSessionalExamRegistrationFine($subjectCatFineRequest){ | |
$subjectCatFineRequest = $this->realEscapeObject($subjectCatFineRequest); | |
$sql = ''; | |
if (!$subjectCatFineRequest->sessionalExamRegId || !$subjectCatFineRequest->subjectCatId || !$subjectCatFineRequest->examFineTypeId) { | |
throw new ProfessionalException(ProfessionalException::INVALID_REQUEST,'Sessional Exam Registration, Subject Category and Exam Type are required'); | |
} | |
try{ | |
$sql = "DELETE FROM ec_sessional_exam_fine | |
WHERE | |
sessional_exam_reg_id = $subjectCatFineRequest->sessionalExamRegId | |
AND subject_category_id = $subjectCatFineRequest->subjectCatId | |
AND exam_fine_type_id = $subjectCatFineRequest->examFineTypeId | |
"; | |
$this->executeQuery($sql); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
} | |
/** | |
* @param $sessionalExamRequest | |
* @return array | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getOpenSessionalExamRegistrations ( $sessionalExamRequest ) { | |
$sessionalExamRequest = $this->realEscapeObject($sessionalExamRequest); | |
$sql = ""; | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sessionalExamRegistrations = []; | |
try { | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date AS startDate, | |
ser.end_date AS endDate, | |
ser.with_out_fine_date, | |
ser.exam_type_id AS examTypeId | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
ec_sessional_exam_registered_batch serb ON (ser.id = serb.sessional_exam_reg_id) | |
INNER JOIN | |
studentaccount sa ON (serb.batch_id = sa.batchID) | |
WHERE | |
'$currentDateTime' BETWEEN start_date AND end_date | |
AND | |
sa.studentID = '$sessionalExamRequest->studentId' "; | |
$sessionalExamRegistrations = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return $sessionalExamRegistrations; | |
} | |
/** | |
* @param $sessionalExamRequest | |
* @return array | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getSessionalExamRegistrationSubjects ( $sessionalExamRequest ) { | |
$sessionalExamRequest = $this->realEscapeObject($sessionalExamRequest); | |
$sessionalExamRegistrationSubjects = []; | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sql = ""; | |
$dateCondition = $sessionalExamRequest->excludeDateCheck ? "":" AND '$currentDateTime' BETWEEN ser.start_date AND ser.end_date "; | |
try { | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date AS startDate, | |
ser.end_date AS endDate, | |
ser.with_out_fine_date, | |
ser.exam_type_id AS examTypeId, | |
s.subjectID, | |
s.subjectName, | |
s.subjectDesc, | |
s.subjectcatID, | |
sescf.amount AS feeAmount, | |
eft.examfineName AS fineName, | |
sef.amount AS fineAmount | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
ec_sessional_exam_registered_batch serb ON ser.id = serb.sessional_exam_reg_id | |
INNER JOIN | |
studentaccount sa ON serb.batch_id = sa.batchID | |
INNER JOIN | |
batches b ON b.batchID = sa.batchID | |
INNER JOIN | |
exam_type et ON et.typeID = ser.exam_type_id | |
INNER JOIN | |
student_marks sm ON sm.studentID = sa.studentID | |
AND sa.batchID = sm.batchID | |
AND b.semID = sm.semID | |
AND sm.examTypeID = et.parent_exam_typeID | |
INNER JOIN | |
subjects s ON sm.subjectID = s.subjectID | |
INNER JOIN | |
ec_sessional_exam_subject_category_fees sescf ON sescf.subject_category_id = s.subjectcatID | |
AND sescf.sessional_exam_reg_id = ser.id | |
LEFT JOIN | |
ec_sessional_exam_fine sef ON sef.sessional_exam_reg_id = ser.id | |
AND sef.start_date < '$currentDateTime' | |
LEFT JOIN | |
exam_finetype eft ON eft.examfineID = sef.exam_fine_type_id | |
WHERE 1 = 1 | |
$dateCondition | |
AND sm.marksObtained = '-1' | |
AND sa.studentID = '$sessionalExamRequest->studentId' | |
AND ser.id = '$sessionalExamRequest->examRegId' | |
ORDER BY ser.end_date ASC , sef.start_date DESC "; | |
$sessionalExamRegistrationSubjects = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return $sessionalExamRegistrationSubjects; | |
} | |
/** | |
* @param $sessionalExamRegDetailsRequest | |
* @return boolean | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function saveSessionalExamStudentRegistrationDetails ( $sessionalExamRegDetailsRequest ) { | |
$sessionalExamRegDetailsRequest = $this->realEscapeObject($sessionalExamRegDetailsRequest); | |
$values = []; | |
if ( !empty ( $sessionalExamRegDetailsRequest->subjects ) ) { | |
$request = new \stdClass(); | |
$request->subjectIds = implode(",", $sessionalExamRegDetailsRequest->subjects); | |
$request->sessionalExamRegId = $sessionalExamRegDetailsRequest->sessionalExamRegId; | |
$totalFees = $this->calculateStudentSessionalExamFeesFine ($request, TRUE); | |
$appliedDate = date("Y-m-d H:i:s"); | |
$sql_details = "INSERT INTO ec_sessional_exam_student_details (studentaccount_id, ec_sessional_exam_registration_id, total_fees, applied_date ) VALUES ('$sessionalExamRegDetailsRequest->studentId', '$sessionalExamRegDetailsRequest->sessionalExamRegId', '$totalFees','$appliedDate') "; | |
$sql_subjects = "INSERT INTO ec_sessional_exam_student_subjects | |
( | |
studentaccount_id, | |
ec_sessional_exam_registration_id, | |
subjects_id | |
) VALUES "; | |
foreach ($sessionalExamRegDetailsRequest->subjects as $subjectId ) { | |
$values[] = " | |
( | |
$sessionalExamRegDetailsRequest->studentId, | |
$sessionalExamRegDetailsRequest->sessionalExamRegId, | |
$subjectId | |
)"; | |
} | |
$sql = $sql_subjects . implode(", ", $values); | |
try { | |
$this->executeQuery($sql_details); | |
$this->executeQuery($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return true; | |
} | |
else { | |
throw new ProfessionalException(ProfessionalException::INSUFFICIENT_PARAMETERS, "No sessional exam subjects found"); | |
} | |
} | |
/** | |
* @param $sessionalExamRequest | |
* @return array|Object | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getSessionalExamStudentRegisteredSubjectDetails ( $sessionalExamRequest ) { | |
$sessionalExamRequest = $this->realEscapeObject($sessionalExamRequest); | |
$sql = ""; | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sessionalExamRegisteredSubjects = []; | |
try { | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
sa.studentName, | |
sa.regNo, | |
s.subjectID, | |
s.subjectName, | |
s.subjectDesc, | |
s.subjectcatID, | |
sescf.amount AS feeAmount, | |
eft.examfineName AS fineName, | |
sef.amount AS fineAmount, | |
sesd.is_paid AS isPaid, | |
sesd.total_fees AS totalFees, | |
sesd.challan_no AS challanNo, | |
sesd.applied_date AS appliedDate, | |
sesd.fee_paid_date AS feePaidDate, | |
sesd.payment_method AS paymentMethod, | |
sesd.approved AS isApproved | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
ec_sessional_exam_registered_batch serb ON ser.id = serb.sessional_exam_reg_id | |
INNER JOIN | |
ec_sessional_exam_student_details sesd ON sesd.ec_sessional_exam_registration_id = ser.id | |
INNER JOIN | |
ec_sessional_exam_student_subjects sess ON sess.studentaccount_id = sesd.studentaccount_id | |
AND sess.ec_sessional_exam_registration_id = ser.id | |
INNER JOIN | |
studentaccount sa ON sesd.studentaccount_id = sa.studentID | |
INNER JOIN | |
subjects s ON sess.subjects_id = s.subjectID | |
INNER JOIN | |
ec_sessional_exam_subject_category_fees sescf ON sescf.subject_category_id = s.subjectcatID | |
AND sescf.sessional_exam_reg_id = ser.id | |
LEFT JOIN | |
ec_sessional_exam_fine sef ON sef.sessional_exam_reg_id = ser.id | |
AND sef.start_date < sesd.applied_date | |
LEFT JOIN | |
exam_finetype eft ON eft.examfineID = sef.exam_fine_type_id | |
WHERE | |
sesd.studentaccount_id = '$sessionalExamRequest->studentId' | |
AND ser.id = '$sessionalExamRequest->examRegId' | |
ORDER BY ser.end_date ASC , sef.start_date DESC"; | |
$sessionalExamRegisteredSubjects = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return $sessionalExamRegisteredSubjects; | |
} | |
/** | |
* @param $sessionalExamRequest | |
* @return array|Object | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function getSessionalExamRegistrationStudentDetails ( $sessionalExamRequest ) { | |
$sessionalExamRequest = $this->realEscapeObject($sessionalExamRequest); | |
$sql = ""; | |
if ( $sessionalExamRequest->studentId && $sessionalExamRequest->examRegId ) { | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sessionalExamRegistrationStudentDetails = []; | |
try { | |
$sql = " | |
SELECT | |
sesd.studentaccount_id AS studentId, | |
sesd.ec_sessional_exam_registration_id AS examRegId, | |
sesd.is_paid AS isPaid, | |
sesd.total_fees AS totalFees, | |
sesd.challan_no AS challanNo, | |
sesd.applied_date AS appliedDate, | |
sesd.fee_paid_date AS feePaidDate, | |
sesd.payment_method AS paymentMethod, | |
sesd.approved AS isApproved | |
FROM | |
ec_sessional_exam_student_details sesd | |
WHERE | |
sesd.studentaccount_id = '$sessionalExamRequest->studentId' | |
AND sesd.ec_sessional_exam_registration_id = '$sessionalExamRequest->examRegId' "; | |
$sessionalExamRegistrationStudentDetails = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $sessionalExamRegistrationStudentDetails; | |
} | |
else { | |
throw new ProfessionalException(ProfessionalException::INSUFFICIENT_PARAMETERS, "Invalid student and sessional exam registration"); | |
} | |
} | |
public function getSessionalExamRegistrationStudentSubjects ( $sessionalExamRequest ) { | |
$sessionalExamRequest = $this->realEscapeObject($sessionalExamRequest); | |
$sql = ""; | |
if ( $sessionalExamRequest->studentId && $sessionalExamRequest->examRegId ) { | |
$sessionalExamRegistrationStudentSubjects = []; | |
try { | |
$sql = " | |
SELECT subjects_id FROM ec_sessional_exam_student_subjects WHERE studentaccount_id = '$sessionalExamRequest->studentId' AND ec_sessional_exam_registration_id = '$sessionalExamRequest->examRegId' "; | |
$sessionalExamRegistrationStudentSubjects = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $sessionalExamRegistrationStudentSubjects; | |
} | |
else { | |
throw new ProfessionalException(ProfessionalException::INSUFFICIENT_PARAMETERS, "Invalid student and sessional exam registration"); | |
} | |
} | |
/** | |
* @param $sessionalExamRegId | |
* @param $subjectIds | |
* @return array|Object | |
* @throws ProfessionalException | |
* @author Vishnu M | |
*/ | |
public function calculateStudentSessionalExamFeesFine ( $request, $returnTotalAmountOnly = TRUE ) { | |
$request = $this->realEscapeObject($request); | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$studentSessionalExamFeeFine = []; | |
try { | |
if ( !empty ( $request->subjectIds ) ) { | |
$sql = " | |
SELECT | |
sescf.amount AS fees, | |
IF(sef.start_date < '$currentDateTime', | |
sef.amount, | |
0) AS fine, | |
IF(sef.start_date < '$currentDateTime', | |
sescf.amount + sef.amount, | |
sescf.amount) AS totalAmount | |
FROM | |
ec_sessional_exam_subject_category_fees sescf | |
INNER JOIN | |
subjects s ON (s.subjectcatID = sescf.subject_category_id) | |
LEFT JOIN | |
ec_sessional_exam_fine sef ON (sescf.sessional_exam_reg_id = sef.sessional_exam_reg_id | |
AND sescf.subject_category_id = sef.subject_category_id) | |
WHERE | |
sescf.sessional_exam_reg_id = $request->sessionalExamRegId | |
AND s.subjectID IN ($request->subjectIds) "; | |
} | |
else if ( $request->studentId ) { | |
$sql = " | |
SELECT | |
sescf.amount AS fees, | |
IF(sef.start_date < '$currentDateTime', | |
sef.amount, | |
0) AS fine, | |
IF(sef.start_date < '$currentDateTime', | |
sescf.amount + sef.amount, | |
sescf.amount) AS totalAmount | |
FROM | |
ec_sessional_exam_student_subjects sess | |
INNER JOIN | |
ec_sessional_exam_subject_category_fees sescf ON sescf.sessional_exam_reg_id = sess.ec_sessional_exam_registration_id | |
INNER JOIN | |
subjects s ON s.subjectcatID = sescf.subject_category_id | |
AND s.subjectID = sess.subjects_id | |
LEFT JOIN | |
ec_sessional_exam_fine sef ON sescf.sessional_exam_reg_id = sef.sessional_exam_reg_id | |
AND sescf.subject_category_id = sef.subject_category_id | |
WHERE | |
sess.ec_sessional_exam_registration_id = $request->sessionalExamRegId | |
AND sess.studentaccount_id = $request->studentId "; | |
} | |
$studentSessionalExamFeeFine = $this->executeQueryForList($sql); | |
if ( $returnTotalAmountOnly ) { | |
$totalAmount = 0; | |
if ( !empty ( $studentSessionalExamFeeFine ) ) { | |
foreach ( $studentSessionalExamFeeFine as $fee ) { | |
$totalAmount += $fee->totalAmount; | |
} | |
} | |
return $totalAmount; | |
} | |
return $studentSessionalExamFeeFine; | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* @param SessionalExamSubjectWiseReportRequest $sessionalExamSubjectWiseReportRequest | |
* @return array | |
* @throws ProfessionalException | |
* @author anoop | |
*/ | |
public function getSessionalExamSubjectWiseReportDetails ($sessionalExamSubjectWiseReportRequest) { | |
$sessionalExamSubjectWiseReportRequest = $this->realEscapeObject($sessionalExamSubjectWiseReportRequest); | |
$subjectwiseSessionalExamReportResponse = new SubjectWiseSessionalExamReportResponse(); | |
$sqlConditions = ""; | |
$sqlGroupBy = ""; | |
$sqlColumns = ""; | |
$sessionalExamRegIdsStr=NULL; | |
$mapper = SessionalExamServiceMapper::GET_SUBJECT_WISE_SESSIONAL_EXAM_REPORT; | |
if ($sessionalExamSubjectWiseReportRequest->sessionalExamRegIds) { | |
$sessionalExamRegIdsStr = implode(',',$sessionalExamSubjectWiseReportRequest->sessionalExamRegIds) ? implode(',',$sessionalExamSubjectWiseReportRequest->sessionalExamRegIds) : $sessionalExamSubjectWiseReportRequest->sessionalExamRegIds; | |
$sqlConditions .= " AND ser.id IN ($sessionalExamRegIdsStr)"; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->sessionalExamTypeIds) { | |
$sessionalExamTypeIdsStr = implode(',',$sessionalExamSubjectWiseReportRequest->sessionalExamTypeIds) ? implode(',',$sessionalExamSubjectWiseReportRequest->sessionalExamTypeIds) : $sessionalExamSubjectWiseReportRequest->sessionalExamTypeIds; | |
$sqlConditions .= " AND ser.exam_type_id IN ($sessionalExamTypeIdsStr)"; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->reportBasedOn == "DEPARTMENT") { | |
$mapper = SessionalExamServiceMapper::GET_SUBJECT_WISE_SESSIONAL_EXAM_REPORT_DEPARTMENT_BASED; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->semesterIds) { | |
$sessionalExamSemesterIdStr = implode(',',$sessionalExamSubjectWiseReportRequest->semesterIds) ? implode(',',$sessionalExamSubjectWiseReportRequest->semesterIds) : $sessionalExamSubjectWiseReportRequest->semesterIds; | |
$sqlConditions .= " AND b.semID IN ($sessionalExamSemesterIdStr)"; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->subjectIds) { | |
$sessionalExamSubjectIdStr = implode(',',$sessionalExamSubjectWiseReportRequest->subjectIds) ? implode(',',$sessionalExamSubjectWiseReportRequest->subjectIds) : $sessionalExamSubjectWiseReportRequest->subjectIds; | |
$sqlConditions .= " AND s.subjectId IN ($sessionalExamSubjectIdStr)"; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->departmentIds) { | |
$sessionalExamdepartmentIdStr = implode(',',$sessionalExamSubjectWiseReportRequest->departmentIds) ? implode(',',$sessionalExamSubjectWiseReportRequest->departmentIds) : $sessionalExamSubjectWiseReportRequest->departmentIds; | |
$sqlConditions .= " AND dept.deptID IN ($sessionalExamdepartmentIdStr)"; | |
} | |
if ($sessionalExamSubjectWiseReportRequest->includeStudentDetails) { | |
$sqlColumns = " ,sa.studentID AS studentId, | |
sa.studentName, | |
sa.regNo, | |
sa.admissionNo, | |
sa.studentAccount"; | |
$sqlGroupBy = " , sa.studentId"; | |
} | |
else { | |
$sqlGroupBy = ""; | |
$sqlColumns = " ,COUNT(DISTINCT sa.studentID) as totalStudents"; | |
} | |
try { | |
$sql = "SELECT | |
ext.typeID as examTypeId, | |
ext.typeName as examTypeName, | |
ser.id AS sessionalExamRegId, | |
ser.name AS sessionalExamName, | |
dept.deptID AS deptId, | |
dept.deptName, | |
b.batchID AS batchId, | |
b.batchName, | |
sem.semID AS semId, | |
sem.semName AS semName, | |
s.subjectId, | |
s.subjectName, | |
s.subjectDesc | |
$sqlColumns | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
exam_type ext ON ext.typeID = ser.exam_type_id | |
INNER JOIN | |
ec_sessional_exam_student_details sesd ON sesd.ec_sessional_exam_registration_id = ser.id | |
INNER JOIN | |
ec_sessional_exam_student_subjects sess ON sess.ec_sessional_exam_registration_id = ser.id | |
AND sesd.studentaccount_id = sess.studentaccount_id | |
INNER JOIN | |
ec_sessional_exam_registered_batch serb ON ser.id = serb.sessional_exam_reg_id | |
INNER JOIN | |
subjects s ON s.subjectID = sess.subjects_id | |
INNER JOIN | |
batches b ON b.batchID = serb.batch_id | |
INNER JOIN | |
department dept ON dept.deptID = b.deptID | |
INNER JOIN | |
semesters sem ON sem.semID = b.semID | |
INNER JOIN | |
studentaccount sa ON sa.studentID = sess.studentaccount_id | |
AND sa.studentID = sesd.studentaccount_id | |
AND sa.batchID = serb.batch_id | |
AND sa.batchID = b.batchID | |
WHERE | |
1 = 1 | |
$sqlConditions | |
GROUP BY b.semID, s.subjectId $sqlGroupBy"; | |
$subjectwiseSessionalExamReportResponse = $this->executeQueryForList($sql, $this->mapper [$mapper]); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subjectwiseSessionalExamReportResponse; | |
} | |
/** | |
* method to get registration opened subjects of sessional retest exam | |
* @param SessionalExamSubjectRequest $sessionalExamSubjectRequest | |
* @return array | |
* @throws ProfessionalException | |
* @author anoop | |
*/ | |
public function getSessionalExamDefinedSubjects ($sessionalExamSubjectRequest) { | |
$sessionalExamSubjectRequest = $this->realEscapeObject($sessionalExamSubjectRequest); | |
$sqlConditions = ""; | |
$sessionalExamRegIdsStr=NULL; | |
if ($sessionalExamSubjectRequest->sessionalExamRegIds) { | |
$sessionalExamRegIdsStr = implode(',',$sessionalExamSubjectRequest->sessionalExamRegIds); | |
$sqlConditions .= " AND ser.id IN ($sessionalExamRegIdsStr)"; | |
} | |
if ($sessionalExamSubjectRequest->semesterIds) { | |
$semesterIdsStr = implode(',',$sessionalExamSubjectRequest->semesterIds); | |
$sqlConditions .= " AND ssr.semId IN ($semesterIdsStr)"; | |
} | |
try { | |
$sql = "SELECT | |
s.subjectId AS id, | |
CONCAT(s.subjectDesc, ' (', s.subjectName, ')') AS name, | |
s.subjectName, | |
s.subjectDesc, | |
ser.id AS sessionalExamRegId, | |
ser.name AS sessionalExamName, | |
sc.subjectcatID, | |
sc.subjectcatName, | |
sc.subjectcatCode | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
ec_sessional_exam_subject_category_fees sescf ON ser.id = sescf.sessional_exam_reg_id | |
INNER JOIN | |
subject_category sc ON sc.subjectcatID = sescf.subject_category_id | |
INNER JOIN | |
subjects s ON s.subjectcatID = sc.subjectcatID | |
AND s.subjectcatID = sescf.subject_category_id | |
INNER JOIN | |
subject_sem_relation ssr ON ssr.subjectId = s.subjectId | |
WHERE | |
1 = 1 | |
$sqlConditions"; | |
$subjectList = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $subjectList; | |
} | |
/** | |
* Method to Search Sessional exam registraion details by sessional exam reg id | |
* @param SessionalExamRequest $sessionalExamSearchRequest | |
* @throws ProfessionalException | |
* @return $sessionalExamRegDetails | |
*/ | |
public function searchSessionalExams($sessionalExamSearchRequest){ | |
$sessionalExamSearchRequest = $this->realEscapeObject($sessionalExamSearchRequest); | |
$sql = ''; | |
$sqlConditions = ''; | |
$sessionalExamRegDetails = NULL; | |
if ($sessionalExamSearchRequest->examRegId) { | |
$sqlConditions .= " AND ser.id = $sessionalExamSearchRequest->sessionalExamRegId"; | |
} | |
if ($sessionalExamSearchRequest->examTypeId) { | |
$sqlConditions .= " AND ser.exam_type_id = $sessionalExamSearchRequest->examTypeId"; | |
} | |
try{ | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date, | |
ser.end_date, | |
ser.with_out_fine_date | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
exam_type et ON et.typeID = ser.exam_type_id | |
WHERE | |
1=1 | |
$sqlConditions"; | |
$sessionalExamRegDetails = $this->executeQueryForList($sql, $this->mapper [SessionalExamServiceMapper::GET_SESSIONAL_EXAM_DETAILS]); | |
}catch (\Exception $e){ | |
throw new ProfessionalException(ProfessionalException::INTERNAL_SERVICE_FAILURE,$e->getMessage()); | |
} | |
return $sessionalExamRegDetails; | |
} | |
/** | |
* @param $sessionalExamStudentRequest | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getSessionalExamRegistrationsOfStudent ( $sessionalExamStudentRequest ) { | |
$sessionalExamStudentRequest = $this->realEscapeObject($sessionalExamStudentRequest); | |
$sql = ""; | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sessionalExamRegistrations = []; | |
try { | |
$sql = "SELECT DISTINCT | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date AS startDate, | |
ser.end_date AS endDate, | |
ser.with_out_fine_date, | |
ser.exam_type_id AS examTypeId, | |
sser.studentId AS isRequested, | |
sser.approveStatus, | |
sser.approvedBy | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN | |
ec_sessional_exam_registered_batch serb ON (ser.id = serb.sessional_exam_reg_id) | |
INNER JOIN | |
studentaccount sa ON (serb.batch_id = sa.batchID) | |
LEFT JOIN | |
studentSessionalExamRegRequestApprove sser ON sser.sessionalExamRegId = serb.sessional_exam_reg_id AND sser.studentId = sa.studentID | |
WHERE | |
sa.studentID = '$sessionalExamStudentRequest->studentId' "; | |
$sessionalExamRegistrations = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return $sessionalExamRegistrations; | |
} | |
/** | |
* get student registerd sessional exams | |
* @param $sessionalExamStudentRequest | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getStudentRegisteredSessioanlExams ( $sessionalExamStudentRequest ) { | |
$sessionalExamStudentRequest = $this->realEscapeObject($sessionalExamStudentRequest); | |
$sql = ""; | |
$currentDateTime = date("Y-m-d H:i:s"); | |
$sessionalExamRegistrations = []; | |
try { | |
$sql = "SELECT | |
sesd.studentaccount_id AS studentId, | |
ser.id, | |
ser.name, | |
ser.description, | |
ser.start_date AS startDate, | |
ser.end_date AS endDate, | |
ser.with_out_fine_date, | |
ser.exam_type_id AS examTypeId, | |
sesd.is_paid AS isPaid | |
FROM | |
ec_sessional_exam_registration ser | |
INNER JOIN ec_sessional_exam_student_details sesd ON | |
sesd.ec_sessional_exam_registration_id = ser.id | |
WHERE | |
sesd.studentaccount_id = '$sessionalExamStudentRequest->studentId' "; | |
$sessionalExamRegistrations = $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException( $e->getCode(), $e->getMessage() ); | |
} | |
return $sessionalExamRegistrations; | |
} | |
/** | |
* request sessional exam reg approval | |
* @param $sessionalExamStudentRequest | |
* @throws ProfessionalException | |
*/ | |
public function requestSessionalExamStudentRegApproval($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
try { | |
$sql = "INSERT INTO studentSessionalExamRegRequestApprove (sessionalExamRegId,studentId,approveStatus) | |
VALUES($request->sessionalExamRegId,$request->studentId,0)"; | |
$this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* get sessional exam reg approval status | |
* @param $sessionalExamStudentRequest | |
* @return objetc | |
* @throws ProfessionalException | |
*/ | |
public function getSessionalExamStudentRegApprovalStatus($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$status=""; | |
try { | |
$sql = "SELECT approveStatus,approvedBy FROM studentSessionalExamRegRequestApprove | |
WHERE sessionalExamRegId = '$request->sessionalExamRegId' AND studentId = '$request->studentId'"; | |
$status = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $status; | |
} | |
/** | |
* get staff assigned as welfare officer | |
* @param $staffId | |
* @return object | |
* @throws ProfessionalException | |
*/ | |
public function getStaffAssignedAsWelfareOfficer($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$staff = ""; | |
try { | |
if($request->staffId){ | |
$sql = "SELECT deptId,staffId FROM welfareOfficerDepartmentPrivilege | |
WHERE staffId = '$request->staffId'"; | |
$staff = $this->executeQueryForObject($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $staff; | |
} | |
/** | |
* get Students For Sessional ExamRegistration | |
* @param $staffId,$sessionalExamRegId | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getStudentsForSessionalExamRegistration($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
$students = []; | |
try { | |
if ($request->sessionalExamRegId && $request->deptId) { | |
$sql = "SELECT sser.studentId,sa.regNo,sa.studentName,b.batchName,sser.approveStatus,essd.id as studentApplied from studentSessionalExamRegRequestApprove sser | |
INNER JOIN studentaccount sa ON sa.studentID = sser.studentId | |
INNER JOIN batches b ON b.batchID = sa.batchID | |
LEFT JOIN ec_sessional_exam_student_details essd ON essd.ec_sessional_exam_registration_id = sser.sessionalExamRegId AND essd.studentaccount_id = sser.studentId | |
WHERE sser.sessionalExamRegId IN ($request->sessionalExamRegId) AND b.deptID IN ($request->deptId)"; | |
$students= $this->executeQueryForList($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $students; | |
} | |
/** | |
* set Students approval For Sessional ExamRegistration | |
* @param $staffId,$sessionalExamRegId | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function setStudentApprovalForSessionalExamRegistration($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
try { | |
if ($request->sessionalExamRegId && $request->studentId) { | |
$sql = "UPDATE studentSessionalExamRegRequestApprove | |
SET approveStatus = '$request->approve' , approvedBy ='$request->staffId' | |
WHERE sessionalExamRegId IN ($request->sessionalExamRegId) AND studentId IN ($request->studentId)"; | |
$this->executeQueryForObject($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
/** | |
* get sessional exam mark submission dates by batch,sem,subject,exam Type | |
* @param request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getSessionalExamMarkSubmissionDates($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$today = date("Y-m-d"); | |
$sql = ""; | |
try { | |
if ($request->batchId && $request->semId && $request->subjectId && $request->examTypeId) { | |
$sql = "SELECT id,fromDate,toDate from sessional_marks_settings WHERE batchID IN ($request->batchId) AND semID IN ($request->semId) AND subjectID IN ($request->subjectId) AND examTypeID IN ($request->examTypeId) | |
AND fromDate <='$today' AND toDate >= '$today'"; | |
$result = $this->executeQueryForObject($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
/** | |
* set sessional exam reg payment status updated | |
* @param request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function updatePaymentStatusSessionalExamReg($studentId,$examRegId,$paid) | |
{ | |
$studentId= $this->realEscapeString($studentId); | |
$examRegId= $this->realEscapeString($examRegId); | |
$paid = $this->realEscapeString($paid); | |
$sql = ""; | |
try { | |
if ($studentId && $examRegId) { | |
$sql = "UPDATE ec_certificate_applied_student_details set paid = $paid,updated_date= NOW() where properties->>'$.applicationId' = $examRegId AND studentID = $studentId"; | |
$result = $this->executeQueryForObject($sql); | |
} | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return true; | |
} | |
public function getSessionalExamStudentDetails($examTypeID, $subbatchID, $batchID, $subjectID, $semID, $sortOrderColumn, $examID = NULL) | |
{ | |
$examTypeID = $this->realEscapeString($examTypeID); | |
$subbatchID = $this->realEscapeString($subbatchID); | |
$batchID = $this->realEscapeString($batchID); | |
$subjectID = $this->realEscapeString($subjectID); | |
$semID = $this->realEscapeString($semID); | |
$examID = $this->realEscapeString($examID); | |
$sortOrderColumn = $this->realEscapeString($sortOrderColumn); | |
$examTypeDetails = ExamService::getInstance()->getExamTypeById($examTypeID); | |
$parent = (int)$examTypeDetails->parent_exam_typeID; | |
$condition = $examID ? " and sm.examID = $examID " : ""; | |
$isCurrentSem = SemesterService::getInstance()->isCurrentSemester($batchID, $semID); | |
if ($subbatchID) { | |
if ($isCurrentSem) { | |
$sql = "SELECT sa.studentID, sa.studentName, sa.rollNo, sa.studentAccount, sa.regNo, sa.batchID,ba.batchName,ba.semID | |
FROM studentaccount sa | |
INNER JOIN subbatch_student ss ON sa.studentID = ss.studentID | |
INNER JOIN batches ba ON ba.batchID = sa.batchID | |
INNER JOIN semesters sem ON sem.semID = ba.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE sa.batchID = $batchID AND ss.subbatchID = $subbatchID AND joinedSem.orderNo <= sem.orderNo | |
ORDER BY sa.$sortOrderColumn;"; | |
} else { | |
$semDetails = SemesterService::getInstance()->getSemDetailsBySemId($semID); | |
$sql = "SELECT st.* FROM (SELECT sa.studentID, sa.studentName, sa.rollNo,sa.regNo, sa.batchID ,ba.batchName,ba.semID | |
FROM studentaccount sa | |
INNER JOIN batches ba ON sa.batchID = ba.batchID | |
INNER JOIN semesters sem ON sem.semID = ba.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
INNER JOIN subbatch_student ss ON sa.studentID = ss.studentID | |
WHERE ba.batchID = $batchID AND joinedSem.orderNo <= $semDetails->orderNo AND ss.subbatchID = $subbatchID | |
UNION | |
SELECT sa.studentID,sa.studentName, sa.rollNo,sa.regNo, fs.previousBatch ,ba.batchName,$semID FROM failed_students fs | |
INNER JOIN studentaccount sa ON sa.studentID = fs.studentID | |
INNER JOIN semesters fsem ON fsem.semID = fs.failedInSemester | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
INNER JOIN subbatch_student ss ON sa.studentID = ss.studentID | |
INNER JOIN batches ba ON fs.previousBatch = ba.batchID | |
WHERE fs.previousBatch = $batchID AND fsem.orderNo > $semDetails->orderNo | |
AND joinedSem.orderNo <= $semDetails->orderNo AND ss.subbatchID = $subbatchID) st ORDER BY st.$sortOrderColumn "; | |
} | |
} else { | |
if ($isCurrentSem) { | |
$sql = "SELECT sa.studentID, sa.studentName, sa.rollNo, sa.regNo,sa.batchID,ba.batchName,ba.semID | |
FROM studentaccount sa | |
INNER JOIN batches ba ON ba.batchID = sa.batchID | |
INNER JOIN semesters sem ON sem.semID = ba.semID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE sa.batchID = $batchID AND joinedSem.orderNo <= sem.orderNo | |
ORDER BY sa.$sortOrderColumn"; | |
} else { | |
$semDetails = SemesterService::getInstance()->getSemDetailsBySemId($semID); | |
$sql = "SELECT sa.studentID, sa.studentName, sa.rollNo, sa.studentAccount,sa.regNo,sa.batchID ,ba.batchName,ba.semID | |
FROM studentaccount sa | |
INNER JOIN batches ba ON sa.batchID = ba.batchID | |
INNER JOIN semesters joinedSem ON sa.joiningSemId = joinedSem.semID | |
WHERE ba.batchID = $batchID AND joinedSem.orderNo <= $semDetails->orderNo | |
UNION | |
SELECT sa.studentID, sa.studentName, sa.rollNo, sa.studentAccount,sa.regNo,sa.batchID ,ba.batchName,fsem.semID | |
FROM failed_students fs | |
LEFT JOIN studentaccount sa on fs.studentID= sa.studentID | |
INNER JOIN batches ba ON fs.previousBatch = ba.batchID | |
INNER JOIN semesters fsem on fsem.semID = fs.failedInSemester | |
INNER JOIN semesters joinedSem on sa.joiningSemId = joinedSem.semID | |
WHERE previousBatch =$batchID AND fsem.orderNo > $semDetails->orderNo AND joinedSem.orderNo <= $semDetails->orderNo | |
ORDER BY $sortOrderColumn"; | |
} | |
} | |
try { | |
return $this->executeQueryForList($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
} | |
/** | |
* get AssessmentComponentRuleByBatchSem | |
* @param request | |
* @return array | |
* @throws ProfessionalException | |
*/ | |
public function getAssessmentComponentRuleByBatchSem($request) | |
{ | |
$request = $this->realEscapeObject($request); | |
$sql = ""; | |
try { | |
$sql = "SELECT acr.id,acr.rule from assessment_component_rule acr | |
INNER JOIN assessment_component_rule_assigned_batches acrb ON acrb.assessment_component_rule_id = acr.id | |
WHERE acrb.batch_id IN ($request->batchId) and acrb.sem_id IN ($request->semId)"; | |
$result = $this->executeQueryForObject($sql); | |
} catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $result; | |
} | |
/** | |
* get student attendance by component rule | |
* @param request | |
* @throws ProfessionalException | |
*/ | |
public function getStudentSubjectAttendanceByComponentRule($r, $student) | |
{ | |
$attendanceRequest = new \stdClass(); | |
$attendanceRequest->batchId = $student->batchID; | |
$attendanceRequest->semId = $student->semID; | |
$attendanceRequest->subjectId = $student->subjectId; | |
$attendanceRequest->studentId = $student->studentID; | |
$student->attendancePercent = 0; | |
$totalInternalMarksArray[$r->code . "MARK"] = 0; | |
try{ | |
if ($student->studentID && $student->batchID && $student->subjectId && $student->semID) { | |
$student->attendancePercent = (float)current(AttendanceService::getInstance()->getStudentsAttendanceByRequest($attendanceRequest))->hour_percentage; | |
$internalMarkDetails[$r->code . "MARK"] = 0; | |
usort($r->innerRules, function ($a, $b) { | |
return $a->val1 > $b->val1; | |
}); | |
$maxValue = array_map('floatval', array_column($r->innerRules, 'val1')); | |
rsort($maxValue); | |
$maxValue = $maxValue[0]; | |
foreach ($r->innerRules as $innerRule) { | |
$mark = 0; | |
$mark = $this->calculateIndividualRule($student->attendancePercent, $innerRule, ($innerRule->val2 && $innerRule->val1 == $maxValue)); | |
if ($mark > $internalMarkDetails[$r->code . "MARK"]) { | |
$internalMarkDetails[$r->code . "MARK"] = $mark; | |
} | |
unset($mark); | |
} | |
$totalInternalMarksArray[$r->code . "MARK"] = (float) $internalMarkDetails[$r->code . "MARK"]; | |
unset($maxValue); | |
} | |
} | |
catch (\Exception $e) { | |
throw new ProfessionalException($e->getCode(), $e->getMessage()); | |
} | |
return $totalInternalMarksArray[$r->code . "MARK"]; | |
} | |
private function calculateIndividualRule($studentValue, $innerRule, $isMaxValue) | |
{ | |
switch ($innerRule->operator) { | |
case "BTW": | |
if (!$isMaxValue) { | |
if ($studentValue >= $innerRule->val1 && $studentValue < $innerRule->val2) { | |
return $innerRule->mark; | |
} | |
} else { | |
if ($studentValue >= $innerRule->val1 && $studentValue <= $innerRule->val2) { | |
return $innerRule->mark; | |
} | |
} | |
break; | |
case "GTE": | |
if ($studentValue >= $innerRule->val1) { | |
return $innerRule->mark; | |
} | |
break; | |
case "LTE": | |
if ($studentValue <= $innerRule->val1) { | |
return $innerRule->mark; | |
} | |
break; | |
} | |
} | |
} |