diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index bff1d34f..d4bfa5d8 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -608,6 +608,8 @@ class ClientController extends AdminController $data['policy_types'] = $this->policyTypeModel->findAll(); $data['policy_type'] = ['1' => 'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon']; $data['client_type'] = ['1' => 'Group', '2' => 'Retail']; + $data['clients'] = $this->clientModel->where('is_active', 1)->findAll(); + $data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll(); // echo "
";
// print_r($data); die;
@@ -2178,6 +2180,7 @@ class ClientController extends AdminController
$insurer_id = $client_policy_data['insurer_id'];
$client_id = $client_policy_data['client_id'];
+ $insurer_branch_id = $client_policy_data['insurer_branch_id'];
if (!empty($client_policy_data['policy_start_date'])) {
$client_policy_data['source_policy_start_date'] = change_date_format($client_policy_data['policy_start_date'], 'Y-m-d', 'd/m/Y');
@@ -2198,7 +2201,8 @@ class ClientController extends AdminController
->findAll();
$client_policy_list = $this->clientPolicyModel->getPolicyTypeForPolicyBinding($client_id);
- $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll();
+ // $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->where('is_active', 1)->findAll();
+ $cd_data = $this->get_cd_ac($client_id, $insurer_id, $insurer_branch_id, "internal");
// $client_policy_data['policy_end_date'] = date('d/m/Y', strtotime($client_policy_data['policy_end_date']));
$fromDate = new \DateTime($client_policy_data['policy_end_date']);
$fromDate->modify('+1 year');
@@ -2604,9 +2608,7 @@ class ClientController extends AdminController
'special_condition_input' => true,
'multiple_sum_insured' => true,
];
-
- // $data = [];
-
+
foreach ($fields as $field => $needsCleanup) {
$value = $this->request->getPost($field);
@@ -2617,7 +2619,6 @@ class ClientController extends AdminController
}
}
-
$data['enrollment_display_key'] = $this->enrollmentGMCDisplayValueTransform();
// print_r($data);die;
@@ -3572,7 +3573,7 @@ class ClientController extends AdminController
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
}
- public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id)
+ public function get_cd_ac($client_id, $insurer_id, $insurer_branch_id, $return_type = null)
{
// Get client data
$client_data = $this->clientModel
@@ -3604,6 +3605,14 @@ class ClientController extends AdminController
$cd_data = array_merge($cd_data, $client_cd_data);
+ if($return_type == "internal"){
+ if(!empty($cd_data)){
+ return $cd_data;
+ }else{
+ return [];
+ }
+ }
+
if (!empty($cd_data)) {
return $this->respond([
'status' => true,
@@ -4213,7 +4222,7 @@ class ClientController extends AdminController
$client_data = [
'client_type' => $postData['client_type'],
'client_name' => $postData['client_name'],
- 'short_name' => $postData['short_name'],
+ 'short_name' => $postData['short_name'] ?? $postData['client_name'],
'pan' => $postData['pan'],
'client_code' => generate_client_code(),
];
@@ -5031,24 +5040,24 @@ class ClientController extends AdminController
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
- $employeeRestController = new EmployeeServiceController();
- // $employeeRestController->excelFileDataValidation(['file_id' => 1629]); die;
- // $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]);
- // $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
- // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
- // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
$empServiceController = new EmployeeServiceController();
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '865']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
+ // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 726]);
+ // $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
+ // $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]);
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
- // $res = $empServiceController->employeeDisembark(['file_id' => '1681']); dd( $res);
+ // $res = $empServiceController->employeeDisembark(['file_id' => '1681']);
+ // $res = $empServiceController->employeesCorrectionProcess(['file_id' => '1681']);
+ // dd( $res);
+
+ // ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
$policyTransactionController = new PolicyTransactionController();
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '17']);
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '22']);
// dd('-----', $res);
-
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
$batch_data = [
@@ -5079,44 +5088,26 @@ class ClientController extends AdminController
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
// $dashBoardController->sendRemainderMail($client_policy_data);
- // $EmpDataServiceController = new EmpDataServiceController();
// $emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard(12);
// $ids = array_column($emp_data, 'id');
- // $EmpDataServiceController->sendMailForDownloadingECard($ids);
$EmpDataServiceController = new EmpDataServiceController();
- // $return = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die;
- // $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die;
- // $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
- // $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
- // $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
- // $result = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
- // $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
-
- // $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data, 1); dd($result);
- // $result = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
+ // $res = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die;
+ // $res = $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die;
+ // $res = $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
+ // $res = $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
+ // $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
+ // $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
+ // $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
+ // $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 310]); dd($res);//for live
+ // $res = $EmpDataServiceController->getInceptionBasePremium(["13332","13333","13334","13335","13336"]); dd($res);//for live
+ // $res = $EmpDataServiceController->getDeletionBasePremium(["13248","13250","13249","13247"], json_decode('{"employeeIds":["13248","13250","13249","13247"],"client_id":"3927","client_policy_id":"6183","client_branch_id":"1874","cd_ac_no":"CD9751909505","endorsement_no":"END1238","count":4,"event_name":"deletion","policy_name":"GMC","user_id":"48"}', true)); dd($res);//for live
+ // $res = $EmpDataServiceController->makeEntryForBDSPolicyTransaction(json_decode('{"client_policy_id":"6187","endorsement_no":null,"emp_count":5,"action_type":"inception","no_of_insured":3,"no_of_dependent":0}', true)); dd($res);//for live
+ // $res = $EmpDataServiceController->sendMailForDownloadingECard($ids);
+ // $res = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data, 1); dd($result);
+ // $res = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
// return $this->downloadInsurerExcelExport($batch_data);
- // dd($result); die;
-
- // $empServiceController = new EmployeeServiceController();
- // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
-
- // $PolicyTransactionController = new PolicyTransactionController();
- // $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
-
- // $empServiceController = new EmployeeServiceController();
- // $res = $empServiceController->excelFileDataValidation(['file_id' => '1101']);
- // dd($res);
-
- // $EmpDataServiceController = new EmpDataServiceController();
- // $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
-
- // $EmpDataServiceController = new EmpDataServiceController();
- // $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
- // $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
- // $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
- // $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
- // $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
+ // dd($res); die;
// $params = [
// 'client_policy_id' => 6090,
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 6da138fd..38a7e190 100755
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -43,6 +43,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException;
use PhpParser\Node\Expr\Cast\Double;
+use Kint\Kint;
use function PHPUnit\Framework\returnSelf;
@@ -1576,6 +1577,7 @@ class EmpDataServiceController extends BaseController
if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
+ //verify the TPA ID is not null
if ($excel_data[$key][13] === null) {
$missing_id[$key][] = [
'row' => $key,
@@ -1585,6 +1587,8 @@ class EmpDataServiceController extends BaseController
];
}
} else if ($insurer_or_tpa == 'insurer') {
+
+ //verify the UHID or Risk ID is not null
if ($excel_data[$key][14] === null) {
$missing_id[$key][] = [
'row' => $key,
@@ -1716,7 +1720,7 @@ class EmpDataServiceController extends BaseController
];
}
- if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
+ if ($insurer_or_tpa == 'tpa') {
if ($emp_value['uhid'] != $excel_data[$key][14]) {
$errors[$key][] = [
@@ -1895,6 +1899,9 @@ class EmpDataServiceController extends BaseController
$emp_endorsement_table_data = [];
$enrollment_file_id = null;
$endorsement_id = null;
+ $no_of_insured = [];
+ $no_of_dependent = [];
+
$emp_count = count($excel_data);
$db = \Config\Database::connect();
@@ -1914,7 +1921,7 @@ class EmpDataServiceController extends BaseController
$totals = $totals + floatval($amount);
$query = $db->table('employee_polices');
- $query->select('employee_polices.id');
+ $query->select('employee_polices.id, employees.id as emp_id, employees.emp_code, employees.name as emp_name, employees.relationship');
$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);
@@ -1935,11 +1942,20 @@ class EmpDataServiceController extends BaseController
$query->limit(1);
$result = $query->get()->getRowArray();
+ // Kint::dump($result);
+
if (isset($result['id']) && $result['id'] !== null) {
$emp_policy_ids[] = $result['id']; //for cash deposite
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[13], 'uhid' => $value[14]);
+ if (strtolower($result['relationship']) == 'self') {
+ $no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }else{
+ $no_of_dependent[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }
}
+
+
if(in_array($file['event_type'], ['missed_inception']) && isset($value[18])){
$endorsement_id = $value[18];
@@ -2001,7 +2017,7 @@ class EmpDataServiceController extends BaseController
}
- // dd($emp_endorsement_table_data, $enrollment_file_id);
+ // dd($emp_endorsement_table_data, $enrollment_file_id, $no_of_insured, $no_of_dependent);
//update the employee policy data (TPAID or UHID)
$return = $this->employeePolicyModel->bulkUpdate($emp_details);
@@ -2021,6 +2037,10 @@ class EmpDataServiceController extends BaseController
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- batch file status : {data}', ['data' => $status_val]);
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- total amount for cash deposite : {data}', ['data' => $totals]);
+ //get the BASE PREMIUM and GST for BDS Entry
+ $base_bremium_and_gst = $this->getInceptionBasePremium($emp_policy_ids);
+ $this->myLogger->logme('error', 'Inception Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
+
//update CD transaction entry if only insurer
if ($file['insurer_or_tpa'] == 'insurer') {
@@ -2063,6 +2083,10 @@ class EmpDataServiceController extends BaseController
'endorsement_no' => $endorsement_id ?? null,
'emp_count' => $emp_count ?? null,
'action_type' => $file['event_type'] ?? null,
+ 'no_of_insured' => count($no_of_insured ?? []) ?? null,
+ 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
+ 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
+ 'gst' => $base_bremium_and_gst['gst'] ?? null,
]]);
// $this->cashDepositCalculationForInception($depositeData);
@@ -3005,6 +3029,8 @@ class EmpDataServiceController extends BaseController
$endorsement_id = '';
$enrollment_file_id = '';
$endorsement_details = [];
+ $no_of_insured = [];
+ $no_of_dependent = [];
$totals = 0;
foreach ($excel_data as $key => $value) {
@@ -3017,7 +3043,14 @@ class EmpDataServiceController extends BaseController
$result = $this->empEndorsementModel
- ->select('emp_endorsement.*, employees.id as emp_id, employee_polices.id as emp_policy_id')
+ ->select('
+ emp_endorsement.*,
+ employees.id as emp_id,
+ employees.name as emp_name,
+ employees.emp_code,
+ employees.relationship,
+ employee_polices.id as emp_policy_id
+ ')
->join('employee_polices', 'employee_polices.id = emp_endorsement.pk')
->join('employees', 'employees.emp_code = emp_endorsement.emp_code')
->where('employees.emp_code', $emp_code)
@@ -3043,6 +3076,11 @@ class EmpDataServiceController extends BaseController
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
$employeeIds[] = $result['emp_policy_id'];
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
+ if (strtolower($result['relationship']) == 'self') {
+ $no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }else{
+ $no_of_dependent[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }
}
$empData = $this->employeePolicyModel
@@ -3110,6 +3148,11 @@ class EmpDataServiceController extends BaseController
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
+ //get the BASE PREMIUM and GST for BDS Entry
+ $base_bremium_and_gst = $this->getInceptionBasePremium($employeeIds);
+ $this->myLogger->logme('error', 'SI Enhancement Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
+
+
//call the cash deposite function
if ($file['insurer_or_tpa'] == 'insurer') {
@@ -3133,6 +3176,10 @@ class EmpDataServiceController extends BaseController
'endorsement_no' => $endorsement_id ?? null,
'emp_count' => $emp_count ?? null,
'action_type' => $file['event_type'] ?? null,
+ 'no_of_insured' => count($no_of_insured ?? []) ?? null,
+ 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
+ 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
+ 'gst' => $base_bremium_and_gst['gst'] ?? null,
]]);
}
@@ -3521,6 +3568,8 @@ class EmpDataServiceController extends BaseController
$employee_policy_table_primaryKey = [];
$endorsement_id = '';
$enrollment_file_id = null; //files table primary key
+ $no_of_insured = [];
+ $no_of_dependent = [];
$totals = 0;
@@ -3554,6 +3603,12 @@ class EmpDataServiceController extends BaseController
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => change_date_format($result['date_of_exit']), 'reason_for_exit' => $result['reason_for_exit'], 'claim_status' => $result['claim_status'], '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');
+
+ if (strtolower($result['relationship']) == 'self') {
+ $no_of_insured[] = ['emp_id' => $result['employees_primarykey'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }else{
+ $no_of_dependent[] = ['emp_id' => $result['employees_primarykey'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
+ }
}
}
@@ -3603,6 +3658,9 @@ class EmpDataServiceController extends BaseController
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
$this->myLogger->logme('error', 'Deletion Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
+ $base_bremium_and_gst = $this->getDeletionBasePremium($employee_policy_table_primaryKey, ['client_policy_id' => $client_policy_id]);
+ $this->myLogger->logme('error', 'Deletion Base Premium and GST :'. json_encode($base_bremium_and_gst ?? []));
+
//call the cash deposite function
if ($file['insurer_or_tpa'] == 'insurer') {
@@ -3626,6 +3684,10 @@ class EmpDataServiceController extends BaseController
'endorsement_no' => $endorsement_id ?? null,
'emp_count' => $emp_count ?? null,
'action_type' => $file['event_type'] ?? null,
+ 'no_of_insured' => count($no_of_insured ?? []) ?? null,
+ 'no_of_dependent' => count($no_of_dependent ?? []) ?? null,
+ 'base_premium' => $base_bremium_and_gst['base_premium'] ?? null,
+ 'gst' => $base_bremium_and_gst['gst'] ?? null,
]]);
}
@@ -4290,8 +4352,6 @@ class EmpDataServiceController extends BaseController
}
-
-
/**
* Below function retrieves the policy name associated with a given client policy ID.
*
@@ -4308,8 +4368,6 @@ class EmpDataServiceController extends BaseController
}
-
-
/**
* Below function converts row data into column data format for SI enhancement.
*
@@ -4866,8 +4924,8 @@ class EmpDataServiceController extends BaseController
$this->myLogger->logme("error", "Policy transaction inserted successfully: " . json_encode(['insert_id' => $insert_id]));
//do not remove this commented item
- // $coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id);
- // $pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
+ $coShareDetails = $this->ConstructPTShareData($policy_data, $insert_id, $params);
+ $pt_co_share_id = $this->PTCOShareDetailsModel->insert($coShareDetails);
// $this->myLogger->logme("error", "PT Co share data inserted successfully: " . json_encode(['pt_co_share_id' => $pt_co_share_id]));
@@ -4903,11 +4961,12 @@ class EmpDataServiceController extends BaseController
private function constructBDSData($policy_data, $lead_data, $params)
{
-
+
+ $this->myLogger->logme("error", "constructBDSData Params: " . json_encode(['policy_data' => $policy_data, 'lead_data' => $lead_data, 'params' => $params]));
$action_type_string = $params['action_type'];
- if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
+ if(in_array($params['action_type'], ['dependent_addition', 'missed_inception'])){
$action_type_string = "addition";
- }
+ }
$policyTransactionData = [
@@ -4928,9 +4987,9 @@ class EmpDataServiceController extends BaseController
'policy_end_date' => $policy_data['policy_end_date'] ?? null,
'data_received_date' => $policy_data['data_received_date'] ?? null,
'closure_date' => $policy_data['closure_date'] ?? null,
- 'emp_count' => $policy_data['emp_count'] ?? null,
- 'dependent_count' => $policy_data['dependent_count'] ?? null,
- 'revenue_type' => ($lead_data['lead_type'] == 1 ? "NA" : ($lead_data['lead_type'] == 2 ? "EA" : "EANR") ) ?? null,
+ 'emp_count' => $params['no_of_insured'] ?? null,
+ 'dependent_count' => $params['no_of_dependent'] ?? null,
+ 'revenue_type' => isset($lead_data['lead_type']) ?($lead_data['lead_type'] == 1 ? "NA" : ($lead_data['lead_type'] == 2 ? "EA" : "EANR") ) : null,
'co_share' => $policy_data['co_share'] ?? 0,
'pre_payable_by' => $policy_data['pre_payable_by'] ?? 1,
'renewal_date' => $policy_data['policy_end_date'] ?? null,
@@ -4939,7 +4998,8 @@ class EmpDataServiceController extends BaseController
'is_cd_reduce_from_bds' => 0,
'client_type_id' => 0,
- 'status' => "co_insurer_pending",
+ // 'status' => "co_insurer_pending",
+ 'status' => "completed",
'action_type' => $action_type_string ?? null,
'endorsement_no' => $params['endorsement_no'] ?? null,
@@ -4954,18 +5014,23 @@ class EmpDataServiceController extends BaseController
return $policyTransactionData;
}
- private function ConstructPTShareData($policy_data, $pt_id)
+ private function ConstructPTShareData($policy_data, $pt_id, $params)
{
$coShareData = [
'pt_id' => $pt_id,
'insurer_id' => $policy_data['insurer_id'],
'insurer_branch_id' => $policy_data['insurer_branch_id'],
+ 'bp_amt' => $params['base_premium'],
+ 'cop_amt' => $params['base_premium'],
+ 'bp_gst_amt' => $params['gst'],
+ 'bp_sgst' => 9,
+ 'bp_cgst' => 9,
'co_share_type' => 1,
+ 'co_share_per' => 100,
];
$this->myLogger->logme("error", "Constructed PT co-share data: " . json_encode($coShareData));
-
return $coShareData;
}
@@ -5113,8 +5178,117 @@ class EmpDataServiceController extends BaseController
}
+ // --------------------------------------------------------------------------------------------------------------------------------
+
+ public function getInceptionBasePremium($ids)
+ {
+ $this->myLogger->logme('error', 'getInceptionBasePremium called with the params : ' . json_encode($ids ?? ""));
+
+ // Validate input
+ if (empty($ids) || !is_array($ids)) {
+ return ['base_premium' => 0, 'gst' => 0];
+ }
+ // Sanitize IDs to ensure they are integers
+ $sanitizedIds = array_filter(array_map('intval', $ids), function ($id) {
+ return $id > 0;
+ });
+ if (empty($sanitizedIds)) {
+ return ['base_premium' => 0, 'gst' => 0];
+ }
+ // Use parameter binding for security
+ $placeholders = str_repeat('?,', count($sanitizedIds) - 1) . '?';
+ $amount = $this->employeePolicyModel->query("
+ SELECT SUM(employee_polices.rata_premimum) AS base_premium,
+ SUM(employee_polices.gst) AS gst
+ FROM employee_polices
+ JOIN employees ON employees.id = employee_polices.employee_id
+ WHERE employee_polices.id IN ($placeholders)
+ ", $sanitizedIds)->getRowArray();
+
+ $this->myLogger->logme('error', 'Get Last Executed Query : '.db_connect()->getLastQuery());
+
+ // Ensure we return proper numeric values
+ return [
+ 'base_premium' => round($amount['base_premium'] ?? 0, 2),
+ 'gst' => round($amount['gst'] ?? 0, 2)
+ ];
+ }
+
+ public function getDeletionBasePremium($ids, $params)
+ {
+ $this->myLogger->logme('error', 'getDeletionBasePremium called with the params : ' . json_encode(['emp_policy_id' => $ids ?? [], 'params' => $params ?? []] ?? ""));
+
+ // Validate input
+ if (empty($ids) || !is_array($ids)) {
+ return ['base_premium' => 0, 'gst' => 0];
+ }
+
+ // Sanitize IDs to ensure they are integers
+ $sanitizedIds = array_filter(array_map('intval', $ids), function ($id) {
+ return $id > 0;
+ });
+
+ if (empty($sanitizedIds)) {
+ return ['base_premium' => 0, 'gst' => 0];
+ }
+
+ // Validate client_policy_id parameter
+ if (empty($params['client_policy_id'])) {
+ return ['base_premium' => 0, 'gst' => 0];
+ }
+
+ $get_insurer_id_from_client_policy = $this->clientPolicyModel
+ ->select('insurers.deletion_add_day')
+ ->join('insurers', 'client_policy.insurer_id = insurers.id')
+ ->where('client_policy.id', intval($params['client_policy_id']))
+ ->first();
+
+ $add_one_day = 0;
+ if (isset($get_insurer_id_from_client_policy['deletion_add_day']) && $get_insurer_id_from_client_policy['deletion_add_day'] == 1) {
+ $add_one_day = 1;
+ }
+
+ // Use parameter binding for security
+ $placeholders = str_repeat('?,', count($sanitizedIds) - 1) . '?';
+
+ // Prepare parameters array (ids repeated twice for both IN clauses)
+ $queryParams = array_merge($sanitizedIds, $sanitizedIds);
+
+ $amount = $this->employeePolicyModel->query("
+ SELECT
+ SUM(ROUND(
+ ((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, emp_endorsement.new_value) + ?)) / 365),
+ 2
+ )) AS base_premium,
+ SUM(ROUND(
+ (((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, emp_endorsement.new_value) + ?)) / 365) * 0.18),
+ 2
+ )) AS gst
+ FROM
+ employee_polices
+ JOIN
+ employees ON employees.id = employee_polices.employee_id
+ JOIN
+ emp_endorsement ON emp_endorsement.pk = employee_polices.id
+ WHERE
+ employee_polices.id IN ($placeholders)
+ AND emp_endorsement.pk IN ($placeholders)
+ AND employee_polices.claim_status = 0
+ AND emp_endorsement.field_name = 'date_of_exit'
+ AND emp_endorsement.is_active = 1
+ AND emp_endorsement.actions = 'd'
+ AND emp_endorsement.status != 'truncated'
+ ", array_merge([$add_one_day, $add_one_day], $queryParams))->getRowArray();
+
+ $this->myLogger->logme('error', 'Get Last Executed Query : '.db_connect()->getLastQuery());
+ // Ensure we return proper numeric values with rounding
+ return [
+ 'base_premium' => round($amount['base_premium'] ?? 0, 2),
+ 'gst' => round($amount['gst'] ?? 0, 2)
+ ];
+ }
}
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index 3d9ee4f6..dddedd54 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -1209,6 +1209,10 @@ class PolicyTransactionController extends BaseController
$client_branch_id = $issue_type['client_branch_id'];
}
+ // if($data['bro_payable_by'] == ""){
+ // $data['bro_payable_by'] = $issue_type['bro_payable_by'];
+ // }
+
if (!$data['id']) {
$data += [
@@ -1224,7 +1228,7 @@ class PolicyTransactionController extends BaseController
'policy_end_date' => $issue_type['policy_end_date'] ?? null,
'revenue_type' => $issue_type['revenue_type'] ?? null,
'co_share' => $issue_type['co_share'] ?? 0,
- 'bro_payable_by' => $issue_type['bro_payable_by'] ?? 0,
+ 'bro_payable_by' => $data['bro_payable_by'] == "" ? $issue_type['bro_payable_by'] ?? 0 : $data['bro_payable_by'],
'installment' => $issue_type['installment'] ?? null,
'installment_data' => $issue_type['installment_data'] ?? null,
'location' => $issue_type['location'] ?? null,
@@ -2279,7 +2283,9 @@ class PolicyTransactionController extends BaseController
// if all good return true, otherwise return false with messssage
foreach ($excel_data as $excel_key => $excel_row) {
$is_row_empty = check_row_is_empty_or_null($excel_row);
+
if (!$is_row_empty) {
+
// $excel_row = ExcelSanitizeHelper::sanitizeArrayData($excel_row);
$is_source_found = 0;
// Kint::dump($excel_key,$excel_row[1],$excel_row[2]);
@@ -2297,8 +2303,17 @@ class PolicyTransactionController extends BaseController
// Kint::dump($excel_key,$policy_no,$endorsement_no,$policy_start_date,$policy_end_date);//die();
foreach ($source_data as $source_key => $source_row) {
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
- // Kint::dump($source_endorsement_no);
- if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
+ // Kint::dump($source_row, $source_endorsement_no, $policy_no, $endorsement_no);
+
+ // if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
+ // {
+ // $is_source_found = 1;
+ // $line_items = $line_items + 1;
+ // unset($source_data[$source_key]);
+ // continue 2;
+ // }
+
+ if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no)
{
$is_source_found = 1;
$line_items = $line_items + 1;
@@ -2395,7 +2410,8 @@ class PolicyTransactionController extends BaseController
foreach ($source_data as $source_key => $source_row) {
// Kint::dump(change_date_format($excel_row[3],'d-m-Y','Y-m-d'));
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
- if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) {
+ // if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date, 'd-m-Y', 'Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name']) {
+ if (($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no) {
$is_source_found = 1;
//calculate percentage first
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index e6b02543..82a8cb3b 100755
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -1251,6 +1251,9 @@ class EmployeePolicyModel extends Model
ee.id as emp_endorsement_primarykey,
ep.id as emp_policy_primarykey,
e.id as employees_primarykey,
+ e.relationship,
+ e.emp_code,
+ e.name as emp_name,
ee.file_id,
ee.group_key,
(
@@ -2098,4 +2101,6 @@ class EmployeePolicyModel extends Model
// var_dump($this->db->getLastQuery());
return $data;
}
+
+
}
\ No newline at end of file
diff --git a/app/Views/cd_master_add_modal.php b/app/Views/cd_master_add_modal.php
index 738b9dcc..a7101a72 100644
--- a/app/Views/cd_master_add_modal.php
+++ b/app/Views/cd_master_add_modal.php
@@ -81,7 +81,7 @@
-
+
@@ -129,10 +129,10 @@
if(res.status == true){
toastr.warning(res.message, 'warning');
// $('#cd_ac_no').val('');
- $('#btnSubmit').prop('disabled',true);
+ $('#cd_master_btn_Submit').prop('disabled',true);
return;
}
- $('#btnSubmit').prop('disabled',false);
+ $('#cd_master_btn_Submit').prop('disabled',false);
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
@@ -283,7 +283,7 @@
$('#opening_bal').val('');
// $('#CDMasterForm').attr('action', '');
$('#title').html('Add Opening Amount');
- $('#btnSubmit').html('Submit');
+ $('#cd_master_btn_Submit').html('Submit');
var myModal = new bootstrap.Modal(document.getElementById('con-close-modal'));
myModal.show();
diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php
index 64dbaf47..8e7bb060 100755
--- a/app/Views/cd_master_list.php
+++ b/app/Views/cd_master_list.php
@@ -280,15 +280,15 @@ table.dataTable thead th {
$('#insurer_branch_id').val(res.data.insurer_id).change();
$('#insurer_branch_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);
+ $('#cd_ac_no_for_cd_master').val(res.data.cd_ac_no);
+ //$('#cd_ac_no_for_cd_master').prop("disabled", true);
$('#opening_bal').val(res.data.opening_bal);
if(res.cd_transaction_count <= 1){
$('#opening_bal').prop("disabled", false)
}else{
$('#opening_bal').prop("disabled", true)
}
- $('#btnSubmit').html('Update');
+ $('#cd_master_btn_Submit').html('Update');
},
error: function (xhr, status, error) {
diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php
index 2d3eb20d..335b55eb 100755
--- a/app/Views/client_basic_info.php
+++ b/app/Views/client_basic_info.php
@@ -113,7 +113,7 @@ input:checked + .slider:before {
-->
-
+
diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php
index 5a1b93ce..33ed64c8 100755
--- a/app/Views/insurer_export_templete.php
+++ b/app/Views/insurer_export_templete.php
@@ -472,13 +472,9 @@
newRow.className = 'form-row dynamic-form-row';
newRow.innerHTML = `
-
-
-
-
-
+
$value) { ?>
@@ -488,6 +484,11 @@
+
+
+
+
+
@@ -719,5 +720,43 @@
}
});
+ function handleDbColumnChange(element) {
+ console.log('=== SELECT CHANGE EVENT TRIGGERED ===');
+
+ let $defaultInput = $(element);
+ console.log('1. Current select element:', $defaultInput);
+ console.log('2. Current select value:', $defaultInput.val());
+
+ let $row = $defaultInput.closest('.form-row, .row');
+ console.log('3. Found row element:', $row);
+ console.log('4. Row exists:', $row.length > 0);
+
+ // Updated to find input instead of select for excel_column_name
+ let $excelInput = $row.find('input[name="excel_column_name[]"]');
+ console.log('5. Target input element:', $excelInput);
+ console.log('6. Target input exists:', $excelInput.length > 0);
+ console.log('7. Current target input value:', $excelInput.val());
+
+ // Get the selected option's text (the display text, not the value)
+ let selectedText = $defaultInput.find('option:selected').text().trim();
+ console.log('8. Selected option text:', selectedText);
+ console.log('9. Selected text length:', selectedText.length);
+
+ // Also get the selected value for comparison
+ let selectedValue = $defaultInput.val();
+ console.log('10. Selected option value:', selectedValue);
+
+ if (selectedText !== '' && selectedText !== 'Select') {
+ console.log('11. Setting target input value to:', selectedText);
+ $excelInput.val(selectedText);
+ console.log('12. Target input value after setting:', $excelInput.val());
+ } else {
+ console.log('11. Selected text is empty or "Select", clearing target input');
+ // $excelInput.val("");
+ console.log('12. Target input value after clearing:', $excelInput.val());
+ }
+
+ console.log('=== EVENT HANDLING COMPLETE ===');
+ }
\ No newline at end of file
diff --git a/app/Views/newClientModal.php b/app/Views/newClientModal.php
index 7343571a..dfe4d66a 100644
--- a/app/Views/newClientModal.php
+++ b/app/Views/newClientModal.php
@@ -86,7 +86,7 @@
-
+
diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php
index 5358566c..6408f18f 100755
--- a/app/Views/policy_gmc_terms.php
+++ b/app/Views/policy_gmc_terms.php
@@ -1136,286 +1136,289 @@
let jsonObject = JSON.parse(response.data);
disableUnwantedTerms(jsonObject);
- Object.keys(jsonObject).forEach(function(key) {
+ if(jsonObject){
+ Object.keys(jsonObject).forEach(function(key) {
- if (key.includes("special_condition_label") || key.includes(
- "special_condition_input")) {
- if (key.includes("special_condition_label")) {
- for (let index = 0; index < jsonObject[key]
- .length; index++) {
- specialCondition();
- }
- }
-
- //console.log('key', key)
- let elements = document.getElementsByName(`${key}[]`);
- //console.log(elements)
-
- if (elements) {
- elements.forEach((element, index) => {
- //console.log()
- if (jsonObject[key][index] == undefined) {
- element.value = " ";
+ if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
+ if (key.includes("special_condition_label")) {
+ if (jsonObject[key] && Array.isArray(jsonObject[key])) {
+ for (let index = 0; index < jsonObject[key].length; index++) {
+ specialCondition();
+ }
} else {
- element.value = jsonObject[key][index];
+ console.warn(`jsonObject[${key}] is not a valid array.`);
+ }
+ }
- if (key.includes("special_condition_label")) {
- let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]');
- console.log("First element:", element);
+ //console.log('key', key)
+ let elements = document.getElementsByName(`${key}[]`);
+ //console.log(elements)
- if (checkbox.length) {
- console.log("Checkbox found:", checkbox);
+ if (elements) {
+ elements.forEach((element, index) => {
+ //console.log()
+ if (jsonObject[key][index] == undefined) {
+ element.value = " ";
+ } else {
+ element.value = jsonObject[key][index];
- // Correct way to set the 'id' attribute
- let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
- console.log('formattedValue', formattedValue);
- checkbox.attr('id', formattedValue + '_display');
+ if (key.includes("special_condition_label")) {
+ let checkbox = $(element).closest('.form-group').find('input[name="special_condition_display[]"]');
+ console.log("First element:", element);
- console.log("Updated Checkbox:", checkbox);
- } else {
- console.log("Checkbox not found for:", element);
+ if (checkbox.length) {
+ console.log("Checkbox found:", checkbox);
+
+ // Correct way to set the 'id' attribute
+ let formattedValue = jsonObject[key][index].replace(/[\s\-\/,&]+/g, '').toLowerCase();
+ console.log('formattedValue', formattedValue);
+ checkbox.attr('id', formattedValue + '_display');
+
+ console.log("Updated Checkbox:", checkbox);
+ } else {
+ console.log("Checkbox not found for:", element);
+ }
}
- }
+ }
+ });
+ }
+ }
+
+
+ // if (key.includes("multiple_sum_insured")) {
+ // jsonObject[key].forEach((value, index) => {
+ // appendGMCSIAddMore(value);
+ // });
+ // }
+
+ if (key.includes("multiple_sum_insured") && key != "") {
+
+ if (Array.isArray(jsonObject[key])) {
+ jsonObject[key].forEach((value, index) => {
+ appendGMCSIAddMore(value);
+ });
+ } else {
+ console.log(`${key} is not an array.`);
+ }
+ }
+
+ if (key === "family_floater") {
+
+ if (jsonObject[key] === "Floater") {
+ setTimeout(() => {
+
+ $("#familyFloaterYes").prop("checked", true);
+ }, 100); // delay in milliseconds
+
+ } else {
+
+ $("#familyFloaterNo").prop("checked", true);
}
- });
- }
- }
-
-
- // if (key.includes("multiple_sum_insured")) {
- // jsonObject[key].forEach((value, index) => {
- // appendGMCSIAddMore(value);
- // });
- // }
-
- if (key.includes("multiple_sum_insured") && key != "") {
-
- if (Array.isArray(jsonObject[key])) {
- jsonObject[key].forEach((value, index) => {
- appendGMCSIAddMore(value);
- });
- } else {
- console.log(`${key} is not an array.`);
- }
- }
-
- if (key === "family_floater") {
-
- if (jsonObject[key] === "Floater") {
- setTimeout(() => {
-
- $("#familyFloaterYes").prop("checked", true);
- }, 100); // delay in milliseconds
-
- } else {
-
- $("#familyFloaterNo").prop("checked", true);
}
+
+
+ if (key.includes("family_floaters")) {
+
+ let checkboxes = document.querySelectorAll(
+ `input[name="${key}[]"]`);
+ if (jsonObject[key]) {
+
+ console.log(jsonObject[key]);
+ if (jsonObject[key].childrens) {
+ $('#children').val(jsonObject[key].childrens);
+ }
+
+ if (jsonObject[key].self == 0) {
+ $('#self').prop('checked', false);
+ }
+
+ if (jsonObject[key].spouse == 0) {
+ $('#spouse').prop('checked', false);
+ } else {
+ $('#spouse').prop('checked', true);
+ }
+
+
+ if (jsonObject[key]['either-parents-pil'] == 1) {
+ $('#family_floaters').val('EPORPIL');
+ } else if (jsonObject[key].parents == 1 && jsonObject[key][
+ 'parents-in-law'
+ ] == 1) {
+ $('#family_floaters').val('2EPORPIL');
+ } else if (jsonObject[key].parents == 2 && jsonObject[key][
+ 'parents-in-law'
+ ] == 2) {
+ $('#family_floaters').val('4EPORPIL');
+ } else if (jsonObject[key].parents == 1) {
+ $('#family_floaters').val('1P');
+ } else if (jsonObject[key].parents == 2) {
+ $('#family_floaters').val('2P');
+ } else if (jsonObject[key]['parents-in-law'] == 1) {
+ $('#family_floaters').val('1PIL');
+ } else if (jsonObject[key]['parents-in-law'] == 2) {
+ $('#family_floaters').val('2PIL');
+ } else if (jsonObject[key]['either-parents-pil'] == 2) {
+ $('#family_floaters').val('2EPORPIL');
+ }
+ }
+
}
- if (key.includes("family_floaters")) {
-
- let checkboxes = document.querySelectorAll(
- `input[name="${key}[]"]`);
- if (jsonObject[key]) {
-
- console.log(jsonObject[key]);
- console.log(jsonObject[key]);
- if (jsonObject[key].childrens) {
- $('#children').val(jsonObject[key].childrens);
- }
-
- if (jsonObject[key].self == 0) {
- $('#self').prop('checked', false);
- }
-
- if (jsonObject[key].spouse == 0) {
- $('#spouse').prop('checked', false);
- } else {
- $('#spouse').prop('checked', true);
- }
+ let elements = document.getElementsByName(key);
+ if (elements && elements.length > 0) {
+ let element = elements[
+ 0]; // Assuming you want to update the first element with the name
- if (jsonObject[key]['either-parents-pil'] == 1) {
- $('#family_floaters').val('EPORPIL');
- } else if (jsonObject[key].parents == 1 && jsonObject[key][
- 'parents-in-law'
- ] == 1) {
- $('#family_floaters').val('2EPORPIL');
- } else if (jsonObject[key].parents == 2 && jsonObject[key][
- 'parents-in-law'
- ] == 2) {
- $('#family_floaters').val('4EPORPIL');
- } else if (jsonObject[key].parents == 1) {
- $('#family_floaters').val('1P');
- } else if (jsonObject[key].parents == 2) {
- $('#family_floaters').val('2P');
- } else if (jsonObject[key]['parents-in-law'] == 1) {
- $('#family_floaters').val('1PIL');
- } else if (jsonObject[key]['parents-in-law'] == 2) {
- $('#family_floaters').val('2PIL');
- } else if (jsonObject[key]['either-parents-pil'] == 2) {
- $('#family_floaters').val('4EPORPIL');
- }
- }
+ if (element.tagName === 'INPUT' && (element.type ===
+ 'checkbox' || element.type === 'radio')) {
- }
+ if (element.type === 'checkbox') {
+ element.checked = jsonObject[key] ===
+ '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
+ } else if (element.type === 'radio') {
+
+ if (element.value === jsonObject[key]) {
+ element.checked = element.value === jsonObject[key];
+
+ if (element.name === "family_floater") {
+ element.parentElement.nextElementSibling.style
+ .display = '';
+ element.parentElement.parentElement
+ .parentElement.nextElementSibling.style
+ .display = '';
+ // alert('family floater');
+ } else if (element.name ===
+ "waiverofpreexistingdiseases") {
+ element.parentElement.parentElement
+ .nextElementSibling.style.display = '';
+ element.parentElement.parentElement
+ .nextElementSibling.nextElementSibling.style
+ .display = '';
+ element.parentElement.parentElement
+ .nextElementSibling.nextElementSibling
+ .nextElementSibling.style.display = '';
+ element.parentElement.parentElement
+ .nextElementSibling.nextElementSibling
+ .nextElementSibling.nextElementSibling.style
+ .display = '';
+
+ } else if (element.name === "ayudhtreatmentcover") {
+ element.parentElement.parentElement
+ .nextElementSibling.style.display = '';
+ } else if (element.name === "ailmentcapping") {
+ element.parentElement.parentElement
+ .nextElementSibling.style.display = '';
+ } else if (element.name === "copayzonewisecopay") {
+ element.parentElement.parentElement
+ .nextElementSibling.style.display = '';
+ } else if (element.name === "cataract") {
+ element.parentElement.parentElement
+ .nextElementSibling.style.display = '';
+ }
- let elements = document.getElementsByName(key);
- if (elements && elements.length > 0) {
- let element = elements[
- 0]; // Assuming you want to update the first element with the name
-
-
- if (element.tagName === 'INPUT' && (element.type ===
- 'checkbox' || element.type === 'radio')) {
-
- if (element.type === 'checkbox') {
- element.checked = jsonObject[key] ===
- '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
- } else if (element.type === 'radio') {
-
- if (element.value === jsonObject[key]) {
- element.checked = element.value === jsonObject[key];
-
- if (element.name === "family_floater") {
- element.parentElement.nextElementSibling.style
- .display = '';
- element.parentElement.parentElement
- .parentElement.nextElementSibling.style
- .display = '';
- // alert('family floater');
- } else if (element.name ===
- "waiverofpreexistingdiseases") {
- element.parentElement.parentElement
- .nextElementSibling.style.display = '';
- element.parentElement.parentElement
- .nextElementSibling.nextElementSibling.style
- .display = '';
- element.parentElement.parentElement
- .nextElementSibling.nextElementSibling
- .nextElementSibling.style.display = '';
- element.parentElement.parentElement
- .nextElementSibling.nextElementSibling
- .nextElementSibling.nextElementSibling.style
- .display = '';
-
- } else if (element.name === "ayudhtreatmentcover") {
- element.parentElement.parentElement
- .nextElementSibling.style.display = '';
- } else if (element.name === "ailmentcapping") {
- element.parentElement.parentElement
- .nextElementSibling.style.display = '';
- } else if (element.name === "copayzonewisecopay") {
- element.parentElement.parentElement
- .nextElementSibling.style.display = '';
- } else if (element.name === "cataract") {
- element.parentElement.parentElement
- .nextElementSibling.style.display = '';
+ } else {
+ element.nextElementSibling.checked = element.value;
}
+ }
+ } else if (key === "Wellness" || key ===
+ "additionalsicknessbenefit") {
+ let wysiwygElement = element.previousElementSibling
+ .querySelector('.jodit-wysiwyg');
+
+
+ if (wysiwygElement) {
+ let pTag = wysiwygElement.querySelector(
+ 'p'); // Find the tag inside the wysiwyg element
+ if (pTag) {
+ // pTag.innerHTML = ''; // Clear the content inside the
tag
+ pTag.innerHTML = jsonObject[
+ key]; // Add your new content inside the
tag
+ }
+ }
+ console.log(jsonObject[key]);
+ } else {
+ console.log(jsonObject[key]);
+
+ if (jsonObject[key] === undefined || jsonObject[key] === "" || jsonObject[key] === null) {
+ element.value = " ";
} else {
- element.nextElementSibling.checked = element.value;
+ element.value = jsonObject[key];
}
}
- } else if (key === "Wellness" || key ===
- "additionalsicknessbenefit") {
- let wysiwygElement = element.previousElementSibling
- .querySelector('.jodit-wysiwyg');
-
-
- if (wysiwygElement) {
- let pTag = wysiwygElement.querySelector(
- 'p'); // Find the
tag inside the wysiwyg element
- if (pTag) {
- // pTag.innerHTML = ''; // Clear the content inside the
tag
- pTag.innerHTML = jsonObject[
- key]; // Add your new content inside the
tag
- }
- }
- console.log(jsonObject[key]);
- } else {
- console.log(jsonObject[key]);
-
- if (jsonObject[key] === undefined || jsonObject[key] === "" || jsonObject[key] === null) {
- element.value = " ";
-
-
- } else {
- element.value = jsonObject[key];
- }
}
- }
- if (key.includes("age_ratio")) {
+ if (key.includes("age_ratio")) {
- $('#self_min_age').val(jsonObject[key].self.min);
- $('#self_max_age').val(jsonObject[key].self.max);
+ $('#self_min_age').val(jsonObject[key].self.min);
+ $('#self_max_age').val(jsonObject[key].self.max);
- $('#spouse_min_age').val(jsonObject[key].spouse.min);
- $('#spouse_max_age').val(jsonObject[key].spouse.max);
+ $('#spouse_min_age').val(jsonObject[key].spouse.min);
+ $('#spouse_max_age').val(jsonObject[key].spouse.max);
- $('#child_min_age').val(jsonObject[key].child.min);
- $('#child_max_age').val(jsonObject[key].child.max);
+ $('#child_min_age').val(jsonObject[key].child.min);
+ $('#child_max_age').val(jsonObject[key].child.max);
- $('#other_member_min_age').val(jsonObject[key].elders.min);
- $('#other_member_max_age').val(jsonObject[key].elders.max);
- }
+ $('#other_member_min_age').val(jsonObject[key].elders.min);
+ $('#other_member_max_age').val(jsonObject[key].elders.max);
+ }
- // if (key.includes("is_payable_employee")) {
+ // if (key.includes("is_payable_employee")) {
- // if (jsonObject[key]) {
+ // if (jsonObject[key]) {
- // if (jsonObject[key].self == 0) {
- // $('#is_payable_employee_for_self').prop('checked',
- // false);
- // } else {
- // $('#is_payable_employee_for_self').prop('checked',
- // true);
- // }
+ // if (jsonObject[key].self == 0) {
+ // $('#is_payable_employee_for_self').prop('checked',
+ // false);
+ // } else {
+ // $('#is_payable_employee_for_self').prop('checked',
+ // true);
+ // }
- // if (jsonObject[key].spouse == 0) {
- // $('#is_payable_employee_for_spouse').prop('checked',
- // false);
- // } else {
- // $('#is_payable_employee_for_spouse').prop('checked',
- // true);
- // }
+ // if (jsonObject[key].spouse == 0) {
+ // $('#is_payable_employee_for_spouse').prop('checked',
+ // false);
+ // } else {
+ // $('#is_payable_employee_for_spouse').prop('checked',
+ // true);
+ // }
- // if (jsonObject[key].childern == 0) {
- // $('#is_payable_employee_for_child').prop('checked',
- // false);
- // } else {
- // $('#is_payable_employee_for_child').prop('checked',
- // true);
- // }
+ // if (jsonObject[key].childern == 0) {
+ // $('#is_payable_employee_for_child').prop('checked',
+ // false);
+ // } else {
+ // $('#is_payable_employee_for_child').prop('checked',
+ // true);
+ // }
- // // if (jsonObject[key].elders == 0) {
- // // $('#is_payable_employee_for_elders').prop('checked',
- // // false);
- // // } else {
- // // $('#is_payable_employee_for_elders').prop('checked',
- // // true);
- // // }
+ // // if (jsonObject[key].elders == 0) {
+ // // $('#is_payable_employee_for_elders').prop('checked',
+ // // false);
+ // // } else {
+ // // $('#is_payable_employee_for_elders').prop('checked',
+ // // true);
+ // // }
- // }
+ // }
- // }
+ // }
- if (key.includes("enrollment_display_key") && key != "") {
+ if (key.includes("enrollment_display_key") && key != "") {
- console.log('enrollment_display_key');
- console.log(jsonObject[key]);
+ console.log('enrollment_display_key');
+ console.log(jsonObject[key]);
- processJsonObject(jsonObject);
- }
+ processJsonObject(jsonObject);
+ }
- });
+ });
+ }
}
$("#sum_insured").trigger("keyup");
@@ -1450,6 +1453,11 @@
}
var family_floaters = $('#family_floaters').val();
+
+ console.log("========================================================");
+ console.log("family_floaters", family_floaters);
+ console.log("========================================================");
+
if (family_floaters != 0) {
$('.other-member-age').css('display', '');
} else {
@@ -1880,36 +1888,40 @@
}
function disableUnwantedTerms(jsonObject) {
- // alert("Disabling unwanted terms");
- fields.forEach(function(key) {
- // If key NOT in jsonObject, then hide and disable its associated elements
- if (!jsonObject.hasOwnProperty(key)) {
- const elements = document.getElementsByName(key);
+ console.log("Disabling unwanted terms");
+ console.log("jsonObject : ", jsonObject);
- elements.forEach(element => {
- element.style.display = "none";
- element.disabled = true;
+ if(jsonObject){
+ fields.forEach(function(key) {
+ // If key NOT in jsonObject, then hide and disable its associated elements
+ if (!jsonObject?.hasOwnProperty(key)) {
+ const elements = document.getElementsByName(key);
- const label = document.querySelector(`label[for="${element.id}"]`);
- if (label) {
- label.style.display = "none";
- }
+ elements.forEach(element => {
+ element.style.display = "none";
+ element.disabled = true;
- const displayElement = document.getElementById(`${element.id}_display`);
- if (displayElement) {
- displayElement.checked = false;
- displayElement.disabled = true;
- displayElement.style.display = "none";
- }
+ const label = document.querySelector(`label[for="${element.id}"]`);
+ if (label) {
+ label.style.display = "none";
+ }
- const rowDiv = element.closest('.row');
- if (rowDiv) {
- rowDiv.style.display = "none";
- }
+ const displayElement = document.getElementById(`${element.id}_display`);
+ if (displayElement) {
+ displayElement.checked = false;
+ displayElement.disabled = true;
+ displayElement.style.display = "none";
+ }
+
+ const rowDiv = element.closest('.row');
+ if (rowDiv) {
+ rowDiv.style.display = "none";
+ }
+ });
+ }
});
}
- });
}
function autoSaveGmcTerms()
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index 55fef2c5..82f39443 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -427,7 +427,7 @@
Agreed TEP %
-
+
>
Agreed Amount
@@ -445,7 +445,7 @@
Standard TEP %
-
+
Actual BP Amount
@@ -520,6 +520,8 @@