apollodec/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php
2018-09-22 17:21:50 +05:30

1551 lines
78 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 8/28/18
* Time: 11:02 AM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Receive_Enrolment_Fees_Univ_model extends CI_Model {
/*
* add received enrolment details
* params:enrolment details, local details
* created by kms
* */
public function getUnivCourseFromFileDetails(){
$selectQuery = "SELECT UniversityCode, UniversityName FROM T_Enrolment_Received_From_University GROUP BY UniversityCode";
$queryDetails = $this->db->query($selectQuery);
if($queryDetails->result()){
foreach ($queryDetails->result() as $formIdDetails){
$univResult['univCode'] = $formIdDetails->UniversityCode;
$univResult['univName'] = $formIdDetails->UniversityName;
$selectCourseQuery = "SELECT CourseCode, CourseName FROM T_Enrolment_Received_From_University WHERE UniversityCode = '$formIdDetails->UniversityCode' GROUP BY CourseCode";
$queryCourseDetails = $this->db->query($selectCourseQuery);
$univResult['univCourseDetails'] = $queryCourseDetails->result();
$selectSessionQuery = "SELECT SessionName FROM T_Enrolment_Received_From_University WHERE UniversityCode = '$formIdDetails->UniversityCode' GROUP BY CourseCode";
$querySessionDetails = $this->db->query($selectSessionQuery);
$univResult['univSessionDetails'] = $querySessionDetails->result();
$merge[]=$univResult;
}
$finalArray['status'] = true;
$finalArray['message'] = "Success.";
$finalArray['details'] = $merge;
} else {
$finalArray['status'] = false;
$finalArray['message'] = "No record found.";
$finalArray['details'] = [];
}
return $finalArray;
}
public function updateEnrolmentDetails($enrolment=null,$local=null)
{
// create array for find sem value
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4');
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4");
$errorArray=array();
$get_data=array();
// loop for fetch details
foreach ($enrolment as $k => $checkRow){
// check enrolment no and form id in upload list
if(array_key_exists("Enrollment_No",$checkRow) AND array_key_exists("Form Id",$checkRow)){
// start
$insert['FormID']=$checkRow['Form Id'];
$insert['EnrolmentNo']=$checkRow['Enrollment_No'];
// check key exist in json array
if(array_key_exists('Roll_No',$checkRow)){
$insert['RollNo']=$checkRow['Roll_No'];
}
else{
$insert['RollNo']="";
}
if(array_key_exists('Centre Code',$checkRow)) {
$insert['CentreCode'] = $checkRow['Centre Code'];
}
else{
$insert['CentreCode'] = "";
}
if(array_key_exists('Centre State',$checkRow)) {
$insert['CentreState'] = $checkRow['Centre State'];
}
else{
$insert['CentreState'] = "";
}
if(array_key_exists('Student_Mob_No',$checkRow)){
$insert['MobileNumber']=$checkRow['Student_Mob_No'];
}
else{
$insert['MobileNumber']="";
}
if(array_key_exists('Student_Name',$checkRow)) {
$insert['StudentName'] = $checkRow['Student_Name'];
}
else{
$insert['StudentName'] = "";
}
if(array_key_exists('Father_Name',$checkRow)) {
$insert['FatherName'] = $checkRow['Father_Name'];
}
else{
$insert['FatherName'] = "";
}
if(array_key_exists('Mother_Name',$checkRow)) {
$insert['MotherName'] = $checkRow['Mother_Name'];
}
else{
$insert['MotherName'] = "";
}
if(array_key_exists('Student_Email_Id',$checkRow)) {
$insert['EmailID'] = $checkRow['Student_Email_Id'];
}
else{
$insert['EmailID'] = "";
}
if(array_key_exists('ID_Proof',$checkRow)) {
$insert['IDProof'] = $checkRow['ID_Proof'];
}
else{
$insert['IDProof'] = "";
}
if(array_key_exists('Gender',$checkRow)) {
$insert['Gender'] = $checkRow['Gender'];
}
else{
$insert['Gender'] = "";
}
if(array_key_exists('Date_Of_Birth',$checkRow)) {
$insert['DOB'] = $checkRow['Date_Of_Birth'];
}
else{
$insert['DOB'] = "";
}
if(array_key_exists('Address',$checkRow)) {
$insert['PresentAddress'] = $checkRow['Address'];
}
else{
$insert['PresentAddress'] = "";
}
if(array_key_exists('Adhar_No',$checkRow)) {
$insert['AadharNumber'] = $checkRow['Adhar_No'];
}
else{
$insert['AadharNumber'] = "";
}
if(array_key_exists('Category',$checkRow)) {
$insert['Category'] = $checkRow['Category'];
}
else{
$insert['Category'] = "";
}
if(array_key_exists('Course_Code',$checkRow)) {
$insert['CourseCode'] = $checkRow['Course_Code'];
}
else{
$insert['CourseCode'] = "";
}
if(array_key_exists('Course_Name',$checkRow)) {
$insert['CourseName'] = $checkRow['Course_Name'];
}
else{
$insert['CourseName'] = "";
}
if(array_key_exists('Specialization',$checkRow)) {
$insert['Specialization'] = $checkRow['Specialization'];
}
else{
$insert['Specialization'] = "";
}
if(array_key_exists('Semester',$checkRow)) {
$insert['SemesterYear'] = $checkRow['Semester'];
}
else{
$insert['SemesterYear'] = "";
}
if(array_key_exists('Session',$checkRow)) {
$insert['SessionName'] = $checkRow['Session'];
}
else{
$insert['SessionName'] = "";
}
if(array_key_exists('Year',$checkRow)) {
$insert['Year'] = $checkRow['Year'];
}
else{
$insert['Year'] = "";
}
if(array_key_exists('Form Type',$checkRow)) {
$insert['FormType'] = $checkRow['Form Type'];
}
else{
$insert['FormType'] = "";
}
if(array_key_exists('Entry Mode',$checkRow)) {
$insert['EntryMode'] = $checkRow['Entry Mode'];
}
else{
$insert['EntryMode'] = "";
}
if(array_key_exists('Remarks',$checkRow)) {
$insert['Remarks'] = $checkRow['Remarks'];
}
else{
$insert['Remarks'] = "";
}
if(array_key_exists('Affidavit_Status',$checkRow)) {
$insert['AffidavitStatus'] = $checkRow['Affidavit_Status'];
}
if(array_key_exists('Migration_Status',$checkRow)) {
$insert['MigrationStatus'] = $checkRow['Migration_Status'];
}
else{
$insert['MigrationStatus'] = "";
}
if(array_key_exists('Finance_Status',$checkRow)) {
$insert['FinanceStatus'] = $checkRow['Finance_Status'];
}
else{
$insert['FinanceStatus'] = "";
}
if(array_key_exists('Most Urgent DMC',$checkRow)) {
$insert['MostUrgentDMC'] = $checkRow['Most Urgent DMC'];
}
else{
$insert['MostUrgentDMC'] = "";
}
if(array_key_exists('created_By',$checkRow)) {
$insert['CreatedByName'] = $checkRow['created_By'];
}
else{
$insert['CreatedByName'] = "";
}
if(array_key_exists('Created_Date',$checkRow)) {
$insert['CreatedDate'] = $checkRow['Created_Date'];
}
else{
$insert['CreatedDate'] = "";
}
if(array_key_exists('Approved_By',$checkRow)) {
$insert['ApprovedByName'] = $checkRow['Approved_By'];
}
else{
$insert['ApprovedByName'] = "";
}
if(array_key_exists('Approved_Date',$checkRow)) {
$insert['ApprovedDate'] = $checkRow['Approved_Date'];
}
else{
$insert['ApprovedDate'] = "";
}
$insert['UniversityCode'] = $local['UniversityCode'];
$insert['UniversityName'] = $local['UniversityName'];
$insert['BranchCode'] = $local['BranchCode'];
$insert['CreatedBy'] = $local['CreatedBy'];
$insert['CreatedOn'] = $local['CreatedOn'];
$get_data[count($get_data)]=array(
'FormID' => $insert['FormID'],
'EnrolmentNo' => $insert['EnrolmentNo'],
'RollNo' => $insert['RollNo'],
'CentreCode' => $insert['CentreCode'],
'CentreState' => $insert['CentreState'],
'MobileNumber' => $insert['MobileNumber'],
'StudentName' => $insert['StudentName'],
'FatherName' => $insert['FatherName'],
'MotherName' => $insert['MotherName'],
'EmailID' => $insert['EmailID'],
'IDProof' => $insert['IDProof'],
'Gender' => $insert['Gender'],
'DOB' => $insert['DOB'],
'PresentAddress' => $insert['PresentAddress'],
'AadharNumber' => $insert['AadharNumber'],
'Category' => $insert['Category'],
'UniversityCode'=>$insert['UniversityCode'],
'UniversityName'=>$insert['UniversityName'],
'CourseCode' => $insert['CourseCode'],
'CourseName' => $insert['CourseName'],
'Specialization' => $insert['Specialization'],
'SemesterYear' => $insert['SemesterYear'],
'SessionName' => $insert['SessionName'],
'Year' => $insert['Year'],
'FormType' => $insert['FormType'],
'EntryMode' => $insert['EntryMode'],
'Remarks' => $insert['Remarks'],
'AffidavitStatus' => $insert['AffidavitStatus'],
'MigrationStatus' => $insert['MigrationStatus'],
'FinanceStatus' => $insert['FinanceStatus'],
'MostUrgentDMC' => $insert['MostUrgentDMC'],
'CreatedByName' => $insert['CreatedByName'],
'CreatedDate' => $insert['CreatedDate'],
'ApprovedByName' => $insert['ApprovedByName'],
'ApprovedDate' => $insert['ApprovedDate'],
'BranchCode' => $insert['BranchCode'],
'CreatedBy' => $insert['CreatedBy'],
'CreatedOn' => $insert['CreatedOn'],
);
}
else{
// for capture error message
$error["StudentName"]=$checkRow['Student_Name'];
$error["Message"]="Enrolment number/Form id is not exist.";
$errorArray[]=$error;
}
}
if(sizeof($get_data)>0) {
// check form id exit in table for insert / update
$formIDData = $this->db->select('FormID')->order_by('SubmitID', 'ASC')->get(ENROLMENTRECEIVEDFROMUNIV)->result_array();
$form_ids = array();
$insertForms = array();
$updateForms = array();
foreach ($formIDData as $fkey => $fvalue):
if(sizeof($get_data)>0){
$matchedKey = array_search($fvalue['FormID'], array_column($get_data, 'FormID'));
if ($matchedKey!== false) {
// $updateForms[count($updateForms)] = $get_data[$matchedKey];
// $form_ids[]=$fvalue['FormID'];
array_splice($get_data, $matchedKey, 1);
}
}
endforeach;
if (sizeof($get_data) > 0) {
$this->db->insert_batch(ENROLMENTRECEIVEDFROMUNIV, $get_data);
if ($this->db->affected_rows() > 0) {
$finalArray['status'] = true;
$finalArray['message'] = "Inserted successfully";
$finalArray['insertedRows'] = $this->db->affected_rows();
$finalArray['details'] = $errorArray;
return $finalArray;
} else {
$finalArray['status'] = false;
$finalArray['message'] = "Please check file data.";
$finalArray['insertedRows'] = $this->db->affected_rows();
$finalArray['details'] = $errorArray;
return $finalArray;
}
} else {
$finalArray['status'] = false;
$finalArray['message'] = "Please check file data.";;
$finalArray['details'] = $errorArray;
}
/* if(count($updateForms)>0){
//$this->db->where_in('FormID',$form_ids);
$this->db->update_batch(ENROLMENTRECEIVEDFROMUNIV, $updateForms,'FormID');
}*/
}
else{
$finalArray['status'] = false;
$finalArray['message'] = "Please check file data.";
$finalArray['insertedRows'] = $this->db->affected_rows();
$finalArray['details'] = $errorArray;
return $finalArray;
}
return $finalArray;
}
// add student formid feedetails from the university by file upload , with check the unique entry
// kdk
public function formIdFeeDetails($formFeeDetails=null,$local=null, $univ =null){
$localBranchID = $local['localBranchID'];
$localUserID = $local['localUserID'];
$univId = $univ['univCode'];
$time = date('Y-m-d H:i:s');
$CreatedOn = $time;
foreach ($formFeeDetails as $formIdDetails){
if(array_key_exists('FormId',$formIdDetails) && $formIdDetails['FormId'] != '' && $formIdDetails['FormId'] != null
&& array_key_exists('Form Type',$formIdDetails) && array_key_exists('CentreCode',$formIdDetails) && array_key_exists('Course_Code',$formIdDetails)
&& array_key_exists('Actual_Course_Fee',$formIdDetails) && array_key_exists('Course_Fee',$formIdDetails) && array_key_exists('Exam_Fee',$formIdDetails)
&& array_key_exists('Enrollment_Fee',$formIdDetails) && array_key_exists('Prospectus_Fee',$formIdDetails) && array_key_exists('Additional_Fee',$formIdDetails)
&& array_key_exists('Amount',$formIdDetails) && array_key_exists('Session',$formIdDetails) && array_key_exists('Year',$formIdDetails)
&& array_key_exists('Semester',$formIdDetails) && array_key_exists('Student_Name',$formIdDetails) && array_key_exists('Father_Name',$formIdDetails) ){
//select query for the check the fields are entered
//echo $formIdDetails['FormId']; echo '====';
$formIds = $formIdDetails['FormId'];
$formType = $formIdDetails['Form Type'] ? $formIdDetails['Form Type'] : '';
$CentreCode = $formIdDetails['CentreCode'] ?: '';
$Session = $formIdDetails['Session'] ?: '';
$Year = $formIdDetails['Year'] ?: '';
$Semester = $formIdDetails['Semester'] ?: '';
$Student_Name = $formIdDetails['Student_Name'] ?: '';
$Father_Name = $formIdDetails['Father_Name'] ?: '';
$CourseCode = $formIdDetails['Course_Code'] ?: '';
$ActualCourseFee = $formIdDetails['Actual_Course_Fee'] ?: '0';
$CourseFee = $formIdDetails['Course_Fee'] ?: '0';
$ExamFee = $formIdDetails['Exam_Fee'] ?: '0';
$EnrollmentFee = $formIdDetails['Enrollment_Fee'] ?: '0';
$ProspectusFee = $formIdDetails['Prospectus_Fee'] ?: '0';
$ReRegFee = $formIdDetails['Re_Reg_Fee'] ?: '0';
$CreditTransferFee = $formIdDetails['Credit_Transfer_Fee'] ?: '0';
$LateralEntryFee = $formIdDetails['Lateral_Entry_Fee'] ?: '0';
$DualSpclFee = $formIdDetails['Dual_Spcl_Fee'] ?: '0';
$OtherFee = $formIdDetails['Other_Fee'] ?: '0';
$NRIFEE = $formIdDetails['NRI_FEE'] ?: '0';
$ProvisionalFee = $formIdDetails['Provisional_Fee'] ?: '0';
$MigrationFee = $formIdDetails['Migration_Fee'] ?: '0';
$UrgentResultDMCFee = $formIdDetails['Urgent_Result_DMC_Fee'] ?: '0';
$AdditionalFee = $formIdDetails['Additional_Fee'] ?: '0';
$Amount = $formIdDetails['Amount'] ?: '0';
$selectQuery = "SELECT * FROM T_FormId_FeeDetails_Received_From_University WHERE
FormID = '$formIds' AND
FormType = '$formType' AND
CentreCode = '$CentreCode' AND
Session = '$Session' AND
Year = '$Year' AND
Semester = '$Semester' AND
Student_Name = '$Student_Name' AND
Father_Name = '$Father_Name' AND
CourseCode = '$CourseCode' AND
ActualCourseFee = '$ActualCourseFee' AND
CourseFee = '$CourseFee' AND
ExamFee = '$ExamFee' AND
EnrollmentFee = '$EnrollmentFee' AND
ProspectusFee = '$ProspectusFee' AND
ReRegFee = '$ReRegFee' AND
CreditTransferFee = '$CreditTransferFee' AND
LateralEntryFee = '$LateralEntryFee' AND
DualSpclFee = '$DualSpclFee' AND
OtherFee = '$OtherFee' AND
NRIFEE = '$NRIFEE' AND
ProvisionalFee = '$ProvisionalFee' AND
MigrationFee = '$MigrationFee' AND
UrgentResultDMCFee = '$UrgentResultDMCFee' AND
AdditionalFee = '$AdditionalFee' AND
Amount = '$Amount'";
$queryDetails = $this->db->query($selectQuery);
// echo count($queryDetails->result());exit();
if(count($queryDetails->result()) == 0){
$query = "INSERT INTO T_FormId_FeeDetails_Received_From_University
(FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount,UniversityID, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus, AddToAccountStatus)
VALUES
( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$univId', '$localUserID', '$CreatedOn', '$localBranchID' , 0, 0, 0)";
$queryDetails = $this->db->query($query);
} else {
echo 'else con';
}
// -- ON DUPLICATE KEY UPDATE
// -- FormType = '$formType',
// -- CentreCode = '$CentreCode',
// -- CourseCode = '$CourseCode',
// -- ActualCourseFee = '$ActualCourseFee',
// -- CourseFee = '$CourseFee',
// -- ExamFee = '$ExamFee',
// -- EnrollmentFee = '$EnrollmentFee',
// -- ProspectusFee = '$ProspectusFee',
// -- ReRegFee = '$ReRegFee',
// -- CreditTransferFee = '$CreditTransferFee',
// -- LateralEntryFee = '$LateralEntryFee',
// -- DualSpclFee = '$DualSpclFee',
// -- OtherFee = '$OtherFee',
// -- NRIFEE = '$NRIFEE',
// -- ProvisionalFee = '$ProvisionalFee',
// -- MigrationFee = '$MigrationFee',
// -- UrgentResultDMCFee = '$UrgentResultDMCFee',
// -- AdditionalFee = '$AdditionalFee',
// -- Amount = '$Amount'";
}
continue;
}
$results['stuFeeList'] = true;
$results['stuFeeList_details'] = "details updated successfully.";
return $results;
}
public function getStudentUnivFeeCompareDetails($search=null){
$mergeFormDetails=array();
$this->db->distinct('ENU.FormID');
$this->db->select('ENU.FormID, ENU.FormType, ENU.SemesterYear, ENU.EnrolmentNo,ENU.RollNo, ST.*,UN.UniversityID, UN.UniversityName,CM.CourseID,CM.CourseCode,CM.CourseName');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
$this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo');
$this->db->join(COURSE.' as CM', 'CM.CourseID = STC.CourseID');
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID');
$this->db->join(UNIVERSITY.' as UN', 'UN.UniversityID = STC.UniversityID');
if($search['University']!=''){
$this->db->where('ENU.UniversityCode',$search['University']);
}
if($search['Course']!=''){
$this->db->where('ENU.CourseName',$search['Course']);
}
if($search['Sem']!=''){
$this->db->where('ENU.SemesterYear',$search['Sem']);
}
$details = $this->db->get();
$detailsList = $details->result();
if($detailsList){
foreach ($detailsList as $fetchStudentRow){
// form id bases get student paid details
$getStudentsetFeesDetails=$this->getStudentsetFeesDetails($fetchStudentRow->StudentID,$fetchStudentRow->CourseID,$fetchStudentRow->SemesterYear);
if(isset($getStudentsetFeesDetails['status']) AND $getStudentsetFeesDetails['status']==true ){
$formResult['SessionName']=$getStudentsetFeesDetails['SessionName'];
$formResult['FormID']=$fetchStudentRow->FormID;
$formResult['FormType']=$fetchStudentRow->FormType;
$formResult['SemesterYear']=$fetchStudentRow->SemesterYear;
$formResult['EnrolmentNo']=$fetchStudentRow->EnrolmentNo;
$formResult['CourseCode']=$fetchStudentRow->CourseCode;
$formResult['CourseName']=$fetchStudentRow->CourseName;
$formResult['RollNo']=$fetchStudentRow->RollNo;
$formResult['StudentID']=$fetchStudentRow->StudentID;
$formResult['MobileNumber']=$fetchStudentRow->MobileNumber;
$formResult['Firstname']=$fetchStudentRow->Firstname;
$formResult['Lastname']=$fetchStudentRow->Lastname;
$formResult['Fathername']=$fetchStudentRow->Fathername;
$formResult['MotherName']=$fetchStudentRow->MotherName;
$formResult['EmailID']=$fetchStudentRow->EmailID;
$formResult['AlternateNumber']=$fetchStudentRow->AlternateNumber;
$formResult['Gender']=$fetchStudentRow->Gender;
$formResult['DOB']=$fetchStudentRow->DOB;
$formResult['PresentAddress']=$fetchStudentRow->PresentAddress;
$formResult['PermanentAddress']=$fetchStudentRow->PermanentAddress;
$formResult['AadharNumber']=$fetchStudentRow->AadharNumber;
$formResult['OtherID']=$fetchStudentRow->OtherID;
$formResult['OtherIDDetails']=$fetchStudentRow->OtherIDDetails;
$formResult['Qualification']=$fetchStudentRow->Qualification;
$formResult['UniversityID']=$fetchStudentRow->UniversityID;
$formResult['UniversityName']=$fetchStudentRow->UniversityName;
$mergeFormDetails[]=$formResult;
}
/* if(sizeof($getStudentPaidDetails)!=0){
$formResult['StudentPaidAmount']=$getStudentPaidDetails['StudentPaidAmount'];
}
else{
$formResult['StudentPaidAmount']='';
}*/
}
$resultArr['studentFeeCompareDetails'] = $mergeFormDetails;
$resultArr['formTypeStatus'] = true;
$resultArr['message'] = "Successfully data generated";
} else {
$resultArr['studentFeeCompareDetails'] = [];
$resultArr['formTypeStatus'] = false;
$resultArr['message'] = "No record found...";
}
return $resultArr;
}
/*form id bases get student paid details for getStudentUnivFeeCompareDetails methods*/
public function getStudentsetFeesDetails($studentID=null,$courseID=null,$sem=null){
// create array for find sem value
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4',12 => "DMC CHANGE SEM1",13 => "DMC CHANGE SEM2",14 => "DMC CHANGE SEM3",15 => "DMC CHANGE SEM4",16 => "DMC CHANGE SEM5",17 => "DMC CHANGE SEM6",18 => "DMC CHANGE SEM7",19 => "DMC CHANGE SEM8",20 => "DMC CHANGE YEAR1",21 => "DMC CHANGE YEAR2",22 => "DMC CHANGE YEAR3",23 => "DMC CHANGE YEAR4");
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4","1","2","3","4","5","6","7","8","1","2","3","4");
$feesArray=array();
$this->db->select("CF.ID,CF.ProgramType,CF.Sem_Year");
$this->db->from(COURSE_FEES . ' as CF');
$this->db->where('CF.CourseID', $courseID);
$courseFeesDetails = $this->db->get();
//this is for sem year type check fees
if ($courseFeesDetails->num_rows() > 1) {
foreach ($courseFeesDetails->result() as $fetchRow) {
$serachKey = array_search(strtoupper($fetchRow->Sem_Year), $keyArray);
if ($valueArray[$serachKey] == $sem) {
$this->db->select("SM.SessionName,SM.SessionID");
$this->db->from(STUDENTS_FEES_STATUS . ' as SFS');
$this->db->join(SESSIONMASTER . ' as SM' , 'SM.SessionID = SFS.SessionName');
$this->db->where('SFS.FeesType', $fetchRow->ID);
$this->db->where('SFS.StudentID', $studentID);
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['status'] = true;
$feesArray['SessionName'] = $feesDetails->SessionName;
$feesArray['SessionID'] = $feesDetails->SessionID;
break;
} else {
$feesArray['status'] = false;
break;
}
}
}
}
else if($courseFeesDetails->num_rows()==1){
foreach ($courseFeesDetails->result() as $fetchRow){
$this->db->select("SM.SessionName,SM.SessionID");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(SESSIONMASTER . ' as SM' , 'SM.SessionID = SFS.SessionName');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$studentID);
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['status'] = true;
$feesArray['SessionName'] = $feesDetails->SessionName;
$feesArray['SessionID'] = $feesDetails->SessionID;
break;
} else {
$feesArray['status'] = false;
break;
}
}
}
else{
$feesArray['status'] = false;
}
return $feesArray;
}
/**
* Unmached file details
*/
public function getUnmatchedFormDetails($reqType){
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4',12 => "DMC CHANGE SEM1",13 => "DMC CHANGE SEM2",14 => "DMC CHANGE SEM3",15 => "DMC CHANGE SEM4",16 => "DMC CHANGE SEM5",17 => "DMC CHANGE SEM6",18 => "DMC CHANGE SEM7",19 => "DMC CHANGE SEM8",20 => "DMC CHANGE YEAR1",21 => "DMC CHANGE YEAR2",22 => "DMC CHANGE YEAR3",23 => "DMC CHANGE YEAR4");
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4","1","2","3","4","5","6","7","8","1","2","3","4");
$this->db->distinct('ENU.FormID');
$this->db->select('ENU.*');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
if($reqType['University']!=''){
$this->db->where('ENU.UniversityCode',$reqType['University']);
}
if($reqType['Course']!=''){
$this->db->where('ENU.CourseName',$reqType['Course']);
}
if($reqType['Sem']!=''){
$this->db->where('ENU.SemesterYear',$reqType['Sem']);
}
$details = $this->db->get();
$resultArr=array();
$mergeFormDetails=array();
if($details->result()){
foreach ($details->result() as $fRow){
$this->db->distinct('ENU1.FormID');
$this->db->select('SC.StudentID,SC.CourseID,SC.EnrollmentID,CF.ID,CF.ProgramType,CF.Sem_Year,ENU1.SemesterYear,ENU1.EnrolmentNo');
$this->db->from(STUDENTCOURSE.' as SC');
$this->db->join(ENROLMENTRECEIVEDFROMUNIV .' as ENU1', 'ENU1.EnrolmentNo = SC.EnrollmentID');
$this->db->join(COURSE_FEES .' as CF', 'CF.CourseID = SC.CourseID');
$this->db->where('ENU1.EnrolmentNo',$fRow->EnrolmentNo);
$this->db->where('ENU1.FormID',$fRow->FormID);
$getEnrolmentMatchDetails=$this->db->get();
if($getEnrolmentMatchDetails->result()){
foreach ($getEnrolmentMatchDetails->result() as $sRow){
$serachKey = array_search(strtoupper($sRow->Sem_Year), $keyArray);
if ($valueArray[$serachKey] == $sRow->SemesterYear) {
$this->db->select('SFS.FeesID');
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(COURSE_FEES .' as CF', 'SFS.FeesType = CF.ID');
$this->db->where('SFS.FeesType',$sRow->ID);
$this->db->where('SFS.CourseID',$sRow->CourseID);
$this->db->where('SFS.StudentID',$sRow->StudentID);
$getEnrolmentMatchDetails=$this->db->get();
if($getEnrolmentMatchDetails->num_rows()==0){
$formResult['SessionName']=$fRow->SessionName;
$formResult['FormID']=$fRow->FormID;
$formResult['FormType']=$fRow->FormType;
$formResult['SemesterYear']=$fRow->SemesterYear;
$formResult['CentreCode']=$fRow->CentreCode;
$formResult['CentreState']=$fRow->CentreState;
$formResult['EnrolmentNo']=$fRow->EnrolmentNo;
$formResult['EnromentStatus']=true;
$formResult['SemStatus']=false;
$formResult['CourseCode']=$fRow->CourseCode;
$formResult['CourseName']=$fRow->CourseName;
$formResult['RollNo']=$fRow->RollNo;
$formResult['MobileNumber']=$fRow->MobileNumber;
$formResult['StudentName']=$fRow->StudentName;
$formResult['FatherName']=$fRow->FatherName;
$formResult['MotherName']=$fRow->MotherName;
$formResult['EmailID']=$fRow->EmailID;
$formResult['AlternateNumber']=$fRow->AlternateNumber;
$formResult['Gender']=$fRow->Gender;
$formResult['DOB']=$fRow->DOB;
$formResult['PresentAddress']=$fRow->PresentAddress;
$formResult['PermanentAddress']=$fRow->PermanentAddress;
$formResult['AadharNumber']=$fRow->AadharNumber;
$formResult['OtherID']=$fRow->IDProof;
$formResult['UniversityCode']=$fRow->UniversityCode;
$formResult['UniversityName']=$fRow->UniversityName;
$mergeFormDetails[]=$formResult;
}
}
}
}
else{
$formResult['SessionName']=$fRow->SessionName;
$formResult['FormID']=$fRow->FormID;
$formResult['FormType']=$fRow->FormType;
$formResult['SemesterYear']=$fRow->SemesterYear;
$formResult['CentreCode']=$fRow->CentreCode;
$formResult['CentreState']=$fRow->CentreState;
$formResult['EnrolmentNo']=$fRow->EnrolmentNo;
$formResult['EnromentStatus']=false;
$formResult['SemStatus']=true;
$formResult['CourseCode']=$fRow->CourseCode;
$formResult['CourseName']=$fRow->CourseName;
$formResult['RollNo']=$fRow->RollNo;
$formResult['MobileNumber']=$fRow->MobileNumber;
$formResult['StudentName']=$fRow->StudentName;
$formResult['FatherName']=$fRow->FatherName;
$formResult['MotherName']=$fRow->MotherName;
$formResult['EmailID']=$fRow->EmailID;
$formResult['AlternateNumber']=$fRow->AlternateNumber;
$formResult['Gender']=$fRow->Gender;
$formResult['DOB']=$fRow->DOB;
$formResult['PresentAddress']=$fRow->PresentAddress;
$formResult['PermanentAddress']=$fRow->PermanentAddress;
$formResult['AadharNumber']=$fRow->AadharNumber;
$formResult['OtherID']=$fRow->IDProof;
$formResult['UniversityCode']=$fRow->UniversityCode;
$formResult['UniversityName']=$fRow->UniversityName;
$mergeFormDetails[]=$formResult;
}
}
// echo sizeof($mergeFormDetails);die();
if(sizeof($mergeFormDetails)>0){
$resultArr['unMatchedRecordDetails'] = $mergeFormDetails;
$resultArr['unMatchedRecordStatus'] = true;
$resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile';
$resultArr['message'] = "Successfully data generated";
}
else{
$resultArr['unMatchedRecordDetails'] = $mergeFormDetails;
$resultArr['unMatchedRecordStatus'] = false;
$resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile';
$resultArr['message'] = "No record found...";
}
}
else{
$resultArr['unMatchedRecordDetails'] = [];
$resultArr['unMatchedRecordStatus'] = false;
$resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile';
$resultArr['message'] = "No record found...";
}
return $resultArr;
}
/*
* get university session details for filter
* created by kms
* */
public function getUniversitySessionList($branchID=null){
$this->db->select('UniversityID,UniversityName');
$this->db->order_by('UniversityID','DESC');
$this->db->where('IsActive','1');
$this->db->group_by('UniversityName');
// $this->db->where('BranchCode',$branchID);
$universityDetails = $this->db->get(UNIVERSITY);
$universityResult=array();
if($universityDetails->result()){
$universityResult['status']=true;
/* foreach ($universityDetails->result() as $row){
$this->db->select('SM.SessionID,SM.SessionName');
$this->db->order_by('SM.SessionID','DESC');
$this->db->where('SM.IsActive','1');
// $this->db->where('SM.BranchCode',$branchID);
$this->db->where('SD.UniversityID',$row->UniversityID);
$this->db->from(SESSIONMASTER.' as SM');
$this->db->join(SESSIONDETAILS.' as SD', 'SD.SessionID = SM.SessionID');
$sessionDetails = $this->db->get();
$fetchArray['UniversityID']=$row->UniversityID;
$fetchArray['UniversityName']=$row->UniversityName;
if($sessionDetails->result()){
$fetchArray['SessionDetails']=$sessionDetails->result();
}
else{
$fetchArray['SessionDetails']="";
}
$getResult[]=$fetchArray;
}*/
$universityResult['details']=$universityDetails->result();
}
else{
$universityResult['status']=false;
$universityResult['details']="";
}
return $universityResult;
}
/*
* get exist student enrolment details
* creted by kms
* */
public function getExistStudentEnrolmentDetails($enrolment=null,$localData=null){
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4',12 => "DMC CHANGE SEM1",13 => "DMC CHANGE SEM2",14 => "DMC CHANGE SEM3",15 => "DMC CHANGE SEM4",16 => "DMC CHANGE SEM5",17 => "DMC CHANGE SEM6",18 => "DMC CHANGE SEM7",19 => "DMC CHANGE SEM8",20 => "DMC CHANGE YEAR1",21 => "DMC CHANGE YEAR2",22 => "DMC CHANGE YEAR3",23 => "DMC CHANGE YEAR4");
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4","1","2","3","4","5","6","7","8","1","2","3","4");
$this->db->distinct('ENU.FormID');
$this->db->select('STC.EnrollmentID,ST.*,UN.UniversityID, UN.UniversityName,CM.CourseID,CM.CourseCode,CM.CourseName,CF.ID,CF.Sem_Year,CF.ProgramType,SM.SessionName,RE.RegistrationType');
$this->db->from(STUDENTCOURSE.' as STC');
$this->db->join(COURSE.' as CM', 'CM.CourseID = STC.CourseID');
$this->db->join(COURSE_FEES.' as CF', 'CF.CourseID = CM.CourseID');
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID');
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFS.StudentID = STC.StudentID AND SFS.CourseID=STC.CourseID AND SFS.FeesType=CF.ID');
$this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName');
$this->db->join(REGISTRATIONDETAILS.' as RE', 'RE.Student_Fee_Status_Id = SFS.FeesID','left');
$this->db->join(UNIVERSITY.' as UN', 'UN.UniversityID = STC.UniversityID');
$this->db->where('STC.EnrollmentID', $enrolment);
$details = $this->db->get();
$arrayResultStudent=array();
if($details->result()){
$getVAll=$details->result();
// $arrayResult['StudentID']=$getVAll[0]->StudentID;
$arrayResult['StudentName']=$getVAll[0]->Firstname.' '.$getVAll[0]->Lastname;
$arrayResult['MobileNumber']=$getVAll[0]->MobileNumber;
$arrayResult['FatherName']=$getVAll[0]->Fathername;
$arrayResult['MotherName']=$getVAll[0]->MotherName;
$arrayResult['EmailID']=$getVAll[0]->EmailID;
$arrayResult['AlternateNumber']=$getVAll[0]->AlternateNumber;
$arrayResult['Gender']=$getVAll[0]->Gender;
$arrayResult['DOB']=$getVAll[0]->DOB;
$arrayResult['AadharNumber']=$getVAll[0]->AadharNumber;
$arrayResult['BranchCode']=$getVAll[0]->BranchCode;
$arrayResult['UniversityCode']=$getVAll[0]->UniversityID;
$arrayResult['UniversityName']=$getVAll[0]->UniversityName;
$arrayResult['CourseCode']=$getVAll[0]->CourseCode;
$arrayResult['CourseName']=$getVAll[0]->CourseName;
$arrayResult['EnrolmentNo']=$getVAll[0]->EnrollmentID;
$arrayResultStudent['StudentInfo']=$arrayResult;
if($getVAll[0]->ProgramType==SEMYEARFEES){
$arrayResultStudent['status']=true;
$arraySem=array();
foreach ($getVAll as $row){
$serachKey = array_search(strtoupper($row->Sem_Year), $keyArray);
$sem=$valueArray[$serachKey];
$this->db->select('FormID');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
$this->db->where('ENU.EnrolmentNo',$enrolment);
$this->db->where('ENU.SemesterYear',$sem);
$notExistDetails=$this->db->get();
if(!$notExistDetails->result()){
$getSemType['sem']=$sem;
$getSemType['SessionName']=$row->SessionName;
$getSemType['FormType']=$row->RegistrationType;
$arraySem[]=$getSemType;
}
}
$arrayResultStudent['semDetails']=$arraySem;
}
else{
$arrayResultStudent['status']=false;
$arrayResultStudent['message']="This is regular or lateral course so we can't do manual entry.";
}
}
else{
$arrayResultStudent['message']="This enrollment either don't registered in student course or set fees.please check to update details.";
$arrayResultStudent['status']=false;
}
return $arrayResultStudent;
}
/*
* add manual enrolment details
* cretaed by kms
* */
public function addManualEnrolmentDetails($studentInfo=null){
$this->db->select('ENU.FormID');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
$this->db->where('ENU.FormID', $studentInfo['FormID']);
$details = $this->db->get();
if($details->num_rows()==0){
$this->db->insert(ENROLMENTRECEIVEDFROMUNIV, $studentInfo);
if ($this->db->affected_rows() > 0) {
$resultArray['status']=true;
$resultArray['message']="Inserted successfully";
} else {
$resultArray['status']=false;
$resultArray['message']="Inserted failed";
}
}
else {
$resultArray['status']=false;
$resultArray['message']="This form id is already exist.";
}
return $resultArray;
}
// get formid draft mode list details
// kdk
public function getForFormIdDraftDetails($getUnivDetails){
$selectUniv = $getUnivDetails['univCode'];
$selectQuery = "SELECT * FROM T_FormId_FeeDetails_Received_From_University WHERE UniversityID = '$selectUniv' AND DraftStatus = 1";
$details = $this->db->query($selectQuery);
$detailsList = $details->result();
if($detailsList) {
$result['draftStatus'] = true;
$result['draftDetails'] = $detailsList;
$result['draftDetailsMessagae'] = "details generate successfully.";
} else {
$result['draftStatus'] = false;
$result['draftDetails'] = '';
$result['draftDetailsMessagae'] = "No Record Found.";
}
return $result;
}
// add formid manual details form the university and draftmode
// kdk
public function addForFormIdDraftDetails($details, $local, $univ =null){
$localBranchID = $local['localBranchID'];
$localUserID = $local['localUserID'];
$univId = $univ['univCode'];
$time = date('Y-m-d H:i:s');
$CreatedOn = $time;
$formIds = $details['FormID'];
$formType = $details['FormType'];
$CentreCode = $details['CentreCode'];
$Session = $details['Session'];
$Year = $details['Year'];
$Semester = $details['Semester'];
$Student_Name = $details['Student_Name'];
$Father_Name = $details['Father_Name'];
$CourseCode = $details['CourseCode'];
$ActualCourseFee = $details['ActualCourseFee'];
$CourseFee = $details['CourseFee'];
$ExamFee = $details['ExamFee'];
$EnrollmentFee = $details['EnrollmentFee'];
$ProspectusFee = $details['ProspectusFee'];
$ReRegFee = $details['ReRegFee'];
$CreditTransferFee = $details['CreditTransferFee'];
$LateralEntryFee = $details['LateralEntryFee'];
$DualSpclFee = $details['DualSpclFee'];
$OtherFee = $details['OtherFee'];
$NRIFEE = $details['NRIFEE'];
$ProvisionalFee = $details['ProvisionalFee'];
$MigrationFee = $details['MigrationFee'];
$UrgentResultDMCFee = $details['UrgentResultDMCFee'];
$AdditionalFee = $details['AdditionalFee'];
$Amount = $details['Amount'];
$selectQuery = "SELECT * FROM T_FormId_FeeDetails_Received_From_University WHERE
FormID = '$formIds' AND
FormType = '$formType' AND
CentreCode = '$CentreCode' AND
Session = '$Session' AND
Year = '$Year' AND
Semester = '$Semester' AND
Student_Name = '$Student_Name' AND
Father_Name = '$Father_Name' AND
CourseCode = '$CourseCode' AND
ActualCourseFee = '$ActualCourseFee' AND
CourseFee = '$CourseFee' AND
ExamFee = '$ExamFee' AND
EnrollmentFee = '$EnrollmentFee' AND
ProspectusFee = '$ProspectusFee' AND
ReRegFee = '$ReRegFee' AND
CreditTransferFee = '$CreditTransferFee' AND
LateralEntryFee = '$LateralEntryFee' AND
DualSpclFee = '$DualSpclFee' AND
OtherFee = '$OtherFee' AND
NRIFEE = '$NRIFEE' AND
ProvisionalFee = '$ProvisionalFee' AND
MigrationFee = '$MigrationFee' AND
UrgentResultDMCFee = '$UrgentResultDMCFee' AND
AdditionalFee = '$AdditionalFee' AND
Amount = '$Amount'";
$queryDetails = $this->db->query($selectQuery);
if(count($queryDetails->result()) == 0){
$query = "INSERT INTO T_FormId_FeeDetails_Received_From_University
(FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount, UniversityID, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus, AddToAccountStatus)
VALUES
( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$univId' , '$localUserID', '$CreatedOn', '$localBranchID' , 1, 1, 0)";
$queryDetails = $this->db->query($query);
if($queryDetails){
$result['draftStatus'] = true;
$result['draftDetailsMessagae'] = "Updated Successfully.";
}else{
$result['draftStatus'] = false;
$result['draftDetailsMessagae'] = "Something went wrong.";
}
} else {
$result['draftStatus'] = false;
$result['draftDetailsMessagae'] = "This record already exist.";
}
return $result;
}
// manual formid entry draft details move to the list details
// kdk
public function draftMovetoList($detail, $local){
// print_r($details);exit();
foreach($detail as $row) {
$ids = $row['ID'];
$updateQuery = 'UPDATE `T_FormId_FeeDetails_Received_From_University` SET `DraftStatus` = 0 WHERE `ID` = '.$ids;
$queryDetails = $this->db->query($updateQuery);
}
// $data = array(
// array(
// 'ID' => 1,
// 'FormType' => 'Hello'
// ),
// array(
// 'ID' => 2,
// 'FormType' => 'World'
// )
// );
// print_r($data);exit();
// $this->db->update('T_FormId_FeeDetails_Received_From_University', $data, 'ID');
// $detailsList = $details->result();
$result['draftStatus'] = true;
$result['draftDetailsMessagae'] = "Updated Successfully.";
return $result;
}
// edit draft mode formid manul entry details
// kdk
public function editDraftFormIdFeesDetails($reqBranch, $details, $detailsID){
$ids = $detailsID;
$formIds = $details['FormID'];
$formType = $details['FormType'];
$CentreCode = $details['CentreCode'];
$Session = $details['Session'];
$Year = $details['Year'];
$Semester = $details['Semester'];
$Student_Name = $details['Student_Name'];
$Father_Name = $details['Father_Name'];
$CourseCode = $details['CourseCode'];
$ActualCourseFee = $details['ActualCourseFee'];
$CourseFee = $details['CourseFee'];
$ExamFee = $details['ExamFee'];
$EnrollmentFee = $details['EnrollmentFee'];
$ProspectusFee = $details['ProspectusFee'];
$ReRegFee = $details['ReRegFee'];
$CreditTransferFee = $details['CreditTransferFee'];
$LateralEntryFee = $details['LateralEntryFee'];
$DualSpclFee = $details['DualSpclFee'];
$OtherFee = $details['OtherFee'];
$NRIFEE = $details['NRIFEE'];
$ProvisionalFee = $details['ProvisionalFee'];
$MigrationFee = $details['MigrationFee'];
$UrgentResultDMCFee = $details['UrgentResultDMCFee'];
$AdditionalFee = $details['AdditionalFee'];
$Amount = $details['Amount'];
$data = array(
'FormID' => $formIds ,
'FormType' => $formType ,
'CentreCode'=> $CentreCode,
'Session' =>$Session,
'Year' =>$Year,
'Semester' =>$Semester,
'Student_Name' =>$Student_Name ,
'Father_Name' =>$Father_Name,
'CourseCode' =>$CourseCode,
'ActualCourseFee' =>$ActualCourseFee,
'CourseFee' =>$CourseFee,
'ExamFee' =>$ExamFee,
'EnrollmentFee' =>$EnrollmentFee,
'ProspectusFee' =>$ProspectusFee,
'ReRegFee'=>$ReRegFee,
'CreditTransferFee' =>$CreditTransferFee,
'LateralEntryFee' =>$LateralEntryFee,
'DualSpclFee' =>$DualSpclFee,
'OtherFee' =>$OtherFee,
'NRIFEE' =>$NRIFEE ,
'ProvisionalFee' =>$ProvisionalFee,
'MigrationFee' =>$MigrationFee,
'UrgentResultDMCFee' =>$UrgentResultDMCFee,
'AdditionalFee' =>$AdditionalFee,
'Amount' => $Amount
);
$this->db->where('ID', $detailsID);
$this->db->update('T_FormId_FeeDetails_Received_From_University', $data);
// echo $this->db->affected_rows();exit();
if($this->db->affected_rows() > 0){
$result['updatedraftStatus'] = true;
$result['updatedraftDetailsMessagae'] = "Updated Successfully.";
}else{
$result['updatedraftStatus'] = false;
$result['updatedraftDetailsMessagae'] = "Something went wrong.";
}
return $result;
}
// get formid , fee details form the file upload for the university , course, student
// kdk
public function getStudentUnivFormIdFeeDatailsList($reqBranchData, $searchDetails){
$this->db->select('FUD.*, ST.MobileNumber, ST.StudentID, concat(ST.FirstName," ", ST.Lastname) as app_StudentName, IF(concat(ST.FirstName," " , ST.Lastname) = FUD.Student_Name, "YES", "NO") as StudentNameStatus ,
ST.Fathername as app_FatherName, IF(ST.Fathername = FUD.Father_Name, "YES", "NO") as FathernameStatus,
CM.CourseCode as app_CourseCode, IF(CM.CourseCode = FUD.CourseCode, "YES", "NO" ) as CourseCodeStatus,
IF(ENU.SemesterYear = FUD.Semester, "YES", "NO" ) as SemesterStatus');
$this->db->from('T_FormId_FeeDetails_Received_From_University as FUD');
$this->db->join(ENROLMENTRECEIVEDFROMUNIV.' as ENU', 'FUD.FormID = ENU.FormID' );
$this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo');
$this->db->join(COURSE.' as CM', 'CM.CourseID = STC.CourseID');
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID');
// $this->db->join(UNIVERSITY.' as UN', 'UN.UniversityID = STC.UniversityID');
if($searchDetails['University']!=''){
$this->db->where('ENU.UniversityCode',$searchDetails['University']);
}
if($searchDetails['Course']!=''){
$this->db->where('ENU.CourseCode',$searchDetails['Course']);
}
if($searchDetails['Sem']!=''){
$this->db->where('ENU.SemesterYear',$searchDetails['Sem']);
}
$this->db->where('FUD.DraftStatus',0);
$details = $this->db->get();
$detailsList = $details->result();
if($detailsList){
// foreach ($detailsList as $fetchStudentRow){
// // form id bases get student paid details
// $getStudentsetFeesDetails=$this->getStudentsetFeesDetails($fetchStudentRow->StudentID,$fetchStudentRow->CourseID,$fetchStudentRow->SemesterYear);
// if(isset($getStudentsetFeesDetails['status']) AND $getStudentsetFeesDetails['status']==true ){
// $formResult['SessionName']=$getStudentsetFeesDetails['SessionName'];
// $formResult['FormID']=$fetchStudentRow->FormID;
// $formResult['FormType']=$fetchStudentRow->FormType;
// $formResult['SemesterYear']=$fetchStudentRow->SemesterYear;
// $formResult['EnrolmentNo']=$fetchStudentRow->EnrolmentNo;
// $formResult['CourseCode']=$fetchStudentRow->CourseCode;
// $formResult['CourseName']=$fetchStudentRow->CourseName;
// $formResult['RollNo']=$fetchStudentRow->RollNo;
// $formResult['StudentID']=$fetchStudentRow->StudentID;
// $formResult['MobileNumber']=$fetchStudentRow->MobileNumber;
// $formResult['Firstname']=$fetchStudentRow->Firstname;
// $formResult['Lastname']=$fetchStudentRow->Lastname;
// $formResult['Fathername']=$fetchStudentRow->Fathername;
// $formResult['MotherName']=$fetchStudentRow->MotherName;
// $formResult['EmailID']=$fetchStudentRow->EmailID;
// $formResult['AlternateNumber']=$fetchStudentRow->AlternateNumber;
// $formResult['Gender']=$fetchStudentRow->Gender;
// $formResult['DOB']=$fetchStudentRow->DOB;
// $formResult['PresentAddress']=$fetchStudentRow->PresentAddress;
// $formResult['PermanentAddress']=$fetchStudentRow->PermanentAddress;
// $formResult['AadharNumber']=$fetchStudentRow->AadharNumber;
// $formResult['OtherID']=$fetchStudentRow->OtherID;
// $formResult['OtherIDDetails']=$fetchStudentRow->OtherIDDetails;
// $formResult['Qualification']=$fetchStudentRow->Qualification;
// $formResult['UniversityID']=$fetchStudentRow->UniversityID;
// $formResult['UniversityName']=$fetchStudentRow->UniversityName;
// $mergeFormDetails[]=$formResult;
// }
// }
$resultArr['studentFeeCompareDetails'] = $detailsList;
$resultArr['formTypeStatus'] = true;
$resultArr['message'] = "Successfully data generated";
} else {
$resultArr['studentFeeCompareDetails'] = [];
$resultArr['formTypeStatus'] = false;
$resultArr['message'] = "No record found";
}
return $resultArr;
}
// get formid status list for that particular record
// kdk
public function getFormIdDetailsStatusUpdateList($reqBranchData, $searchDetails){
$selectQuery = "SELECT t1.* , concat(t3.Firstname, '', t3.Lastname) as CreatedByName
FROM T_FormId_FeeDetails_Received_From_University_StatusUpdate as t1
LEFT JOIN T_Login as t2 ON t1.CreatedBy = t2.ID
LEFT JOIN T_StaffDetails as t3 ON t2.StaffID = t3.StaffID
WHERE FormIdDetailsID = '$searchDetails' ORDER BY t1.CreatedOn DESC ";
$details = $this->db->query($selectQuery);
$detailsList = $details->result();
if($detailsList) {
$result['formIdstatusListStatus'] = true;
$result['formIdstatusListDetails'] = $detailsList;
$result['formIdstatusListMessagae'] = "details generate successfully.";
} else {
$result['formIdstatusListStatus'] = false;
$result['formIdstatusListDetails'] = '';
$result['formIdstatusListMessagae'] = "No Record Found.";
}
return $result;
}
// add formid list file status list for that record
// kdk
public function insertStatusUpdateDetails($reqBranchData, $statusDetails, $id, $formId ){
$newLeadDetails['FormIdDetailsID'] = $id;
$newLeadDetails['FormID'] = $formId;
$newLeadDetails['Status'] = $statusDetails['Status'];
$newLeadDetails['Comments'] = $statusDetails['Comments'];
$time = date('Y-m-d H:i:s');
$newLeadDetails['CreatedOn'] = $time;
$newLeadDetails['CreatedBy'] = $reqBranchData['localUserID'];
$this->db->insert('T_FormId_FeeDetails_Received_From_University_StatusUpdate', $newLeadDetails);
// this if for insert lead details
if ($this->db->affected_rows() == '1') {
$result['insertStatusUpdateDetailsStatus'] = true;
$result['insertStatusUpdateDetailsMessagae'] = "Status Updated successfully.";
}else {
$result['insertStatusUpdateDetailsStatus'] = false;
$result['insertStatusUpdateDetailsMessagae'] = "Something went Wrong.";
}
return $result;
}
// get university list for search
// kdk
public function get_university_list($branch) {
$this->db->select('UniversityID, UniversityName');
$this->db->order_by('CreatedOn', 'DESC');
$this->db->from(UNIVERSITY);
$this->db->where('IsActive', 1);
$this->db->where('BranchCode', $branch);
$univDetails = $this->db->get();
$universityDetails = $univDetails->result();
if (count($universityDetails) > 0) {
$results['univList'] = true;
$results['university_details'] = $universityDetails;
} else {
$results['univList'] = false;
$results['message'] = 'No record found';
}
return $results;
}
// get unmatched records of the formid file details , compare with file 1
// kdk
public function getUnmatchedFormIdFeesDetails($localDetails, $getDetailsFor) {
$searchUniv = $getDetailsFor['univCode'];
// echo $searchUniv;exit();
$query = "select *
from T_FormId_FeeDetails_Received_From_University as t1
where t1.FormID NOT IN (select FormID from T_Enrolment_Received_From_University)
and t1.UniversityID ='$searchUniv'";
$details = $this->db->query($query);
$detailsList = $details->result();
if($detailsList){
$resultArr['unMatchedRecordDetails'] = $detailsList;
$resultArr['unMatchedRecordStatus'] = true;
$resultArr['unMatchedRecordFor'] = 'FormIDFile';
$resultArr['message'] = "Successfully data generated";
} else {
$resultArr['unMatchedRecordDetails'] = [];
$resultArr['unMatchedRecordStatus'] = false;
$resultArr['unMatchedRecordFor'] = 'FormIDFile';
$resultArr['message'] = "No record found";
}
return $resultArr;
}
// Add formid , university amount payment details to the account state
// kdk
public function addFormIdListToAccountState($localDetails, $getDetailsFor){
$localCreatedBy = $localDetails['localUserID'];
$time = date('Y-m-d H:i:s');
$localCreatedOn = $time;
foreach($getDetailsFor as $row) {
$ids = $row['ID'];
$query = "SELECT t1.ID, t1.FormID, t1.Amount, t2.ApprovedDate , t2.CreatedOn ,t2.UniversityCode, t2.UniversityName
from T_FormId_FeeDetails_Received_From_University as t1
LEFT JOIN T_Enrolment_Received_From_University as t2 ON t1.FormID = t2.FormID
WHERE t1.ID = '$ids'";
$details = $this->db->query($query);
$detailsList = $details->result();
if($detailsList){
$arr['FormMapID'] = $detailsList[0]->ID;
$arr['FormID'] = $detailsList[0]->FormID;
$arr['CreditAmount'] = $detailsList[0]->Amount;
$ApprovedDate = date('y-m-d',strtotime($detailsList[0]->ApprovedDate));
$CreatedOn = date('y-m-d',strtotime($detailsList[0]->CreatedOn));
$arr['ApprovedDate'] = $ApprovedDate ? $ApprovedDate : $CreatedOn;
$arr['TypeID'] = 1;
$arr['TypeName'] = 'Credit';
$arr['UniversityCode'] = $detailsList[0]->UniversityCode;
$arr['UniversityName'] = $detailsList[0]->UniversityName;
$arr['CreatedOn'] = $localCreatedOn;
$arr['CreatedBy'] = $localCreatedBy;
$this->db->insert('T_University_Credit_Debit', $arr);
if ($this->db->affected_rows() >= 1) {
$updateQuery = 'UPDATE `T_FormId_FeeDetails_Received_From_University` SET `AddToAccountStatus` = 1 WHERE `ID` = '.$ids;
$queryDetails = $this->db->query($updateQuery);
if ($this->db->affected_rows() == '1') {
$result['accountStateMoveStatus'] = true;
$result['accountStateMoveMessagae'] = "Updated Successfully.";
} else {
$result['accountStateMoveStatus'] = false;
$result['accountStateMoveMessagae'] = "Something went wrong.";
}
} else {
$result['accountStateMoveStatus'] = false;
$result['accountStateMoveMessagae'] = "Something went wrong.";
}
} else {
$result['accountStateMoveStatus'] = false;
$result['accountStateMoveMessagae'] = "Something went wrong.";
}
}
return $result;
}
// public function getUnmatchedFormDetails($reqType){
// // $this->db->select('t1.*');
// // $this->db->from('T_Enrolment_Received_From_University as t1');
// // $this->db->join('T_Student_CourseDetails as t2', 't2.EnrollmentID = t1.EnrolmentNo');
// if($reqType == 'EnrolmentIDFile'){
// $query = "select *
// from T_Enrolment_Received_From_University as t1
// where t1.EnrolmentNo NOT IN (select EnrollmentID from T_Student_CourseDetails)";
// $details = $this->db->query($query);
// $detailsList = $details->result();
// if($detailsList){
// $resultArr['unMatchedRecordDetails'] = $detailsList;
// $resultArr['unMatchedRecordStatus'] = true;
// $resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile';
// $resultArr['message'] = "Successfully data generated";
// } else {
// $resultArr['unMatchedRecordDetails'] = [];
// $resultArr['unMatchedRecordStatus'] = false;
// $resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile';
// $resultArr['message'] = "No record found";
// }
// }else if($reqType == 'FormIDFile'){
// $query = "select *
// from T_FormId_FeeDetails_Received_From_University as t1
// where t1.FormID NOT IN (select FormID from T_Enrolment_Received_From_University)";
// $details = $this->db->query($query);
// $detailsList = $details->result();
// if($detailsList){
// $resultArr['unMatchedRecordDetails'] = $detailsList;
// $resultArr['unMatchedRecordStatus'] = true;
// $resultArr['unMatchedRecordFor'] = 'FormIDFile';
// $resultArr['message'] = "Successfully data generated";
// } else {
// $resultArr['unMatchedRecordDetails'] = [];
// $resultArr['unMatchedRecordStatus'] = false;
// $resultArr['unMatchedRecordFor'] = 'FormIDFile';
// $resultArr['message'] = "No record found";
// }
// }
// return $resultArr;
// }
/*
* get payment verification details
* created by kms
* */
public function getPaymentVerificationDetails($search){
$this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,DATE_FORMAT(UNCD.ApprovedDate, "%d-%m-%Y") as FormatDate,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID,UNP.Amount,UNP.ReceiptNo,UNP.Remarks,ST.MobileNumber');
$this->db->from(UNIVERSITYCREDITDEBIY.' as UNCD');
$this->db->join(FORMFEESRECEIVEDFROMUNIV.' as UNFR', 'UNFR.ID = UNCD.FormMapID','left');
$this->db->join(UNIVERSITYPAYMENT.' as UNP', 'UNP.PID = UNCD.PaymentMapID','left');
$this->db->join(ENROLMENTRECEIVEDFROMUNIV.' as ENU', 'ENU.FormID = UNFR.FormID','left');
$this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo','left');
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID','left');
$this->db->order_by('UNCD.ApprovedDate','ASC');
$this->db->where('UNCD.UniversityCode',$search['UniversityCode']);
$this->db->order_by('UNCD.UniversityName',$search['UniversityName']);
$details = $this->db->get();
$resultArray=array();
if($details->result()){
$resultArray['status']=true;
$resultArray['details']=$details->result();
}
else{
$resultArray['status']=false;
$resultArray['details']="No list were found";
}
return $resultArray;
}
/*
* add payment details
* created by kms
* */
public function addPaymentDetails($fromDetails=null){
$resultArray=array();
$this->db->select('UNP.BillNo');
$this->db->from(UNIVERSITYPAYMENT.' as UNP');
$this->db->where('UNP.BillNo', $fromDetails['BillNo']);
$billExist = $this->db->get();
if($billExist->num_rows()<=0){
if($fromDetails['ReceiptNo']!='' AND $fromDetails['ReceiptNo']!=null){
$this->db->select('UNP1.ReceiptNo');
$this->db->from(UNIVERSITYPAYMENT.' as UNP1');
$this->db->where('UNP1.ReceiptNo', $fromDetails['ReceiptNo']);
$receiptExist = $this->db->get();
if($receiptExist->num_rows()<=0){
$this->db->insert(UNIVERSITYPAYMENT, $fromDetails);
if ($this->db->affected_rows() > 0) {
$updateDebitTable['PaymentMapID']=$this->db->insert_id();
$updateDebitTable['DebitAmount']=$fromDetails['Amount'];
$updateDebitTable['ApprovedDate']=$fromDetails['ApprovedDate'];
$updateDebitTable['TypeID']=0;
$updateDebitTable['TypeName']="Debit";
$updateDebitTable['UniversityCode']=$fromDetails['UniversityCode'];
$updateDebitTable['UniversityName']=$fromDetails['UniversityName'];
$updateDebitTable['BranchCode']=$fromDetails['BranchCode'];
$updateDebitTable['CreatedBy']=$fromDetails['CreatedBy'];
$updateDebitTable['CreatedOn']=$fromDetails['CreatedOn'];
$this->db->insert(UNIVERSITYCREDITDEBIY, $updateDebitTable);
if ($this->db->affected_rows() > 0) {
$resultArray['status']=true;
$resultArray['message']="Payment added successfully";
}
else{
$this->db->delete(UNIVERSITYPAYMENT);
$this->db->where('PID',$updateDebitTable['PaymentMapID']);
$resultArray['status']=false;
$resultArray['message']="Payment failed.try again";
}
} else {
$resultArray['status']=false;
$resultArray['message']="Payment failed.Try again";
}
}
else{
$resultArray['status']=false;
$resultArray['message']="Receipt no is already exist..";
}
}
else{
$this->db->insert(UNIVERSITYPAYMENT, $fromDetails);
if ($this->db->affected_rows() > 0) {
$updateDebitTable['PaymentMapID']=$this->db->insert_id();
$updateDebitTable['DebitAmount']=$fromDetails['Amount'];
$updateDebitTable['ApprovedDate']=$fromDetails['ApprovedDate'];
$updateDebitTable['TypeID']=0;
$updateDebitTable['TypeName']="Debit";
$updateDebitTable['UniversityCode']=$fromDetails['UniversityCode'];
$updateDebitTable['UniversityName']=$fromDetails['UniversityName'];
$updateDebitTable['BranchCode']=$fromDetails['BranchCode'];
$updateDebitTable['CreatedBy']=$fromDetails['CreatedBy'];
$updateDebitTable['CreatedOn']=$fromDetails['CreatedOn'];
$this->db->insert(UNIVERSITYCREDITDEBIY, $updateDebitTable);
if ($this->db->affected_rows() > 0) {
$resultArray['status']=true;
$resultArray['message']="Payment added successfully";
}
else{
$this->db->delete(UNIVERSITYPAYMENT);
$this->db->where('PID',$updateDebitTable['PaymentMapID']);
$resultArray['status']=false;
$resultArray['message']="Payment failed.try again";
}
} else {
$resultArray['status']=false;
$resultArray['message']="Payment failed.Try again";
}
}
}
else {
$resultArray['status']=false;
$resultArray['message']="Bill no is already exist..";
}
return $resultArray;
}
/*
* update payment details
* created by kms
* */
public function updatePaymentDetails($update=null,$payment=null,$debit=null){
$resultArray=array();
$this->db->where('UNP.BillNo', $payment['BillNo']);
$this->db->where('UNP.PID != ', $update['PaymentID']);
$this->db->select('UNP.BillNo');
$this->db->from(UNIVERSITYPAYMENT.' as UNP');
$billExist = $this->db->get();
if($billExist->num_rows()<=0){
if($payment['ReceiptNo']!='' AND $payment['ReceiptNo']!=null){
$this->db->where('UNP1.ReceiptNo', $payment['ReceiptNo']);
$this->db->where('UNP1.PID != ', $update['PaymentID']);
$this->db->select('UNP1.ReceiptNo');
$this->db->from(UNIVERSITYPAYMENT.' as UNP1');
$receiptExist = $this->db->get();
if($receiptExist->num_rows()<=0){
$this->db->where('PID', $update['PaymentID']);
$this->db->update(UNIVERSITYPAYMENT, $payment);
if ($this->db->affected_rows() > 0) {
$this->db->where('ID', $update['ID']);
$this->db->update(UNIVERSITYCREDITDEBIY, $debit);
if ($this->db->affected_rows() > 0) {
$resultArray['status']=true;
$resultArray['message']="Payment update successfully";
}
else{
$resultArray['status']=false;
$resultArray['message']="Payment update failed.try again";
}
} else {
$resultArray['status']=false;
$resultArray['message']="Payment failed.Try again";
}
}
else{
$resultArray['status']=false;
$resultArray['message']="Receipt no is already exist..";
}
}
else{
$this->db->where('PID', $update['PaymentID']);
$this->db->update(UNIVERSITYPAYMENT, $payment);
if ($this->db->affected_rows() > 0) {
$this->db->where('ID', $update['ID']);
$this->db->update(UNIVERSITYCREDITDEBIY, $debit);
if ($this->db->affected_rows() > 0) {
$resultArray['status']=true;
$resultArray['message']="Payment update successfully";
}
else{
$resultArray['status']=false;
$resultArray['message']="Payment update failed.try again";
}
} else {
$resultArray['status']=false;
$resultArray['message']="Payment failed.Try again";
}
}
}
else {
$resultArray['status']=false;
$resultArray['message']="Bill no is already exist..";
}
return $resultArray;
}
}