MERGE_TRUNCATE_ISSUE&EXCEL_ERR_VIEW_ISSUE
This commit is contained in:
commit
fc81f6b3b4
@ -17,7 +17,7 @@ $routes->get('/logout', 'LoginController::logout');
|
|||||||
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||||
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
||||||
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||||
$routes->get('download-e-card/(:segment)/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1/$2');
|
$routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -280,3 +280,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
|||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Ticketing System
|
||||||
|
|
||||||
|
// Ticketing System End's
|
||||||
|
|||||||
@ -21,4 +21,7 @@ class DashboardController extends AdminController
|
|||||||
echo view('DashBoard');
|
echo view('DashBoard');
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use CodeIgniter\HTTP\ResponseInterface;
|
|||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
use App\Helpers\DepositHelper;
|
use App\Helpers\DepositHelper;
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
@ -644,7 +645,10 @@ class EmpDataServiceController extends BaseController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$this->cashDepositCalculationForInception($depositeData);
|
$this->cashDepositCalculationForInception($depositeData);
|
||||||
|
|
||||||
|
|
||||||
|
$this->sendMailForDownloadingECard($empty_emp_tpa_uh_ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1586,4 +1590,69 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function sendMailForDownloadingECard(array $ids)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
|
||||||
|
$get_emp_email_and_other_details = $this->employeePolicyModel
|
||||||
|
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
||||||
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->where('employees.is_active', '1')
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.is_active', '1')
|
||||||
|
->where('employee_polices.id', $id)->first();
|
||||||
|
|
||||||
|
if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "") {
|
||||||
|
|
||||||
|
$name = $get_emp_email_and_other_details['name'];
|
||||||
|
$email = $get_emp_email_and_other_details['email_corporate'];
|
||||||
|
$rand_string = $get_emp_email_and_other_details['rand_string'];
|
||||||
|
$tpa_id = $get_emp_email_and_other_details['tpa_id'];
|
||||||
|
$link = generate_download_link($rand_string);
|
||||||
|
$subject = 'Download E-Card';
|
||||||
|
|
||||||
|
$html = '<body>
|
||||||
|
<p>Dear ' .$name .',</p>
|
||||||
|
<p>Your Policy( ' .$tpa_id .' ) has been successfully created. Please click the link below to download the insurance card:</p>
|
||||||
|
<p><a href="'.$link.'">Download Insurance Card</a></p>
|
||||||
|
<p>Thank you,</p>
|
||||||
|
</body>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($email != null && $email != "") {
|
||||||
|
|
||||||
|
$mail_data = [
|
||||||
|
'mail' => $email,
|
||||||
|
'subject' => $subject,
|
||||||
|
'message' => $html
|
||||||
|
];
|
||||||
|
|
||||||
|
// dd($mail_data);
|
||||||
|
|
||||||
|
$result = Mailhelper::send_email($mail_data);
|
||||||
|
$decoded_result = (array) json_decode($result);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'status' => $decoded_result['status'],
|
||||||
|
'message'=>$decoded_result['message'] ?? 'Internal Server Error',
|
||||||
|
'email' => $decoded_result['data']
|
||||||
|
];
|
||||||
|
|
||||||
|
// dd($data);
|
||||||
|
$this->myLogger->logme('error', 'status : {status}, message : {message}, email : {email}', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true; // Email(s) sent successfully
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Log the error
|
||||||
|
$this->myLogger->log('error', 'Error occurred while sending email: ' . $e->getMessage());
|
||||||
|
return false; // Email(s) sending failed
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -249,13 +249,13 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
$file_id = $this->request->uri->getSegment(3);
|
$file_id = $this->request->uri->getSegment(3);
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
$result['file_id'] = $file_id;
|
|
||||||
|
|
||||||
// Render views and capture output
|
// Render views and capture output
|
||||||
$result = $empServiceController->getExcelErrorData($file_id);
|
$result = $empServiceController->getExcelErrorData($file_id);
|
||||||
|
|
||||||
if ($result != 0) {
|
if ($result != 0) {
|
||||||
|
|
||||||
|
$result['file_id'] = $file_id;
|
||||||
echo view('excel_errors', $result);
|
echo view('excel_errors', $result);
|
||||||
} else if ($result == 0) {
|
} else if ($result == 0) {
|
||||||
|
|
||||||
@ -723,206 +723,170 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function downloadFullExcelErrorFile($file_id = 137, $rowIndex = 1, $colIndex = 1)
|
public function downloadFullExcelErrorFile($file_id, $rowIndex = 1, $colIndex = 1)
|
||||||
{
|
{
|
||||||
// Get file data from the database
|
// Get file data from the database
|
||||||
$file_data = $this->fileModel->find($file_id);
|
$file_data = $this->fileModel->find($file_id);
|
||||||
|
|
||||||
$error = json_decode($file_data['reason']);
|
$error = json_decode($file_data['reason']);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($error); die;
|
// print_r($error); die;
|
||||||
// dd($error);
|
// dd($error);
|
||||||
|
|
||||||
// Check if the file exists
|
|
||||||
if (!$file_data) {
|
|
||||||
$error_message = "File not found";
|
|
||||||
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
|
|
||||||
return $error_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fileName = $file_data['file_name'];
|
|
||||||
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
|
|
||||||
|
|
||||||
// Check if the file exists
|
|
||||||
if (!file_exists($filePath)) {
|
|
||||||
$error_message = "File not found";
|
|
||||||
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
|
|
||||||
return $error_message;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the Excel file
|
|
||||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
|
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
|
|
||||||
foreach ($error->error_data as $index => $error_data) {
|
|
||||||
|
|
||||||
$rowIndex = $index+1;
|
|
||||||
|
|
||||||
if( $error->error_type == 1 ){
|
|
||||||
|
|
||||||
foreach ($error_data as $key => $value) {
|
|
||||||
|
|
||||||
$colIndex = $value->col_idx+1;
|
|
||||||
|
|
||||||
$originalValue = $sheet->getCell([$colIndex, $rowIndex])->getValue();
|
|
||||||
|
|
||||||
$newValue = implode(', ',$value->error);
|
// Check if the file exists
|
||||||
$val = $originalValue . ' ( ' . $newValue . ' )';
|
if (!$file_data) {
|
||||||
$sheet->setCellValue([$colIndex, $rowIndex], $val);
|
$error_message = "File not found";
|
||||||
|
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
|
||||||
$style = [
|
return $error_message;
|
||||||
'fill' => [
|
|
||||||
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
|
||||||
'startColor' => ['rgb' => 'ffad99'] // Red color
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
|
|
||||||
|
|
||||||
}
|
|
||||||
}else if( $error->error_type == 2){
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($error_data as $key => $value) {
|
|
||||||
|
|
||||||
|
|
||||||
$originalValue = $sheet->getCell([1, $rowIndex])->getValue();
|
|
||||||
|
|
||||||
$newValue = implode(', ',$value->error);
|
|
||||||
$val = $originalValue . ' ( ' . $newValue . ' )';
|
|
||||||
$sheet->setCellValue([$colIndex, $rowIndex], $val);
|
|
||||||
|
|
||||||
$style = [
|
|
||||||
'fill' => [
|
|
||||||
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
|
||||||
'startColor' => ['rgb' => 'ffad99'] // Red color
|
|
||||||
]
|
|
||||||
];
|
|
||||||
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fileName = $file_data['file_name'];
|
||||||
|
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
|
||||||
|
|
||||||
|
// Check if the file exists
|
||||||
|
if (!file_exists($filePath)) {
|
||||||
|
$error_message = "File not found";
|
||||||
|
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
|
||||||
|
return $error_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the Excel file
|
||||||
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
}
|
// echo '<pre>';
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($error->error_data as $index => $error_data) {
|
||||||
// Create a new filename for the modified Excel file
|
|
||||||
$newFileName = 'modified_' . $fileName;
|
$rowIndex = $index+1;
|
||||||
|
|
||||||
// Save the modified Excel file to a new location
|
if( $error->error_type == 1 ){
|
||||||
$newFilePath = WRITEPATH . '/uploads/excel/' . $newFileName;
|
|
||||||
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
|
foreach ($error_data as $key => $value) {
|
||||||
$writer->save($newFilePath);
|
|
||||||
|
$colIndex = $value->col_idx+1;
|
||||||
// Set headers to force download
|
|
||||||
$response = service('response');
|
$originalValue = $sheet->getCell([$colIndex, $rowIndex])->getValue();
|
||||||
$response->setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
||||||
$response->setHeader('Content-Disposition', 'attachment;filename="' . $newFileName . '"');
|
$newValue = implode(', ',$value->error);
|
||||||
$response->setHeader('Cache-Control', 'max-age=0');
|
$val = $originalValue . ' ( ' . $newValue . ' )';
|
||||||
$response->setHeader('Content-Length', filesize($newFilePath));
|
$sheet->setCellValue([$colIndex, $rowIndex], $val);
|
||||||
$response->setBody(file_get_contents($newFilePath));
|
|
||||||
|
$style = [
|
||||||
// Delete the temporary file
|
'fill' => [
|
||||||
unlink($newFilePath);
|
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
|
'startColor' => ['rgb' => 'ffad99'] // Red color
|
||||||
// Return the response
|
]
|
||||||
return $response;
|
];
|
||||||
|
|
||||||
|
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
|
||||||
|
|
||||||
|
}
|
||||||
|
}else if( $error->error_type == 2){
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($error_data as $key => $value) {
|
||||||
|
|
||||||
|
|
||||||
|
$originalValue = $sheet->getCell([1, $rowIndex])->getValue();
|
||||||
|
|
||||||
|
$newValue = implode(', ',$value->error);
|
||||||
|
$val = $originalValue . ' ( ' . $newValue . ' )';
|
||||||
|
$sheet->setCellValue([$colIndex, $rowIndex], $val);
|
||||||
|
|
||||||
|
$style = [
|
||||||
|
'fill' => [
|
||||||
|
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
||||||
|
'startColor' => ['rgb' => 'ffad99'] // Red color
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Create a new filename for the modified Excel file
|
||||||
|
$newFileName = 'error_with_highlight_' . $fileName;
|
||||||
|
|
||||||
|
// Save the modified Excel file to a new location
|
||||||
|
$newFilePath = WRITEPATH . '/uploads/excel/' . $newFileName;
|
||||||
|
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
|
||||||
|
$writer->save($newFilePath);
|
||||||
|
|
||||||
|
// Set headers to force download
|
||||||
|
$response = service('response');
|
||||||
|
$response->setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
|
$response->setHeader('Content-Disposition', 'attachment;filename="' . $newFileName . '"');
|
||||||
|
$response->setHeader('Cache-Control', 'max-age=0');
|
||||||
|
$response->setHeader('Content-Length', filesize($newFilePath));
|
||||||
|
$response->setBody(file_get_contents($newFilePath));
|
||||||
|
|
||||||
|
// Delete the temporary file
|
||||||
|
unlink($newFilePath);
|
||||||
|
|
||||||
|
// Return the response
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateIDCardForEmployee($emp_code, $client_policy_id)
|
public function generateIDCardForEmployee($rand_string)
|
||||||
{
|
{
|
||||||
$dompdf = new Dompdf();
|
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
|
||||||
|
->select('employee_polices.client_policy_id, employees.emp_code')
|
||||||
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->where('employees.is_active', '1')
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.is_active', '1')
|
||||||
|
->where('employee_polices.rand_string', $rand_string)->first();
|
||||||
|
|
||||||
|
if($get_emp_code_and_client_policy_id == null || $get_emp_code_and_client_policy_id == ""){
|
||||||
|
|
||||||
|
$data['message'] = 'Record Not Found';
|
||||||
|
return view('errors/404', $data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
||||||
|
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
||||||
|
|
||||||
$data['data'] = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
$data['data'] = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
||||||
// $this->loadLayout('id_card_view', $data); exit;
|
// $this->loadLayout('id_card_view', $data);exit;
|
||||||
|
|
||||||
$html = view('id_card_view', $data);
|
$html = view('id_card_view', $data);
|
||||||
// $html = str_replace('<body>', '<body style="text-align: center;">', $html);
|
|
||||||
|
|
||||||
|
$dompdf = new Dompdf();
|
||||||
$dompdf->loadHtml($html);
|
$dompdf->loadHtml($html);
|
||||||
|
|
||||||
// (Optional) Setup the paper size and orientation
|
|
||||||
$dompdf->setPaper('A4', 'landscape');
|
$dompdf->setPaper('A4', 'landscape');
|
||||||
|
|
||||||
// Render the HTML as PDF
|
|
||||||
$dompdf->render();
|
$dompdf->render();
|
||||||
|
|
||||||
// Output the generated PDF to Browser
|
$filename = 'ECard.pdf'; // Default filename
|
||||||
$dompdf->stream();
|
|
||||||
|
foreach ($data['data'] as $key => $value) {
|
||||||
|
|
||||||
|
if ($value['relationship'] == "Self") {
|
||||||
|
|
||||||
|
$filename = $value['tpa_id']; // Update filename if relationship is "Self"
|
||||||
|
|
||||||
|
} elseif (!empty($value['tpa_id']) && $filename == 'ECard.pdf') {
|
||||||
|
|
||||||
|
$filename = $value['tpa_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dompdf->stream($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewECard()
|
public function viewECard()
|
||||||
{
|
{
|
||||||
$this->loadLayout('id_card_view');
|
|
||||||
|
$this->loadLayout('id_card_view');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function truncateFileData() //truncateFileDataIn DB (de activate rows)
|
|
||||||
{
|
|
||||||
$file_id = $this->request->uri->getSegment(3);
|
|
||||||
// $file_id = 112;
|
|
||||||
$file = $this->fileModel->find($file_id);
|
|
||||||
// $file['action'] = 'si_enhancement';
|
|
||||||
// $result = [];
|
|
||||||
// !dd($file);
|
|
||||||
if($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition')
|
|
||||||
{
|
|
||||||
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id,emp_status: ['active'],policy_status:['active']);
|
|
||||||
// ~dd($result);
|
|
||||||
if(count($result))
|
|
||||||
{
|
|
||||||
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'File data already processed'], 200);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
//update emp and emp plocies
|
|
||||||
$db = db_connect();
|
|
||||||
$query = "UPDATE employees JOIN employee_polices ON employees.id = employee_polices.employee_id and employees.file_id = $file_id SET employees.emp_status = 'truncated', employee_polices.status = 'truncated', employees.is_active = 0,employee_polices.is_active = 0 WHERE employees.file_id = $file_id";
|
|
||||||
$db->query($query);
|
|
||||||
$affectedRows = $db->affectedRows();
|
|
||||||
// $affectedRows = 10;
|
|
||||||
|
|
||||||
//update file status
|
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true,'code' => 200,'data' => round($affectedRows/2)], 200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion')
|
|
||||||
{
|
|
||||||
$res = $this->empEndorsementModel->select(['count(id) as count'])
|
|
||||||
->where('emp_endorsement.file_id',$file_id)
|
|
||||||
->groupStart()
|
|
||||||
->where('emp_endorsement.endorsement_id is not null')
|
|
||||||
->orwhereIn('emp_endorsement.status',['complete'])
|
|
||||||
->groupEnd()
|
|
||||||
->get()
|
|
||||||
->getResult();
|
|
||||||
// print_r($this->empEndorsementModel->getLastQuery());
|
|
||||||
// echo $res[0]->count;die();
|
|
||||||
if($res[0]->count == 0)
|
|
||||||
{
|
|
||||||
//update truncated status to db
|
|
||||||
$this->empEndorsementModel->where('file_id',$file_id)
|
|
||||||
->set(['status' => 'truncated'])
|
|
||||||
->update();
|
|
||||||
//update file status
|
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
|
||||||
return $this->respond(['dataStatus' => true,'code' => 200,'data' => 'success'], 200);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'File data already processed'], 200);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -77,11 +77,11 @@ class RestAuthenticationController extends AdminController
|
|||||||
if ($employeeData) {
|
if ($employeeData) {
|
||||||
$id= $employeeData["id"];
|
$id= $employeeData["id"];
|
||||||
$otp = $this->employeeModel->where('id', $id)->set('otp', $randomNumber)->update();
|
$otp = $this->employeeModel->where('id', $id)->set('otp', $randomNumber)->update();
|
||||||
$result = ['user_verification' => true , 'otp'=>$randomNumber];
|
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false];
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
@ -118,7 +118,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
$result = JWTToken::encode($employeeData);
|
$result = JWTToken::encode($employeeData);
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||||
@ -136,11 +136,11 @@ class RestAuthenticationController extends AdminController
|
|||||||
if ($HrData) {
|
if ($HrData) {
|
||||||
$id= $HrData["id"];
|
$id= $HrData["id"];
|
||||||
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
|
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
|
||||||
$result = ['user_verification' => true , 'otp'=>$randomNumber];
|
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false];
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
@ -180,7 +180,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
$result = JWTToken::encode($hrData['0']);
|
$result = JWTToken::encode($hrData['0']);
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||||
|
|||||||
@ -340,6 +340,8 @@ if (!function_exists('name_and_empid_check_in_db'))
|
|||||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||||
// ->where("cp.id",$policy_id)
|
// ->where("cp.id",$policy_id)
|
||||||
->where("employees.client_id",$client_id)
|
->where("employees.client_id",$client_id)
|
||||||
|
->where("employees.is_active",1)
|
||||||
|
->where("ep.is_active",1)
|
||||||
// ->where("ep.client_id",$client_id)
|
// ->where("ep.client_id",$client_id)
|
||||||
->where('name',$row[2])->where('emp_code',$row[1])
|
->where('name',$row[2])->where('emp_code',$row[1])
|
||||||
->findAll();
|
->findAll();
|
||||||
@ -634,6 +636,8 @@ if (!function_exists('transform_excel_data_to_db'))
|
|||||||
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
|
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
|
||||||
$result['temp']['emp_id'] = isset($memArr['temp']['emp_id']) ? $memArr['temp']['emp_id'] : null;
|
$result['temp']['emp_id'] = isset($memArr['temp']['emp_id']) ? $memArr['temp']['emp_id'] : null;
|
||||||
$result['temp']['emp_policy_id'] = isset($memArr['temp']['emp_policy_id']) ? $memArr['temp']['emp_policy_id'] : null;
|
$result['temp']['emp_policy_id'] = isset($memArr['temp']['emp_policy_id']) ? $memArr['temp']['emp_policy_id'] : null;
|
||||||
|
$result['temp']['policy_status'] = isset($memArr['temp']['policy_status']) ? $memArr['temp']['policy_status'] : null;
|
||||||
|
$result['temp']['emp_status'] = isset($memArr['temp']['emp_status']) ? $memArr['temp']['emp_status'] : null;
|
||||||
$result['policy_details'] = $policy;
|
$result['policy_details'] = $policy;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -650,6 +654,20 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
// grid type
|
// grid type
|
||||||
// 1 = premium => si
|
// 1 = premium => si
|
||||||
// dd($emp_data);
|
// dd($emp_data);
|
||||||
|
|
||||||
|
//check if the data comes from enrollment (DB) and status is draft then fetch original data of employee from
|
||||||
|
//audit history table then initiate calculation with it. so this data again get updated in emp and policy table
|
||||||
|
|
||||||
|
// if($emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
|
||||||
|
// {
|
||||||
|
// $original_emp_records = get_emp_records_from_audit_history($emp_data['temp']['emp_id']);
|
||||||
|
// if(is_array($original_emp_records))
|
||||||
|
// {
|
||||||
|
// print_r($original_emp_records);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//end of fetching data from audit history table
|
||||||
|
//gird and calculation start
|
||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||||
|
|
||||||
@ -1004,6 +1022,8 @@ if (!function_exists('transform_db_data_to_excel'))
|
|||||||
$row['temp']['source'] = 'db';
|
$row['temp']['source'] = 'db';
|
||||||
$row['temp']['emp_id'] = $value['emp_id'];
|
$row['temp']['emp_id'] = $value['emp_id'];
|
||||||
$row['temp']['emp_policy_id'] = $value['emp_policy_id'];
|
$row['temp']['emp_policy_id'] = $value['emp_policy_id'];
|
||||||
|
$row['temp']['emp_status'] = $value['emp_status'];
|
||||||
|
$row['temp']['policy_status'] = $value['status'];
|
||||||
|
|
||||||
array_push($return_data, ($row));
|
array_push($return_data, ($row));
|
||||||
}
|
}
|
||||||
@ -1028,4 +1048,26 @@ if (!function_exists('compare_excel_cell_range'))
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('get_emp_records_from_audit_history'))
|
||||||
|
{
|
||||||
|
function get_emp_records_from_audit_history($employee_id)
|
||||||
|
{
|
||||||
|
$db = db_connect();
|
||||||
|
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM venbaehn_nhance.auditing_history where pk = $employee_id and table_name = 'employees'group by field_name order by id asc";
|
||||||
|
$res = $db->query($query);
|
||||||
|
// echo $db->getLastQuery();
|
||||||
|
$res = $res->getResultArray();
|
||||||
|
if(count($res))
|
||||||
|
{ $temp = [];
|
||||||
|
foreach($res as $row)
|
||||||
|
{
|
||||||
|
$temp[ $row['field_name'] ] = $row['old_value'];
|
||||||
|
}
|
||||||
|
return $temp;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -132,5 +132,41 @@ if(!function_exists('check_string_date'))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('generate_download_link')) {
|
||||||
|
|
||||||
|
function generate_download_link($rand_string) {
|
||||||
|
|
||||||
|
// Generate the link using provided emp_code and client_policy_id
|
||||||
|
$link = htmlspecialchars(base_url('download-e-card/' . $rand_string));
|
||||||
|
|
||||||
|
// Return the link wrapped in anchor tag
|
||||||
|
// return '<a href="' . $link . '" target="_blank">Click To </a>';
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('generate_random_alphanumeric')) {
|
||||||
|
function generate_random_alphanumeric($length = 6) {
|
||||||
|
$random_string = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$random_ascii = rand(0, 61);
|
||||||
|
if ($random_ascii < 10) {
|
||||||
|
$random_character = chr($random_ascii + 48);
|
||||||
|
} elseif ($random_ascii < 36) {
|
||||||
|
$random_character = chr($random_ascii + 55);
|
||||||
|
} else {
|
||||||
|
$random_character = chr($random_ascii + 61);
|
||||||
|
}
|
||||||
|
$random_string .= $random_character;
|
||||||
|
}
|
||||||
|
return $random_string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -81,7 +81,7 @@ class EmployeeModel extends Model
|
|||||||
return $this->where('emp_code',$arr['emp_code'])
|
return $this->where('emp_code',$arr['emp_code'])
|
||||||
->where('name',$arr['name'])
|
->where('name',$arr['name'])
|
||||||
->where('client_id',$arr['client_id'])
|
->where('client_id',$arr['client_id'])
|
||||||
// ->where('relationship_code',$arr['relationship_code'])
|
->where('is_active',1)
|
||||||
->where('gender',$arr['gender'])
|
->where('gender',$arr['gender'])
|
||||||
->where('dob',$arr['dob'])
|
->where('dob',$arr['dob'])
|
||||||
->find();
|
->find();
|
||||||
|
|||||||
@ -30,12 +30,13 @@ class EmployeePolicyModel extends Model
|
|||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
|
"rand_string",
|
||||||
"is_active",
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
protected $allowCallbacks = true;
|
protected $allowCallbacks = true;
|
||||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
protected $beforeInsert = ["checkAndADDCreatedByValue", "addRandomNumberBeforeInsert"];
|
||||||
protected $afterInsert = [];
|
protected $afterInsert = [];
|
||||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
protected $afterUpdate = [];
|
protected $afterUpdate = [];
|
||||||
@ -66,6 +67,14 @@ class EmployeePolicyModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function addRandomNumberBeforeInsert(array $data)
|
||||||
|
{
|
||||||
|
$random_number = generate_random_alphanumeric();
|
||||||
|
$data['data']['rand_string'] = $random_number;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id,$status)
|
public function getEmployeePolicy($client_id,$policy_id,$status)
|
||||||
{
|
{
|
||||||
@ -100,6 +109,7 @@ class EmployeePolicyModel extends Model
|
|||||||
{
|
{
|
||||||
return $this->where('employee_id',$arr['employee_id'])
|
return $this->where('employee_id',$arr['employee_id'])
|
||||||
->where('client_policy_id',$arr['client_policy_id'])
|
->where('client_policy_id',$arr['client_policy_id'])
|
||||||
|
->where('is_active',1)
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,66 +185,66 @@ class EmployeePolicyModel extends Model
|
|||||||
public function getCorrectionEmployeesDataForExportExcel($ref_data)
|
public function getCorrectionEmployeesDataForExportExcel($ref_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$client_id = $ref_data['client_id'];
|
$client_id = $ref_data['client_id'];
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
emp_endorsement.id,
|
emp_endorsement.id,
|
||||||
emp_endorsement.pk,
|
emp_endorsement.pk,
|
||||||
emp_endorsement.emp_code,
|
emp_endorsement.emp_code,
|
||||||
emp_endorsement.endorsement_id,
|
emp_endorsement.endorsement_id,
|
||||||
emp_endorsement.old_value,
|
emp_endorsement.old_value,
|
||||||
emp_endorsement.new_value,
|
emp_endorsement.new_value,
|
||||||
emp_endorsement.field_name,
|
emp_endorsement.field_name,
|
||||||
emp_endorsement.remarks,
|
emp_endorsement.remarks,
|
||||||
emp_endorsement.actions,
|
emp_endorsement.actions,
|
||||||
employees.id AS primaryKey,
|
employees.id AS primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.dob AS emp_dob,
|
employees.dob AS emp_dob,
|
||||||
employees.gender AS emp_gender,
|
employees.gender AS emp_gender,
|
||||||
employees.client_id AS emp_client_id,
|
employees.client_id AS emp_client_id,
|
||||||
'Has Define' AS emp_type,
|
'Has Define' AS emp_type,
|
||||||
employee_polices.uhid,
|
employee_polices.uhid,
|
||||||
employees.relationship_code,
|
employees.relationship_code,
|
||||||
batch_data.emp_policy_id,
|
batch_data.emp_policy_id,
|
||||||
batch_data.bl AS batch_list_batch_code,
|
batch_data.bl AS batch_list_batch_code,
|
||||||
batch_data.bf AS batch_files_batch_code
|
batch_data.bf AS batch_files_batch_code
|
||||||
|
|
||||||
FROM
|
|
||||||
emp_endorsement
|
|
||||||
LEFT JOIN
|
|
||||||
employees ON employees.id = emp_endorsement.pk
|
|
||||||
LEFT JOIN
|
|
||||||
employee_polices ON employees.id = employee_polices.employee_id
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT batch_list.emp_policy_id,
|
|
||||||
batch_list.batch_code AS bl,
|
|
||||||
batch_files.batch_code AS bf
|
|
||||||
FROM
|
FROM
|
||||||
batch_files
|
emp_endorsement
|
||||||
|
LEFT JOIN
|
||||||
|
employees ON employees.id = emp_endorsement.pk
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
employee_polices ON employees.id = employee_polices.employee_id
|
||||||
WHERE batch_files.event_type = 'correction'
|
LEFT JOIN (
|
||||||
AND batch_files.actions = 'export'
|
SELECT batch_list.emp_policy_id,
|
||||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
batch_list.batch_code AS bl,
|
||||||
) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id
|
batch_files.batch_code AS bf
|
||||||
|
FROM
|
||||||
|
batch_files
|
||||||
|
LEFT JOIN
|
||||||
|
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||||
|
WHERE batch_files.event_type = 'correction'
|
||||||
|
AND batch_files.actions = 'export'
|
||||||
|
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||||
|
) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id
|
||||||
|
|
||||||
WHERE batch_data.bf IS NULL
|
WHERE batch_data.bf IS NULL
|
||||||
AND batch_data.bl IS NULL
|
AND batch_data.bl IS NULL
|
||||||
AND employees.client_id = '{$client_id}'
|
AND employees.client_id = '{$client_id}'
|
||||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
AND emp_endorsement.actions = 'c'
|
AND emp_endorsement.actions = 'c'
|
||||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||||
|
|
||||||
// Execute the raw query
|
// Execute the raw query
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
// Get the result set
|
// Get the result set
|
||||||
$result = $query->getResult();
|
$result = $query->getResult();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,106 +252,106 @@ class EmployeePolicyModel extends Model
|
|||||||
public function getSIEnhancementEmployeesDataForExportExcel($ref_data)
|
public function getSIEnhancementEmployeesDataForExportExcel($ref_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$client_id = $ref_data['client_id'];
|
$client_id = $ref_data['client_id'];
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
|
||||||
a.id as endorsement_primarykey,
|
|
||||||
employee_polices.id AS primaryKey,
|
|
||||||
employees.name AS emp_name,
|
|
||||||
employees.emp_code AS emp_code,
|
|
||||||
employees.dob AS emp_dob,
|
|
||||||
employees.gender AS emp_gender,
|
|
||||||
employees.relationship_code AS emp_relationship_code,
|
|
||||||
'Has Define' AS emp_type,
|
|
||||||
employee_polices.uhid AS risk_id,
|
|
||||||
employee_polices.pre_existing_alignments,
|
|
||||||
employee_polices.policy_end_date,
|
|
||||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
|
||||||
employee_polices.rata_premimum as old_si_premium,
|
|
||||||
batch_data.emp_policy_id,
|
|
||||||
batch_data.bl AS batch_list_batch_code,
|
|
||||||
batch_data.bf AS batch_files_batch_code,
|
|
||||||
sidata.new_basic_cover_si,
|
|
||||||
sidata.new_si_premium,
|
|
||||||
sidata.date_of_coverage,
|
|
||||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
|
||||||
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
|
||||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
|
||||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
|
||||||
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
|
||||||
|
|
||||||
FROM
|
|
||||||
emp_endorsement a
|
|
||||||
LEFT JOIN
|
|
||||||
employees ON employees.emp_code = a.emp_code
|
|
||||||
LEFT JOIN
|
|
||||||
employee_polices ON employees.id = employee_polices.employee_id
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
SELECT
|
||||||
aa.emp_code,
|
a.id as endorsement_primarykey,
|
||||||
aa.new_value as 'new_basic_cover_si',
|
employee_polices.id AS primaryKey,
|
||||||
bb.new_value as 'new_si_premium',
|
employees.name AS emp_name,
|
||||||
cc.new_value as 'date_of_coverage'
|
employees.emp_code AS emp_code,
|
||||||
FROM (
|
employees.dob AS emp_dob,
|
||||||
SELECT
|
employees.gender AS emp_gender,
|
||||||
a1.emp_code,
|
employees.relationship_code AS emp_relationship_code,
|
||||||
a1.field_name,
|
'Has Define' AS emp_type,
|
||||||
a1.new_value
|
employee_polices.uhid AS risk_id,
|
||||||
FROM
|
employee_polices.pre_existing_alignments,
|
||||||
emp_endorsement as a1
|
employee_polices.policy_end_date,
|
||||||
WHERE
|
employee_polices.basic_cover_si as old_basic_cover_si,
|
||||||
a1.field_name = 'basic_cover_si'
|
employee_polices.rata_premimum as old_si_premium,
|
||||||
) aa
|
batch_data.emp_policy_id,
|
||||||
LEFT JOIN (
|
batch_data.bl AS batch_list_batch_code,
|
||||||
SELECT
|
batch_data.bf AS batch_files_batch_code,
|
||||||
b1.emp_code,
|
sidata.new_basic_cover_si,
|
||||||
b1.field_name,
|
sidata.new_si_premium,
|
||||||
b1.new_value
|
sidata.date_of_coverage,
|
||||||
FROM
|
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||||
emp_endorsement as b1
|
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||||
WHERE
|
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||||
b1.field_name = 'premium'
|
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||||
) bb ON aa.emp_code = bb.emp_code
|
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
c1.emp_code,
|
|
||||||
c1.field_name,
|
|
||||||
c1.new_value
|
|
||||||
FROM
|
|
||||||
emp_endorsement as c1
|
|
||||||
WHERE
|
|
||||||
c1.field_name = 'si_enhancement_date'
|
|
||||||
) cc ON aa.emp_code = cc.emp_code
|
|
||||||
) as sidata ON a.emp_code = sidata.emp_code
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT DISTINCT
|
|
||||||
batch_list.emp_policy_id,
|
|
||||||
batch_list.batch_code AS bl,
|
|
||||||
batch_files.batch_code AS bf
|
|
||||||
FROM
|
|
||||||
batch_files
|
|
||||||
LEFT JOIN
|
|
||||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
|
||||||
WHERE
|
|
||||||
batch_files.event_type = 'si_enhancement'
|
|
||||||
AND batch_files.actions = 'export'
|
|
||||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
|
||||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
|
||||||
WHERE
|
|
||||||
batch_data.bf IS NULL
|
|
||||||
AND batch_data.bl IS NULL
|
|
||||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
|
||||||
AND employee_polices.is_active = '1'
|
|
||||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
|
||||||
AND a.field_name = 'si_enhancement_date'
|
|
||||||
");
|
|
||||||
|
|
||||||
// Get the result set
|
FROM
|
||||||
$results = $query->getResult();
|
emp_endorsement a
|
||||||
return $results;
|
LEFT JOIN
|
||||||
|
employees ON employees.emp_code = a.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
employee_polices ON employees.id = employee_polices.employee_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
aa.emp_code,
|
||||||
|
aa.new_value as 'new_basic_cover_si',
|
||||||
|
bb.new_value as 'new_si_premium',
|
||||||
|
cc.new_value as 'date_of_coverage'
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
a1.emp_code,
|
||||||
|
a1.field_name,
|
||||||
|
a1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement as a1
|
||||||
|
WHERE
|
||||||
|
a1.field_name = 'basic_cover_si'
|
||||||
|
) aa
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
b1.emp_code,
|
||||||
|
b1.field_name,
|
||||||
|
b1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement as b1
|
||||||
|
WHERE
|
||||||
|
b1.field_name = 'premium'
|
||||||
|
) bb ON aa.emp_code = bb.emp_code
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
c1.emp_code,
|
||||||
|
c1.field_name,
|
||||||
|
c1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement as c1
|
||||||
|
WHERE
|
||||||
|
c1.field_name = 'si_enhancement_date'
|
||||||
|
) cc ON aa.emp_code = cc.emp_code
|
||||||
|
) as sidata ON a.emp_code = sidata.emp_code
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT
|
||||||
|
batch_list.emp_policy_id,
|
||||||
|
batch_list.batch_code AS bl,
|
||||||
|
batch_files.batch_code AS bf
|
||||||
|
FROM
|
||||||
|
batch_files
|
||||||
|
LEFT JOIN
|
||||||
|
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||||
|
WHERE
|
||||||
|
batch_files.event_type = 'si_enhancement'
|
||||||
|
AND batch_files.actions = 'export'
|
||||||
|
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||||
|
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||||
|
WHERE
|
||||||
|
batch_data.bf IS NULL
|
||||||
|
AND batch_data.bl IS NULL
|
||||||
|
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
|
AND employee_polices.is_active = '1'
|
||||||
|
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||||
|
AND a.field_name = 'si_enhancement_date'
|
||||||
|
");
|
||||||
|
|
||||||
|
// Get the result set
|
||||||
|
$results = $query->getResult();
|
||||||
|
return $results;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,12 +747,14 @@ class EmployeePolicyModel extends Model
|
|||||||
->where('e.is_active', '1')
|
->where('e.is_active', '1')
|
||||||
->where('ep.status', 'active')
|
->where('ep.status', 'active')
|
||||||
->where('ep.is_active', '1')
|
->where('ep.is_active', '1')
|
||||||
->where('MD5(e.emp_code)', $emp_code)
|
->where('e.emp_code', $emp_code)
|
||||||
->where('MD5(ep.client_policy_id)', $client_policy_id)
|
->where('ep.client_policy_id', $client_policy_id)
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,9 +2,15 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<title>NHANCE</title>
|
||||||
<title>Driving License ID Card</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta content="A fully featured CRM" name="description" />
|
||||||
|
<meta content="Venba info tech" name="author" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
|
||||||
|
<!-- App favicon -->
|
||||||
|
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -66,15 +72,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<br>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php if(!isset($data)) { ?>
|
|
||||||
<a href="<?= htmlspecialchars(base_url('util/digital-id-card/'.md5('EMP004').'/'.md5('12'))) ?>"
|
|
||||||
target="_blank">button</a>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@ -602,7 +602,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#">
|
<?php
|
||||||
|
$sessionData = get_session_userdata();
|
||||||
|
$currentUrl = base_url();
|
||||||
|
$parsedUrl = parse_url($currentUrl);
|
||||||
|
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||||
|
$redirectUrl = $baseUrl . 'nhanceTicket/staff/login_done?' . http_build_query(['token' => $sessionData]);
|
||||||
|
?>
|
||||||
|
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||||
<i class="mdi mdi-lifebuoy"></i>
|
<i class="mdi mdi-lifebuoy"></i>
|
||||||
<span> Tickets </span>
|
<span> Tickets </span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user