Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
548131867c
@ -271,6 +271,13 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1");
|
||||
$routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1");
|
||||
$routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1");
|
||||
$routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
|
||||
$routes->get("rename_rack_rate_tab/(:any)", "ClientController::renameRackRateTab/$1");
|
||||
$routes->post("create_excel_template", "MasterController::createExcelTemplate");
|
||||
$routes->get("get_insurer_by_export_templete", "MasterController::getInsurerByExportTemplete");
|
||||
$routes->get("copy_insurer_templete/(:any)", "MasterController::copyInsurerTemplete/$1");
|
||||
$routes->get("get_single_excel_template/(:any)", "MasterController::getSingleExcelTemplate/$1");
|
||||
$routes->get("dublicate_template/(:any)", "MasterController::duplicateTemplate/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -252,15 +252,25 @@ class ClientController extends AdminController
|
||||
public function removeClientBranch($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Client Branch Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->clientBranchModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
|
||||
$data = [
|
||||
'updated_by' => get_session_userid(),
|
||||
'is_active' => 0
|
||||
];
|
||||
|
||||
$config_count = $this->clientPolicyModel->where('client_branch_id', $id)->countAllResults();
|
||||
|
||||
if($config_count > 0){
|
||||
|
||||
$update = $this->clientBranchModel->where('id', $id)->set($data)->update();
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Client branch removed successfully'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to remove client branch'], 200);
|
||||
}
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'The client branch configuration with policy cannot be deleted.'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,6 +569,8 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createClientRelation()
|
||||
{
|
||||
|
||||
@ -647,6 +659,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function createClientBranch()
|
||||
{
|
||||
|
||||
@ -658,7 +671,7 @@ class ClientController extends AdminController
|
||||
$data['sez'] = 1;
|
||||
}
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->clientBranchModel->insert($data);
|
||||
$insert = $this->clientBranchModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||
@ -679,9 +692,18 @@ class ClientController extends AdminController
|
||||
if($insert){
|
||||
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
|
||||
$branchData['role'] = get_role_id();
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'data' => $branchData,
|
||||
'message' => 'Client branch created successfully',
|
||||
], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'Failed to create client branch ',
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -692,11 +714,57 @@ class ClientController extends AdminController
|
||||
$id = $this->request->getPost('branch_id_primarykey');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$data = $this->request->getPost();
|
||||
$units = $this->request->getPost('units');
|
||||
|
||||
$emp_unit_count = 0;
|
||||
$rr_unit_count = 0;
|
||||
$rr_unit_count2 = 0;
|
||||
$total_count = 0;
|
||||
|
||||
$list_of_branch_units = $this->clientBranchModel->find($id);
|
||||
$units = json_decode($list_of_branch_units['units']);
|
||||
|
||||
if (!empty($units)) {
|
||||
foreach ($units as $unit) {
|
||||
$emp_unit_count += $this->employeeModel->where('unit', $unit)->countAllResults();
|
||||
$rr_unit_count += $this->policyPremium2Model->where('unit', $unit)->countAllResults();
|
||||
$rr_unit_count2 += $this->policyPremium1Model->where('unit', $unit)->countAllResults();
|
||||
}
|
||||
|
||||
$total_count = $emp_unit_count + $rr_unit_count + $rr_unit_count2;
|
||||
}
|
||||
$uncommonValues = [];
|
||||
|
||||
if ($total_count > 0) {
|
||||
$units = (string) $this->request->getPost('units'); // Assuming 'units' is an array
|
||||
|
||||
$list_of_branch_units = $this->clientBranchModel->find($id);
|
||||
$branch_units = json_decode($list_of_branch_units['units'], true);
|
||||
$units = json_decode($units);
|
||||
|
||||
$uncommonValues = array_diff($branch_units, $units);
|
||||
|
||||
if (count($uncommonValues) > 0) {
|
||||
|
||||
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => "Deleted unit(s) in use. couldn't complete this operation.",
|
||||
'uncommonValues' => $uncommonValues,
|
||||
'data' => $branchData,
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isset($data['sez'])) {
|
||||
$data['sez'] = 0;
|
||||
} elseif ($data['sez']) {
|
||||
$data['sez'] = 1;
|
||||
}
|
||||
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$insert = $this->clientBranchModel->update($id, $data);
|
||||
$this->myLogger->logme('error','Client branch EDITED by {data}', ['data' => get_session_userid()]);
|
||||
@ -721,12 +789,25 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'data' => $branchData,
|
||||
'emp_unit_count' => $emp_unit_count,
|
||||
'rr_unit_count' => $rr_unit_count,
|
||||
'list_of_branch_units' => $list_of_branch_units,
|
||||
'total_count' => $total_count,
|
||||
'uncommonValues' => $uncommonValues,
|
||||
'message' => 'Client branch updated successfully'
|
||||
|
||||
], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to update client branch'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createClientPolicy()
|
||||
{
|
||||
|
||||
@ -1019,22 +1100,32 @@ class ClientController extends AdminController
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
}
|
||||
|
||||
$branch_units = $this->getBranchUnitsByBranchId($record['client_branch_id']);
|
||||
$branch_units = json_decode($branch_units);
|
||||
|
||||
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
$rack_rate_name = $this->request->getPost('rack_rate_name');
|
||||
|
||||
$relation_data = [
|
||||
'self' => $this->request->getPost('self'),
|
||||
'spouse' => $this->request->getPost('spouse'),
|
||||
'childrens' => $this->request->getPost('childrens'),
|
||||
'parents' => $this->request->getPost('parents'),
|
||||
'parents-in-law'=> $this->request->getPost('parents-in-law'),
|
||||
'self' => $this->request->getPost('self') ?? 'NA',
|
||||
'spouse' => $this->request->getPost('spouse') ?? 'NA',
|
||||
'childrens' => $this->request->getPost('childrens') ?? 'NA',
|
||||
'parents' => $this->request->getPost('parents') ?? 'NA',
|
||||
'parents-in-law'=> $this->request->getPost('parents-in-law') ?? 'NA',
|
||||
];
|
||||
|
||||
if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) {
|
||||
$relation_data_for_form_submit_check = [
|
||||
$rack_rate_name => [
|
||||
'self' => $this->request->getPost('self') ?? 'NA',
|
||||
'spouse' => $this->request->getPost('spouse') ?? 'NA',
|
||||
'childrens' => $this->request->getPost('childrens') ?? 'NA',
|
||||
'parents' => $this->request->getPost('parents') ?? 'NA',
|
||||
'parents-in-law'=> $this->request->getPost('parents-in-law') ?? 'NA',
|
||||
]
|
||||
];
|
||||
|
||||
if ($policy_grid_id == 1 || $policy_grid_id == 2 ) {
|
||||
$relation_data = [
|
||||
'self' => 1,
|
||||
'spouse' => 'NA',
|
||||
@ -1046,7 +1137,7 @@ class ClientController extends AdminController
|
||||
|
||||
// Convert to JSON
|
||||
$jsonDataForRelation = json_encode($relation_data);
|
||||
|
||||
$json_data_relation_data_for_form_submit_check = json_encode($relation_data_for_form_submit_check);
|
||||
|
||||
$si_or_bp = $this->request->getPost('si_or_bp');
|
||||
$basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier'));
|
||||
@ -1077,7 +1168,7 @@ class ClientController extends AdminController
|
||||
$premium = str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
||||
$sum_insure = str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
||||
$multiplier = $this->request->getPost('gpa_sum_multiplier');
|
||||
$unit = $this->request->getPost('gpa_unit[]');
|
||||
$unit = $this->request->getPost('gpa_unit_1[]');
|
||||
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['si'] = $sum_insure[$i];
|
||||
@ -1099,7 +1190,7 @@ class ClientController extends AdminController
|
||||
$sum_insure = str_replace(',', '', $this->request->getPost('gpa_sum_si2[]'));
|
||||
$multiplier = $this->request->getPost('gpa_sum_multiplier2');
|
||||
$grade = $this->request->getPost('gpa_band[]');
|
||||
$unit = $this->request->getPost('gpa_unit[]');
|
||||
$unit = $this->request->getPost('gpa_unit_3[]');
|
||||
|
||||
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
@ -1156,20 +1247,27 @@ class ClientController extends AdminController
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '2') {
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||
$unit = $this->request->getPost('gpa_unit');
|
||||
if (empty($unit)) {
|
||||
$data['unit'] = $branch_units[0];
|
||||
} else {
|
||||
$data['unit'] = $unit;
|
||||
}
|
||||
|
||||
$policyPremium = $this->policyPremium1Model->insert($data);
|
||||
} else if ($policy_grid_id == '2') {
|
||||
|
||||
$premium = $this->request->getPost('gpa_premium29[]');
|
||||
$sum_insure = $this->request->getPost('gpa_si29[]');
|
||||
$unit = $this->request->getPost('gpa_unit29[]');
|
||||
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i])) {
|
||||
$data['unit'] = $branch_units[0];
|
||||
} else {
|
||||
$data['unit'] = $unit[$i];
|
||||
}
|
||||
$dataa = $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
|
||||
} else if ($policy_grid_id == '3') {
|
||||
|
||||
$premium = $this->request->getPost('3_premium[]');
|
||||
@ -1215,6 +1313,7 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
} else if ($policy_grid_id == '5') {
|
||||
|
||||
$premium = $this->request->getPost('5_premium[]');
|
||||
$sum_insure = $this->request->getPost('5_si[]');
|
||||
$age_from = $this->request->getPost('5_age_from[]');
|
||||
@ -1226,7 +1325,7 @@ class ClientController extends AdminController
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i])) {
|
||||
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i] || $unit[$i] == 'undefined')) {
|
||||
$data['unit'] = $branch_units[0];
|
||||
} else {
|
||||
$data['unit'] = $unit[$i];
|
||||
@ -1234,8 +1333,10 @@ class ClientController extends AdminController
|
||||
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
|
||||
} else if ($policy_grid_id == '6') {
|
||||
|
||||
$premium = $this->request->getPost('6_premium[]');
|
||||
@ -1305,27 +1406,24 @@ class ClientController extends AdminController
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '9') {
|
||||
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||
$unit = $this->request->getPost('gpa_unit');
|
||||
if (empty($unit)) {
|
||||
$data['unit'] = $branch_units[0];
|
||||
} else {
|
||||
$data['unit'] = $unit;
|
||||
$premium = $this->request->getPost('gpa_premium29[]');
|
||||
$sum_insure = $this->request->getPost('gpa_si29[]');
|
||||
$unit = $this->request->getPost('gpa_unit29[]');
|
||||
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
if (empty($unit) || !isset($unit[$i]) || empty($unit[$i])) {
|
||||
$data['unit'] = $branch_units[0];
|
||||
} else {
|
||||
$data['unit'] = $unit[$i];
|
||||
}
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
|
||||
$policyPremium = $this->policyPremium2Model->insert($data);
|
||||
// $premium = $this->request->getPost('9_premium[]');
|
||||
// $sum_insure = $this->request->getPost('9_si[]');
|
||||
// $grade = $this->request->getPost('9_grade[]');
|
||||
// for ($i = 0; $i < count($premium); $i++) {
|
||||
// $data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
// $data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
// // $data['grade'] = $grade[$i];
|
||||
// $dataa = $this->policyPremium2Model->insert($data);
|
||||
// }
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
|
||||
} else if ($policy_grid_id == '10') {
|
||||
$premium = $this->request->getPost('10_premium[]');
|
||||
$sum_insure = $this->request->getPost('10_si[]');
|
||||
@ -1355,7 +1453,7 @@ class ClientController extends AdminController
|
||||
$sum_insure = $this->request->getPost('11_si[]');
|
||||
$grade = $this->request->getPost('11_grade[]');
|
||||
$max_sum_insure = $this->request->getPost('11_max_si[]');
|
||||
$unit = $this->request->getPost('11_max_si[]');
|
||||
$unit = $this->request->getPost('11_unit[]');
|
||||
|
||||
for ($i = 0; $i < count($premium); $i++) {
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
@ -1421,13 +1519,13 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
if ($insert) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data, 'rack_rate_json'=>$jsonDataForRelation,], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $data, 'rack_rate_json'=>$json_data_relation_data_for_form_submit_check,], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'data' => $data, 'message' => 'no data found'], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
echo 'Error: ' . $e->getMessage(). ' at line no ' . $e->getLine();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1557,6 +1655,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||
$jsonArray = [];
|
||||
|
||||
if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||
|
||||
@ -1564,6 +1663,19 @@ class ClientController extends AdminController
|
||||
} else if ($search_term === 'GMC') {
|
||||
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
$rackRateJson = $this->policyPremium2Model
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('is_active', 1)
|
||||
->groupBy('rack_rate_name')
|
||||
->orderBy('id')
|
||||
->findAll();
|
||||
|
||||
foreach ($rackRateJson as $value) {
|
||||
$jsonArray[$value['rack_rate_name']] = json_decode($value['additional_relationship']);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$premiumData = "";
|
||||
@ -1650,7 +1762,8 @@ class ClientController extends AdminController
|
||||
'self' => $self,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'terms_si_amount_array' => $terms_si_amount_array,
|
||||
'branch_units' => $branch_units
|
||||
'branch_units' => $branch_units,
|
||||
'jsonArray' => $jsonArray,
|
||||
], 200);
|
||||
|
||||
} else if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||
@ -1665,7 +1778,8 @@ class ClientController extends AdminController
|
||||
'self' => $self,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'terms_si_amount_array' => $terms_si_amount_array,
|
||||
'branch_units' => $branch_units
|
||||
'branch_units' => $branch_units,
|
||||
'jsonArray' => $jsonArray,
|
||||
], 200);
|
||||
} else {
|
||||
|
||||
@ -1679,7 +1793,8 @@ class ClientController extends AdminController
|
||||
'self' => $self,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'terms_si_amount_array' => $terms_si_amount_array,
|
||||
'branch_units' => $branch_units
|
||||
'branch_units' => $branch_units,
|
||||
'jsonArray' => $jsonArray,
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@ -2044,7 +2159,7 @@ class ClientController extends AdminController
|
||||
$message = 'Enrolment Closed Successfully';
|
||||
}
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||
$data = $this->policesModel->getPolicyPremium($client_policy_id);
|
||||
$pattern = '/gmc/i';
|
||||
$subject = $data[0]->policy_type;
|
||||
if (preg_match($pattern, $subject)) {
|
||||
@ -2076,8 +2191,8 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
// Check if 'family_floater' key exists and has a value
|
||||
if (isset($termsData->family_floater) && $termsData->family_floater == null) {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Family Floater field is empty'], 200);
|
||||
if (isset($termsData->family_floater) && $termsData->family_floater === null) {
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Family Floater field is empty', 'termsData' => $termsData , 'family_floater' => $termsData->family_floater], 200);
|
||||
}
|
||||
|
||||
// Check if 'family_floaters' key exists and has a value
|
||||
@ -2666,9 +2781,8 @@ class ClientController extends AdminController
|
||||
|
||||
public function getClientDetails($client_id)
|
||||
{
|
||||
|
||||
$result = $this->clientModel->where('id', $client_id)->first();
|
||||
return $this->respond(['status' => true, 'data' => $result], 200);
|
||||
$result = $this->clientModel->where('id', $client_id)->first();
|
||||
return $this->respond(['status' => true, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
public function getBranchUnitsByBranchId($branch_id)
|
||||
@ -2828,7 +2942,6 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function removeRackRate($rack_rate_name = null, $client_policy_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Rack Rate Remove function called');
|
||||
@ -2853,7 +2966,7 @@ class ClientController extends AdminController
|
||||
if ($update) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Rack Rate removed successfully', 'rr_count' => $rackRateData], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy', 'rr_count' => $rackRateData], 200);
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove Rack Rate', 'rr_count' => $rackRateData], 200);
|
||||
}
|
||||
}else{
|
||||
|
||||
@ -2862,4 +2975,40 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function renameRackRateTab($rack_rate_name = null, $new_rack_rate_name = null, $client_policy_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Rack Rate renameRackRateTab function called');
|
||||
|
||||
$data = [
|
||||
'updated_by' => get_session_userid(),
|
||||
'rack_rate_name' => $new_rack_rate_name
|
||||
];
|
||||
|
||||
$rackRateData = $this->policyPremium2Model
|
||||
->where('rack_rate_name', $rack_rate_name)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('is_active',1)
|
||||
->countAllResults();
|
||||
|
||||
if($rackRateData > 0){
|
||||
$update = $this->policyPremium2Model
|
||||
->where('rack_rate_name', $rack_rate_name)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('is_active',1)
|
||||
->set($data)
|
||||
->update();
|
||||
|
||||
$affectedRows = $this->policyPremium2Model->affectedRows();
|
||||
|
||||
if ($update) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Rack Rate renamed successfully', 'rr_count' => $affectedRows], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to rename Rack Rate', 'rr_count' => $affectedRows], 200);
|
||||
}
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Rack Rate not available', 'rr_count' => $rackRateData, 'rack_rate_name' => $rack_rate_name, 'client_policy_id' => $client_policy_id, 'new_rack_rate_name' => $new_rack_rate_name, ], 200);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -331,7 +331,7 @@ class EmpDataServiceController extends BaseController
|
||||
[
|
||||
'column_index' => 0,
|
||||
'column_name' => 'S.No',
|
||||
'header_name' => 'index'
|
||||
'db_column_name' => 'index'
|
||||
],
|
||||
[
|
||||
'column_index' => 1,
|
||||
@ -943,7 +943,7 @@ class EmpDataServiceController extends BaseController
|
||||
->select('insurer_excel_export_template.jsoncolumns')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $export_data['client_policy_id'])
|
||||
->where('insurer_excel_export_template.event_name', 'inception')
|
||||
->where('insurer_excel_export_template.event_name', 'all')
|
||||
->where('insurer_excel_export_template.type_name', $export_data['actions'])
|
||||
->first();
|
||||
|
||||
@ -1549,7 +1549,6 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$batch_list_id[] = $emp_value['emp_policy_id'];
|
||||
}
|
||||
|
||||
@ -1696,7 +1695,7 @@ class EmpDataServiceController extends BaseController
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]); // Remove header row
|
||||
array_pop($excel_data); // Remove footer row
|
||||
// array_pop($excel_data);
|
||||
|
||||
$totals = 0;
|
||||
$emp_policy_ids = [];
|
||||
@ -1707,7 +1706,6 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_count = count($excel_data);
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
|
||||
foreach ($excel_data as $key => $value) {
|
||||
|
||||
$name = $value[1];
|
||||
@ -1716,33 +1714,37 @@ class EmpDataServiceController extends BaseController
|
||||
$uhid[] = $value[16];
|
||||
$amount = $value[20];
|
||||
|
||||
$totals = $totals + $amount;
|
||||
if(!empty($name) && !empty($emp_code)){
|
||||
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
$query->where('employees.client_branch_id', $client_branch_id);
|
||||
$query->where('employees.name', $name);
|
||||
$query->where('employees.emp_code', $emp_code);
|
||||
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||
$totals = $totals + $amount;
|
||||
|
||||
$query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
|
||||
} else if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
$query->where('employees.client_branch_id', $client_branch_id);
|
||||
$query->where('employees.name', $name);
|
||||
$query->where('employees.emp_code', $emp_code);
|
||||
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||
|
||||
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
|
||||
}
|
||||
$query->where('employee_polices.is_active', 1);
|
||||
$query->where('employee_polices.status', 'active');
|
||||
$query->where('employees.is_active', 1);
|
||||
$query->where('employees.emp_status', 'active');
|
||||
$query->limit(1);
|
||||
$query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
|
||||
} else if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
|
||||
}
|
||||
$query->where('employee_polices.is_active', 1);
|
||||
$query->where('employee_polices.status', 'active');
|
||||
$query->where('employees.is_active', 1);
|
||||
$query->where('employees.emp_status', 'active');
|
||||
$query->limit(1);
|
||||
|
||||
$result = $query->get()->getRowArray();
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
$emp_policy_ids[] = $result['id']; //for cash deposite
|
||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[15], 'uhid' => $value[16]);
|
||||
}
|
||||
|
||||
$result = $query->get()->getRowArray();
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
$emp_policy_ids[] = $result['id']; //for cash deposite
|
||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[15], 'uhid' => $value[16]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1766,18 +1768,17 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds' => $emp_policy_ids,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'count' => $emp_count,
|
||||
'event' => $file['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
'user_id' => $user_id,
|
||||
];
|
||||
|
||||
|
||||
// $depositeData = [
|
||||
// 'employeeIds' => $emp_policy_ids,
|
||||
// 'client_id' => $client_id,
|
||||
// 'client_policy_id' => $client_policy_id,
|
||||
// 'client_branch_id' => $client_branch_id,
|
||||
// 'count' => $emp_count,
|
||||
// 'event' => $file['event_type'],
|
||||
// 'policy_name' => $policy_name['policy_name'],
|
||||
// 'user_id' => $user_id,
|
||||
// ];
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForInception', 'payload' => [
|
||||
@ -1813,8 +1814,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Endorsement Correction
|
||||
public function importCorrectionValidation($params)
|
||||
{
|
||||
@ -2229,7 +2228,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
//Endorsement SIEnhancement
|
||||
public function importSIEnhancementValidation($params)
|
||||
{
|
||||
@ -2866,7 +2864,7 @@ class EmpDataServiceController extends BaseController
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
// array_pop($excel_data);
|
||||
|
||||
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
||||
|
||||
@ -3276,24 +3274,25 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = $totals + $value[13];
|
||||
$endorsement_id = $value[15];
|
||||
|
||||
if(!empty($emp_code) && !empty($emp_name)){
|
||||
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
||||
|
||||
// dd($result['emp_endorsement_primarykey']);
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -103,6 +103,8 @@ class EmployeeController extends AdminController
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
|
||||
// dd( $data['getData']);
|
||||
|
||||
// dd($this->request->getGet());
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
$this->loadLayout('employee_list', $data);
|
||||
@ -252,6 +254,7 @@ class EmployeeController extends AdminController
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
|
||||
}
|
||||
|
||||
$data['page_name'] = 'View Inception';
|
||||
|
||||
//for TPA/insurer upload
|
||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
@ -413,7 +416,6 @@ class EmployeeController extends AdminController
|
||||
$event_type = $this->request->getPost('event_type');
|
||||
}
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Import Export -- Function called');
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
@ -463,10 +465,10 @@ class EmployeeController extends AdminController
|
||||
if (!$return) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
session()->setFlashdata('error', "No data was found for this action. The TPA ID has already been updated.");
|
||||
session()->setFlashdata('error', "No data was found for this action.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
session()->setFlashdata('error', "No data was found for this action. The UHID has already been updated.");
|
||||
session()->setFlashdata('error', "No data was found for this action.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else {
|
||||
@ -532,7 +534,6 @@ class EmployeeController extends AdminController
|
||||
$batch_data['event_type'] = $array;
|
||||
$return = $empDataServiceController->generateExcelForAllEventType($batch_data);
|
||||
|
||||
|
||||
if($return === 6){
|
||||
|
||||
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||
@ -547,6 +548,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
@ -1511,8 +1513,11 @@ class EmployeeController extends AdminController
|
||||
$client_id = $json->client_id;
|
||||
$policy_id = $json->policy_id;
|
||||
$branch_id = $json->branch_id;
|
||||
$unit_id = $json->unit_id;
|
||||
$action = $json->action;
|
||||
$family_code = $json->emp_code;
|
||||
$tabledata = $json->data;
|
||||
|
||||
$existing_famility_details = [];
|
||||
if(count($tabledata))
|
||||
{
|
||||
$family_details = [];
|
||||
@ -1523,7 +1528,7 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
|
||||
$temp[0] = $row['column1'];//sno
|
||||
$temp[1] = $row['column2'];//emp code
|
||||
$temp[1] = $family_code != "" ? $family_code : $row['column2'];//emp code
|
||||
$temp[2] = $row['column3'];//name
|
||||
$temp[3] = $row['column4'];//DOB
|
||||
$temp[4] = strtoupper($row['column5']);//Gender
|
||||
@ -1540,14 +1545,29 @@ class EmployeeController extends AdminController
|
||||
$temp[15] = '';//RFE
|
||||
$temp[16] = '';//DOE
|
||||
$temp[17] = '';//Unit
|
||||
$temp[18] = $row['column11'];//unit
|
||||
$temp[18] = $unit_id;//unit
|
||||
$family_details[] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($family_details);
|
||||
// return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
if($action == 'dependent_addition')
|
||||
{
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $family_code,client_id: $client_id,client_policy_id: $policy_id,emp_status: ['active'],policy_status:['active'],client_branch_id: [ $branch_id ]);
|
||||
// ~dd($this->employeeModel->getLastQuery());
|
||||
|
||||
if(!count($existing_famility_details))
|
||||
{
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'data' => [],'messgae' => "No Data found for emp code $family_code"], 200);
|
||||
}
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,[]);
|
||||
// Kint::dump($existing_famility_details);
|
||||
$family_details = array_merge($family_details,$existing_famility_details);
|
||||
$family_details = data_group_by_family($family_details)[ $family_code ];// reason to call this again is bring self to first index of the array
|
||||
// dd($family);
|
||||
}
|
||||
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
|
||||
$policy_details = (array)$policy_details[0];
|
||||
@ -1570,7 +1590,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['new' => $data,'old' => $existing_famility_details], 200]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ use App\Models\EmpEndorsementModel;
|
||||
use App\Models\MessageModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\InsurerModel;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
@ -41,6 +42,7 @@ class EmployeeServiceController extends AdminController
|
||||
protected $messageModel;
|
||||
protected $clientBranchModel;
|
||||
protected $notificationModel;
|
||||
protected $insurerModel;
|
||||
|
||||
protected $general_relationships = [
|
||||
'self' => [
|
||||
@ -649,6 +651,7 @@ class EmployeeServiceController extends AdminController
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
}
|
||||
|
||||
public function excelFileFormatValidation($params)
|
||||
@ -1295,21 +1298,31 @@ class EmployeeServiceController extends AdminController
|
||||
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
// kint::dump($excel_data);
|
||||
$endorsement_data = [];
|
||||
|
||||
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$insurer = new InsurerModel();
|
||||
$insurer = ($insurer->find($policy_terms[0]->insurer_id));
|
||||
// kint::dump($insurer);
|
||||
//make closure funciton which is going to use only by this method
|
||||
$endorsement = function($data,$file,$row){
|
||||
$endorsement = function($data,$file,$row) use ($insurer){
|
||||
|
||||
$group_key = rand(100000, 999999);
|
||||
$row[4] = change_date_format($row[4],'d-M-Y','Y-m-d');// date of exit from excel
|
||||
// Kint::dump($row[4]);
|
||||
// check if insurer configured with add one day for deletion
|
||||
if($insurer['deletion_add_day'] == true)
|
||||
{
|
||||
$row[4] = (new \DateTime($row[4]))->modify('+1 day')->format('Y-m-d');
|
||||
}
|
||||
// dd($row[4]);
|
||||
//for emp table
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
// dd( $this->empEndorsementModel->getLastQuery());
|
||||
// $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
|
||||
// for employee policy table
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => $row[4],'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'inactive','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
};
|
||||
@ -1326,6 +1339,7 @@ class EmployeeServiceController extends AdminController
|
||||
// dd($employee);
|
||||
if(is_array($employee) && count($employee))
|
||||
{
|
||||
// dd($employee);
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','d')
|
||||
->where('table_name','employees')
|
||||
->where('endorsement_id is null')
|
||||
@ -1334,9 +1348,10 @@ class EmployeeServiceController extends AdminController
|
||||
->where('field_name','emp_status')
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($existing_endorsements);
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
// dd($employee);
|
||||
if(strtolower($employee['relationship']) != 'self')
|
||||
{
|
||||
|
||||
@ -1654,6 +1669,10 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
}// if end
|
||||
}// is array check end
|
||||
else
|
||||
{
|
||||
$this->myLogger->logme('error','######Incoming value is not an array');
|
||||
}
|
||||
}// for end
|
||||
}//function end
|
||||
|
||||
|
||||
@ -152,8 +152,65 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insurer_templete_count'] = $this->insurerTemplateModel->where(['insurer_id' => $id, 'is_active' => 1])->countAllResults();
|
||||
$editData['insurer_templete_list'] = $this->insurerModel->getInsurerTemplateByInsurerID($id);
|
||||
|
||||
|
||||
$editData['policy_type'] = $this->policyTypeModel->whereIn('id', [1,2,6,7])->findAll();
|
||||
$editData['events'] = ['inception' => 'Inception', 'addition' => 'Addition', 'dependent_addition' => 'Dependent Addition', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement', 'all' => 'All'];
|
||||
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$editData['db_column_name'] = [
|
||||
|
||||
'Employee Name' => 'emp_name',
|
||||
'Employee ID' => 'emp_code',
|
||||
'Date of Birth' => 'emp_dob',
|
||||
'Gender' => 'emp_gender',
|
||||
'Change Event' => 'change_event',
|
||||
'Relationship' => 'emp_relationship',
|
||||
'Relationship Code' => 'emp_relationship_code',
|
||||
'Event Type' => 'event_type_data',
|
||||
'Date of Joining' => 'emp_doj',
|
||||
'Mobile' => 'emp_mobile',
|
||||
'Corporate Email' => 'emp_email_c',
|
||||
'Personal Email' => 'emp_email_p',
|
||||
'Grade' => 'emp_grade',
|
||||
'Designation' => 'emp_designation',
|
||||
'Basic Pay' => 'emp_basic_pay',
|
||||
'Age' => 'emp_age',
|
||||
'Employee Type' => 'emp_type',
|
||||
'Primary Key' => 'primaryKey',
|
||||
'TPA ID' => 'tpa_id',
|
||||
'UHID' => 'uhid',
|
||||
'Pre-existing Alignments' => 'pre_existing_alignments',
|
||||
'Basic Cover SI' => 'basic_cover_si',
|
||||
'Date of Coverage' => 'date_coverage',
|
||||
'Policy End Date' => 'policy_end_date',
|
||||
'Number of Days' => 'no_of_days',
|
||||
'Premium' => 'premium',
|
||||
'Pro Rata Premium' => 'pro_rata_premium',
|
||||
'GST' => 'gst',
|
||||
'Total' => 'total',
|
||||
'Policy ID' => 'emp_policy_id',
|
||||
'SEZ' => 'sez',
|
||||
'Endorsement ID' => 'endorsement_id',
|
||||
'Old Value' => 'old_value',
|
||||
'New Value' => 'new_value',
|
||||
'Field Name' => 'field_name',
|
||||
'Remarks' => 'remarks',
|
||||
'Actions' => 'actions',
|
||||
'Date of Exit' => 'dateofexit',
|
||||
'Reason for Exit' => 'reasonforexit',
|
||||
'Status' => 'status',
|
||||
'Old Basic Cover SI' => 'old_basic_cover_si',
|
||||
'Old SI Premium' => 'old_si_premium',
|
||||
'New Basic Cover SI' => 'new_basic_cover_si',
|
||||
'New SI Premium' => 'new_si_premium',
|
||||
'Date of Coverage' => 'date_of_coverage',
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
@ -207,6 +264,10 @@ class MasterController extends AdminController
|
||||
$data['addition_add_day'] = 1;
|
||||
}
|
||||
|
||||
if($this->request->getPost('deletion_add_day')){
|
||||
$data['deletion_add_day'] = 1;
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['insurer_logo'] = $file_name;
|
||||
|
||||
@ -285,6 +346,12 @@ class MasterController extends AdminController
|
||||
$data['addition_add_day'] = 0;
|
||||
}
|
||||
|
||||
if($this->request->getPost('deletion_add_day')){
|
||||
$data['deletion_add_day'] = 1;
|
||||
}else{
|
||||
$data['deletion_add_day'] = 0;
|
||||
}
|
||||
|
||||
$update = $this->insurerModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
@ -347,6 +414,8 @@ class MasterController extends AdminController
|
||||
$insurer_data = $this->insurerModel
|
||||
->select('insurers.name as insurer_name, insurers.id, insurers.is_multi_event')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = insurers.id')
|
||||
->where('insurer_excel_export_template.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->groupBy('insurers.id')
|
||||
->findAll();
|
||||
|
||||
@ -355,8 +424,8 @@ class MasterController extends AdminController
|
||||
|
||||
public function copyInsurerTemplete($existing_insurer_id, $copy_insurer_id)
|
||||
{
|
||||
$insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $existing_insurer_id)->findAll();
|
||||
$existing_insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $copy_insurer_id)->delete();
|
||||
$insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $existing_insurer_id)->where('is_active', 1)->findAll();
|
||||
$existing_insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $copy_insurer_id)->set('is_active', 0)->update();
|
||||
|
||||
$data_to_insert = [];
|
||||
foreach ($insurer_templete_data as $value) {
|
||||
@ -372,12 +441,29 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
$insert_result = $this->insurerTemplateModel->insertBatch($data_to_insert);
|
||||
|
||||
if($insert_result){
|
||||
return $this->respond(['status' => true, 'message' => 'Template added successfully', $insurer_templete_data]);
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to add template', $insurer_templete_data]);
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to add template', $insurer_templete_data]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSingleExcelTemplate($id = null)
|
||||
{
|
||||
$insurer_templete_data = $this->insurerTemplateModel
|
||||
->where('id', $id)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if($insurer_templete_data){
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $insurer_templete_data, 'message' => 'data found'], 200);
|
||||
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
|
||||
}
|
||||
// Insurer Ends
|
||||
@ -386,7 +472,6 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
// TPA Start
|
||||
|
||||
public function tpaList()
|
||||
{
|
||||
$this->myLogger->logme('error','TPA list function called');
|
||||
@ -709,10 +794,11 @@ class MasterController extends AdminController
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
//Ends TPA Models
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Start KYC
|
||||
public function kycList()
|
||||
@ -901,8 +987,9 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
|
||||
//Start Policy
|
||||
|
||||
|
||||
//Start Policy
|
||||
public function policyTypeList()
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type list function called');
|
||||
@ -1098,13 +1185,15 @@ class MasterController extends AdminController
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
//end policies
|
||||
|
||||
|
||||
|
||||
|
||||
//start CD Master list
|
||||
public function CDMasterList()
|
||||
{
|
||||
{
|
||||
$data['page_name'] = 'CD Master List';
|
||||
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
@ -1254,4 +1343,101 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//excel export template
|
||||
public function createExcelTemplate()
|
||||
{
|
||||
// return $this->respond($this->request->getPost());
|
||||
$template_id = $this->request->getPost('template_id');
|
||||
|
||||
$data = [
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'policy_type_id' => $this->request->getPost('policy_type'),
|
||||
'event_name' => $this->request->getPost('event'),
|
||||
'type_name' => 'export',
|
||||
'jsoncolumns' => $this->request->getPost('json_data'),
|
||||
'is_active' => 1,
|
||||
'created_by' => get_session_userid(),
|
||||
];
|
||||
|
||||
if($template_id){
|
||||
|
||||
$update = $this->insurerTemplateModel->where('id', $template_id)->set($data)->update();
|
||||
|
||||
if($update){
|
||||
return $this->respond(['status' => true, 'message' => 'Template updated successfully', $data]);
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to update template', $data]);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$insert = $this->insurerTemplateModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true, 'message' => 'Template created successfully', $data]);
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to create template', $data]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function duplicateTemplate($template_id, $event_name)
|
||||
{
|
||||
// Fetch the template data based on the provided ID and ensure it is active
|
||||
$insurer_template_data = $this->insurerTemplateModel->where('id', $template_id)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
|
||||
if ($insurer_template_data) {
|
||||
|
||||
// Check if the event name matches the existing template's event name
|
||||
if ($insurer_template_data['event_name'] == $event_name) {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'message' => 'Template with the same event already exists.',
|
||||
'data' => $insurer_template_data
|
||||
]);
|
||||
}
|
||||
|
||||
// Prepare data for insertion as a duplicate
|
||||
$data_to_insert = [
|
||||
"insurer_id" => $insurer_template_data['insurer_id'],
|
||||
"policy_type_id" => $insurer_template_data['policy_type_id'],
|
||||
"event_name" => $event_name,
|
||||
"type_name" => $insurer_template_data['type_name'],
|
||||
"jsoncolumns" => $insurer_template_data['jsoncolumns'],
|
||||
"created_by" => get_session_user(),
|
||||
"is_active" => 1,
|
||||
];
|
||||
|
||||
// Insert the duplicate template data
|
||||
$insert_result = $this->insurerTemplateModel->insert($data_to_insert);
|
||||
|
||||
if ($insert_result) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'Template duplicated successfully.',
|
||||
'data' => $insurer_template_data
|
||||
]);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'message' => 'Failed to duplicate template.',
|
||||
'data' => $insurer_template_data
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
// No matching active template found
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'message' => 'No active template data found.',
|
||||
'data' => null
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,7 +35,7 @@ class UserController extends AdminController
|
||||
|
||||
public function list()
|
||||
{
|
||||
$data['headerData'] = 'User List';
|
||||
$data['page_name'] = 'User';
|
||||
$this->myLogger->logme('error','User list function called');
|
||||
$data['UserList'] = $this->userModel->getUserList();
|
||||
// echo '<pre>';
|
||||
@ -47,54 +47,60 @@ class UserController extends AdminController
|
||||
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->myLogger->logme('error','User create function called');
|
||||
$teams = $this->request->getPost('team');
|
||||
|
||||
{
|
||||
$this->myLogger->logme('error', 'User create function called');
|
||||
$teams = $this->request->getPost('team');
|
||||
|
||||
//if this is get method return to user creation page
|
||||
if(!$this->request->getPost()){
|
||||
if (!$this->request->getPost()) {
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
}else{
|
||||
|
||||
} else {
|
||||
|
||||
$userData = $this->request->getPost();
|
||||
$userData['created_by'] = get_session_userid();
|
||||
$temp_team = $userData['team'];
|
||||
unset($userData['team']);
|
||||
$insert = $this->userModel->insert($userData);
|
||||
if($insert){
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
|
||||
if($userData['role'] == 1){
|
||||
if ($insert) {
|
||||
|
||||
if ($userData['role'] == 3) {
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
$admin = 1;
|
||||
}else{
|
||||
$admin = 0;
|
||||
}
|
||||
foreach ($temp_team as $key => $value) {
|
||||
$team = $this->teamModel->where('id' , $value)->first();
|
||||
if($team['name'] == 'Claims'){
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
'registration' => time(),
|
||||
];
|
||||
|
||||
$db->table($tableName)->insert($hdz_staff);
|
||||
}
|
||||
}
|
||||
|
||||
$teamData['user_id'] = $insert ;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
$password = '12345678'; //Default password
|
||||
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
foreach ($temp_team as $key => $value) {
|
||||
$team = $this->teamModel->where('id', $value)->first();
|
||||
if ($team['name'] == 'Claims') {
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
'registration' => time(),
|
||||
'password' => $hashedPassword,
|
||||
'active' => 1,
|
||||
];
|
||||
|
||||
$db->table($tableName)->insert($hdz_staff);
|
||||
}
|
||||
}
|
||||
|
||||
$teamData['user_id'] = $insert;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->myLogger->logme('error','User create Successfully created by id {data}', ['data' => get_session_userid()]);
|
||||
$this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]);
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
}
|
||||
|
||||
@ -110,62 +116,65 @@ class UserController extends AdminController
|
||||
}
|
||||
|
||||
public function edit()
|
||||
{
|
||||
$teams = $this->request->getPost('team');
|
||||
{
|
||||
$teams = $this->request->getPost('team');
|
||||
|
||||
if(!$this->request->getPost()){
|
||||
if (!$this->request->getPost()) {
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
}else{
|
||||
} else {
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$userData = $this->request->getPost();
|
||||
unset($userData['csrf_test_name']);
|
||||
unset($userData['PrimaryKey']);
|
||||
|
||||
// Update data in the 'users' table based on the $id
|
||||
$userData['updated_by'] = get_session_userid();
|
||||
$update = $this->userModel->where('id', $id )->set($userData)->update();
|
||||
$update = $this->userModel->where('id', $id)->set($userData)->update();
|
||||
|
||||
if($update){
|
||||
if ($update) {
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
if ($userData['role'] == 3) {
|
||||
|
||||
if($userData['role'] == 1){
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
$admin = 1;
|
||||
}else{
|
||||
$admin = 0;
|
||||
}
|
||||
|
||||
foreach ($userData['team'] as $key => $value) {
|
||||
if($value == 2){
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
];
|
||||
|
||||
foreach ($userData['team'] as $key => $value) {
|
||||
if ($value == 2) {
|
||||
|
||||
$db->table($tableName)->where('emp_code', $userData['emp_code'])
|
||||
->where('email', $userData['email'])
|
||||
->set($userData)
|
||||
->update();
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
'registration' => time(),
|
||||
'active' => 1,
|
||||
];
|
||||
|
||||
|
||||
$db->table($tableName)->where('emp_code', $userData['emp_code'])
|
||||
->where('email', $userData['email'])
|
||||
->set($hdz_staff)
|
||||
->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->userTeamsModel->where('user_id', $id)->delete();
|
||||
|
||||
$this->userTeamsModel->where('user_id', $id)->delete();
|
||||
if($teams){
|
||||
$teamData['user_id'] = $id ;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
}
|
||||
if ($teams) {
|
||||
$teamData['user_id'] = $id;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function deactive($id = null)
|
||||
|
||||
@ -241,6 +241,13 @@ if(!function_exists('check_si'))
|
||||
$return_array = array('status' => true,'error' => '');
|
||||
}
|
||||
|
||||
if($policy_details['policy_type_id'] == 3 && strtolower($row['5']) == 'self') // if GMC parent and current relation is self then skip this . so set all true;
|
||||
{
|
||||
$is_si_found = true;
|
||||
$is_age_slab_found = true;
|
||||
$return_array = array('status' => true,'error' => '');
|
||||
}
|
||||
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','SI','MI']))// check rule only of action column data available
|
||||
{
|
||||
$received_si = $row['current_action'] == 'SI' ? $row[3] : $row[6];
|
||||
|
||||
@ -45,14 +45,14 @@ class ClientModel extends Model
|
||||
->where('is_active',1)
|
||||
->findAll();
|
||||
|
||||
// if($role_id == 2 || $role_id == 3){
|
||||
if($role_id == 2 || $role_id == 3){
|
||||
|
||||
// $clients = $this->select($columns)
|
||||
// ->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
// ->where('client_rm.user_id', $user_id)
|
||||
// ->where('clients.is_active',1)
|
||||
// ->findAll();
|
||||
// }
|
||||
$clients = $this->select($columns)
|
||||
->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
->where('client_rm.user_id', $user_id)
|
||||
->where('clients.is_active',1)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -84,6 +84,7 @@ class ClientModel extends Model
|
||||
$clientBranchModel = new ClientBranchModel();
|
||||
$clientBranchs = $clientBranchModel->select(['client_branch.id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id','client_branch.units'])
|
||||
->where('client_branch.client_id',$client['id'])
|
||||
->where('client_branch.is_active',1)
|
||||
->findAll();
|
||||
|
||||
$client['branchs'] = $clientBranchs;
|
||||
|
||||
@ -22,7 +22,6 @@ class ClientPolicyModel extends Model
|
||||
"reminder_date",
|
||||
"open_date",
|
||||
"close_date",
|
||||
"close_date",
|
||||
"insured",
|
||||
"no_of_employees",
|
||||
"no_of_lives",
|
||||
|
||||
@ -105,6 +105,8 @@ class EmployeePolicyModel extends Model
|
||||
'emp.basic_pay',
|
||||
'emp.band as grade',
|
||||
'policy_type.policy_type',
|
||||
'client_branch.branch_name as client_branch_name',
|
||||
'client_branch.branch_code as client_branch_code',
|
||||
'cp.policy_no',
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
@ -116,6 +118,7 @@ class EmployeePolicyModel extends Model
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id', 'left') //tpab - tpa branch
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
|
||||
->orderBy('emp.emp_code', 'ASC')
|
||||
->orderBy('employee_polices.employee_id', 'ASC');
|
||||
|
||||
@ -202,10 +205,11 @@ class EmployeePolicyModel extends Model
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.change_event AS change_event,
|
||||
employees.relationship AS emp_relationship,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
'$datas' as event_type_data,
|
||||
employees.change_event AS change_event,
|
||||
|
||||
|
||||
employees.doj AS emp_doj,
|
||||
employees.mobile AS emp_mobile,
|
||||
@ -294,10 +298,11 @@ class EmployeePolicyModel extends Model
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.client_id AS emp_client_id,
|
||||
employees.emp_type as emp_temp_codeype,
|
||||
employees.emp_type as emp_type,
|
||||
employee_polices.uhid,
|
||||
employees.relationship_code,
|
||||
employees.relationship,
|
||||
employee_polices.tpa_id,
|
||||
employees.relationship_code as emp_relationship_code,
|
||||
employees.relationship as emp_relationship,
|
||||
'C' as event_type_data,
|
||||
|
||||
employees.doj AS emp_doj,
|
||||
@ -385,7 +390,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.designation AS emp_designation,
|
||||
employees.basic_pay AS emp_basic_pay,
|
||||
|
||||
employee_polices.uhid AS risk_id,
|
||||
employee_polices.uhid AS uhid,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
||||
|
||||
@ -20,6 +20,7 @@ class InsurerModel extends Model
|
||||
"is_active",
|
||||
"addition_add_day",
|
||||
"is_multi_event",
|
||||
"deletion_add_day",
|
||||
|
||||
];
|
||||
|
||||
@ -35,6 +36,7 @@ class InsurerModel extends Model
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getInsurerName($insurerId)
|
||||
{
|
||||
// Fetch the insurer name based on the insurer ID
|
||||
@ -50,6 +52,23 @@ class InsurerModel extends Model
|
||||
|
||||
return null; // or handle accordingly if the insurer is not found
|
||||
}
|
||||
|
||||
public function getInsurerTemplateByInsurerID($insurer_id)
|
||||
{
|
||||
$insurer_data = $this->db->table('insurer_excel_export_template')
|
||||
->select('insurer_excel_export_template.*, insurers.name as insurer_name, insurers.is_multi_event')
|
||||
->select('CASE WHEN insurers.is_multi_event = 1 THEN "All" ELSE insurer_excel_export_template.event_name END as event_name', false)
|
||||
->select('insurer_excel_export_template.type_name, insurer_excel_export_template.jsoncolumns, policy_type.policy_type')
|
||||
->join('insurers', 'insurers.id = insurer_excel_export_template.insurer_id')
|
||||
->join('policy_type', 'policy_type.id = insurer_excel_export_template.policy_type_id')
|
||||
->where('insurers.id', $insurer_id)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('insurer_excel_export_template.is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $insurer_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -23,11 +23,10 @@ class PolicesModel extends Model
|
||||
|
||||
public function getPolicyPremium($policy_id){
|
||||
|
||||
return $this->db->table('policies')
|
||||
return $this->db->table('client_policy')
|
||||
->select('policy_type.*')
|
||||
->select('policies.name as policy_name')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('policies.id', $policy_id)
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.id', $policy_id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
@ -259,9 +259,16 @@ $(document).ready(function () {
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
console.error("Error Details:");
|
||||
console.error("Status Code:", xhr.status);
|
||||
console.error("Status Text:", xhr.statusText);
|
||||
console.error("Response Text:", xhr.responseText);
|
||||
console.error("Ready State:", xhr.readyState);
|
||||
console.error("Response Headers:", xhr.getAllResponseHeaders());
|
||||
console.error("Error Thrown:", error);
|
||||
console.error("Status:", status);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -241,6 +241,10 @@ table.dataTable thead th {
|
||||
$('#opening_bal').val('');
|
||||
$('#CDMasterForm')[0].reset();
|
||||
$('#CDMasterForm').parsley().reset();
|
||||
$('#client_id').prop("disabled", false);
|
||||
$('#insurer_id').prop("disabled", false);
|
||||
$('#cd_ac_no').prop("disabled", false);
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -261,9 +265,12 @@ table.dataTable thead th {
|
||||
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
|
||||
$('#CD_Master_ID').val(res.data.id);
|
||||
$('#client_id').val(res.data.client_id).change();
|
||||
$('#client_id').prop("disabled", true);
|
||||
$('#insurer_id').val(res.data.insurer_id).change();
|
||||
$('#insurer_id').prop("disabled", true);
|
||||
$('#opening_date').val(res.data.opening_date);
|
||||
$('#cd_ac_no').val(res.data.cd_ac_no);
|
||||
$('#cd_ac_no').prop("disabled", true);
|
||||
$('#opening_bal').val(res.data.opening_bal);
|
||||
$('#btnSubmit').html('Update');
|
||||
|
||||
@ -279,6 +286,10 @@ table.dataTable thead th {
|
||||
$('#cd_ac_no').change(function(){
|
||||
|
||||
var cd_ac_no = $(this).val();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
cd_ac_no = cd_ac_no.trim();
|
||||
console.log(cd_ac_no +'-'+cd_ac_no.length);
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,
|
||||
|
||||
@ -371,6 +371,8 @@ $("#branch_form").submit(function(event) {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log('client branch submit response', res)
|
||||
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
|
||||
@ -380,11 +382,17 @@ $("#branch_form").submit(function(event) {
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = (branch_PrimaryKey === '') ?
|
||||
'Client Branch Created successfully' :
|
||||
'Client Branch Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
|
||||
if(res.status == false){
|
||||
toastr.error(res.message, 'Error');
|
||||
}else{
|
||||
toastr.success(res.message, 'Success');
|
||||
}
|
||||
// var message = (branch_PrimaryKey === '') ?
|
||||
// 'Client Branch Created successfully' :
|
||||
// 'Client Branch Updated successfully';
|
||||
// toastr.success(message, 'Success');
|
||||
}, 800);
|
||||
}
|
||||
|
||||
$('#branch_list tr').remove();
|
||||
@ -395,7 +403,7 @@ $("#branch_form").submit(function(event) {
|
||||
console.log(role)
|
||||
$.each(res.data, function(index, item) {
|
||||
|
||||
console.log('client_branch_data', item)
|
||||
// console.log('client_branch_data', item)
|
||||
|
||||
if(role != 3 && role != 4){
|
||||
|
||||
@ -433,8 +441,8 @@ $("#branch_form").submit(function(event) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
console.log('Something Wrong!', 'warning');
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -696,10 +704,10 @@ function removeClientBranch(element) {
|
||||
// console.log(res.status == true);
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
toastr.success('Client branch removed successfully', 'success');
|
||||
toastr.success(res.message, 'success');
|
||||
location.reload();
|
||||
} else {
|
||||
toastr.warning('Failed to remove client branch', 'warning');
|
||||
toastr.warning(res.message, 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -145,15 +145,15 @@
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter OpenS Date " name="open_date" id="open_date" >
|
||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Open Date " name="open_date" id="open_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" >
|
||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
@ -195,10 +195,13 @@
|
||||
$(open_data).show();
|
||||
$(close_data).show();
|
||||
$(reminder_data).show();
|
||||
$('.dateofdata').attr('required', true);
|
||||
}else{
|
||||
$(open_data).hide();
|
||||
$(close_data).hide();
|
||||
$(reminder_data).hide();
|
||||
$('.dateofdata').attr('required', false);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -286,7 +289,7 @@
|
||||
delete data.role;
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
console.log('step 1');
|
||||
// console.log('step 1');
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
@ -341,7 +344,7 @@
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.open_date)} / ${(item.close_date)}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -447,8 +450,8 @@
|
||||
var policyDataId = $('#policy').children('option:selected').attr('data-id');
|
||||
var basePolicyDataId = $('#base_policy').children('option:selected').attr('data-id');
|
||||
|
||||
// //console.log('policyDataId', policyDataId);
|
||||
// //console.log('basePolicyDataId', basePolicyDataId);
|
||||
//console.log('policyDataId', policyDataId);
|
||||
//console.log('basePolicyDataId', basePolicyDataId);
|
||||
|
||||
if (policy_PrimaryKey === '' && policy_client === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
@ -525,7 +528,7 @@
|
||||
delete res.data.role;
|
||||
|
||||
$.each(res.data, function(index, item) {
|
||||
console.log(item);
|
||||
// console.log(item);
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
@ -675,72 +678,17 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy').change(function() {
|
||||
$('#policy_type').change(function() {
|
||||
|
||||
var id = $(this).val();
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
var branch_id = $('#client_branch').val();
|
||||
var client_id = $('#client_id_policy').val();
|
||||
var policy_type_id = $(this).val();
|
||||
|
||||
console.log('client_id', client_id)
|
||||
console.log('branch_id', branch_id)
|
||||
console.log('policy_type_id', dataId)
|
||||
console.log('client_policy_id', $('#policy_PrimaryKey').val())
|
||||
|
||||
|
||||
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
var url = '<?php echo base_url('util/check_policy_type/') ?>' + dataId + '/' + branch_id + '/' + client_id;
|
||||
|
||||
|
||||
if (dataId == 1) {
|
||||
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
} else {
|
||||
$('#tpa').prop('required', true);
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
var base_policy_dataId = $('#base_policy').children('option:selected').attr('data-id');
|
||||
|
||||
if ($('#policy_type').val() == 1) {
|
||||
|
||||
// //console.log('step 1')
|
||||
|
||||
if (dataId == 3) {
|
||||
|
||||
// //console.log('step 2')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').show();
|
||||
$('#base_danger').hide();
|
||||
// $('#base_policy').prop('required', true);
|
||||
|
||||
if (displayStatus === 'none') {
|
||||
// //console.log('step 2.1')
|
||||
|
||||
$('#base_policy').val('').change();
|
||||
}
|
||||
|
||||
// $('#base_policy').find('option[data-id="3"]').hide();
|
||||
|
||||
} else {
|
||||
|
||||
// //console.log('step 3')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_danger').show();
|
||||
// $('#base_policy').prop('required', false);
|
||||
|
||||
if (displayStatus === 'none') {
|
||||
// //console.log('step 3.1')
|
||||
$('#base_policy').val('').change();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -798,12 +746,13 @@
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#insurer_policy_id').val(res.data.policy_id);
|
||||
$('#policy_no').val(res.data.policy_no);
|
||||
// $('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#open_date').val(rearrangeDateFormat(res.data.open_date));
|
||||
// $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
$('#close_date').val(rearrangeDateFormat(res.data.close_date));
|
||||
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
||||
$('#gst_no').val(gst);
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#policy_status_field').show();
|
||||
|
||||
|
||||
@ -812,11 +761,13 @@
|
||||
$('#open_date').parent().show();
|
||||
$('#close_date').parent().show();
|
||||
$('#reminder_date').parent().show();
|
||||
$('.dateofdata').attr('required', true);
|
||||
} else {
|
||||
$('#inception_type').prop('checked', false);
|
||||
$('#open_date').parent().hide();
|
||||
$('#close_date').parent().hide();
|
||||
$('#reminder_date').parent().hide();
|
||||
$('.dateofdata').attr('required', false);
|
||||
}
|
||||
|
||||
|
||||
@ -920,6 +871,15 @@
|
||||
}
|
||||
|
||||
|
||||
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
} else {
|
||||
$('#tpa').prop('required', true);
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||
@ -971,6 +931,8 @@
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
console.log('OpenEnrollment response', res);
|
||||
|
||||
if (res) {
|
||||
if (res.open_for_enrollment) {
|
||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||
@ -1054,11 +1016,11 @@
|
||||
return rearrangedDate;
|
||||
} else {
|
||||
// Handle unexpected date format
|
||||
return '00-00-0000';
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
// Handle the case where inputDate is not a valid string
|
||||
return '00-00-0000';
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1171,13 +1133,23 @@
|
||||
function convertCommaNumberToWords(input) {
|
||||
|
||||
let number;
|
||||
if (input instanceof HTMLElement) {
|
||||
|
||||
// console.log( 'input type step 1', typeof input);
|
||||
|
||||
if (input instanceof HTMLElement && input.value) {
|
||||
// Ensure input.value is defined and not null
|
||||
const inputValue = input.value;
|
||||
number = parseFloat(inputValue.replace(/,/g, ''), 10);
|
||||
} else {
|
||||
} else if (input) {
|
||||
// console.log( 'input type step 2', typeof input);
|
||||
// Handle the case where input is a string
|
||||
number = parseFloat(input.replace(/,/g, ''), 10);
|
||||
} else {
|
||||
// Handle the case where input is undefined or null
|
||||
number = NaN; // or handle as needed
|
||||
}
|
||||
|
||||
|
||||
const [integerPart, decimalPart] = number.toFixed(2).split('.');
|
||||
const integerWord = convertNumberToWords(parseInt(integerPart, 10));
|
||||
let result = `${integerWord}`;
|
||||
@ -1224,7 +1196,12 @@
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
|
||||
//console.log('formetted value', value);
|
||||
// console.log('formatNumber function formetted value', value);
|
||||
// console.log('formatNumber function formetted value type',typeof value);
|
||||
|
||||
if(value == 'NaN' || value == 'null' || value == 'undefined'){
|
||||
value = '';
|
||||
}
|
||||
|
||||
input.value = (value);
|
||||
|
||||
@ -1232,6 +1209,7 @@
|
||||
if (input.id == 'gpa_si') {
|
||||
gpaSumInsureMultiplier();
|
||||
}
|
||||
|
||||
convertCommaNumberToWords(input);
|
||||
|
||||
if (input.id == 'gpa_sum_si') {
|
||||
@ -1308,7 +1286,7 @@
|
||||
$.get(url_for_get_policy_type_list, function(response){
|
||||
|
||||
console.log(response)
|
||||
console.log(response.data)
|
||||
// console.log(response.data)
|
||||
|
||||
appendBasePolicyList(response.data);
|
||||
|
||||
@ -1489,7 +1467,7 @@
|
||||
|
||||
|
||||
var uri = '<?= base_url('client/policy/list/') ?>' + client_policy_id
|
||||
console.log('uri', uri)
|
||||
// console.log('uri', uri)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -1631,9 +1609,9 @@
|
||||
function appendBasePolicyList(data, select = null)
|
||||
{
|
||||
|
||||
console.log('appendBasePolicyList', 'function called');
|
||||
console.log('appendBasePolicyList data', data);
|
||||
console.log('appendBasePolicyList selected value', select);
|
||||
// console.log('appendBasePolicyList', 'function called');
|
||||
// console.log('appendBasePolicyList data', data);
|
||||
// console.log('appendBasePolicyList selected value', select);
|
||||
|
||||
$('#base_policy').empty();
|
||||
$('#base_policy').append($('<option>', {
|
||||
@ -1674,9 +1652,9 @@
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var id = element.getAttribute('data-id');
|
||||
console.log(id)
|
||||
// console.log(id)
|
||||
var form_action = '<?= base_url("client/policy/remove/") ?>' + id;
|
||||
console.log(form_action)
|
||||
// console.log(form_action)
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
@ -1688,7 +1666,7 @@
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res)
|
||||
console.log('removepolicy function response', res)
|
||||
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
|
||||
@ -30,6 +30,10 @@
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.dataTables_filter{
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||
@ -42,219 +46,154 @@
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Employees</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<!-- <th class="font-weight-medium">Employee code</th> -->
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer <br> name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">Risk ID</th>
|
||||
<th class="font-weight-medium">Policy <br> status</th>
|
||||
<th class="font-weight-medium">(₹)Sum Insured</th>
|
||||
<th class="font-weight-medium">(₹)Premium</th>
|
||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">
|
||||
(₹)Pro Rata <br> Premium</th>
|
||||
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST
|
||||
</th>
|
||||
<!-- <th class="font-weight-medium">Action</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||
<th class="font-weight-medium">Client/Branch</th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||
<th class="font-weight-medium">Branch</th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">Risk ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">(₹)Sum Insured</th>
|
||||
<th class="font-weight-medium">(₹)Premium</th>
|
||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">(₹)Pro Rata <br> Premium</th>
|
||||
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if (isset($employees)) {
|
||||
$pro_rata_total = 0;
|
||||
$gst_total = 0;
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1); ?></b></td>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> - <?php echo $employee['relationship']?> )</td>
|
||||
<!-- <td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td> -->
|
||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></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>';
|
||||
}elseif ($employee['status'] == 'enrolled') {
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo format_indian_number($employee['basic_cover_si'])?> </td>
|
||||
<td><?php echo format_indian_number($employee['premium'])?></td>
|
||||
<td><?php $pro_rata_total = $pro_rata_total + $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum'])?></td>
|
||||
<td><?php $gst_total = $gst_total + $employee['gst']; echo format_indian_number($employee['gst'])?></td>
|
||||
<!-- <td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</td> -->
|
||||
</tr>
|
||||
<?php }}?>
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||
<td><?php echo $employee['client_short_name'] . ' - ' . $employee['client_branch_name']; ?></td>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th><?php echo format_indian_number($pro_rata_total) ?></th>
|
||||
<th><?php echo format_indian_number($gst_total) ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||
<td><?php echo $employee['client_branch_name']; ?></td>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<td><?php echo $employee['name'] . ' (' . $employee['emp_code'] . ' - ' . $employee['relationship'] . ')'; ?></td>
|
||||
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
|
||||
<td><?php echo $employee['insurer_short_name']; ?></td>
|
||||
<td><?php echo $employee['tpa_id']; ?></td>
|
||||
<td><?php echo $employee['uhid']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
switch ($employee['status']) {
|
||||
case 'draft':
|
||||
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||
break;
|
||||
case 'active':
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
break;
|
||||
case 'inactive':
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
break;
|
||||
case 'expired':
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
break;
|
||||
case 'enrolled':
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
break;
|
||||
default:
|
||||
echo $employee['status'];
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo format_indian_number($employee['basic_cover_si']); ?></td>
|
||||
<td><?php echo format_indian_number($employee['premium']); ?></td>
|
||||
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
|
||||
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
|
||||
<th></th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($getData)) { ?>
|
||||
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
|
||||
<th></th>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th><?php echo format_indian_number($pro_rata_total); ?></th>
|
||||
<th><?php echo format_indian_number($gst_total); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css">
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
<script src="https://unpkg.com/tippy.js@6"></script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
var ticketsTable = $('#tickets-table');
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Employee-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)', // Adjust as needed
|
||||
footer: true // Include the footer in the export
|
||||
}
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "82px"
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Member-List',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true,
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// // Function to format a number in Indian Rupees format
|
||||
// function formatNumberInIndianRupees(number) {
|
||||
// const maxLength = 24;
|
||||
// let value = number.toString().replace(/[^\d.]/g, ''); // Remove non-numeric characters
|
||||
|
||||
// // Limit the number of digits before the decimal point
|
||||
// if (value.includes('.')) {
|
||||
// let parts = value.split('.');
|
||||
// parts[0] = parts[0].slice(0, maxLength); // Limit the integer part
|
||||
// value = parts.join('.');
|
||||
// } else {
|
||||
// value = value.slice(0, maxLength);
|
||||
// }
|
||||
|
||||
// // Convert to a number and format with commas using the Indian numbering system
|
||||
// const formattedNumber = Number(value).toLocaleString('en-IN', {
|
||||
// maximumFractionDigits: 2 // Optional: limit to 2 decimal places if required
|
||||
// });
|
||||
|
||||
// return formattedNumber;
|
||||
// }
|
||||
|
||||
|
||||
// // Function to format numbers based on a class
|
||||
// function formatNumbersByClass(className) {
|
||||
// const elements = document.querySelectorAll(`.${className}`);
|
||||
// elements.forEach(element => {
|
||||
// const number = parseFloat(element.innerText.replace(/,/g, ''));
|
||||
|
||||
// if (!isNaN(number)) {
|
||||
// element.innerText = formatNumberInIndianRupees(number);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// // Format numbers when the DOM content is loaded
|
||||
// document.addEventListener("DOMContentLoaded", function() {
|
||||
// setTimeout(() => {
|
||||
|
||||
// formatNumbersByClass('indian-number');
|
||||
|
||||
// }, 500);
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
|
||||
// var table = $('#tickets-table').DataTable({
|
||||
// "footer": true
|
||||
// });
|
||||
|
||||
// var sumColumn9 = table.column(9).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b);
|
||||
// }, 0);
|
||||
|
||||
// console.log(sumColumn9)
|
||||
|
||||
// var sumColumn10 = table.column(10).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b);
|
||||
// }, 0);
|
||||
|
||||
// console.log(sumColumn10)
|
||||
|
||||
// $('#tickets-table tfoot th:eq(9)').html(sumColumn9);
|
||||
// $('#tickets-table tfoot th:eq(10)').html(sumColumn10);
|
||||
// });
|
||||
</script>
|
||||
@ -1004,7 +1004,12 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
}else{
|
||||
$("#event_type").removeAttr("multiple");
|
||||
$("#event_type").attr("name", "event_type");
|
||||
$("#event_type").select2('destroy');
|
||||
|
||||
if ($('event_type').data('select2')) {
|
||||
$('event_type').select2('destroy');
|
||||
}
|
||||
|
||||
// $("#event_type").select2('destroy');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@
|
||||
<a data-id="<?php echo $file['id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
|
||||
|
||||
<?php if ($file['status'] == 'success') { ?>
|
||||
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
|
||||
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate2" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
@ -246,7 +246,7 @@ $('body').on('click', '.upload_button', function() {
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.truncate', function(event) {
|
||||
$('body').on('click', '.truncate2', function(event) {
|
||||
event.preventDefault();
|
||||
// console.log(event);
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
|
||||
@ -84,12 +84,20 @@ input:checked + .slider:before {
|
||||
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
|
||||
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_download_btn" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when Addition/Dependent addition</label>
|
||||
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when Addition/Dependent addition</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
|
||||
<input id="deletion_add_day" type="checkbox" name="deletion_add_day" <?= (isset($insurer['deletion_add_day']) && $insurer['deletion_add_day'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="deletion_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of Deletion </label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -199,6 +207,8 @@ input:checked + .slider:before {
|
||||
setTimeout(function(){
|
||||
window.location.href = '<?= base_url('master/insurer/list/')?>' + res.data.id
|
||||
}, 100)
|
||||
}else{
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -1,6 +1,55 @@
|
||||
<style>
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
max-width: 80px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.select2-hidden-accessible + .select2-container .select2-dropdown {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
color: #000000;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
#dynamic-form-container {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
max-height: 300px;
|
||||
}
|
||||
|
||||
/* Custom scrollbar styles */
|
||||
#dynamic-form-container::-webkit-scrollbar {
|
||||
width: 8px; /* Set the width of the scrollbar */
|
||||
}
|
||||
|
||||
#dynamic-form-container::-webkit-scrollbar-thumb {
|
||||
background-color: #888; /* Color of the scrollbar thumb */
|
||||
border-radius: 4px; /* Rounded corners of the scrollbar thumb */
|
||||
}
|
||||
|
||||
#dynamic-form-container::-webkit-scrollbar-thumb:hover {
|
||||
background-color: #555; /* Color of the scrollbar thumb on hover */
|
||||
}
|
||||
|
||||
#dynamic-form-container::-webkit-scrollbar-track {
|
||||
background-color: #f1f1f1; /* Background color of the scrollbar track */
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="template-tab">
|
||||
|
||||
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
|
||||
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
|
||||
<input type="hidden" id="insurer_id" value="<?= $insurer['id'] ?>">
|
||||
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email">Existing Insurer Export<span class="text-danger">*</span></label>
|
||||
@ -9,21 +58,258 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="position: relative;top: 28px;">
|
||||
<div class="form-group col-md-6" style="position: relative;top: 28px;">
|
||||
<label for="email"><span class="text-danger"></span></label>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;left: 80px;">
|
||||
<label for="email"><span class="text-danger"></span></label>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="addNewJsonExportTemplate(this)">Add New</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>S.NO</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Event Type</th>
|
||||
<th>Import/Export</th>
|
||||
<th>Template</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($insurer_templete_list)){ ?>
|
||||
<?php foreach($insurer_templete_list as $key => $value ){ ?>
|
||||
<tr>
|
||||
<td><?= $key+1; ?></td>
|
||||
<td><?= $value['policy_type']; ?></td>
|
||||
<td><?= $value['event_name']; ?></td>
|
||||
<td><?= $value['type_name']; ?></td>
|
||||
<td style="overflow: hidden;" class="truncate" ><?= $value['jsoncolumns']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#" onclick="editJSONExportTemplate(this, '<?= $value['id']; ?>')"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" id="template_id_for_duplicate" data-id="<?= $value['id']; ?>" data-toggle="modal" data-target="#centermodal"><i class="mdi mdi-content-duplicate mr-2 text-muted font-18 vertical-middle"></i>Duplicate</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="template_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Create Template</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="parsley-examples" method="post" id="templateForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="insurer_id" value="<?= $insurer['id'] ?>">
|
||||
<input type="hidden" name="template_id" id="template_id">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="policy_type">Policy Type<span class="text-danger">*</span></label>
|
||||
<select name="policy_type" class="form-control" id="policy_type" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($policy_type)){ ?>
|
||||
<?php foreach ($policy_type as $key => $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['policy_type']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select name="event" class="form-control" id="event" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($events)){ ?>
|
||||
<?php foreach ($events as $key => $event) { ?>
|
||||
<option value="<?= $key ?>"><?= $event?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<label for="action">Action<span class="text-danger">*</span></label>
|
||||
<select name="import_or_export" class="form-control" id="import_or_export" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($action)){ ?>
|
||||
<?php foreach ($action as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"><?= $value?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- <div class="form-row dynamic-form-row">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="excel_column_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input class="form-control" type="text" name="excel_column_name[]">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="db_column_name">DataBase Column Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="db_column_name[]" required>
|
||||
<option selected>Select DB Column</option>
|
||||
<?php if (!empty($db_column_name)){ ?>
|
||||
<?php foreach ($db_column_name as $key => $value) { ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div id="dynamic-form-container"></div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Duplicate Template</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="event_name_for_duplicate" id="event_name_for_duplicate">
|
||||
<option value="">Select</option>
|
||||
<option value="inception">Inception</option>
|
||||
<option value="addition">Addition</option>
|
||||
<option value="dependent_addition">Dependent Addition</option>
|
||||
<option value="deletion">Deletion</option>
|
||||
<option value="correction">Correction</option>
|
||||
<option value="si_enhancement">SI Enhancement</option>
|
||||
<option value="si_enhancement">All</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="dublicateTemplate(this)">Duplicate</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#insurer').select2();
|
||||
// $('#event').select2();
|
||||
featchInsurerList()
|
||||
})
|
||||
|
||||
$('#templateForm').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var jsonString = createFormArray();; // Convert the array to a JSON string
|
||||
console.log(jsonString);
|
||||
|
||||
var formData = new FormData($('#templateForm')[0]);
|
||||
var url = '<?= base_url("util/create_excel_template") ?>';
|
||||
|
||||
formData.append('json_data', jsonString);
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('Export template list:', response);
|
||||
|
||||
if(response.status == false){
|
||||
toastr.error(response.message,'Error');
|
||||
}else{
|
||||
toastr.success(response.message,'Success');
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
// Detailed error handling
|
||||
console.error("Request failed with status: " + status + ", error: " + error);
|
||||
|
||||
// Log detailed response information
|
||||
console.error('Response status code:', xhr.status);
|
||||
console.error('Response status text:', xhr.statusText);
|
||||
console.error('Response readyState:', xhr.readyState);
|
||||
console.error('Response text:', xhr.responseText);
|
||||
|
||||
// Optionally log additional details
|
||||
console.error('Response headers:', xhr.getAllResponseHeaders());
|
||||
console.error('Response URL:', xhr.responseURL);
|
||||
|
||||
// Example of throwing a detailed error for further handling
|
||||
throw new Error(`AJAX Request failed:
|
||||
Status: ${status},
|
||||
Error: ${error},
|
||||
Status Code: ${xhr.status},
|
||||
Status Text: ${xhr.statusText},
|
||||
Response: ${xhr.responseText}
|
||||
`);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function featchInsurerList()
|
||||
{
|
||||
@ -54,7 +340,8 @@
|
||||
|
||||
function appendInsurer(data)
|
||||
{
|
||||
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
console.log('insurer_id', insurer_id);
|
||||
$('#insurer').empty();
|
||||
$('#insurer').append($('<option>', {
|
||||
value: '',
|
||||
@ -63,11 +350,13 @@
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.insurer_name
|
||||
});
|
||||
$('#insurer').append(option);
|
||||
if(insurer_id != item.id){
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.insurer_name
|
||||
});
|
||||
$('#insurer').append(option);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@ -139,6 +428,7 @@
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
}
|
||||
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -149,4 +439,241 @@
|
||||
});
|
||||
}
|
||||
|
||||
function addNewJsonExportTemplate(input)
|
||||
{
|
||||
$('#myCenterModalLabel').text('Create Template');
|
||||
$('#dynamic-form-container').empty();
|
||||
addHTMLInput();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('template_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function addHTMLInput(element = null, data = null)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="excel_column_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input id="excel_column_name" value="${data !== null && data !== undefined && data !== '' ? data.column_name : ''}" class="form-control" type="text" name="excel_column_name[]" placeholder="Excel Header Column Name">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="db_column_name">DataBase Column Name<span class="text-danger"></span></label>
|
||||
<select class="form-control db-column-name-select" name="db_column_name[]" onchange="checkForDuplicates(this)">
|
||||
<option value="" selected >Select</option>
|
||||
<?php if (!empty($db_column_name)){ ?>
|
||||
<?php foreach ($db_column_name as $key => $value) { ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
|
||||
if (data !== null && data.db_column_name !== undefined) {
|
||||
const selectElement = newRow.querySelector('.db-column-name-select');
|
||||
selectElement.value = data.db_column_name;
|
||||
}
|
||||
}
|
||||
|
||||
// function removeHTMLInput(element)
|
||||
// {
|
||||
// const row = element.closest('.dynamic-form-row');
|
||||
// row.remove();
|
||||
// }
|
||||
|
||||
|
||||
function removeHTMLInput(element)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||
|
||||
if (rows.length > 1) {
|
||||
const row = element.closest('.dynamic-form-row');
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function createFormArray()
|
||||
{
|
||||
var formArray = [];
|
||||
|
||||
try {
|
||||
var columnNames = $('input[name="excel_column_name[]"]');
|
||||
var dbColumnNames = $('select[name="db_column_name[]"]');
|
||||
|
||||
// Check if both arrays are of the same length
|
||||
if (columnNames.length !== dbColumnNames.length) {
|
||||
throw new Error('Mismatch between the number of column names and database column names.');
|
||||
}
|
||||
|
||||
// Iterate over the column names and build the formArray
|
||||
columnNames.each(function(index) {
|
||||
var columnName = $(this).val();
|
||||
var dbColumnName = dbColumnNames.eq(index).val() ?? null;
|
||||
|
||||
// if (!columnName) {
|
||||
// throw new Error(`Column name at index ${index} is empty.`);
|
||||
// }
|
||||
// if (!dbColumnName) {
|
||||
// throw new Error(`Database column name at index ${index} is empty.`);
|
||||
// }
|
||||
|
||||
var columnObj = {
|
||||
'column_index': index,
|
||||
'column_name': columnName,
|
||||
'db_column_name': dbColumnName
|
||||
};
|
||||
formArray.push(columnObj);
|
||||
});
|
||||
|
||||
console.log('Form array successfully created:', formArray);
|
||||
var jsonString = JSON.stringify(formArray);
|
||||
console.log('Form array successfully created: jsonString', jsonString);
|
||||
return jsonString;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error creating form array:', error.message);
|
||||
// Optionally, display an error message to the user
|
||||
alert('An error occurred while processing the form: ' + error.message);
|
||||
return null; // Return null to indicate that an error occurred
|
||||
}
|
||||
}
|
||||
|
||||
function editJSONExportTemplate(input, id)
|
||||
{
|
||||
console.log(id);
|
||||
$('#template_id').val(id);
|
||||
$('#myCenterModalLabel').text('Edit Template');
|
||||
var url = '<?php echo base_url('util/get_single_excel_template/'); ?>' + id;
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('editJSONExportTemplate response', res)
|
||||
|
||||
$('#policy_type').val(res.data.policy_type_id);
|
||||
$('#event').val(res.data.event_name);
|
||||
|
||||
// console.log(res.data.jsoncolumns);
|
||||
var data = JSON.parse(res.data.jsoncolumns)
|
||||
// console.log(JSON.parse(res.data.jsoncolumns));
|
||||
|
||||
$('#dynamic-form-container').empty();
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
addHTMLInput(null, item)
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('template_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function checkForDuplicates(selectElement)
|
||||
{
|
||||
|
||||
const selectedValue = selectElement.value;
|
||||
const selects = document.querySelectorAll('#dynamic-form-container .db-column-name-select');
|
||||
|
||||
let isDuplicate = false;
|
||||
|
||||
selects.forEach(select => {
|
||||
if (select !== selectElement && select.value === selectedValue) {
|
||||
isDuplicate = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (isDuplicate) {
|
||||
toastr.warning('This value is already selected in another dropdown.', 'Warning');
|
||||
selectElement.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
$('.close').click(function()
|
||||
{
|
||||
$('#dynamic-form-container').empty();
|
||||
$('#policy_type').val('');
|
||||
$('#event').val('').change();
|
||||
$('#excel_column_name').val('');
|
||||
$('#template_id').val('')
|
||||
});
|
||||
|
||||
function dublicateTemplate()
|
||||
{
|
||||
var template_id = $('#template_id_for_duplicate').attr('data-id');
|
||||
var event_name = $('#event_name_for_duplicate').val();
|
||||
|
||||
console.log('template_id_for_duplicate', template_id)
|
||||
console.log('event_name_for_duplicate', event_name)
|
||||
|
||||
if(event_name == ""){
|
||||
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: 'Please select the Event',
|
||||
icon: "warning"
|
||||
});
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
var url = '<?= base_url('util/dublicate_template/') ?>' + template_id + '/' + event_name
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('dublicateTemplate response', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == false){
|
||||
toastr.error(res.message, 'ERROR');
|
||||
}else{
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
}
|
||||
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -813,7 +813,8 @@
|
||||
|
||||
|
||||
<script>
|
||||
function formatDate(dateString) {
|
||||
function formatDate(dateString)
|
||||
{
|
||||
// Parse the input date string
|
||||
let date = new Date(dateString);
|
||||
|
||||
@ -840,6 +841,18 @@
|
||||
|
||||
return formattedDate;
|
||||
}
|
||||
|
||||
function printCurrentTime()
|
||||
{
|
||||
var now = new Date();
|
||||
var hours = now.getHours().toString().padStart(2, '0');
|
||||
var minutes = now.getMinutes().toString().padStart(2, '0');
|
||||
var seconds = now.getSeconds().toString().padStart(2, '0');
|
||||
var currentTime = hours + ':' + minutes + ':' + seconds;
|
||||
// console.log("Current Time:", currentTime);
|
||||
|
||||
return currentTime;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@ -509,7 +509,6 @@
|
||||
$('#gpa_client_policy_id').val(client_policy_id);
|
||||
|
||||
|
||||
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
@ -589,8 +588,9 @@
|
||||
});
|
||||
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2));
|
||||
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured));
|
||||
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2) ?? '' );
|
||||
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured) ?? '');
|
||||
|
||||
if (jsonObject.compassionateVisitExpenses == '1') {
|
||||
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
@ -615,6 +615,10 @@
|
||||
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
console.log('jsonObject key', key)
|
||||
console.log('jsonObject value', jsonObject[key])
|
||||
console.log('jsonObject value type',typeof jsonObject[key])
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
if (elements && elements.length > 0) {
|
||||
let element = elements[0];
|
||||
@ -625,15 +629,14 @@
|
||||
element.checked = jsonObject[key] === '1';
|
||||
} else if (element.type === 'radio') {
|
||||
element.checked = element.value === jsonObject[key];
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(jsonObject[key] == undefined){
|
||||
if(jsonObject[key] == undefined || jsonObject[key] == ''){
|
||||
element.value = " ";
|
||||
}else{
|
||||
element.value = jsonObject[key];
|
||||
element.value = jsonObject[key] ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -788,9 +791,11 @@
|
||||
});
|
||||
|
||||
|
||||
function appendGPASIAddMore(data = null){
|
||||
function appendGPASIAddMore(data = null)
|
||||
{
|
||||
|
||||
console.log('function called')
|
||||
console.log('appendGPASIAddMore function called')
|
||||
console.log('appendGPASIAddMore function data', data)
|
||||
|
||||
var html = `
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -36,91 +36,91 @@ const excel_headers = {
|
||||
1: {
|
||||
|
||||
1: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
},
|
||||
2: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"basic_pay": "Basic Pay",
|
||||
},
|
||||
3: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"band_or_grade": "Band or Grade",
|
||||
"sum_insured": "Sum Insured",
|
||||
}
|
||||
|
||||
},
|
||||
2: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
3: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"unit": "Units",
|
||||
"unit": "Unit",
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
@ -140,6 +140,10 @@ function copyHeaders(unique_id) {
|
||||
var client_units = localStorage.getItem('client_units');
|
||||
client_units = JSON.parse(client_units);
|
||||
|
||||
// console.log('copyHeaders function client_units', client_units);
|
||||
// console.log('copyHeaders function client_units.length', client_units.length)
|
||||
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
var obj = $('#grid');
|
||||
@ -183,14 +187,18 @@ function copyHeaders(unique_id) {
|
||||
}
|
||||
|
||||
var headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
console.log('copyHeaders function default headerString', headerString)
|
||||
|
||||
if (formatType == 1) {
|
||||
if(client_units.length = 1){
|
||||
// console.log('copyHeaders function formatType 1', formatType)
|
||||
if(client_units.length == 1){
|
||||
// console.log('copyHeaders function client_units.length', client_units.length)
|
||||
delete excel_headers[formatType][secondKey].unit;
|
||||
}
|
||||
var headerString = Object.values(excel_headers[formatType][secondKey]).join("\t"); // Using specified format type for copying headers
|
||||
}
|
||||
|
||||
console.log('headerString', headerString);
|
||||
console.log('copyHeaders function converted headerString', headerString);
|
||||
|
||||
|
||||
//console.log('headerString', headerString);
|
||||
@ -203,13 +211,18 @@ function copyHeaders(unique_id) {
|
||||
|
||||
function generateTable(unique_id) {
|
||||
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
console.log('generateTable Function called : ', printCurrentTime());
|
||||
|
||||
var client_units = localStorage.getItem('client_units');
|
||||
client_units = JSON.parse(client_units);
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
var secondKey = $('#si_or_bp').val();
|
||||
var secondKey = $('#si_or_bp').val() ?? '';
|
||||
|
||||
if (unique_id != 'na') {
|
||||
data = $('#copied_excel_data_'+unique_id).val();
|
||||
@ -217,10 +230,12 @@ function generateTable(unique_id) {
|
||||
obj = $('#grid_'+unique_id);
|
||||
}
|
||||
|
||||
// console.log('generateTable obj', obj);
|
||||
// console.log('generateTable formatType', formatType);
|
||||
// console.log('generateTable data', data);
|
||||
// console.log('generateTable secondKey', secondKey);
|
||||
console.log('generateTable obj', obj);
|
||||
console.log('generateTable formatType', formatType);
|
||||
// console.log('generateTable data');
|
||||
// console.log(data)
|
||||
console.log('generateTable secondKey', secondKey);
|
||||
console.log('generateTable client_units', client_units);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
@ -251,7 +266,6 @@ function generateTable(unique_id) {
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
console
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
@ -276,22 +290,40 @@ function generateTable(unique_id) {
|
||||
|
||||
|
||||
if (formatType == 1) {
|
||||
|
||||
//console.log('si_or_bp secondKey', secondKey)
|
||||
// console.log('si_or_bp secondKey', secondKey)
|
||||
expectedHeader = Object.keys(excel_headers[formatType][secondKey]);
|
||||
}
|
||||
|
||||
// remove unit key from the array, if the client unit is one
|
||||
if (client_units.length === 1) {
|
||||
expectedHeader = expectedHeader.filter(key => key !== 'unit');
|
||||
}
|
||||
|
||||
|
||||
// console.log('expectedHeader', expectedHeader);
|
||||
// console.log('HEADERS' , JSON.stringify(header))
|
||||
// console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
|
||||
// console.log('HEADERS' , JSON.stringify(header));
|
||||
// console.log('Excepted HEADERS' , JSON.stringify(expectedHeader));
|
||||
// console.log('secondKey' , secondKey);
|
||||
|
||||
|
||||
if (secondKey != 2) {
|
||||
|
||||
if (secondKey != 2 && secondKey != undefined) {
|
||||
// console.log('expectedHeader' + secondKey + '-' + formatType);
|
||||
console.log('expectedHeader', expectedHeader);
|
||||
// console.log(excel_headers[formatType]);
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
||||
|
||||
var expectedHeaders;
|
||||
|
||||
if (formatType == 1 ) {
|
||||
expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
||||
} else {
|
||||
expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||
}
|
||||
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
|
||||
console.log('receivedHeaders', receivedHeaders);
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
@ -457,8 +489,8 @@ function generateTable(unique_id) {
|
||||
}
|
||||
|
||||
|
||||
if(secondKey != 2){
|
||||
console.log(secondKey)
|
||||
if(secondKey != 2 && secondKey != undefined){
|
||||
// console.log(secondKey)
|
||||
if ($('.duplicate').length > 0) {
|
||||
//console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
@ -473,12 +505,23 @@ function generateTable(unique_id) {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(unique_id);
|
||||
submitData(unique_id, client_units);
|
||||
$('.excel_textarea').val('');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('generateTable Function end : ', printCurrentTime());
|
||||
|
||||
}
|
||||
|
||||
function submitData(unique_id)
|
||||
function submitData(unique_id, client_units)
|
||||
{
|
||||
console.log('submitData Function called : ', printCurrentTime());
|
||||
|
||||
console.log('submitData function unique id', unique_id);
|
||||
console.log('submitData function client_units', client_units);
|
||||
console.log('submitData function client_units first index', client_units[0]);
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
@ -492,7 +535,6 @@ function submitData(unique_id)
|
||||
var gpa_sum_multiplier = $('#gpa_sum_multiplier').val();
|
||||
|
||||
|
||||
|
||||
if (unique_id != 'na') {
|
||||
formatType = $('#grid_'+unique_id).val();
|
||||
table = $('#excel_table_'+unique_id+' table');
|
||||
@ -550,12 +592,24 @@ function submitData(unique_id)
|
||||
delete obj.band_or_grade;
|
||||
}
|
||||
|
||||
if (client_units.length == 1) {
|
||||
if (!('unit' in obj)) {
|
||||
obj.unit = client_units[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (formatType == 1) {
|
||||
|
||||
if (si_or_bp == 1) {
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier ? gpa_sum_multiplier : 0;
|
||||
if( obj.multiplier == 0){
|
||||
obj.premium = 0;
|
||||
}else{
|
||||
obj.premium = obj.si * obj.multiplier / 1000
|
||||
}
|
||||
|
||||
} else if (si_or_bp == 2) {
|
||||
|
||||
@ -569,16 +623,21 @@ function submitData(unique_id)
|
||||
|
||||
obj.si_or_bp = si_or_bp;
|
||||
obj.multiplier = gpa_sum_multiplier2 ? gpa_sum_multiplier2 : 0;
|
||||
if( obj.multiplier == 0){
|
||||
obj.premium = 0;
|
||||
}else{
|
||||
obj.premium = obj.si * obj.multiplier / 1000
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
console.log('formatType', formatType);
|
||||
// console.log('formatType', formatType);
|
||||
|
||||
if (unique_id != 'na') {
|
||||
|
||||
$('#grid_content_input_'+unique_id).empty()
|
||||
$('#grid_content_input_for_additional_'+unique_id).empty()
|
||||
|
||||
if ($('#copyfromexcel_'+unique_id).text() == "Manual entry") {
|
||||
$('#copyfromexcel_'+unique_id).text("Copy from excel")
|
||||
@ -586,7 +645,7 @@ function submitData(unique_id)
|
||||
$('#copyfromexcel_'+unique_id).text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input_'+unique_id).toggle();
|
||||
$('#grid_content_input_for_additional_'+unique_id).toggle();
|
||||
$('#grid_content_from_excel_'+unique_id).toggle();
|
||||
|
||||
} else {
|
||||
@ -608,14 +667,14 @@ function submitData(unique_id)
|
||||
unique_id = null;
|
||||
}
|
||||
|
||||
if (formatType == 1 || formatType == 2 || formatType == 4 || formatType == 6) {
|
||||
if (formatType == 1 || formatType == 2 || formatType == 4 || formatType == 6 || formatType == 9) {
|
||||
var FirstIndex = jsonData[0]
|
||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, unique_id)
|
||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, unique_id);
|
||||
jsonData.shift();
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, unique_id, item)
|
||||
appendGridtHtml(formatType, unique_id, item);
|
||||
});
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
@ -623,35 +682,61 @@ function submitData(unique_id)
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="basic_pay[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_si[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_basic_premium[]"]`).each(function() {
|
||||
// //console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_sum_si2[]"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_sum_si[]"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_premium"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_si"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_premium29[]"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
$(`input[name="gpa_si29[]"]`).each(function() {
|
||||
$(this).trigger('keyup');
|
||||
$(this).trigger('change').keyup();
|
||||
});
|
||||
|
||||
console.log('submitData Function end : ', printCurrentTime());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -78,10 +78,21 @@
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div> -->
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Action</label> <br />
|
||||
<select name="action" class="form-control" id="action">
|
||||
<!-- <option value="0">Select</option> -->
|
||||
<option value="inception" selected="selected">Inception/Addition</option>
|
||||
<option value="dependent_addition">Dependent Addition</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label>Employee Code</label> <br />
|
||||
<input type="text" class="form-control" id="emp_code" name="emp_code" value="">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="checkDependentConflict(event);" >Check Dependent conflict</a>
|
||||
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc premium</a>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a>
|
||||
@ -147,6 +158,34 @@
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="oldrestable" style="display: none;">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="small-width">SNO</th>
|
||||
<th class="small-width">Emp code</th>
|
||||
<th class="large-width">Name</th>
|
||||
<th class="medium-width">DOB</th>
|
||||
<th class="medium-width">Relation</th>
|
||||
<th class="large-width">Rack rate name</th>
|
||||
<th class="small-width">Grid ID</th>
|
||||
<th class="small-width">Is Self</th>
|
||||
<th class="small-width">Premium type</th>
|
||||
<th class="large-width">SI</th>
|
||||
<th class="medium-width">premium</th>
|
||||
<th class="small-width">Policy days</th>
|
||||
|
||||
<th class="small-width">no of days</th>
|
||||
<th class="medium-width">Rata premium</th>
|
||||
<th class="medium-width">GST</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id='oldrestablebody'>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
@ -540,16 +579,31 @@
|
||||
var policy_id = $('#policies').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
var unit_id = $('#unit_id').val();
|
||||
var action = $('#action').val();
|
||||
var emp_code = $('#emp_code').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select all values in dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == 'dependent_addition') {
|
||||
if(emp_code.trim() == "")
|
||||
{
|
||||
alert('Enter emp code');
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// return;
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id,
|
||||
branch_id: branch_id,
|
||||
unit_id: unit_id,
|
||||
action: action,
|
||||
emp_code: emp_code,
|
||||
data: tabledata,
|
||||
};
|
||||
|
||||
@ -577,8 +631,10 @@
|
||||
displayData(response.data);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
alert(response.messgae);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
alert('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -659,8 +715,21 @@
|
||||
|
||||
function displayData(data)
|
||||
{
|
||||
const tableBody = document.getElementById("restablebody");
|
||||
$("#restablebody").empty();
|
||||
displayTable(data.new,"restablebody");
|
||||
if(data.old.length)
|
||||
{
|
||||
$('#oldrestablebody').prop('display','block');
|
||||
displayTable(data.old,"oldrestablebody");
|
||||
}
|
||||
}
|
||||
function displayTable(data,tableID)
|
||||
{
|
||||
|
||||
var old_data = data.old;
|
||||
const tableBody = document.getElementById(tableID);
|
||||
// $(("#".tableID)).empty();
|
||||
$("#restable tbody").empty()
|
||||
$('#oldrestable tbody').empty();
|
||||
const existingRowCount = tableBody.rows.length;
|
||||
for(i = 0; i < data.length; i++)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user