This commit is contained in:
dineshkumarkannan 2018-08-31 18:33:01 +05:30
commit 9bbb12891f
2 changed files with 167 additions and 34 deletions

View File

@ -27,6 +27,7 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
$get_data=array(); $get_data=array();
// loop for fetch details // loop for fetch details
foreach ($enrolment as $k => $checkRow){ foreach ($enrolment as $k => $checkRow){
// check enrolment no and form id in upload list // check enrolment no and form id in upload list
if(array_key_exists("Enrollment_No",$checkRow) AND array_key_exists("Form Id",$checkRow)){ if(array_key_exists("Enrollment_No",$checkRow) AND array_key_exists("Form Id",$checkRow)){
// start // start
@ -277,31 +278,61 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
} }
} }
// check form id exit in table for insert / update if(sizeof($get_data)>0) {
$formIDData = $this->db->select('FormID')->order_by('SubmitID','ASC')->get(ENROLMENTRECEIVEDFROMUNIV)->result_array(); // 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(); $form_ids = array();
$insertForms=array(); $insertForms = array();
$updateForms=array(); $updateForms = array();
foreach($formIDData as $fkey => $fvalue): foreach ($formIDData as $fkey => $fvalue):
$matchedKey=array_search($fvalue['FormID'], array_column($get_data, 'FormID')); if(sizeof($get_data)>0){
if(count($matchedKey)>0){
$updateForms[count($updateForms)]=$get_data[$matchedKey]; $matchedKey = array_search($fvalue['FormID'], array_column($get_data, 'FormID'));
// $form_ids[]=$fvalue['FormID']; if ($matchedKey!='') {
array_splice($get_data,$matchedKey,1); // $updateForms[count($updateForms)] = $get_data[$matchedKey];
// $form_ids[]=$fvalue['FormID'];
array_splice($get_data, 0, 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'] = "Insert failed please check data.";
$finalArray['insertedRows'] = $this->db->affected_rows();
$finalArray['details'] = $errorArray;
return $finalArray;
}
} else {
$finalArray['status'] = false;
$finalArray['message'] = "Updated Successfully.";;
$finalArray['details'] = $errorArray;
} }
endforeach; /* if(count($updateForms)>0){
//$this->db->where_in('FormID',$form_ids);
if(count($get_data)>0){ $this->db->update_batch(ENROLMENTRECEIVEDFROMUNIV, $updateForms,'FormID');
$this->db->insert_batch(ENROLMENTRECEIVEDFROMUNIV, $get_data); }*/
} }
/* if(count($updateForms)>0){ else{
//$this->db->where_in('FormID',$form_ids); $finalArray['status'] = false;
$this->db->update_batch(ENROLMENTRECEIVEDFROMUNIV, $updateForms,'FormID'); $finalArray['message'] = "Insert failed please check data.";
}*/ $finalArray['insertedRows'] = $this->db->affected_rows();
$finalArray['status']=true; $finalArray['details'] = $errorArray;
$finalArray['details']=$errorArray; return $finalArray;
}
return $finalArray; return $finalArray;
} }
@ -423,21 +454,57 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
} }
public function getStudentUnivFeeCompareDetails($univCode=null,$courseCode=null){ public function getStudentUnivFeeCompareDetails($univCode=null,$courseCode=null){
// echo $univID, $courseID;exit(); $this->db->select('t1.FormID, t1.FormType, t1.SemesterYear, t1.EnrolmentNo,t1.CourseName,t1.RollNo, t4.*,t5.UniversityID, t5.UniversityName,t3.CourseID,t2.Amount as UniversityPaidAmount');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as t1');
$this->db->select('t1.FormID, t1.FormType, t2.SemesterYear, t2.EnrolmentNo,t2.CourseName,t2.RollNo, t4.*,t5.UniversityID, t5.UniversityName'); $this->db->join(STUDENTCOURSE.' as t3', 't3.EnrollmentID = t1.EnrolmentNo');
$this->db->from('T_FormId_FeeDetails_Received_From_University as t1'); $this->db->join(STUDENTS.' as t4', 't4.StudentID = t3.StudentID');
$this->db->join('T_Enrolment_Received_From_University as t2', 't2.FormID = t1.FormID'); $this->db->join(UNIVERSITY.' as t5', 't5.UniversityID = t3.UniversityID');
$this->db->join('T_Student_CourseDetails as t3', 't3.EnrollmentID = t2.EnrolmentNo'); $this->db->join(FORMFEESRECEIVEDFROMUNIV.' as t2', 't2.FormID = t1.FormID','left');
$this->db->join('T_StudentDetails as t4', 't4.StudentID = t3.StudentID'); $this->db->where('t1.CourseCode', $courseCode);
$this->db->join('T_UniversityMaster as t5', 't5.UniversityID = t3.UniversityID'); $this->db->where('t1.UniversityCode', $univCode);
$this->db->where('t2.CourseCode', $courseCode);
$this->db->where('t2.UniversityCode', $univCode);
$details = $this->db->get(); $details = $this->db->get();
$detailsList = $details->result(); $detailsList = $details->result();
if($detailsList){ if($detailsList){
$resultArr['studentFeeCompareDetails'] = $detailsList; foreach ($detailsList as $fetchStudentRow){
$formResult['FormID']=$fetchStudentRow->FormID;
$formResult['FormType']=$fetchStudentRow->FormType;
$formResult['SemesterYear']=$fetchStudentRow->SemesterYear;
$formResult['EnrolmentNo']=$fetchStudentRow->EnrolmentNo;
$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;
$formResult['UniversityPaidAmount']=$fetchStudentRow->UniversityPaidAmount;
// form id bases get student paid details
$getStudentPaidDetails=$this->getFormIDStudentPaidDetails($fetchStudentRow->StudentID,$fetchStudentRow->CourseID,$fetchStudentRow->SemesterYear);
if(sizeof($getStudentPaidDetails)!=0){
$formResult['StudentPaidAmount']=$getStudentPaidDetails['StudentPaidAmount'];
}
else{
$formResult['StudentPaidAmount']='';
}
$mergeFormDetails[]=$formResult;
}
$resultArr['studentFeeCompareDetails'] = $mergeFormDetails;
$resultArr['formTypeStatus'] = true; $resultArr['formTypeStatus'] = true;
$resultArr['message'] = "Successfully data generated"; $resultArr['message'] = "Successfully data generated";
} else { } else {
@ -447,6 +514,64 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
} }
return $resultArr; return $resultArr;
} }
/*form id bases get student paid details for getStudentUnivFeeCompareDetails methods*/
public function getFormIDStudentPaidDetails($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("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS . ' as SFS');
$this->db->join(STUDENTS_FEES_PAID . ' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType', $fetchRow->ID);
$this->db->where('SFS.StudentID', $studentID);
$this->db->where('SFP.IsActive', '1');
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['StudentPaidAmount'] = $feesDetails->StudentPaidAmount;
break;
} else {
$feesArray['StudentPaidAmount'] = 0;
break;
}
}
}
}
else if($courseFeesDetails->num_rows()==1){
foreach ($courseFeesDetails->result() as $fetchRow){
$this->db->select("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$studentID);
$this->db->where('SFP.IsActive','1');
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['StudentPaidAmount'] = $feesDetails->StudentPaidAmount;
break;
} else {
$feesArray['StudentPaidAmount'] = 0;
break;
}
}
}
else{
$feesArray['StudentPaidAmount'] = 0;
}
return $feesArray;
}
/* /*
* form id bases get fees compare details * form id bases get fees compare details
* created by kms * created by kms
@ -497,6 +622,7 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
} }
} }
else if($studentCourseDetails->num_rows()==1){ else if($studentCourseDetails->num_rows()==1){
foreach ($studentCourseDetails->result() as $fetchRow){ foreach ($studentCourseDetails->result() as $fetchRow){

View File

@ -178,6 +178,13 @@ from
left join T_PickListDetails p on p.ListCode = app.ListCode left join T_PickListDetails p on p.ListCode = app.ListCode
left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID
where CertificateName not like 'APPLICATION%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType) where CertificateName not like 'APPLICATION%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType)
group by app.ID
union
SELECT app.ID,app.StudentID as sid,app.CourseID as cid,app.BranchCode as branch,app.ListCode as lcode,p.ListName as status,AppDate as adate,app.Comments as acmts,CertificationType as ctype,app.CertificationType as certname,sum(bal.balpayable) as balance
FROM T_ApplicationStatus as app
left join T_PickListDetails p on p.ListCode = app.ListCode
left join BalFees bal on bal.student=app.StudentID and bal.course=app.CourseID
where app.CertificationType not like 'CERT%' and app.ID IN (SELECT max(ID) FROM T_ApplicationStatus group by StudentID,CourseID,ListCode,BranchCode,CertificationType)
group by app.ID) as sms group by app.ID) as sms
left join left join
(SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others (SELECT FeesID as fid,BatchCode as batch,StudentID as sid,CourseID as cid,FeesType as ftype,sum(CourseFees) as cf,Sum(STFOrWR) as stf,sum(Others) as others
@ -258,7 +265,7 @@ left join BalFees bal on bal.student=c.StudentID and bal.course=sfs.CourseID and
where CDate is not null and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' ) where CDate is not null and (list.ListName like 'ISSUED TO STUDENT' or list.ListName like 'RECEIVED%' )
group by sid,cid,sem,ctype group by sid,cid,sem,ctype
union union
select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,cm.CertificateName as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance, select a.ID,a.StudentID as sid,a.CourseID as cid,sfs.BranchCode as branch,sfs.FeesID as fid,'-' as sem,ifnull(cm.CertificateName,a.CertificationType) as certname,a.CertificationType as ctype,AppDate as mdate,bal.balpayable as balance,
max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus, max(if(ListName = 'ISSUED TO STUDENT', AppDate,'-')) as issuedate,max(if(ListName = 'ISSUED TO STUDENT', ListName,'-')) as istatus,
max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts max(if(ListName = 'RECEIVED', AppDate,'-')) as rcvedate,max(if(ListName = 'RECEIVED', ListName,'-')) as rstatus,a.Comments as acmts
from T_ApplicationStatus a from T_ApplicationStatus a