Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
f8e247a710
@ -207,6 +207,7 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
|
|||||||
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||||
$routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
|
$routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
|
||||||
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
||||||
|
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
|
||||||
$routes->post("import-export", "EmployeeController::importExport");
|
$routes->post("import-export", "EmployeeController::importExport");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -162,9 +162,17 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForCorrection($export_data)
|
public function generateExcelForCorrection($export_data)
|
||||||
{
|
{
|
||||||
|
$ids = [];
|
||||||
|
|
||||||
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data);
|
||||||
// dd($objects);
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($objects); die;
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
||||||
@ -201,6 +209,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if($return){
|
if($return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -228,9 +244,15 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForSIEnhancement($export_data)
|
public function generateExcelForSIEnhancement($export_data)
|
||||||
{
|
{
|
||||||
|
$ids = [];
|
||||||
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
||||||
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->endorsement_primarykey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($ids); die;
|
||||||
// dd($objects);
|
// dd($objects);
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
@ -280,6 +302,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if($return){
|
if($return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -306,8 +335,18 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForDeletion($export_data)
|
public function generateExcelForDeletion($export_data)
|
||||||
{
|
{
|
||||||
// dd($export_data['client_id']);
|
$ids = [];
|
||||||
|
|
||||||
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
|
||||||
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->endorsement_primarykey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($ids);
|
||||||
|
// print_r($objects); die;
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
|
|
||||||
@ -351,6 +390,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if( $return){
|
if( $return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -560,7 +606,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
||||||
|
|
||||||
$queryData = $this->empEndorsementModel->select('emp_endorsement.*')
|
$queryData = $this->empEndorsementModel->select('emp_endorsement.*, employees.id as emp_id')
|
||||||
->join('employees', 'employees.id = emp_endorsement.pk')
|
->join('employees', 'employees.id = emp_endorsement.pk')
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
@ -578,7 +624,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
$emp_id = $endorsementData['emp_id'];
|
$emp_id = $endorsementData['emp_id'];
|
||||||
$field_name = $endorsementData['field_name'];
|
$field_name = $endorsementData['field_name'];
|
||||||
$new_value = $endorsementData['new_value'];
|
$new_value = $endorsementData['new_value'];
|
||||||
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set('endorsement_id', $endorsement_id)->update();
|
$endoresment_udate_data = [
|
||||||
|
'endorsement_id' => $endorsement_id,
|
||||||
|
'status' => 'complete',
|
||||||
|
];
|
||||||
|
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set($endoresment_udate_data)->update();
|
||||||
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
|
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +667,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$import_data['created_by'] = get_session_userid();
|
$import_data['created_by'] = get_session_userid();
|
||||||
$import_data['file_name'] = $filename;
|
$import_data['file_name'] = $filename;
|
||||||
$insert = $this->batchFileModel->insert($import_data);
|
$insert = $this->batchFileModel->insert($import_data);
|
||||||
$batch_file_batch_code = $this->batchFileModel->where('id', 2)->first();
|
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||||
|
|
||||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||||
@ -725,8 +775,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->cashDepositCalculationForSIEnhancement($depositeData);
|
$this->cashDepositCalculationForSIEnhancement($depositeData);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -801,18 +849,18 @@ class EmpDataServiceController extends BaseController
|
|||||||
array_push($employeeIds, $id);
|
array_push($employeeIds, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateData = [
|
// $updateData = [
|
||||||
'emp_code' =>$emp_code,
|
// 'emp_code' =>$emp_code,
|
||||||
'client_id' =>$client_id,
|
// 'client_id' =>$client_id,
|
||||||
'client_policy_id' =>$client_policy_id,
|
// 'client_policy_id' =>$client_policy_id,
|
||||||
'emp_name' =>$emp_name,
|
// 'emp_name' =>$emp_name,
|
||||||
'endorsement_id' =>$endorsement_id,
|
// 'endorsement_id' =>$endorsement_id,
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$this->employeePolicyModel->updateEndoresmentIdForDeletion($updateData);
|
// $this->employeePolicyModel->updateEndoresmentIdForDeletion($updateData);
|
||||||
|
|
||||||
$deletionDataForEmployee = $this->empEndorsementModel
|
$deletionDataForEmployee = $this->empEndorsementModel
|
||||||
->select('emp_endorsement.new_value, employees.id')
|
->select('emp_endorsement.new_value, emp_endorsement.id as ee_id, employees.id')
|
||||||
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
|
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('emp_endorsement.emp_code', $emp_code)
|
->where('emp_endorsement.emp_code', $emp_code)
|
||||||
@ -825,6 +873,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$deletionDataForEmployee['updated_by'] = get_session_userid();
|
$deletionDataForEmployee['updated_by'] = get_session_userid();
|
||||||
$this->employeeModel->save($deletionDataForEmployee);
|
$this->employeeModel->save($deletionDataForEmployee);
|
||||||
|
|
||||||
|
$e_Data = [
|
||||||
|
'endorsement_id'=> $endorsement_id,
|
||||||
|
'status'=> 'complete',
|
||||||
|
];
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $deletionDataForEmployee['ee_id'])->first();
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set($e_Data)->update();
|
||||||
|
|
||||||
$fetchData = [
|
$fetchData = [
|
||||||
'emp_code'=> $emp_code,
|
'emp_code'=> $emp_code,
|
||||||
'client_policy_id'=> $client_policy_id,
|
'client_policy_id'=> $client_policy_id,
|
||||||
@ -835,11 +890,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
|
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
|
||||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($deletionDataForEmployeePolicy); die;
|
|
||||||
|
|
||||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
|
||||||
|
|
||||||
// $query = $this->employeePolicyModel->getLastQuery();
|
// $query = $this->employeePolicyModel->getLastQuery();
|
||||||
// echo $query . "<br>";
|
// echo $query . "<br>";
|
||||||
|
|
||||||
@ -918,6 +968,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||||
{
|
{
|
||||||
if (!empty($arrayData)) {
|
if (!empty($arrayData)) {
|
||||||
@ -954,13 +1005,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function cashDepositCalculationForDeletion($arrayData)
|
public function cashDepositCalculationForDeletion($arrayData)
|
||||||
{
|
{
|
||||||
// print_r($arrayData);
|
// print_r($arrayData);
|
||||||
if (!empty($arrayData)) {
|
if (!empty($arrayData)) {
|
||||||
|
|
||||||
echo '<pre>';
|
// echo '<pre>';
|
||||||
print_r($arrayData); die;
|
// print_r($arrayData); die;
|
||||||
$amount = $this->employeePolicyModel->query("
|
$amount = $this->employeePolicyModel->query("
|
||||||
SELECT
|
SELECT
|
||||||
SUM(ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, employee_polices.date_of_exit)) / 365, 2) +
|
SUM(ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, employee_polices.date_of_exit)) / 365, 2) +
|
||||||
@ -968,7 +1020,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
FROM employee_polices
|
FROM employee_polices
|
||||||
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||||
")->getRow();
|
")->getRow();
|
||||||
print_r($amount);die;
|
|
||||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||||
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||||
|
|
||||||
@ -996,11 +1048,175 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyNameUsingClientPolicyId($client_policy_id){
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function retrieves the policy name associated with a given client policy ID.
|
||||||
|
*
|
||||||
|
* @param int $client_policy_id The ID of the client policy.
|
||||||
|
* @return mixed Returns the policy name if found, otherwise null.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getPolicyNameUsingClientPolicyId($client_policy_id)
|
||||||
|
{
|
||||||
return $this->clientPolicyModel->select('policies.name as policy_name')
|
return $this->clientPolicyModel->select('policies.name as policy_name')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->where('client_policy.id', $client_policy_id)
|
->where('client_policy.id', $client_policy_id)
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function converts row data into column data format for SI enhancement.
|
||||||
|
*
|
||||||
|
* This function takes an array of data containing information about SI enhancement
|
||||||
|
* and calculates additional fields such as pro rata premium, GST, and total.
|
||||||
|
*
|
||||||
|
* @param array $data The array of data containing SI enhancement information.
|
||||||
|
* @return array Returns the converted data in column format.
|
||||||
|
*/
|
||||||
|
public function convertRowTColumnForSIEnhancement($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($data as $obj) {
|
||||||
|
|
||||||
|
$pro_rata_premium = round(($obj->difference_premium * $obj->no_of_days / 365), 2);
|
||||||
|
$gst = round(($pro_rata_premium * 18 / 100), 2);
|
||||||
|
$total = round(($pro_rata_premium + $gst), 2);
|
||||||
|
|
||||||
|
$old_total = round(($obj->old_rata + $obj->old_gst), 2);
|
||||||
|
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Basic Cover SI',
|
||||||
|
"old_value" => $obj->old_basic_cover_si,
|
||||||
|
"new_value" => $obj->new_basic_cover_si
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Premium',
|
||||||
|
"old_value" => $obj->old_si_premium,
|
||||||
|
"new_value" => $obj->new_si_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'SI Enhancement Date',
|
||||||
|
"old_value" => change_date_format($obj->old_date, 'Y-m-d', 'd-M-Y'),
|
||||||
|
"new_value" => change_date_format($obj->date_of_coverage, 'Y-m-d', 'd-M-Y')
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Difference Premium',
|
||||||
|
"old_value" => ' --- ',
|
||||||
|
"new_value" => $obj->difference_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'No of Days',
|
||||||
|
"old_value" => $obj->old_days,
|
||||||
|
"new_value" => $obj->no_of_days
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Pro Rata Premium',
|
||||||
|
"old_value" => $obj->old_rata,
|
||||||
|
"new_value" => $pro_rata_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'GST(18%)',
|
||||||
|
"old_value" => $obj->old_gst,
|
||||||
|
"new_value" => $gst
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Total',
|
||||||
|
"old_value" => $old_total,
|
||||||
|
"new_value" => $total
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function converts row data into column data format for deletion records.
|
||||||
|
*
|
||||||
|
* This function takes an array of data containing information about deletion records
|
||||||
|
* and converts it into a column format. It also calculates additional fields such as
|
||||||
|
* period of non-coverage, premium for non-coverage period, GST, total amount, and
|
||||||
|
* claim status based on the exist_reason field.
|
||||||
|
*
|
||||||
|
* @param array $data The array of data containing deletion records information.
|
||||||
|
* @return array Returns the converted data in column format.
|
||||||
|
*/
|
||||||
|
public function convertRowTColumnForDeletion($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($data as $obj) {
|
||||||
|
|
||||||
|
$old_total = round(($obj->old_rata + $obj->old_gst), 2);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Policy Period',
|
||||||
|
"data" => change_date_format($obj->start_date, 'Y-m-d', 'd-M-Y') . ' - <br> ' . change_date_format($obj->end_date, 'Y-m-d', 'd-M-Y'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Exit on',
|
||||||
|
"data" => change_date_format($obj->date_of_leaving, 'Y-m-d', 'd-M-Y'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Reason',
|
||||||
|
"data" => $obj->exist_reason,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($obj->exist_reason != 'death'){
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Period of non coverage',
|
||||||
|
"data" => $obj->no_of_days
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Premium for non coverage period',
|
||||||
|
"data" => $obj->pro_rata_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'GST(18%)',
|
||||||
|
"data" => $obj->gst
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Total Amount',
|
||||||
|
"data" => $obj->total
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Claim',
|
||||||
|
"data" => '---',
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,10 +61,12 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
// $model = new UserModel();
|
// $model = new UserModel();
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
||||||
if(count($this->request->getGet()))
|
if(count($this->request->getGet()))
|
||||||
{
|
{
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'],policy_id: $filterData['policy_id']);
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'],policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||||
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error','list called');
|
$this->myLogger->logme('error','list called');
|
||||||
@ -452,16 +454,91 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
public function endorsementList(){
|
|
||||||
|
/**
|
||||||
|
* Below function displays the endorsement list page.
|
||||||
|
*
|
||||||
|
* This method retrieves filter data from the request and fetches the endorsement list
|
||||||
|
* based on the provided filters such as client ID, policy ID, and status.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function endorsementList()
|
||||||
|
{
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete'=>'Complete'];
|
||||||
if(count($this->request->getGet()))
|
if(count($this->request->getGet()))
|
||||||
{
|
{
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'],policy_id: $filterData['policy_id']);
|
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'],policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||||
$data['getData'] = $filterData;
|
$data['getData'] = $filterData;
|
||||||
|
// echo "<pre>";
|
||||||
|
// print_r($data); die;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error','list called');
|
$this->myLogger->logme('error','list called');
|
||||||
$this->loadLayout('endorsement_list',$data);
|
$this->loadLayout('endorsement_list',$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beleo function retrieves employee endorsement (emp_endorsement table) data.
|
||||||
|
*
|
||||||
|
* This method fetches endorsement data based on the provided ID.
|
||||||
|
* It determines the type of endorsement action (SI enhancement, deletion, or other),
|
||||||
|
* formats the data accordingly, and returns it as a response.
|
||||||
|
*
|
||||||
|
* @param int|null $id The ID of the endorsement entry to retrieve.
|
||||||
|
* @return \CodeIgniter\HTTP\Response Returns a JSON response containing the endorsement entry data.
|
||||||
|
*/
|
||||||
|
public function getEmpEndoresmentEntry($id = null)
|
||||||
|
{
|
||||||
|
// Create instance of EmpDataServiceController
|
||||||
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
|
|
||||||
|
// Check if $id is provided
|
||||||
|
if ($id) {
|
||||||
|
// Retrieve group key and actions based on $id
|
||||||
|
$group_key_actions = $this->empEndorsementModel->select('group_key, actions')->where('id', $id)->first();
|
||||||
|
$groupedData = $this->empEndorsementModel->where('group_key', $group_key_actions['group_key'])->findAll();
|
||||||
|
|
||||||
|
// If group key and actions are found
|
||||||
|
if ($group_key_actions) {
|
||||||
|
// Retrieve endorsement data based on actions
|
||||||
|
switch ($group_key_actions['actions']) {
|
||||||
|
case 'si':
|
||||||
|
$data = $this->empEndorsementModel->getDataForEnodrsementListinSIEnhancement($group_key_actions['group_key']);
|
||||||
|
$formatedData = $empDataServiceController->convertRowTColumnForSIEnhancement($data);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
$data = $this->empEndorsementModel->getDataForEnodrsementListinDeletion($group_key_actions['group_key']);
|
||||||
|
$formatedData = $empDataServiceController->convertRowTColumnForDeletion($data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$formatedData = $groupedData;
|
||||||
|
$formatedData[0]['field_name'] = remove_underscore_capitalize_first_letter($formatedData[0]['field_name']);
|
||||||
|
$formatedData[0]['old_value'] = formatDateOrReturn($formatedData[0]['old_value']);
|
||||||
|
$formatedData[0]['new_value'] = formatDateOrReturn($formatedData[0]['new_value']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return response with data
|
||||||
|
return $this->respond([
|
||||||
|
'dataStatus' => true,
|
||||||
|
'code' => 200,
|
||||||
|
'data' => $formatedData,
|
||||||
|
'data2' => $groupedData
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return response if group key and actions are not found
|
||||||
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Return response if $id is not provided
|
||||||
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -394,7 +394,27 @@ if (! function_exists('generate_filename')) {
|
|||||||
if (!function_exists('remove_underscore_capitalize_first_letter')) {
|
if (!function_exists('remove_underscore_capitalize_first_letter')) {
|
||||||
function remove_underscore_capitalize_first_letter($word) {
|
function remove_underscore_capitalize_first_letter($word) {
|
||||||
// Remove underscore and capitalize first letter of each word
|
// Remove underscore and capitalize first letter of each word
|
||||||
|
$pattern = '/dob/i';
|
||||||
|
if (preg_match($pattern, $word)) {
|
||||||
|
$formattedEvent = 'DOB';
|
||||||
|
return $formattedEvent;
|
||||||
|
}
|
||||||
$formattedEvent = ucwords(str_replace('_', ' ', $word));
|
$formattedEvent = ucwords(str_replace('_', ' ', $word));
|
||||||
return $formattedEvent;
|
return $formattedEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('formatDateOrReturn')) {
|
||||||
|
function formatDateOrReturn($value)
|
||||||
|
{
|
||||||
|
// Check if the value is a valid date
|
||||||
|
$timestamp = strtotime($value);
|
||||||
|
if ($timestamp !== false) {
|
||||||
|
// Format the date
|
||||||
|
return date('d-M-Y', $timestamp);
|
||||||
|
} else {
|
||||||
|
// Return the original value
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -132,3 +132,5 @@ if(!function_exists('check_string_date'))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class EmpEndorsementModel extends Model
|
|||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
'id',
|
'id',
|
||||||
'pk',
|
'pk',
|
||||||
|
'group_key',
|
||||||
'endorsement_id',
|
'endorsement_id',
|
||||||
'emp_code',
|
'emp_code',
|
||||||
'table_name',
|
'table_name',
|
||||||
@ -27,4 +28,173 @@ class EmpEndorsementModel extends Model
|
|||||||
"remarks"
|
"remarks"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
|
||||||
|
// protected function afterFind(array $data)
|
||||||
|
// {
|
||||||
|
// foreach ($data as &$row) {
|
||||||
|
// // Format date_of_coverage field to Indian date format
|
||||||
|
// if (isset($row['field_name'])) {
|
||||||
|
// $row['field_name'] = remove_underscore_capitalize_first_letter($row['field_name']);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return $data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public function getDataForEnodrsementListinSIEnhancement($group_key){
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
employee_polices.days as old_days,
|
||||||
|
employee_polices.rata_premimum as old_rata,
|
||||||
|
employee_polices.gst as old_gst,
|
||||||
|
client_policy.policy_start_date as old_date,
|
||||||
|
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'basic_cover_si' THEN emp_endorsement.new_value ELSE NULL END) AS new_basic_cover_si,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) AS new_si_premium,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END) AS date_of_coverage,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'basic_cover_si' THEN emp_endorsement.old_value ELSE NULL END) AS old_basic_cover_si,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END) AS old_si_premium,
|
||||||
|
|
||||||
|
(MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) AS difference_premium,
|
||||||
|
|
||||||
|
DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value END)) + 1 AS no_of_days,
|
||||||
|
|
||||||
|
ROUND(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value END) -
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value END)
|
||||||
|
) *
|
||||||
|
DATEDIFF(
|
||||||
|
employee_polices.policy_end_date,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value END)
|
||||||
|
) / 365
|
||||||
|
),
|
||||||
|
2
|
||||||
|
) AS pro_rata_premimum,
|
||||||
|
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365) * 0.18, 2) AS gst,
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365), 2) +
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365) * 0.18, 2) AS total
|
||||||
|
|
||||||
|
FROM emp_endorsement
|
||||||
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
|
JOIN client_policy ON client_policy.id = employee_polices.client_policy_id
|
||||||
|
WHERE group_key = '{$group_key}'
|
||||||
|
";
|
||||||
|
|
||||||
|
$results = $this->db->query($query)->getResult();
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDataForEnodrsementListinDeletion($group_key){
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
|
||||||
|
employee_polices.days as old_days,
|
||||||
|
employee_polices.rata_premimum as old_rata,
|
||||||
|
employee_polices.gst as old_gst,
|
||||||
|
employee_polices.policy_end_date as end_date,
|
||||||
|
client_policy.policy_start_date as start_date,
|
||||||
|
|
||||||
|
MAX(CASE WHEN a.field_name = 'date_of_exit' THEN a.new_value ELSE NULL END) AS date_of_leaving,
|
||||||
|
MAX(CASE WHEN a.field_name = 'reason_for_exit' THEN a.new_value ELSE NULL END) AS exist_reason,
|
||||||
|
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
|
||||||
|
ROUND((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
|
||||||
|
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
|
||||||
|
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
|
||||||
|
FROM
|
||||||
|
emp_endorsement a
|
||||||
|
LEFT JOIN
|
||||||
|
employees ON a.emp_code = employees.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
employee_polices ON employees.id = employee_polices.employee_id
|
||||||
|
LEFT JOIN
|
||||||
|
client_policy ON client_policy.id = employee_polices.client_policy_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
aa.emp_code,
|
||||||
|
aa.new_value AS 'empstatus',
|
||||||
|
bb.new_value AS 'changeevent',
|
||||||
|
cc.new_value AS 'dateofexit',
|
||||||
|
dd.new_value AS 'reasonforexit',
|
||||||
|
ee.new_value AS 'status'
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
a1.emp_code,
|
||||||
|
a1.field_name,
|
||||||
|
a1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS a1
|
||||||
|
WHERE
|
||||||
|
a1.field_name = 'emp_status'
|
||||||
|
) aa
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
b1.emp_code,
|
||||||
|
b1.field_name,
|
||||||
|
b1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS b1
|
||||||
|
WHERE
|
||||||
|
b1.field_name = 'change_event'
|
||||||
|
) 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 = 'date_of_exit'
|
||||||
|
) cc ON aa.emp_code = cc.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
d1.emp_code,
|
||||||
|
d1.field_name,
|
||||||
|
d1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS d1
|
||||||
|
WHERE
|
||||||
|
d1.field_name = 'reason_for_exit'
|
||||||
|
) dd ON aa.emp_code = dd.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
e1.emp_code,
|
||||||
|
e1.field_name,
|
||||||
|
e1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS e1
|
||||||
|
WHERE
|
||||||
|
e1.field_name = 'status'
|
||||||
|
) ee ON aa.emp_code = ee.emp_code
|
||||||
|
) AS deletiondata ON a.emp_code = deletiondata.emp_code
|
||||||
|
WHERE group_key = '{$group_key}';
|
||||||
|
";
|
||||||
|
|
||||||
|
$results = $this->db->query($query)->getResult();
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id)
|
public function getEmployeePolicy($client_id,$policy_id,$status)
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
@ -79,8 +79,13 @@ class EmployeePolicyModel extends Model
|
|||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
->where('emp.client_id',$client_id)
|
->where('emp.client_id',$client_id)
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
->where('employee_polices.client_policy_id',$policy_id);
|
||||||
->findAll();
|
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
$result->where('employee_polices.status', $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $result->findAll();
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +235,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT
|
||||||
|
a.id as endorsement_primarykey,
|
||||||
employee_polices.id AS primaryKey,
|
employee_polices.id AS primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.emp_code AS emp_code,
|
employees.emp_code AS emp_code,
|
||||||
@ -336,6 +342,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT
|
||||||
|
a.id as endorsement_primarykey,
|
||||||
employee_polices.id as primaryKey,
|
employee_polices.id as primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.emp_code AS emp_code,
|
employees.emp_code AS emp_code,
|
||||||
@ -451,7 +458,7 @@ class EmployeePolicyModel extends Model
|
|||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employees ON employees.id = emp_endorsement.pk
|
JOIN employees ON employees.id = emp_endorsement.pk
|
||||||
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE employees.emp_code = '$emp_code'
|
WHERE employees.emp_code = '$emp_code'
|
||||||
AND employee_polices.uhid = '$uhid'
|
AND employee_polices.uhid = '$uhid'
|
||||||
";
|
";
|
||||||
@ -463,15 +470,15 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
$client_id = $update_data['client_id'];
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
$client_policy_id = $update_data['client_policy_id'];
|
||||||
$emp_name = $update_data['name'];
|
$emp_name = $update_data['emp_name'];
|
||||||
$emp_code = $update_data['emp_code'];
|
$emp_code = $update_data['emp_code'];
|
||||||
$endorsement_id = $update_data['uhid'];
|
$endorsement_id = $update_data['endorsement_id'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
JOIN employees ON employee_polices.employee_id = employees.id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE emp_endorsement.emp_code = '$emp_code'
|
WHERE emp_endorsement.emp_code = '$emp_code'
|
||||||
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'
|
||||||
@ -483,19 +490,20 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updateEndoresmentIdForDeletion($update_data){
|
public function updateEndoresmentIdForDeletion($update_data)
|
||||||
|
{
|
||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
$client_id = $update_data['client_id'];
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
$client_policy_id = $update_data['client_policy_id'];
|
||||||
$emp_name = $update_data['name'];
|
$emp_name = $update_data['emp_name'];
|
||||||
$emp_code = $update_data['emp_code'];
|
$emp_code = $update_data['emp_code'];
|
||||||
$endorsement_id = $update_data['uhid'];
|
$endorsement_id = $update_data['endorsement_id'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
JOIN employees ON employee_polices.employee_id = employees.id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE employees.emp_code = '$emp_code'
|
WHERE employees.emp_code = '$emp_code'
|
||||||
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'
|
||||||
@ -508,7 +516,7 @@ class EmployeePolicyModel extends Model
|
|||||||
public function fetchEmpEndorsementData($fetch_data)
|
public function fetchEmpEndorsementData($fetch_data)
|
||||||
{
|
{
|
||||||
$client_policy_id = $fetch_data['client_policy_id'];
|
$client_policy_id = $fetch_data['client_policy_id'];
|
||||||
$emp_name = $fetch_data['name'];
|
$emp_name = $fetch_data['emp_name'];
|
||||||
$emp_code = $fetch_data['emp_code'];
|
$emp_code = $fetch_data['emp_code'];
|
||||||
|
|
||||||
// Your raw SQL query
|
// Your raw SQL query
|
||||||
@ -561,22 +569,78 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmployeeEndorsementList($client_id,$policy_id)
|
public function getEmployeeEndorsementList($client_id, $policy_id, $status)
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
$query1 = $this->db->table('emp_endorsement e');
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
$query1->select('
|
||||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
e.id,
|
||||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
e.pk,
|
||||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
|
e.emp_code,
|
||||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
|
e.name,
|
||||||
->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
|
e.actions,
|
||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
e.status,
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
e.remarks,
|
||||||
->where('emp.client_id',$client_id)
|
e.endorsement_id,
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
ep.client_policy_id,
|
||||||
->findAll();
|
policies.name as policy_name,
|
||||||
return ($result);
|
insurers.short_name as insurer_short_name
|
||||||
|
');
|
||||||
|
$query1->distinct();
|
||||||
|
$query1->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||||
|
$query1->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||||
|
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||||
|
$query1->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||||
|
$query1->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||||
|
$query1->whereIn('e.actions', ['c']);
|
||||||
|
$query1->where('ep.client_policy_id', $client_id);
|
||||||
|
$query1->where('employees.client_id', $policy_id);
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
|
$query1->where('e.status', $status);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
$query1->orderBy('e.id', 'desc');
|
||||||
|
|
||||||
|
$results1 = $query1->get()->getResultArray();
|
||||||
|
|
||||||
|
$query2 = $this->db->table('emp_endorsement e');
|
||||||
|
|
||||||
|
$query2->select('
|
||||||
|
e.id,
|
||||||
|
e.pk,
|
||||||
|
e.emp_code,
|
||||||
|
e.name,
|
||||||
|
e.actions,
|
||||||
|
e.status,
|
||||||
|
e.endorsement_id,
|
||||||
|
e.remarks,
|
||||||
|
ep.client_policy_id,
|
||||||
|
policies.name as policy_name,
|
||||||
|
insurers.short_name as insurer_short_name
|
||||||
|
');
|
||||||
|
$query2->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||||
|
$query2->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||||
|
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||||
|
$query2->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||||
|
$query2->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||||
|
$query2->whereIn('e.actions', ['si', 'd']);
|
||||||
|
$query2->where('ep.client_policy_id', $client_id);
|
||||||
|
$query2->where('employees.client_id', $policy_id);
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
|
$query2->where('e.status', $status);
|
||||||
|
}
|
||||||
|
$query2->groupBy('e.emp_code, e.name, e.actions');
|
||||||
|
$query2->orderBy('e.id', 'desc');
|
||||||
|
|
||||||
|
$results2 = $query2->get()->getResultArray();
|
||||||
|
|
||||||
|
$results = array_merge($results1, $results2);
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
body {
|
body {
|
||||||
.multiselect-native-select {
|
.multiselect-native-select {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -25,7 +24,15 @@ body {
|
|||||||
.multiselect-selected-text{
|
.multiselect-selected-text{
|
||||||
float: left !important;
|
float: left !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- End ADD and EDIT Page HTML -->
|
<!-- End ADD and EDIT Page HTML -->
|
||||||
|
|||||||
@ -328,7 +328,7 @@
|
|||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name}</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
|
|||||||
@ -22,23 +22,34 @@ table.dataTable tbody td {
|
|||||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- <div class="text-center"> -->
|
<!-- <div class="text-center"> -->
|
||||||
<div class="row">
|
<div class="form-row">
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
|
||||||
<label>Client</label> <br />
|
<label>Client</label> <br />
|
||||||
<select class="form-control" id="clients">
|
<select class="form-control" id="clients">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Status</label> <br />
|
||||||
|
<select class="form-control" id="status2">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php foreach($status as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>"
|
||||||
|
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||||
|
<?= $value ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -98,7 +109,19 @@ table.dataTable tbody td {
|
|||||||
<td><?php echo $employee['insurer_short_name']?></td>
|
<td><?php echo $employee['insurer_short_name']?></td>
|
||||||
<td><?php echo $employee['tpa_id']?></td>
|
<td><?php echo $employee['tpa_id']?></td>
|
||||||
<td><?php echo $employee['uhid']?></td>
|
<td><?php echo $employee['uhid']?></td>
|
||||||
<td><span class="badge badge-success">active</span></td>
|
<td>
|
||||||
|
<?php
|
||||||
|
if ($employee['status'] == 'draft') {
|
||||||
|
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||||
|
} elseif ($employee['status'] == 'active') {
|
||||||
|
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||||
|
} elseif ($employee['status'] == 'inactive') {
|
||||||
|
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||||
|
}elseif ($employee['status'] == 'expired') {
|
||||||
|
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
<td><?php echo $employee['premium']?></td>
|
<td><?php echo $employee['premium']?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -134,6 +157,8 @@ table.dataTable tbody td {
|
|||||||
<script>
|
<script>
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
console.log("document loaded");
|
console.log("document loaded");
|
||||||
@ -144,7 +169,6 @@ $(document).ready(function() {
|
|||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("window loaded");
|
console.log("window loaded");
|
||||||
fetchClientPolicies();
|
fetchClientPolicies();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -167,8 +191,21 @@ function fetchClientPolicies() {
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
// console.log(clientPolicies);
|
console.log('1',clientPolicies);
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
//this function for reselect the policy
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id != 0 ) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendPolicies(foundPolicies.policies);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
//end
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
}
|
}
|
||||||
@ -188,29 +225,43 @@ function fetchClientPolicies() {
|
|||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#clients').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name
|
text: item.client_name
|
||||||
}));
|
});
|
||||||
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||||
|
console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#policies').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.name
|
text: item.name
|
||||||
}));
|
});
|
||||||
|
if (PolicyID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policies').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#clients').on('change', function() {
|
$('#clients').on('change', function() {
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
console.log(selectedClient);
|
console.log(selectedClient);
|
||||||
@ -224,16 +275,20 @@ $('#clients').on('change', function() {
|
|||||||
appendPolicies(foundPolicies.policies);
|
appendPolicies(foundPolicies.policies);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
// Function to convert object to query parameters
|
||||||
function objectToQueryString(obj) {
|
function objectToQueryString(obj) {
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetchEmpolyeeList(event) {
|
function fetchEmpolyeeList(event) {
|
||||||
event.preventDefault(); // Prevent default action
|
event.preventDefault(); // Prevent default action
|
||||||
|
|
||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
|
var status = $('#status2').val();
|
||||||
|
|
||||||
console.log(client_id + '-' + policy_id);
|
console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
@ -241,8 +296,10 @@ function fetchEmpolyeeList(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
|
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id
|
policy_id: policy_id,
|
||||||
|
status : status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
@ -268,9 +325,11 @@ function fetchEmpolyeeList(event) {
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
var icon = document.getElementById('icon');
|
var icon = document.getElementById('icon');
|
||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1,12 +1,12 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -22,23 +22,34 @@
|
|||||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- <div class="text-center"> -->
|
<!-- <div class="text-center"> -->
|
||||||
<div class="row">
|
<div class="form-row">
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
|
||||||
<label>Client</label> <br />
|
<label>Client</label> <br />
|
||||||
<select class="form-control" id="clients">
|
<select class="form-control" id="clients">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Status</label> <br />
|
||||||
|
<select class="form-control" id="status1">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php foreach($status as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>"
|
||||||
|
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||||
|
<?= $value ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -74,11 +85,11 @@
|
|||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
<th class="font-weight-medium">Name/code</th>
|
<th class="font-weight-medium">Name/code</th>
|
||||||
<th class="font-weight-medium">Policy name</th>
|
<th class="font-weight-medium">Policy name</th>
|
||||||
<th class="font-weight-medium">Insurar name</th>
|
<th class="font-weight-medium">Endorsement ID</th>
|
||||||
<th class="font-weight-medium">TPA ID</th>
|
<th class="font-weight-medium">Insurer name</th>
|
||||||
<th class="font-weight-medium">UHID ID</th>
|
<th class="font-weight-medium">Remarks</th>
|
||||||
<th class="font-weight-medium">Policy status</th>
|
<th class="font-weight-medium">Endorsement Type</th>
|
||||||
<th class="font-weight-medium">Premium</th>
|
<th class="font-weight-medium">Status</th>
|
||||||
<th class="font-weight-medium">Action</th>
|
<th class="font-weight-medium">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -91,32 +102,37 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1)?></b></td>
|
<td><b><?php echo ($key + 1)?></b></td>
|
||||||
<!-- <td><?php echo $employee['emp_code']?></td> -->
|
|
||||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||||
<td><?php echo $employee['policy_name']?></td>
|
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||||
<td><?php echo $employee['insurer_short_name']?></td>
|
<td><?php echo $employee['endorsement_id']?></td>
|
||||||
<td><?php echo $employee['tpa_id']?></td>
|
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||||
<td><?php echo $employee['uhid']?></td>
|
</td>
|
||||||
<td><span class="badge badge-success">active</span></td>
|
<td><?php echo $employee['remarks']?></td>
|
||||||
<td><?php echo $employee['premium']?></td>
|
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<?php
|
||||||
<a href="javascript: void(0);"
|
if ($employee['actions'] == 'c') {
|
||||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
echo 'Correction';
|
||||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
} elseif ($employee['actions'] == 'si') {
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
echo 'SI Enhancement';
|
||||||
<a class="dropdown-item" href="#"><i
|
} elseif ($employee['actions'] == 'd') {
|
||||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
echo 'Deletion';
|
||||||
Ticket</a>
|
}
|
||||||
<a class="dropdown-item" href="#"><i
|
?>
|
||||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
</td>
|
||||||
<a class="dropdown-item" href="#"><i
|
<td>
|
||||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
<?php
|
||||||
<a class="dropdown-item" href="#"><i
|
if ($employee['status'] == 'pending') {
|
||||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||||
Unread</a>
|
} elseif ($employee['status'] == 'inprogress') {
|
||||||
</div>
|
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||||
</div>
|
} elseif ($employee['status'] == 'complete') {
|
||||||
|
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td class="text-center"><a href="#" data-id="<?php echo $employee['id']?>"
|
||||||
|
class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal"
|
||||||
|
data-target="#centermodal"></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php }}?>
|
<?php }}?>
|
||||||
@ -127,27 +143,48 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- end col -->
|
</div><!-- end col -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end row -->
|
|
||||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
|
||||||
|
|
||||||
|
<!-- Center modal content -->
|
||||||
|
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="background-color: gainsboro;">
|
||||||
|
<h4 class="modal-title" id="myCenterModalLabel">Endorsement Details <span id="heading"></span></h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" id="modal_body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0">
|
||||||
|
<thead id="table_head_data">
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
<tbody id="table_data">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div> <!-- end table-responsive-->
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
$(document).ready(function() {
|
|
||||||
console.log("document loaded");
|
|
||||||
//fetchClientPolicies();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("window loaded");
|
console.log("window loaded");
|
||||||
fetchClientPolicies();
|
fetchClientPolicies();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
function fetchClientPolicies() {
|
||||||
|
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
console.log('fetchClientPolicies');
|
||||||
@ -166,8 +203,21 @@ function fetchClientPolicies() {
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
// console.log(clientPolicies);
|
console.log(clientPolicies);
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
//this function for reselect policy
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendPolicies(foundPolicies.policies);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
//end
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
}
|
}
|
||||||
@ -187,26 +237,40 @@ function fetchClientPolicies() {
|
|||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
|
|
||||||
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#clients').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name
|
text: item.client_name
|
||||||
}));
|
});
|
||||||
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||||
|
console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#policies').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.name
|
text: item.name
|
||||||
}));
|
});
|
||||||
|
if (PolicyID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policies').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +297,7 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
|
var status = $('#status1').val();
|
||||||
console.log(client_id + '-' + policy_id);
|
console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
@ -241,7 +306,8 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id
|
policy_id: policy_id,
|
||||||
|
status: status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
@ -256,4 +322,160 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
|||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.emp_data_model').click(function() {
|
||||||
|
var myVal = $(this).data('id');
|
||||||
|
console.log(myVal);
|
||||||
|
fetchEmpEndorsementData(myVal)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function fetchEmpEndorsementData(id) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var apiURL = '<?php echo base_url();?>' + 'util/get-emp-endorsement/' + id;
|
||||||
|
console.log('fetchEmpEndorsementData');
|
||||||
|
console.log(apiURL);
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
if (response.code === 200 && response.dataStatus === true) {
|
||||||
|
try {
|
||||||
|
endorsementData = (response.data);
|
||||||
|
endorsementData2 = (response.data2);
|
||||||
|
|
||||||
|
e_actions = endorsementData2[0]['actions'];
|
||||||
|
|
||||||
|
|
||||||
|
var heading = "";
|
||||||
|
if (endorsementData2[0]['actions'] == 'si') {
|
||||||
|
heading = ' - ' + 'SI Enhancement';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'd') {
|
||||||
|
heading = ' - ' + 'Deletion';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'c') {
|
||||||
|
heading = ' - ' + 'Correction';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#heading').html(heading);
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
$('#table_head_data').empty();
|
||||||
|
|
||||||
|
|
||||||
|
if(e_actions == 'd'){
|
||||||
|
|
||||||
|
$.each(endorsementData, function(index, item) {
|
||||||
|
var tableHtml = `
|
||||||
|
<tr>
|
||||||
|
<td>${item.field_name}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_data').append(tableHtml);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var table_head = `
|
||||||
|
<tr>
|
||||||
|
<th class="font-weight-medium"></th>
|
||||||
|
<th class="font-weight-medium">Old Value</th>
|
||||||
|
<th class="font-weight-medium">New Value</th>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_head_data').append(table_head);
|
||||||
|
|
||||||
|
$.each(endorsementData, function(index, item) {
|
||||||
|
var tableHtml = `
|
||||||
|
<tr>
|
||||||
|
<td>${item.field_name}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_data').append(tableHtml);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing API response data:', error);
|
||||||
|
}
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
|
} else {
|
||||||
|
console.error('Something went wrong!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatNumberToIndianLocale(value, field_name, action) {
|
||||||
|
|
||||||
|
// Check if the value is a valid number (either as a number or as a string)
|
||||||
|
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||||
|
|
||||||
|
// Convert the value to a number and format it using Indian English locale
|
||||||
|
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||||
|
|
||||||
|
if(field_name == 'Period of non coverage'){
|
||||||
|
|
||||||
|
return value + ' days';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(field_name == 'Total Amount'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(field_name == 'Total'){
|
||||||
|
|
||||||
|
if(action == 'd'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
|
||||||
|
}else if(action == 'si'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be paid )';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return '₹ ' + return_val;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return the original value if it's not a valid number
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.close').click(function(){
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -14,6 +14,7 @@
|
|||||||
<th class="font-weight-medium">File name</th>
|
<th class="font-weight-medium">File name</th>
|
||||||
<th class="font-weight-medium">Client</th>
|
<th class="font-weight-medium">Client</th>
|
||||||
<th class="font-weight-medium">policy</th>
|
<th class="font-weight-medium">policy</th>
|
||||||
|
<th class="font-weight-medium">Event</th>
|
||||||
<th class="font-weight-medium">User/Time</th>
|
<th class="font-weight-medium">User/Time</th>
|
||||||
<th class="font-weight-medium">Status</th>
|
<th class="font-weight-medium">Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -34,6 +35,7 @@
|
|||||||
<td><?php echo $file['file_name']?></td>
|
<td><?php echo $file['file_name']?></td>
|
||||||
<td><?php echo $file['short_name']?></td>
|
<td><?php echo $file['short_name']?></td>
|
||||||
<td><?php echo $file['policy_name']?></td>
|
<td><?php echo $file['policy_name']?></td>
|
||||||
|
<td><?php echo $file['action']?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td>
|
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td>
|
||||||
<td><?php echo $file['status']; if($file['status'] == 'failed')
|
<td><?php echo $file['status']; if($file['status'] == 'failed')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>nHANCE</title>
|
<title>nHANCE</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
<meta content="A fully featured CRM" name="description" />
|
||||||
<meta content="Coderthemes" name="author" />
|
<meta content="Venba info tech" name="author" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<!-- App favicon -->
|
<!-- App favicon -->
|
||||||
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/favicon.ico">
|
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/favicon.ico">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user