MERGE_TEST_RFQ_LIVE_ISSUES&FEEDBACK
This commit is contained in:
commit
a1cfca14e2
@ -45,6 +45,9 @@ class Database extends Config
|
||||
'numberNative' => false,
|
||||
];
|
||||
|
||||
|
||||
public array $book_stack = [];
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
@ -75,6 +78,29 @@ class Database extends Config
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Initialize book_stack configuration with environment variables
|
||||
$this->book_stack = [
|
||||
'DSN' => '',
|
||||
'hostname' => getenv('bookStack_hostname'),
|
||||
'username' => getenv('bookStack_username'),
|
||||
'password' => getenv('bookStack_password'),
|
||||
'database' => getenv('bookStack_database'),
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => true,
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
|
||||
// Ensure that we always set the database group to 'tests' if
|
||||
// we are currently running an automated test suite, so that
|
||||
// we don't overwrite live data on accident.
|
||||
@ -82,4 +108,5 @@ class Database extends Config
|
||||
$this->defaultGroup = 'tests';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -448,6 +448,7 @@ $routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDr
|
||||
//crone job
|
||||
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
|
||||
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
@ -462,7 +463,9 @@ $routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::upda
|
||||
|
||||
//HR login api's
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
$routes->post("/employeeRest/updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||
|
||||
// Test initiate Claim
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
@ -513,7 +516,12 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
|
||||
$routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId");
|
||||
$routes->get("getCashDepositData", "EmployeeRestController::getCashDepositData");
|
||||
|
||||
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||
$routes->get("cdSummaryData", "EmployeeRestController::cdSummaryData");
|
||||
$routes->get("cdTransactionData", "EmployeeRestController::cdTransactionData");
|
||||
$routes->match( ['get', 'post'], 'claimsSearch','EmployeeRestController::claimsSearch');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||
@ -525,8 +533,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
||||
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
|
||||
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
@ -538,7 +546,7 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol
|
||||
|
||||
// Ticketing System End's
|
||||
|
||||
|
||||
$routes->get("autobookstackLogin", "RestAuthenticationController::bookstackLoginToken");
|
||||
//BDSReports
|
||||
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
||||
|
||||
@ -618,7 +618,7 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
// In your controller
|
||||
public function deposit($id = null)
|
||||
public function deposit($id = null , $requestFrom = null )
|
||||
{
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
|
||||
@ -629,13 +629,15 @@ class ClientController extends AdminController
|
||||
// Fetch associated insurer names and balances
|
||||
$balances = $this->clientPolicyModel->getBalances($id);
|
||||
$data['balances'] = $balances;
|
||||
// dd($data);
|
||||
|
||||
if($requestFrom == 'rest'){ return $data; }
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_deposit_list', $data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
public function view_Deposit($insurerId)
|
||||
public function view_Deposit($insurerId , $requestFrom = null , $param = null)
|
||||
{
|
||||
// Load your model to fetch data based on $clientId and $insurerId
|
||||
// $subTypeOptions = [
|
||||
@ -660,15 +662,23 @@ class ClientController extends AdminController
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
$loggedInUserID = get_session_userid();
|
||||
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
if($requestFrom == 'rest')
|
||||
{
|
||||
$clientId = $param['client_id'];
|
||||
$cd_ac_pk = $param['cd_ac_pk'];
|
||||
}else{
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
$cd_ac_pk = $this->request->getGet('cd_ac_pk');
|
||||
}
|
||||
|
||||
$data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId);
|
||||
$data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId);
|
||||
$data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId, $cd_ac_pk);
|
||||
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId, $cd_ac_pk);
|
||||
$data['cd_ac_pk'] = $cd_ac_pk;
|
||||
|
||||
// dd($data);
|
||||
|
||||
// print_r($data['depositdata'] );die;
|
||||
if($requestFrom == 'rest'){ return $data; }
|
||||
|
||||
// Load the view for the new list page;
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('view_deposit', $data);
|
||||
@ -689,9 +699,16 @@ class ClientController extends AdminController
|
||||
->where('insurer_id', $insurer_id)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
// Prepare the array with data
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||
$record_date = $date->format('Y-m-d');
|
||||
|
||||
|
||||
if(!empty($record_date)){
|
||||
// Prepare the array with data
|
||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||
$record_date = $date->format('Y-m-d');
|
||||
}else{
|
||||
$record_date = null;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
||||
@ -1273,7 +1290,12 @@ class ClientController extends AdminController
|
||||
$data['insurer_id'] = $insurerId;
|
||||
|
||||
$tpaValue = (string) $this->request->getPost('tpa');
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
if(!empty($tpaValue) || $tpaValue !== ''){
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
}else{
|
||||
$tpaBranchId = null;
|
||||
$tpaId = null;
|
||||
}
|
||||
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
$data['client_id'] = $client_id;
|
||||
@ -4053,13 +4075,13 @@ class ClientController extends AdminController
|
||||
|
||||
// Additional logic for non-individual clients (client_type != 2)
|
||||
if ($client_type != 2) {
|
||||
$unit = $postData['short_name'] . '-' . $postData['branch_code'];
|
||||
$unit[] = $postData['short_name'] . '-' . $postData['branch_code'];
|
||||
$branch_data = [
|
||||
'client_id' => $client_insert,
|
||||
'branch_name' => $postData['branch_name'],
|
||||
'branch_code' => $postData['branch_code'],
|
||||
'gst' => $postData['gst'],
|
||||
'units' => $unit,
|
||||
'units' => json_encode($unit) ?? null,
|
||||
];
|
||||
|
||||
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
||||
@ -4825,10 +4847,22 @@ class ClientController extends AdminController
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
// $batch_data = [
|
||||
// 'client_id' => 17,
|
||||
// 'client_policy_id' => 30,
|
||||
// 'client_branch_id' => 18,
|
||||
// 'event_type' => "inception",
|
||||
// 'client_id' => 29,
|
||||
// 'client_policy_id' => 17,
|
||||
// 'client_branch_id' => 15,
|
||||
// 'insurer_or_tpa' => "insurer",
|
||||
// 'event_type' => "deletion",
|
||||
// ];
|
||||
|
||||
// $batch_data = [
|
||||
// 'client_id' => 89,
|
||||
// 'client_policy_id' => 328,
|
||||
// 'client_branch_id' => 88,
|
||||
// 'insurer_or_tpa' => "insurer",
|
||||
// // 'insurer_or_tpa' => "tpa",
|
||||
// 'event_type' => "si_enhancement",
|
||||
// 'file_name' => "si_enhancement_test_file.xlsx",
|
||||
// 'actions' => "export",
|
||||
// ];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
@ -4844,13 +4878,17 @@ class ClientController extends AdminController
|
||||
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
|
||||
$EmpDataServiceController = new EmpDataServiceController();
|
||||
// $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
|
||||
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||
|
||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
||||
// print_rr($result); die;
|
||||
// $result = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data, 1);
|
||||
// return $this->downloadInsurerExcelExport($batch_data);
|
||||
// dd($result); die;
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
|
||||
@ -4859,7 +4897,7 @@ class ClientController extends AdminController
|
||||
// $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '319']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1101']);
|
||||
// dd($res);
|
||||
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
@ -5192,8 +5230,10 @@ class ClientController extends AdminController
|
||||
->where('insurers.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.emp_status', "active")
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', "active")
|
||||
->where($field_name, $param);
|
||||
|
||||
if (!empty($client_id)) {
|
||||
|
||||
@ -185,7 +185,7 @@ class EmpDataServiceController extends BaseController
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $export_data['client_id'])
|
||||
->where('insurer_id', $policy_details['insurer_id'])
|
||||
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('id', $policy_details['cd_ac_pk'])
|
||||
->first();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
@ -683,7 +683,7 @@ class EmpDataServiceController extends BaseController
|
||||
$balance = $this->CDMasterModel
|
||||
->where('client_id', $export_data['client_id'])
|
||||
->where('insurer_id', $policy_details['insurer_id'])
|
||||
->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('id', $policy_details['cd_ac_pk'])
|
||||
->first();
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
@ -1411,7 +1411,8 @@ class EmpDataServiceController extends BaseController
|
||||
// dd($inceptionHeader);
|
||||
foreach ($inceptionHeader as $key => $value) {
|
||||
|
||||
if($excel_header[$key] != $value){
|
||||
if (!isset($excel_header[$key]) || $excel_header[$key] != $value) {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-5',
|
||||
];
|
||||
@ -3046,25 +3047,28 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// dd($emp_policy_ids, $emp_details, $endorsement_details);
|
||||
|
||||
$this->employeePolicyModel->updateBatch($emp_policy_ids, 'id');
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
// $this->employeePolicyModel->insertBatch($emp_details);
|
||||
// $insertedIds = [];
|
||||
// $startId = $db->insertID(); // Get the first inserted ID
|
||||
|
||||
// for ($i = 0; $i < count($emp_details); $i++) {
|
||||
// $insertedIds[] = $startId + $i;
|
||||
// }
|
||||
$this->employeePolicyModel->updateBatch($emp_policy_ids, 'id');
|
||||
|
||||
$insertedIds = [];
|
||||
foreach ($emp_details as $emp) {
|
||||
$insertedIds[] = $this->employeePolicyModel->insert($emp);
|
||||
// $this->employeePolicyModel->insertBatch($emp_details);
|
||||
// $insertedIds = [];
|
||||
// $startId = $db->insertID(); // Get the first inserted ID
|
||||
|
||||
// for ($i = 0; $i < count($emp_details); $i++) {
|
||||
// $insertedIds[] = $startId + $i;
|
||||
// }
|
||||
|
||||
$insertedIds = [];
|
||||
foreach ($emp_details as $emp) {
|
||||
$insertedIds[] = $this->employeePolicyModel->insert($emp);
|
||||
}
|
||||
|
||||
// dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
// dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
|
||||
|
||||
// Update batch file status and amount
|
||||
@ -3537,20 +3541,29 @@ class EmpDataServiceController extends BaseController
|
||||
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
||||
// }
|
||||
|
||||
// Check if $employee_policy_table_data is null or empty
|
||||
if (empty($employee_policy_table_data)) {
|
||||
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||
}
|
||||
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
// Check if $emp_endorsement_table_data is null or empty
|
||||
if (empty($emp_endorsement_table_data)) {
|
||||
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
}
|
||||
// Check if $employee_policy_table_data is null or empty
|
||||
if (empty($employee_policy_table_data)) {
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'status' => "failed",
|
||||
]);
|
||||
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||
}
|
||||
|
||||
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
// Check if $emp_endorsement_table_data is null or empty
|
||||
if (empty($emp_endorsement_table_data)) {
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'status' => "failed",
|
||||
]);
|
||||
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||
}
|
||||
|
||||
// $this->employeeModel->updateBatch($employees_table_data, 'id');
|
||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
// Update batch file status and amount
|
||||
$this->batchFileModel->update($file_id, [
|
||||
|
||||
@ -336,15 +336,16 @@ class EmployeeController extends AdminController
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left');
|
||||
->join("client_rm cr","cr.client_id = c.id and cr.is_active = 1",'left')
|
||||
->where('files.is_active', 1);
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$query->where('cr.user_id', $user_id);
|
||||
}
|
||||
// ->where('files.created_by', get_session_userid())
|
||||
$data['fileList'] = $query->orderBy('files.created_at', 'desc')
|
||||
->limit(100)
|
||||
$data['fileList'] = $query->groupBy("c.id")->orderBy('files.created_at', 'desc')
|
||||
->limit(1500)
|
||||
->find();
|
||||
// dd($data['fileList']);
|
||||
|
||||
@ -386,15 +387,16 @@ class EmployeeController extends AdminController
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left');
|
||||
->join("client_rm cr","cr.client_id = clients.id and cr.is_active = 1",'left')
|
||||
->where('batch_files.is_active', 1);
|
||||
if (in_array($role_id, [2, 3])) {
|
||||
|
||||
// If the user is a Account Manager or Manager, filter by user_id
|
||||
$query2->where('cr.user_id', $user_id);
|
||||
}
|
||||
// ->where('files.created_by', get_session_userid())
|
||||
$data['batch_list'] = $query2->orderBy('batch_files.id', 'desc')
|
||||
->limit(1000)
|
||||
$data['batch_list'] = $query2->groupBy("clients.id")->orderBy('batch_files.id', 'desc')
|
||||
->limit(1500)
|
||||
->find();
|
||||
|
||||
|
||||
@ -1040,6 +1042,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
$data = $this->employeePolicyModel->select('employee_polices.id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employee_polices.client_policy_id', $id)
|
||||
->findAll();
|
||||
|
||||
@ -2401,7 +2404,7 @@ class EmployeeController extends AdminController
|
||||
} else if ($actionType == 'deletion') {
|
||||
$filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Deletion.xlsx';
|
||||
}else if ($actionType == 'missed_inception') {
|
||||
$filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Inception.xlsx';
|
||||
$filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Addition.xlsx';
|
||||
}
|
||||
|
||||
// Check if the file exists
|
||||
|
||||
@ -2276,72 +2276,47 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getCashDepositData()
|
||||
public function getPolicyLevelEmployeeSummaryData()
|
||||
{
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->findAll();
|
||||
$result = [];
|
||||
|
||||
if(count($ClientPolicyData))
|
||||
{
|
||||
foreach ($ClientPolicyData as $key => $value) {
|
||||
|
||||
$data['clientId'] = $value['clientId'];
|
||||
$data['insurerId'] = $value['insurerId'];
|
||||
$data['insurerName'] = $value['insurer_name'];
|
||||
$data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']);
|
||||
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
|
||||
|
||||
$data['policyDetails'] = [];
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
||||
|
||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $this->request->getGet('policy_status'))
|
||||
->findAll();
|
||||
$result = [];
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
{
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
||||
$value['type'] = $policyTypeData->policy_type;
|
||||
$value['policy_name'] = $policyTypeData->long_name;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
// dd($employeeDetails);
|
||||
$activeCount = 0;
|
||||
$inactiveCount = 0;
|
||||
if(count($employeeDetails))
|
||||
{
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
||||
$value['type'] = $policyTypeData->policy_type;
|
||||
$value['policy_name'] = $policyTypeData->long_name;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
if(count($employeeDetails))
|
||||
{
|
||||
foreach ($employeeDetails as $item) {
|
||||
if ($item['emp_status'] === 'enrolled') {
|
||||
$enrolledCount++;
|
||||
} elseif ($item['emp_status'] === 'draft') {
|
||||
$draftCount++;
|
||||
}
|
||||
foreach ($employeeDetails as $item) {
|
||||
if ($item['emp_status'] === 'active') {
|
||||
$activeCount++;
|
||||
} elseif ($item['emp_status'] === 'inactive') {
|
||||
$inactiveCount++;
|
||||
}
|
||||
}
|
||||
|
||||
$value['totalMembersCount'] = count($employeeDetails);
|
||||
$value['membersCountOfEnrolled'] = $enrolledCount;
|
||||
$value['membersCountOfDraft'] = $draftCount;
|
||||
|
||||
array_push($data['policyDetails'],$value);
|
||||
}
|
||||
|
||||
|
||||
array_push($result,$data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$value['totalMembersCount'] = count($employeeDetails);
|
||||
$value['membersCountOfActive'] = $activeCount;
|
||||
$value['membersCountOfInactive'] = $inactiveCount;
|
||||
|
||||
|
||||
array_push($result,$value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($result)
|
||||
{
|
||||
@ -2353,6 +2328,218 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function cdSummaryData()
|
||||
{
|
||||
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
|
||||
$clientController = new ClientController;
|
||||
$result = $clientController->deposit($clientId , $requestFrom = 'rest');
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($result['clientData'] as $key => $value)
|
||||
{
|
||||
$temp['client_id'] = $value->client_id;
|
||||
$temp['insurer_id'] = $value->insurer_id;
|
||||
$temp['cd_ac_pk'] = $value->cd_ac_pk;
|
||||
$temp['insurer_name'] = $value->insurer_name;
|
||||
$temp['cd_master_account_no'] = $value->cd_master_account_no;
|
||||
if (isset($result['balances'][$temp['insurer_id']])) {
|
||||
$balance = $result['balances'][$temp['insurer_id']]->balance;
|
||||
$temp['balance'] = $balance;
|
||||
} else {
|
||||
$temp['balance'] = "N/A";
|
||||
}
|
||||
|
||||
array_push($data,$temp);
|
||||
}
|
||||
|
||||
|
||||
if($data)
|
||||
{
|
||||
return $this->respond(['status' => 'success','code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => (count($data) ? 200 : 404),'data' => [] ], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function cdTransactionData()
|
||||
{
|
||||
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
$insurerId = $this->request->getGet('insurer_id');
|
||||
$cdAccountPrimaryKey = $this->request->getGet('cd_ac_pk');
|
||||
|
||||
$clientController = new ClientController;
|
||||
$result = $clientController->view_Deposit($insurerId , $requestFrom = 'rest' , $param = ['client_id'=>$clientId, 'cd_ac_pk'=>$cdAccountPrimaryKey ]);
|
||||
|
||||
$data['insurer_name'] = $result['insurerName']->name;
|
||||
$data['account_number'] = $result['insurerName']->cd_master_account_no;
|
||||
$data['total_deposit'] = $result['deposiamount']->total_credit;
|
||||
$data['total_consumed'] = $result['deposiamount']->total_withdraw;
|
||||
$data['total_refund'] = $result['deposiamount']->total_refund;
|
||||
$data['currect_balance'] = $result['deposiamount']->balance;
|
||||
$data['deposit_data'] = $result['depositdata'];
|
||||
|
||||
|
||||
// dd($data);
|
||||
|
||||
if($data)
|
||||
{
|
||||
return $this->respond(['status' => 'success','code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => (count($data) ? 200 : 404),'data' => [] ], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function claimsSearch()
|
||||
{
|
||||
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
$data['claim_status'] = $this->claimStatusModel->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
$data['ticket_type'] = [
|
||||
["ticket_type" => "1", "type_name" => "Claim-GMC"],
|
||||
["ticket_type" => "2", "type_name" => "Claim-GPA"],
|
||||
["ticket_type" => "3", "type_name" => "EDLI"],
|
||||
["ticket_type" => "4", "type_name" => "GTLI"],
|
||||
];
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
|
||||
}
|
||||
|
||||
$db = db_connect();
|
||||
|
||||
$search_data = $this->request->getJSON(true); // Get JSON as associative array
|
||||
|
||||
$client_id = isset($search_data['client_id']) ? (int) $search_data['client_id'] : 0;
|
||||
unset($search_data['client_id']);
|
||||
|
||||
$from_date = isset($search_data['from_date']) ? $search_data['from_date'] : null;
|
||||
$to_date = isset($search_data['to_date']) ? $search_data['to_date'] : null;
|
||||
unset($search_data['from_date'], $search_data['to_date']);
|
||||
|
||||
$where = [];
|
||||
|
||||
// Dynamically build WHERE conditions from non-empty parameters
|
||||
foreach ($search_data as $key => $value) {
|
||||
if (!empty($value) && $value !== 0 && $value !== '0') {
|
||||
$where["tm.$key"] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$builder = $db->table('ticket_master tm');
|
||||
$builder->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name_sub',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.client_policy_id',
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
]);
|
||||
|
||||
$builder->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left');
|
||||
$builder->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left');
|
||||
$builder->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left');
|
||||
|
||||
$builder->where('tm.is_active', 1);
|
||||
|
||||
if ($client_id > 0) {
|
||||
$builder->where('tm.client_id', $client_id);
|
||||
}
|
||||
|
||||
if (!empty($from_date) && !empty($to_date)) {
|
||||
$from_date_mysql = date('Y-m-d', strtotime($from_date));
|
||||
$to_date_mysql = date('Y-m-d', strtotime($to_date));
|
||||
$builder->where("DATE(tm.created_at) BETWEEN '$from_date_mysql' AND '$to_date_mysql'");
|
||||
}
|
||||
|
||||
if (!empty($where)) {
|
||||
$builder->where($where);
|
||||
}
|
||||
|
||||
$builder->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $builder->get()->getResultArray();
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
|
||||
}
|
||||
|
||||
public function claimView()
|
||||
{
|
||||
$ticket_id = $this->request->getGet('ticket_id');
|
||||
$ticketController = new TicketController;
|
||||
$data['ticket_history'] = $ticketController->ticketHistory($ticket_id);
|
||||
$data['claims_data'] = $this->ticketMaster->getTicketDataByTicketID($ticket_id);
|
||||
$data['ticket_data'] = $ticketController->getMoreInfo($requestFrom = 'rest', $ticket_id);
|
||||
|
||||
|
||||
|
||||
return $this->respond(['status' => (count($data) ? 'success' : 'failed'),'code' => (count($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function exportCashDepositData()
|
||||
@ -2501,8 +2688,9 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
{
|
||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name')
|
||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; $policy_status_key = "Active"; }else{ $policy_status = 0; $policy_status_key = "InActive";}
|
||||
$dayInterval = 10;
|
||||
$ClientPolicyData = $this->clientPolicyModel->select("client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name, DATE_ADD(client_policy.policy_end_date, INTERVAL {$dayInterval} DAY) as claims_grace_date")
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
@ -2526,12 +2714,16 @@ class EmployeeRestController extends AdminController
|
||||
->get()->getRow()->name;
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
|
||||
if (strtotime(date('Y-m-d') > strtotime($ClientPolicyValue['claims_grace_date']))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1)
|
||||
{
|
||||
$policyGroup = 'gpa';
|
||||
@ -2565,6 +2757,8 @@ class EmployeeRestController extends AdminController
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
$data['heading'] = $ClientPolicyValue['policy_long_name'];
|
||||
$data['claims_grace_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['claims_grace_date']);
|
||||
$data['policy_status'] = $policy_status_key;
|
||||
// $data['policy_terms'] = $terms;
|
||||
|
||||
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
@ -3325,7 +3519,8 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
public function getWellnessUrl()
|
||||
{
|
||||
$url = "https://aam.mohfw.gov.in/home/login";
|
||||
// $url = "https://aam.mohfw.gov.in/home/login";
|
||||
$url = "";
|
||||
|
||||
if (!empty($url)) {
|
||||
return $this->respond([
|
||||
@ -3335,7 +3530,7 @@ class EmployeeRestController extends AdminController
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'failed',
|
||||
'message' => 'No link found'
|
||||
'message' => 'Coming soon........!'
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -461,9 +461,10 @@ class PolicyTransactionController extends BaseController
|
||||
$insurer_id = null;
|
||||
}
|
||||
|
||||
if($data['bro_payable_by'] == 1){
|
||||
$cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" || !empty($data['co_premium'][$index]) ) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0);
|
||||
}else{
|
||||
if ($data['bro_payable_by'] == 1) {
|
||||
$cop_amt = isset($data['co_premium'][$index]) && ($data['co_premium'][$index] != "0.00" && !empty($data['co_premium'][$index])) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0);
|
||||
// print_r($cop_amt);die();
|
||||
} else {
|
||||
$cop_amt = $data['co_premium'][$index] ?? 0;
|
||||
}
|
||||
|
||||
@ -1098,13 +1099,19 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
$data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
|
||||
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
// $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
list($policyList, $policyListByClient) = $this->getPolicyForEndorsment();
|
||||
|
||||
$data['endorsementPolicies'] = $policyList;
|
||||
$data['endorsementPolicyListByClient'] = $policyListByClient;
|
||||
|
||||
// dd($data);
|
||||
// print_r($data['endorsementPolicies']);die();
|
||||
|
||||
$this->loadLayout('policy_transaction_endorsement_list', $data);
|
||||
}
|
||||
@ -1648,6 +1655,7 @@ class PolicyTransactionController extends BaseController
|
||||
->where('policy_transaction.client_id', $client_id)
|
||||
->where('policy_transaction.client_policy_id', $client_policy_id)
|
||||
->where('policy_transaction.action_type', 'inception')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$is_copay_yes = $this->policyTransactionModel
|
||||
@ -2820,11 +2828,9 @@ class PolicyTransactionController extends BaseController
|
||||
try {
|
||||
|
||||
$bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails();
|
||||
|
||||
}catch (Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
|
||||
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||
|
||||
}
|
||||
$this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData));
|
||||
// dd($bdsInstallmentData);
|
||||
@ -2904,17 +2910,17 @@ class PolicyTransactionController extends BaseController
|
||||
'message' => $message,
|
||||
'subject' => $subject
|
||||
];
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||
}
|
||||
}
|
||||
|
||||
public function getMoreInfo() {
|
||||
public function getMoreInfo()
|
||||
{
|
||||
|
||||
$pt_id = $this->request->getPost("pt_id");
|
||||
$data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active",1)->where("pt_id",$pt_id)->findAll();
|
||||
$data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active", 1)->where("pt_id", $pt_id)->findAll();
|
||||
|
||||
foreach ($data_to_send['bds_data'] as &$data) {
|
||||
|
||||
@ -2923,23 +2929,23 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
if (!empty($data_to_send)) {
|
||||
|
||||
return $this->respond(['status' => true , "data" => $data_to_send],200);
|
||||
}else {
|
||||
return $this->respond(['status' => true, "data" => $data_to_send], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false,"No Data Found For the Policy Transaction"],404);
|
||||
return $this->respond(['status' => false, "No Data Found For the Policy Transaction"], 404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function saveInstallment() {
|
||||
|
||||
public function saveInstallment()
|
||||
{
|
||||
|
||||
$installments = $this->request->getPost('installments');
|
||||
|
||||
|
||||
if (!$installments || !is_array($installments)) {
|
||||
return $this->respond(['status' => false, 'message' => 'No data received'], 400);
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error",json_encode($installments));
|
||||
$this->myLogger->logme("error", json_encode($installments));
|
||||
// die();
|
||||
|
||||
foreach ($installments as &$row) {
|
||||
@ -2956,6 +2962,49 @@ class PolicyTransactionController extends BaseController
|
||||
return $this->respond(['status' => true, 'message' => 'Data saved successfully'], 200);
|
||||
}
|
||||
|
||||
protected function getPolicyForEndorsment()
|
||||
{
|
||||
|
||||
$policyList = [];
|
||||
$policyListByClient = [];
|
||||
|
||||
|
||||
$clients = $this->clientModel
|
||||
->select("*, DATE_FORMAT(dob, '%d-%m-%Y') as dob")
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$clientIds = array_column($clients, 'id');
|
||||
|
||||
$policies = $this->clientPolicyModel
|
||||
->select("
|
||||
client_policy.*,
|
||||
policy_type.policy_type,
|
||||
policy_type.ebp,
|
||||
policy_type.etp,
|
||||
policy_type.iep,
|
||||
policy_type.itp,
|
||||
policy_type.bap,
|
||||
policy_type.allocg,
|
||||
DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
|
||||
")
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->join('policy_transaction pt', 'pt.client_policy_id = client_policy.id and pt.action_type = "inception" and pt.is_active = 1 and pt.client_policy_id is not null')
|
||||
->whereIn('client_policy.client_id', $clientIds)
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
foreach ($policies as $policy) {
|
||||
$policyList[$policy['client_branch_id']][] = $policy;
|
||||
$policyListByClient[$policy['client_id']][] = $policy;
|
||||
if (isset($policyCount[$policy['client_id']])) {
|
||||
$policyCount[$policy['client_id']]++;
|
||||
} else {
|
||||
$policyCount[$policy['client_id']] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [$policyList, $policyListByClient];
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,12 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function verifyEmployeeWithMobileNumber()
|
||||
{
|
||||
try {
|
||||
@ -78,7 +84,7 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active'])
|
||||
->whereIn('EP.status', ['active', 'expired'])
|
||||
->first();
|
||||
|
||||
|
||||
@ -118,7 +124,7 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['active'])
|
||||
->whereIn('EP.status', ['active', 'expired'])
|
||||
->first();
|
||||
|
||||
if (isset($employeeData['employee_id'])) {
|
||||
@ -272,6 +278,13 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function verifyHrWithMobileNumber()
|
||||
{
|
||||
try {
|
||||
@ -295,16 +308,105 @@ class RestAuthenticationController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyHrWithEmail()
|
||||
{
|
||||
try {
|
||||
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
$email = $data->email;
|
||||
|
||||
$HrData = $this->hrModel->where('email', $email)
|
||||
->where('contact_type', 'client')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($HrData) {
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
$sql = "
|
||||
UPDATE level_contacts
|
||||
SET otp = ?
|
||||
WHERE email = ?
|
||||
AND contact_type = 'client'
|
||||
AND is_active = 1
|
||||
";
|
||||
|
||||
$db = db_connect();
|
||||
$update = $db->query($sql, [$otp, $email]);
|
||||
|
||||
if($update)
|
||||
{
|
||||
$data->otp = $otp;
|
||||
|
||||
$common = [
|
||||
'login_type' => 'HR login',
|
||||
'login_email' => $email,
|
||||
'mail_type' => 'otp_mail'
|
||||
];
|
||||
$subject = 'Nhance user verification - OTP';
|
||||
$mail_content = $otp . ' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $email, 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||
$this->myLogger->logme("info", $res);
|
||||
|
||||
if (json_decode($res)->status == 'success') {
|
||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateHROTP()
|
||||
{
|
||||
|
||||
$email = $this->request->getJSON()->email;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
|
||||
$this->hrModel->where('email', $email) ->where('contact_type', 'client')
|
||||
->where('is_active', 1)->set(array('otp' => $otp))
|
||||
->update();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public function getVerifiedHrData()
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp_verification = $this->request->getJSON()->otp_verification;
|
||||
// mobile number
|
||||
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
||||
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
||||
// email id
|
||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
|
||||
|
||||
if (isset($mobile_number))
|
||||
{
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||
}else{
|
||||
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||
}
|
||||
|
||||
if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) )
|
||||
{
|
||||
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
||||
if ($hrData && $otp_verification == true) {
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
@ -320,15 +422,34 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
if(isset($this->request->getJSON()->mobile_number)){
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->find();
|
||||
|
||||
}else if(isset($this->request->getJSON()->otp)){
|
||||
|
||||
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->where('level_contacts.email', $email )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->find();
|
||||
}
|
||||
|
||||
$result = JWTToken::encode($hrData['0']);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" ],200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||
@ -505,5 +626,32 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
// TokenController.php
|
||||
public function bookstackLoginToken()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$user_data = session()->get('userData');
|
||||
$user = $user_data->email;
|
||||
$secret = getenv('bookstack.token');
|
||||
// $user = 'staff@staff.com';
|
||||
$name = $user_data->first_name ?? 'User';
|
||||
|
||||
$payload = [
|
||||
'email' => $user,
|
||||
'name' => $name,
|
||||
'exp' => time() + (60 * 60 * 24) // expires in 1 day
|
||||
];
|
||||
|
||||
// dd($payload);
|
||||
$token = base64_encode(json_encode($payload));
|
||||
$signature = hash_hmac('sha256', $token, $secret);
|
||||
$bookStackUrl = getenv('bookstack.baseURL');
|
||||
|
||||
$url = $bookStackUrl . urlencode($token) . '&sig=' . $signature;
|
||||
return redirect()->to($url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1659,6 +1659,8 @@ class TicketController extends BaseController
|
||||
$policies = $this->employeePolicyModel
|
||||
->select('client_policy_id')
|
||||
->where('employee_id', $emp_id)
|
||||
->where('is_active', 1)
|
||||
->where('status', 'active')
|
||||
->findAll();
|
||||
|
||||
if (empty($policies)) {
|
||||
@ -1670,8 +1672,20 @@ class TicketController extends BaseController
|
||||
|
||||
// Fetch all policy names and IDs in one query
|
||||
$policyNameandID = $this->clientPolicyModel
|
||||
->select('CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name, client_policy.id as client_policy_value,client_policy.policy_type_id,client_policy.policy_no')
|
||||
->select('
|
||||
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
|
||||
client_policy.id as client_policy_value,
|
||||
client_policy.policy_type_id,
|
||||
client_policy.policy_no,
|
||||
insurers.id as insurer_id,
|
||||
insurers.name as insurer_name,
|
||||
tpa.name as tpa_name,
|
||||
tpa.id as tpa_id,
|
||||
')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
|
||||
->where('client_policy.policy_status', 1)
|
||||
->whereIn('client_policy.id', $policy_ids)
|
||||
->findAll();
|
||||
|
||||
@ -1840,8 +1854,12 @@ class TicketController extends BaseController
|
||||
$this->loadLayout("ticket_feedback_list",$data);
|
||||
}
|
||||
|
||||
public function getMoreInfo() {
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
public function getMoreInfo($requestFrom = null , $ticket_id) {
|
||||
|
||||
if($requestFrom == null){
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
||||
|
||||
$fields = $this->extraFields;
|
||||
@ -1905,6 +1923,9 @@ class TicketController extends BaseController
|
||||
|
||||
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
||||
|
||||
if($requestFrom == 'rest'){
|
||||
return $data_to_send;
|
||||
}
|
||||
// Send response based on data availability
|
||||
if (!empty($data_to_send)) {
|
||||
return $this->respond(['status' => true, 'data' => $data_to_send], 200);
|
||||
|
||||
@ -12,6 +12,7 @@ use App\Models\UserModel;
|
||||
use App\Models\RoleModel;
|
||||
use App\Models\TeamModel;
|
||||
use App\Models\UserTeamsModel;
|
||||
use App\Helpers\BookStackUserHelper;
|
||||
|
||||
|
||||
class UserController extends AdminController
|
||||
@ -21,6 +22,7 @@ class UserController extends AdminController
|
||||
protected $roleModel;
|
||||
protected $teamModel;
|
||||
protected $userTeamsModel;
|
||||
protected $bookStack;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -31,6 +33,7 @@ class UserController extends AdminController
|
||||
$this->roleModel = new RoleModel();
|
||||
$this->teamModel = new TeamModel();
|
||||
$this->userTeamsModel = new UserTeamsModel();
|
||||
$this->bookStack = new BookStackUserHelper();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -60,10 +63,17 @@ class UserController extends AdminController
|
||||
$userData['created_by'] = get_session_userid();
|
||||
$temp_team = $userData['team'];
|
||||
unset($userData['team']);
|
||||
|
||||
$insert = $this->userModel->insert($userData);
|
||||
|
||||
if ($insert) {
|
||||
$bookStackData = [
|
||||
'name' => $userData['first_name'],
|
||||
'email' => $userData['email'],
|
||||
|
||||
];
|
||||
$this->bookStack->createEditUser($bookStackData);
|
||||
|
||||
if ($insert) {
|
||||
$teamData['user_id'] = $insert;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
@ -137,10 +147,20 @@ class UserController extends AdminController
|
||||
unset($userData['csrf_test_name']);
|
||||
unset($userData['PrimaryKey']);
|
||||
|
||||
$existingData = $this->userModel->where('id',$id)->first();;
|
||||
|
||||
// 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();
|
||||
|
||||
$bookStackData = [
|
||||
'name' => $userData['first_name'],
|
||||
'email' => $userData['email'],
|
||||
];
|
||||
|
||||
$this->bookStack->createEditUser($bookStackData,$existingData);
|
||||
|
||||
|
||||
if ($update) {
|
||||
|
||||
if ($teams) {
|
||||
@ -211,7 +231,11 @@ class UserController extends AdminController
|
||||
public function deactive($id = null)
|
||||
{
|
||||
$model = new UserModel();
|
||||
|
||||
$emailToDelete = $model->where('id', $id)->first();
|
||||
$deactive = $model->where('id', $id)->set(['is_active' => 0])->update();
|
||||
|
||||
$this->bookStack->deleteUser($emailToDelete);
|
||||
if($deactive)
|
||||
{
|
||||
// $db = \Config\Database::connect();
|
||||
|
||||
77
app/Helpers/BookStackUserHelper.php
Normal file
77
app/Helpers/BookStackUserHelper.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\BookStackUserModel;
|
||||
use App\Models\BookStackRoleModel;
|
||||
|
||||
class BookStackUserHelper {
|
||||
|
||||
protected $userModel;
|
||||
protected $roleModel;
|
||||
|
||||
public function __construct() {
|
||||
$this->userModel = new BookStackUserModel();
|
||||
$this->roleModel = new BookStackRoleModel();
|
||||
}
|
||||
|
||||
public function createEditUser($data,$preData = null) {
|
||||
// This function will handle the creation or editing of a user
|
||||
// It will check if the user already exists and update or create accordingly
|
||||
// The $data parameter should contain all necessary user information
|
||||
// For example: ['name' => 'johndoe', 'email' => 'johndoe@doe.com']
|
||||
|
||||
if (!empty($preData)) {
|
||||
|
||||
$isExistingUser = $this->userModel->where('email', $preData['email'])->first();
|
||||
|
||||
if ($isExistingUser) {
|
||||
$id = $isExistingUser['id'];
|
||||
$update = $this->userModel->where('id', $id)->set($data)->update();
|
||||
return $update;
|
||||
}
|
||||
}
|
||||
|
||||
$password = 'password';
|
||||
$hashedPassword = ['password' => password_hash($password, PASSWORD_DEFAULT)];
|
||||
|
||||
$slug = ['slug' => $this->createSlug($data['name'])];
|
||||
|
||||
// array_push($data,$hashedPassword,$slug);
|
||||
|
||||
$data['password'] = $hashedPassword['password'];
|
||||
$data['slug'] = $slug['slug'];
|
||||
|
||||
// dd($data);
|
||||
$this->userModel->insert($data);
|
||||
$userId = $this->userModel->insertID();
|
||||
|
||||
if (!empty($userId)) {
|
||||
|
||||
$roleData = [
|
||||
'user_id' => $userId,
|
||||
'role_id' => 3 // 3 is the default role ID for viewers
|
||||
];
|
||||
|
||||
$this->roleModel->insert($roleData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function createSlug($string) {
|
||||
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)));
|
||||
}
|
||||
|
||||
public function deleteUser($data) {
|
||||
|
||||
$isExistingUser = $this->userModel->where('email', $data['email'])->first();
|
||||
if ($isExistingUser) {
|
||||
$id = $isExistingUser['id'];
|
||||
$delete = $this->userModel->where('id', $id)->delete();
|
||||
$this->roleModel->where('user_id', $id)->delete();
|
||||
return $delete;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -102,10 +102,10 @@ class DepositHelper
|
||||
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||
|
||||
if(empty($cd_ac_pk)){
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY id DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$cd_ac_no];
|
||||
}else{
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_pk = ? AND is_active = 1 ORDER BY id DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$cd_ac_pk];
|
||||
}
|
||||
|
||||
|
||||
@ -1385,7 +1385,7 @@ if (!function_exists('premium_calculation_manager')) {
|
||||
}
|
||||
|
||||
//this if condition for premium calculated & premium type 3 (familiy floater but premium calculated every individual implemented later) then remove si amount only for dependents (not self)
|
||||
if ($is_match_found && strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 3) {
|
||||
if ($is_match_found && strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 3 && $policy_terms['is_addon'] != 3) {
|
||||
//set dependent si to 0
|
||||
$emp_data['policy_details']['basic_cover_si'] = 0;
|
||||
}
|
||||
@ -2008,4 +2008,30 @@ if (!function_exists('generate_family_floater_key')) {
|
||||
|
||||
return $relation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('formatIndianCurrency')) {
|
||||
function formatIndianCurrency($amount)
|
||||
{
|
||||
$amount = (string) $amount;
|
||||
$decimal = '';
|
||||
|
||||
// Split decimal part if exists
|
||||
if (strpos($amount, '.') !== false) {
|
||||
list($amount, $decimal) = explode('.', $amount);
|
||||
$decimal = '.' . substr($decimal, 0, 2); // Limit to 2 decimal places
|
||||
}
|
||||
|
||||
$lastThree = substr($amount, -3);
|
||||
$rest = substr($amount, 0, -3);
|
||||
|
||||
if ($rest != '') {
|
||||
$rest = preg_replace("/\B(?=(\d{2})+(?!\d))/", ",", $rest);
|
||||
$formatted = $rest . ',' . $lastThree;
|
||||
} else {
|
||||
$formatted = $lastThree;
|
||||
}
|
||||
|
||||
return $formatted . $decimal;
|
||||
}
|
||||
}
|
||||
|
||||
19
app/Models/BookStackRoleModel.php
Normal file
19
app/Models/BookStackRoleModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BookStackRoleModel extends Model
|
||||
{
|
||||
protected $DBGroup = 'book_stack';
|
||||
protected $table = 'role_user';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDelete = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
'user_id','role_id'
|
||||
];
|
||||
|
||||
}
|
||||
19
app/Models/BookStackUserModel.php
Normal file
19
app/Models/BookStackUserModel.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BookStackUserModel extends Model
|
||||
{
|
||||
protected $DBGroup = 'book_stack';
|
||||
protected $table = 'users';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDelete = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
'name','email','password','slug'
|
||||
];
|
||||
|
||||
}
|
||||
@ -181,8 +181,9 @@ class ClientPolicyModel extends Model
|
||||
->where('client_policy.client_id', $id)
|
||||
->where('cd_master.id = client_policy.cd_ac_pk')
|
||||
->where('cd_master.is_active', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->groupBy('client_policy.cd_ac_pk')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
@ -225,10 +226,10 @@ class ClientPolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getDepositData($clientId, $insurerId)
|
||||
public function getDepositData($clientId, $insurerId, $cd_ac_pk = null)
|
||||
{
|
||||
// Fetch the deposit data based on client and insurer IDs
|
||||
return $this->db->table('cash_deposit')
|
||||
// Fetch the deposit data based on client and insurer IDs
|
||||
$query = $this->db->table('cash_deposit')
|
||||
->select('cash_deposit.*')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('clients.client_name as clientname, clients.short_name as clientshort, client_policy.policy_no')
|
||||
@ -245,15 +246,18 @@ class ClientPolicyModel extends Model
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
|
||||
->where('cash_deposit.client_id', $clientId)
|
||||
->where('cash_deposit.insurer_id', $insurerId)
|
||||
->where('cash_deposit.is_active', 1)
|
||||
->where('cash_deposit.is_active', 1);
|
||||
// ->where('cash_deposit.cd_ac_pk = cd_master.id')
|
||||
->orderBy('cash_deposit.id', 'DESC')
|
||||
->get()
|
||||
->getResult();
|
||||
if(!empty($cd_ac_pk)){
|
||||
$query->where('cash_deposit.cd_ac_pk', $cd_ac_pk);
|
||||
}
|
||||
$query->orderBy('cash_deposit.id', 'DESC');
|
||||
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function getDepositSummary($clientId, $insurerId)
|
||||
public function getDepositSummary($clientId, $insurerId, $cd_ac_pk)
|
||||
{
|
||||
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||
return $this->db->table('cash_deposit')
|
||||
@ -263,6 +267,7 @@ class ClientPolicyModel extends Model
|
||||
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
||||
->where('client_id', $clientId)
|
||||
->where('insurer_id', $insurerId)
|
||||
->where('cd_ac_pk', $cd_ac_pk)
|
||||
->where('cash_deposit.is_active', 1)
|
||||
->get()
|
||||
->getRow();
|
||||
@ -315,10 +320,12 @@ class ClientPolicyModel extends Model
|
||||
public function getDepositlistsummary($id)
|
||||
{
|
||||
return $this->db->table('cash_deposit')
|
||||
->select('insurer_id')
|
||||
->select('insurer_id, cd_ac_pk')
|
||||
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
|
||||
->where('client_id', $id)
|
||||
->where('is_active', 1)
|
||||
->groupBy('insurer_id')
|
||||
// ->groupBy('cd_ac_pk')
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
@ -326,14 +333,18 @@ class ClientPolicyModel extends Model
|
||||
|
||||
public function updateStatus()
|
||||
{
|
||||
|
||||
// Update client_policy table
|
||||
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
||||
$client_count = $this->db->affectedRows();
|
||||
|
||||
// Update employee_polices table
|
||||
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
||||
$emp_count = $this->db->affectedRows();
|
||||
|
||||
// Log the result
|
||||
log_message('info', "Client policies updated: {$client_count}");
|
||||
log_message('info', "Employee policies updated: {$emp_count}");
|
||||
|
||||
return ['client' => $client_count, 'emp' => $emp_count];
|
||||
}
|
||||
|
||||
@ -358,12 +369,12 @@ class ClientPolicyModel extends Model
|
||||
{
|
||||
|
||||
$query = "
|
||||
SELECT client_policy.*, policies.name, policies.policy_type_id
|
||||
FROM client_policy
|
||||
JOIN policies ON policies.id = client_policy.policy_id
|
||||
JOIN policy_type ON policy_type.id = policies.policy_type_id
|
||||
WHERE policy_type.policy_type = '{$type}'
|
||||
AND client_policy.client_id = {$client_id}";
|
||||
SELECT client_policy.*, policies.name, policies.policy_type_id
|
||||
FROM client_policy
|
||||
JOIN policies ON policies.id = client_policy.policy_id
|
||||
JOIN policy_type ON policy_type.id = policies.policy_type_id
|
||||
WHERE policy_type.policy_type = '{$type}'
|
||||
AND client_policy.client_id = {$client_id}";
|
||||
|
||||
$result = $this->db->query($query)->getResult();
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.designation AS emp_designation,
|
||||
employees.basic_pay AS emp_basic_pay,
|
||||
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, employee_polices.date_coverage) AS emp_age,
|
||||
employees.emp_type as emp_type,
|
||||
|
||||
|
||||
@ -597,17 +597,17 @@ class EmployeePolicyModel extends Model
|
||||
public function getSIEnhancementEmployeesDataForExportExcel($ref_data, $return_type = 0)
|
||||
{
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id as endorsement_primarykey,
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id AS endorsement_primarykey,
|
||||
a.group_key,
|
||||
employee_polices.id AS primaryKey,
|
||||
employees.name AS emp_name,
|
||||
@ -616,10 +616,8 @@ class EmployeePolicyModel extends Model
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
employees.relationship AS emp_relationship,
|
||||
employees.emp_type as emp_type,
|
||||
'SI' as event_type_data,
|
||||
|
||||
|
||||
employees.emp_type AS emp_type,
|
||||
'SI' AS event_type_data,
|
||||
employees.doj AS emp_doj,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email_c,
|
||||
@ -627,97 +625,59 @@ class EmployeePolicyModel extends Model
|
||||
employees.band AS emp_grade,
|
||||
employees.designation AS emp_designation,
|
||||
employees.basic_pay AS emp_basic_pay,
|
||||
|
||||
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,
|
||||
employee_polices.rata_premimum as old_si_premium,
|
||||
employee_polices.basic_cover_si AS old_basic_cover_si,
|
||||
employee_polices.premium AS old_si_premium,
|
||||
employee_polices.rata_premimum AS old_rata_premium,
|
||||
employee_polices.age_band,
|
||||
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.old_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
|
||||
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||
|
||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premium,
|
||||
|
||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
ROUND(
|
||||
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) +
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||
2
|
||||
) AS pro_rata_premium,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
) AS gst,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
ROUND(
|
||||
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2
|
||||
), 2
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
),
|
||||
2
|
||||
) AS total
|
||||
|
||||
FROM
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON employees.emp_code = a.emp_code
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN employees ON employees.emp_code = a.emp_code
|
||||
LEFT JOIN employee_polices ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
aa.emp_code,
|
||||
aa.new_value as 'new_basic_cover_si',
|
||||
bb.new_value as 'new_si_premium',
|
||||
cc.new_value as 'date_of_coverage'
|
||||
FROM (
|
||||
SELECT
|
||||
a1.emp_code,
|
||||
a1.field_name,
|
||||
a1.new_value
|
||||
FROM
|
||||
emp_endorsement as a1
|
||||
WHERE
|
||||
a1.field_name = 'basic_cover_si'
|
||||
) aa
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
b1.emp_code,
|
||||
b1.field_name,
|
||||
b1.new_value
|
||||
FROM
|
||||
emp_endorsement as b1
|
||||
WHERE
|
||||
b1.field_name = 'premium'
|
||||
) bb ON aa.emp_code = bb.emp_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
c1.emp_code,
|
||||
c1.field_name,
|
||||
c1.new_value
|
||||
FROM
|
||||
emp_endorsement as c1
|
||||
WHERE
|
||||
c1.field_name = 'si_enhancement_date'
|
||||
) cc ON aa.emp_code = cc.emp_code
|
||||
) as sidata ON a.emp_code = sidata.emp_code
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT
|
||||
batch_list.emp_policy_id,
|
||||
batch_list.batch_code AS bl,
|
||||
batch_files.batch_code AS bf
|
||||
FROM
|
||||
batch_files
|
||||
LEFT JOIN
|
||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
WHERE
|
||||
batch_files.event_type = 'si_enhancement'
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
|
||||
SELECT
|
||||
emp_code,
|
||||
CAST(MAX(CASE WHEN field_name = 'basic_cover_si' THEN new_value END) AS UNSIGNED) AS new_basic_cover_si,
|
||||
CAST(MAX(CASE WHEN field_name = 'premium' THEN new_value END) AS DECIMAL(10,2)) AS new_si_premium,
|
||||
CAST(MAX(CASE WHEN field_name = 'premium' THEN old_value END) AS DECIMAL(10,2)) AS old_si_premium,
|
||||
MAX(CASE WHEN field_name = 'si_enhancement_date' THEN new_value END) AS date_of_coverage
|
||||
FROM emp_endorsement
|
||||
GROUP BY emp_code
|
||||
) AS sidata ON a.emp_code = sidata.emp_code
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
$endorsement_condition
|
||||
@ -730,20 +690,177 @@ class EmployeePolicyModel extends Model
|
||||
group by group_key
|
||||
");
|
||||
|
||||
// Get the result set
|
||||
$results = $query->getResult();
|
||||
// Get the result set
|
||||
$results = $query->getResult();
|
||||
|
||||
if($return_type == 1){
|
||||
$results = $query->getResultArray();
|
||||
}else{
|
||||
$results = $query->getResult();
|
||||
}
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
return $results;
|
||||
if ($return_type == 1) {
|
||||
$results = $query->getResultArray();
|
||||
} else {
|
||||
$results = $query->getResult();
|
||||
}
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
return $results;
|
||||
}
|
||||
|
||||
// DO NOT DELETE this SI ENHANCEMENT QUERY FUNCTION
|
||||
|
||||
// public function getSIEnhancementEmployeesDataForExportExcel($ref_data, $return_type = 0)
|
||||
// {
|
||||
|
||||
// $client_id = $ref_data['client_id'];
|
||||
// $client_policy_id = $ref_data['client_policy_id'];
|
||||
// $client_branch_id = $ref_data['client_branch_id'];
|
||||
// $insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
// $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
|
||||
// $query = $this->db->query("
|
||||
// SELECT
|
||||
// a.id as endorsement_primarykey,
|
||||
// a.group_key,
|
||||
// employee_polices.id AS primaryKey,
|
||||
// employees.name AS emp_name,
|
||||
// employees.emp_code AS emp_code,
|
||||
// employees.dob AS emp_dob,
|
||||
// employees.gender AS emp_gender,
|
||||
// employees.relationship_code AS emp_relationship_code,
|
||||
// employees.relationship AS emp_relationship,
|
||||
// employees.emp_type as emp_type,
|
||||
// 'SI' as event_type_data,
|
||||
|
||||
|
||||
// employees.doj AS emp_doj,
|
||||
// employees.mobile AS emp_mobile,
|
||||
// employees.email_corporate AS emp_email_c,
|
||||
// employees.email_personal AS emp_email_p,
|
||||
// employees.band AS emp_grade,
|
||||
// employees.designation AS emp_designation,
|
||||
// employees.basic_pay AS emp_basic_pay,
|
||||
|
||||
// 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,
|
||||
// employee_polices.premium as old_si_premium,
|
||||
// employee_polices.rata_premimum as old_rata_premium,
|
||||
// employee_polices.age_band,
|
||||
|
||||
// batch_data.emp_policy_id,
|
||||
// batch_data.bl AS batch_list_batch_code,
|
||||
// batch_data.bf AS batch_files_batch_code,
|
||||
|
||||
// sidata.new_basic_cover_si,
|
||||
// sidata.new_si_premium,
|
||||
// sidata.old_si_premium,
|
||||
// sidata.date_of_coverage,
|
||||
|
||||
// DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
|
||||
// ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
|
||||
// ROUND((sidata.new_si_premium - sidata.old_si_premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premium,
|
||||
|
||||
// ROUND(((sidata.new_si_premium - sidata.old_si_premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
|
||||
// ROUND(
|
||||
// ((sidata.new_si_premium - sidata.old_si_premium) *
|
||||
// (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) +
|
||||
// ROUND(
|
||||
// ((sidata.new_si_premium - sidata.old_si_premium) *
|
||||
// (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2
|
||||
// ), 2
|
||||
// ) AS total
|
||||
|
||||
// FROM
|
||||
// emp_endorsement a
|
||||
// LEFT JOIN
|
||||
// employees ON employees.emp_code = a.emp_code
|
||||
// LEFT JOIN
|
||||
// employee_polices ON employees.id = employee_polices.employee_id
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// aa.emp_code,
|
||||
// aa.new_value as 'new_basic_cover_si',
|
||||
// bb.new_value as 'new_si_premium',
|
||||
// bb.old_value as 'old_si_premium',
|
||||
// cc.new_value as 'date_of_coverage'
|
||||
// FROM (
|
||||
// SELECT
|
||||
// a1.emp_code,
|
||||
// a1.field_name,
|
||||
// a1.new_value,
|
||||
// a1.old_value
|
||||
// FROM
|
||||
// emp_endorsement as a1
|
||||
// WHERE
|
||||
// a1.field_name = 'basic_cover_si'
|
||||
// ) aa
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// b1.emp_code,
|
||||
// b1.field_name,
|
||||
// b1.new_value,
|
||||
// b1.old_value
|
||||
// FROM
|
||||
// emp_endorsement as b1
|
||||
// WHERE
|
||||
// b1.field_name = 'premium'
|
||||
// ) bb ON aa.emp_code = bb.emp_code
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// c1.emp_code,
|
||||
// c1.field_name,
|
||||
// c1.new_value,
|
||||
// c1.old_value
|
||||
// FROM
|
||||
// emp_endorsement as c1
|
||||
// WHERE
|
||||
// c1.field_name = 'si_enhancement_date'
|
||||
// ) cc ON aa.emp_code = cc.emp_code
|
||||
// ) as sidata ON a.emp_code = sidata.emp_code
|
||||
// LEFT JOIN (
|
||||
// SELECT DISTINCT
|
||||
// batch_list.emp_policy_id,
|
||||
// batch_list.batch_code AS bl,
|
||||
// batch_files.batch_code AS bf
|
||||
// FROM
|
||||
// batch_files
|
||||
// LEFT JOIN
|
||||
// batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
// WHERE
|
||||
// batch_files.event_type = 'si_enhancement'
|
||||
// AND batch_files.actions = 'export'
|
||||
// AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
// ) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
|
||||
// WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
// AND employees.client_branch_id = '{$client_branch_id}'
|
||||
// $endorsement_condition
|
||||
// AND a.actions = 'si'
|
||||
// AND a.status != 'truncated'
|
||||
// AND employee_polices.is_active = 1
|
||||
// AND employee_polices.status = 'active'
|
||||
// AND employees.is_active = 1
|
||||
// AND employees.emp_status = 'active'
|
||||
// group by group_key
|
||||
// ");
|
||||
|
||||
// // Get the result set
|
||||
// $results = $query->getResult();
|
||||
|
||||
// if($return_type == 1){
|
||||
// $results = $query->getResultArray();
|
||||
// }else{
|
||||
// $results = $query->getResult();
|
||||
// }
|
||||
|
||||
// // dd($this->db->getLastQuery());
|
||||
// return $results;
|
||||
|
||||
// }
|
||||
|
||||
// DO NOT DELETE this DELETION QUERY FUNCTION
|
||||
|
||||
// public function getDeletionEmployeeDataForExportExcel($ref_data, $return_type = 0)
|
||||
@ -944,10 +1061,10 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
$status_condition = "{$insurer_or_tpa}" === 'tpa'
|
||||
? "employee_polices.status = 'active' AND employees.emp_status = 'active'"
|
||||
? "employee_polices.status = 'inactive' AND employees.emp_status = 'active'"
|
||||
: "employee_polices.status = 'active' AND employees.emp_status = 'active'";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT DISTINCT
|
||||
@ -972,7 +1089,8 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.uhid as uhid,
|
||||
employee_polices.rata_premimum as premium,
|
||||
employee_polices.rata_premimum,
|
||||
ROUND(employee_polices.premium,2) as premium,
|
||||
employee_polices.claim_status,
|
||||
employee_polices.age_band,
|
||||
employee_polices.tpa_id,
|
||||
@ -998,22 +1116,22 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
CASE
|
||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
||||
ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2)
|
||||
ROUND((employee_polices.premium * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2)
|
||||
ELSE
|
||||
0
|
||||
END AS pro_rata_premium,
|
||||
|
||||
CASE
|
||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
||||
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2)
|
||||
ROUND(((employee_polices.premium * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2)
|
||||
ELSE
|
||||
0
|
||||
END AS gst,
|
||||
|
||||
CASE
|
||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
||||
ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) +
|
||||
(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
||||
ROUND(((employee_polices.premium * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) +
|
||||
(((employee_polices.premium * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
||||
ELSE
|
||||
0
|
||||
END AS total,
|
||||
|
||||
@ -97,6 +97,7 @@ class LeadsModel extends Model
|
||||
'is_installment',
|
||||
'no_of_installment',
|
||||
'is_policy_created',
|
||||
'claim_history'
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -125,13 +125,13 @@ input:checked + .slider:before {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- <div>
|
||||
<label class="switch">
|
||||
<input id="is_download_btn" type="checkbox" name="is_download_btn" <?= (isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
|
||||
<input id="is_download_btn" type="checkbox" name="is_download_btn" <?php // echo(isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_download_btn" style=" position: relative;bottom: 5px;">Enable Client Export Option</label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a class="dropdown-item"
|
||||
href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}"); ?>">
|
||||
href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}&cd_ac_pk={$value->cd_ac_pk}"); ?>">
|
||||
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit
|
||||
</a>
|
||||
</td>
|
||||
|
||||
@ -94,16 +94,16 @@ body {
|
||||
<span class="d-none d-sm-inline-block">API</span>
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<!-- <li class="nav-item">
|
||||
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Others</span>
|
||||
</a>
|
||||
</li>
|
||||
</li> -->
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include("client_api.php"); ?>
|
||||
<?php include('client_others_tab.php'); ?>
|
||||
<?php // include('client_others_tab.php'); ?>
|
||||
<?php include('notification.php'); ?>
|
||||
<?php include('client_basic_info.php'); ?>
|
||||
<?php include('client_kyc.php'); ?>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<th>Client Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrolment Status</th>
|
||||
<!-- <th>Enrolment Status</th> -->
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -136,7 +136,7 @@
|
||||
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 EB">
|
||||
<!-- <div class="form-group col-md-4 EB">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="inception_type" type="checkbox" name="inception_type">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
@ -159,7 +159,7 @@
|
||||
<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 dateofdata" placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date" id="reminder_date" >
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-12 EB">
|
||||
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
||||
@ -239,23 +239,23 @@
|
||||
|
||||
<script>
|
||||
|
||||
$('#inception_type').change(function () {
|
||||
var open_data = $('#open_date').parent();
|
||||
var close_data = $('#close_date').parent();
|
||||
var reminder_data = $('#reminder_date').parent();
|
||||
if($(this).prop('checked')){
|
||||
$(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);
|
||||
// $('#inception_type').change(function () {
|
||||
// var open_data = $('#open_date').parent();
|
||||
// var close_data = $('#close_date').parent();
|
||||
// var reminder_data = $('#reminder_date').parent();
|
||||
// if($(this).prop('checked')){
|
||||
// $(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);
|
||||
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
@ -348,28 +348,28 @@
|
||||
}
|
||||
//console.log('search_term :', search_term)
|
||||
|
||||
var enrollmentStatus = '';
|
||||
if (item.inception_type == 1) {
|
||||
// var enrollmentStatus = '';
|
||||
// if (item.inception_type == 1) {
|
||||
|
||||
enrollmentStatus = 'N/A'
|
||||
// enrollmentStatus = 'N/A'
|
||||
|
||||
} else if (item.inception_type == 2) {
|
||||
// } else if (item.inception_type == 2) {
|
||||
|
||||
if (item.open_for_enrollment == 1) {
|
||||
// if (item.open_for_enrollment == 1) {
|
||||
|
||||
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">Open</a>'
|
||||
// enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
|
||||
// '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">Open</a>'
|
||||
|
||||
|
||||
} else if (item.open_for_enrollment == 0) {
|
||||
// } else if (item.open_for_enrollment == 0) {
|
||||
|
||||
enrollmentStatus =
|
||||
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
|
||||
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
// enrollmentStatus =
|
||||
// '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
|
||||
// item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
var tpaValue = 'TPA Unavailable';
|
||||
|
||||
@ -388,7 +388,7 @@
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</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>
|
||||
<div class="btn-group dropdown">
|
||||
@ -434,6 +434,7 @@
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').show();
|
||||
// console.log("Policy Form Added")
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
@ -442,9 +443,9 @@
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#close_date').val('').change();
|
||||
// $('#start_date').val('').change();
|
||||
// $('#end_date').val('').change();
|
||||
// $('#close_date').val('').change();
|
||||
// $('#policy').html('<option value="" selected>Select Policy</option>').change();
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
@ -590,31 +591,31 @@
|
||||
|
||||
// //console.log('search_term :', search_term)
|
||||
|
||||
var enrollmentStatus = '';
|
||||
if (item.inception_type == 1) {
|
||||
// var enrollmentStatus = '';
|
||||
// if (item.inception_type == 1) {
|
||||
|
||||
enrollmentStatus = 'N/A'
|
||||
// enrollmentStatus = 'N/A'
|
||||
|
||||
} else if (item.inception_type == 2) {
|
||||
// } else if (item.inception_type == 2) {
|
||||
|
||||
if (item.open_for_enrollment == 1) {
|
||||
// if (item.open_for_enrollment == 1) {
|
||||
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Open</a>'
|
||||
// enrollmentStatus =
|
||||
// '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
||||
// item.id + '" id="' + item.policy_id +
|
||||
// '" class="btnOpenEnroll">Open</a>'
|
||||
|
||||
|
||||
} else if (item.open_for_enrollment == 0) {
|
||||
// } else if (item.open_for_enrollment == 0) {
|
||||
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Closed</a>'
|
||||
// enrollmentStatus =
|
||||
// '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
||||
// item.id + '" id="' + item.policy_id +
|
||||
// '" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
var tpaValue = 'TPA Unavailable';
|
||||
|
||||
@ -632,7 +633,6 @@
|
||||
<td>${tpaValue}</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>
|
||||
<div class="btn-group dropdown">
|
||||
@ -725,10 +725,12 @@
|
||||
$(document).ready(function() {
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy_type').change(function() {
|
||||
// alert('policy_type change');
|
||||
|
||||
var policy_type_id = $(this).val();
|
||||
// alert(policy_type_id);
|
||||
|
||||
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
|
||||
if (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7 || policy_type_id > 10) {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
} else {
|
||||
@ -804,19 +806,19 @@
|
||||
|
||||
|
||||
//Open for enrollment yes or no
|
||||
if (res.data.inception_type == 2) {
|
||||
$('#inception_type').prop('checked', true);
|
||||
$('#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);
|
||||
}
|
||||
// if (res.data.inception_type == 2) {
|
||||
// $('#inception_type').prop('checked', true);
|
||||
// $('#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);
|
||||
// }
|
||||
|
||||
//Policy Visibility in Web App
|
||||
if (res.data.enrolment_visibility == 1) {
|
||||
@ -904,7 +906,8 @@
|
||||
$('#third').show();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
|
||||
$("#tpa").prop('required', false);
|
||||
$('#tpa_danger').hide();
|
||||
$(".EB").hide();
|
||||
}
|
||||
|
||||
@ -1450,14 +1453,29 @@
|
||||
$('#base_policy').prop('required', false);
|
||||
$('#base_danger').hide();
|
||||
}
|
||||
|
||||
if($('#inception_type').prop('checked')){
|
||||
|
||||
if ($(this).val() > 7) {
|
||||
|
||||
$('#first').show();
|
||||
$('#second').show();
|
||||
$('#third').show();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
$(".EB").hide();
|
||||
setTimeout(() => {
|
||||
$("#tpa").prop('required', false);
|
||||
$('#tpa_danger').hide();
|
||||
}, 100);
|
||||
|
||||
}else{
|
||||
$('#open_date').parent().hide();
|
||||
$('#close_date').parent().hide();
|
||||
$('#reminder_date').parent().hide();
|
||||
}
|
||||
|
||||
// if($('#inception_type').prop('checked')){
|
||||
|
||||
// }else{
|
||||
// $('#open_date').parent().hide();
|
||||
// $('#close_date').parent().hide();
|
||||
// $('#reminder_date').parent().hide();
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
@ -1530,6 +1548,7 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#base_policy').change(function() {
|
||||
// alert('Base Policy Change');
|
||||
|
||||
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
||||
var policy_type = $('#policy_type').val()
|
||||
@ -1882,19 +1901,19 @@
|
||||
$('#policy_status_field').show();
|
||||
|
||||
|
||||
if (res.data.inception_type == 2) {
|
||||
$('#inception_type').prop('checked', true);
|
||||
$('#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);
|
||||
}
|
||||
// if (res.data.inception_type == 2) {
|
||||
// $('#inception_type').prop('checked', true);
|
||||
// $('#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);
|
||||
// }
|
||||
|
||||
|
||||
if (res.data.enrolment_visibility == 1) {
|
||||
@ -2002,7 +2021,8 @@
|
||||
$('#third').show();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
|
||||
$("#tpa").prop('required', false);
|
||||
$('#tpa_danger').hide();
|
||||
$(".EB").hide();
|
||||
}
|
||||
|
||||
|
||||
@ -627,10 +627,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
if (isDuplicate) {
|
||||
toastr.warning('This value is already selected in another dropdown.', 'Warning');
|
||||
selectElement.value = '';
|
||||
}
|
||||
// if (isDuplicate) {
|
||||
// toastr.warning('This value is already selected in another dropdown.', 'Warning');
|
||||
// selectElement.value = '';
|
||||
// }
|
||||
}
|
||||
|
||||
$('.close').click(function()
|
||||
|
||||
@ -849,9 +849,9 @@
|
||||
<?php if (in_array(get_role_id(), [1,2,3,5])) { ?>
|
||||
<li>
|
||||
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
|
||||
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> App Content Management </span>
|
||||
<span>App Content Mgmt</span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboardsmenu">
|
||||
<ul class="nav-second-level">
|
||||
@ -865,7 +865,12 @@
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<li>
|
||||
<a id="user_manual" href="<?= base_url("autobookstackLogin") ?>" class="waves-effect" target="_blank" rel="noopener noreferrer">
|
||||
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
||||
<span>User Manual</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- End Sidebar -->
|
||||
|
||||
@ -36,6 +36,53 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.info-icon-wrapper {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
top: 30px;
|
||||
left: 35px;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.info-tooltip {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
width: max-content;
|
||||
max-width: 300px;
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
bottom: 125%; /* Show above icon */
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
font-size: 12px;
|
||||
white-space: normal;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.info-tooltip::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 100%; /* Arrow below tooltip */
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: #333 transparent transparent transparent;
|
||||
}
|
||||
|
||||
.info-icon-wrapper:hover .info-tooltip {
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="leads_form">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -99,6 +146,30 @@
|
||||
<!-- client row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label class="switch" style="position: relative;top: 33px;left: 0px;">
|
||||
<input id="exixting_client" type="checkbox" name="exixting_client">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="exixting_client" style="position: relative;top: 39px;left: 20px;">Existing Client</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
@ -139,21 +210,6 @@
|
||||
placeholder="Enter Client Short Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||
class="text-danger">*</span></label>
|
||||
@ -393,12 +449,18 @@
|
||||
}
|
||||
$("#source_policy_id").removeAttr("required");
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
$("#source_policy_id").hide();
|
||||
$('#source_policy_id').closest('.form-group').hide();
|
||||
|
||||
$("#source_policy_start_date").removeAttr("required");
|
||||
$("#source_policy_start_date").closest("div") .find("label .text-danger").remove();
|
||||
$("#source_policy_start_date").hide();
|
||||
$('#source_policy_start_date').closest('.form-group').hide();
|
||||
|
||||
$("#source_policy_end_date").removeAttr("required");
|
||||
$("#source_policy_end_date").closest("div") .find("label .text-danger").remove();
|
||||
$("#source_policy_end_date").hide();
|
||||
$('#source_policy_end_date').closest('.form-group').hide();
|
||||
|
||||
|
||||
|
||||
@ -407,25 +469,27 @@
|
||||
$("#source_policy_start_date").prop("required", true);
|
||||
$("#source_policy_end_date").prop("required", true);
|
||||
|
||||
$("#source_policy_id").show();
|
||||
$("#source_policy_start_date").show();
|
||||
$("#source_policy_start_date").show();
|
||||
|
||||
$('#source_policy_id').closest('.form-group').find('label').show();
|
||||
$('#source_policy_start_date').closest('.form-group').find('label').show();
|
||||
$('#source_policy_end_date').closest('.form-group').find('label').show();
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
let $label = $("#source_policy_id").closest("div") .find("label");
|
||||
|
||||
if ($label.find(".text-danger").length === 0) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
let $label2 = $("#source_policy_start_date")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
let $label2 = $("#source_policy_start_date").closest("div") .find("label");
|
||||
|
||||
if ($label2.find(".text-danger").length === 0) {
|
||||
$label2.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
let $label3 = $("#source_policy_end_date")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
let $label3 = $("#source_policy_end_date").closest("div").find("label");
|
||||
|
||||
if ($label3.find(".text-danger").length === 0) {
|
||||
$label3.append(' <span class="text-danger">*</span>');
|
||||
@ -439,6 +503,17 @@
|
||||
|
||||
}
|
||||
|
||||
if(lead_type != 1){
|
||||
dataIncrement = 1;
|
||||
// updateRenewalFields(dataIncrement);
|
||||
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
});
|
||||
}
|
||||
|
||||
var policy_end_datePicker = flatpickr("#policy_end_date_" + increment, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
@ -448,6 +523,12 @@
|
||||
document.getElementById('source_policy_end_date').readOnly = true;
|
||||
|
||||
$('#source_policy_start_date, #source_policy_end_date').addClass('readonly-select');
|
||||
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').val("");
|
||||
|
||||
console.log('---- completed ----')
|
||||
});
|
||||
|
||||
console.log('increment count for insurer and tpa ', increment);
|
||||
@ -470,12 +551,17 @@
|
||||
$('#tpa_' + increment).select2();
|
||||
$('#proposed_insurer').select2();
|
||||
$('#proposed_tpa').select2();
|
||||
$('#client_id').select2();
|
||||
$('#client_branch_id').select2();
|
||||
$('#source_policy_id').val("");
|
||||
|
||||
console.log('---- completed ----')
|
||||
|
||||
|
||||
})
|
||||
//------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) ---------------------------------------------------------------------------
|
||||
|
||||
//view and edit Lead data function
|
||||
//view and edit Lead data function ( NOT IN USE DON'T DELETE )
|
||||
function getLeadsDataForEdit(input) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -531,9 +617,9 @@
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// updateRenewalFields(dataIncrement);
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -556,9 +642,9 @@
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
@ -899,10 +985,12 @@
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
|
||||
updateRenewalFields(dataIncrement);
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
|
||||
if(lead_type == 1){
|
||||
updateRenewalFields(dataIncrement);
|
||||
}
|
||||
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
@ -924,17 +1012,12 @@
|
||||
console.log('Policy Start Date:', policyStartDate.val());
|
||||
|
||||
// Recalculate policy_run_days if policy start date is already selected
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
// if (policyStartDate.val()) {
|
||||
// calculatePolicyRunDays(increment);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
|
||||
@ -1022,7 +1105,7 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="">Date of Commencement <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC">
|
||||
<input type="text" class="form-control policy_start_date" id="policy_start_date_${increment}" name="policy_start_date[]" placeholder="Enter DOC" onchange="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -1104,14 +1187,14 @@
|
||||
|
||||
$('#source_policy_id').on('change', function() {
|
||||
let client_policy_id = $(this).val();
|
||||
console.log('increment given', increment)
|
||||
console.log('increment given', increment);
|
||||
getPolicyData(client_policy_id, increment);
|
||||
})
|
||||
|
||||
if (check == 1) {
|
||||
let client_policy_id = $('#source_policy_id').val();
|
||||
if (client_policy_id) {
|
||||
getPolicyData(client_policy_id, increment)
|
||||
getPolicyData(client_policy_id, increment);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1161,116 +1244,217 @@
|
||||
//------------------------ CALCULATION ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function calculatePolicyRunDays(increment) {
|
||||
// function calculatePolicyRunDays(increment) {
|
||||
|
||||
// // console.log('calculatePolicyRunDays function called');
|
||||
// // console.log('increment', increment);
|
||||
// // let lead_type = $('#lead_type').val();
|
||||
// // var policyStartDate = $("#source_policy_start_date");
|
||||
// // if(lead_type == 3){
|
||||
// // policyStartDate = $("#policy_start_date");
|
||||
// // }
|
||||
// // var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
|
||||
// // var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
|
||||
|
||||
// // console.log('policyStartDate', policyStartDate)
|
||||
// // console.log('incurredClaimDate', incurredClaimDate)
|
||||
|
||||
// // if (policyStartDate && incurredClaimDate) {
|
||||
// // var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
|
||||
// // console.log('timeDiff', timeDiff);
|
||||
// // var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
|
||||
// // console.log('daysDiff', daysDiff);
|
||||
// // $("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
|
||||
// // }
|
||||
// }
|
||||
|
||||
// function incurredClaimSum(input) {
|
||||
|
||||
// // let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
// // console.log('increment', increment);
|
||||
|
||||
// // // Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
// // let paid_claims = Number($('#paid_claims_' + increment).val()) || 0;
|
||||
// // console.log('paid_claims', paid_claims);
|
||||
|
||||
// // let outstanding_claims = Number($('#outstanding_claims_' + increment).val()) || 0;
|
||||
// // console.log('outstanding_claims', outstanding_claims);
|
||||
|
||||
// // // Calculate the incurred claim
|
||||
// // let incurred_claims = paid_claims + outstanding_claims;
|
||||
// // console.log('incurred_claims', incurred_claims);
|
||||
|
||||
// // // Set the calculated value
|
||||
// // $('#incurred_claims_' + increment).val(incurred_claims);
|
||||
|
||||
// // // ------------------------------------------------------------------------------------------
|
||||
|
||||
// // let policy_run_days = Number($('#policy_run_days_' + increment).val()) || 0;
|
||||
// // console.log('policy_run_days', policy_run_days);
|
||||
// // console.log('incurred claims ' + incurred_claims);
|
||||
// // // Prevent division by zero in annualised claims calculation
|
||||
// // let annualised_claims = policy_run_days > 0 ? incurred_claims / policy_run_days * 365 : 0;
|
||||
// // let annualised_claims_roundoff = Math.round(annualised_claims);
|
||||
// // console.log('annualised_claims', annualised_claims_roundoff);
|
||||
|
||||
// // $('#annualised_claims_' + increment).val(annualised_claims_roundoff);
|
||||
|
||||
// // // ------------------------------------------------------------------------------------------
|
||||
|
||||
// // // Prevent division by zero in incurred claim ratio calculation
|
||||
// // let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
// // let incurred_claim_ratio = (annualised_claims > 0 && premium_as_on_date > 0)
|
||||
// // ? (annualised_claims / premium_as_on_date)
|
||||
// // : 0;
|
||||
|
||||
// // let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio)
|
||||
// // ? Math.round(incurred_claim_ratio)
|
||||
// // : 0;
|
||||
|
||||
// // console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
|
||||
|
||||
// // $('#incurred_claims_ratio_' + increment).val(incurred_claim_ratio_roundoff);
|
||||
|
||||
// // // ------------------------------------------------------------------------------------------
|
||||
|
||||
// // let earnedPremium = parseFloat($('#earned_premium_' + increment).val()) || 0;
|
||||
// // console.log('earnedPremium:', earnedPremium);
|
||||
|
||||
// // // Prevent division by zero
|
||||
// // let earnedClaimsRatio = earnedPremium > 0 ? annualised_claims / earnedPremium : 0;
|
||||
|
||||
// // // Round to nearest integer
|
||||
// // let earnedClaimsRatioRounded = Math.round(earnedClaimsRatio);
|
||||
// // console.log('earnedClaimsRatio:', earnedClaimsRatio);
|
||||
|
||||
// // // Set the value to the corresponding input
|
||||
// // $('#earned_claims_ratio_' + increment).val(earnedClaimsRatioRounded);
|
||||
|
||||
// }
|
||||
|
||||
// function earnedPremiumCalc(input) {
|
||||
|
||||
// // let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
// // console.log('increment', increment);
|
||||
|
||||
// // let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
|
||||
// // // Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
// // let premium_at_inception = Number($('#premium_at_inception_' + increment).val()) || 0;
|
||||
// // console.log('premium_at_inception', premium_at_inception);
|
||||
|
||||
// // let policy_run_days = Number($('#policy_run_days_' + increment).val()) || 0;
|
||||
// // console.log('policy_run_days', policy_run_days);
|
||||
|
||||
// // // Prevent division by zero and calculate earned premium
|
||||
// // let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * 364 : 0;
|
||||
// // console.log('earned_premium', earned_premium);
|
||||
// // let earned_premium_roundoff = Math.round(earned_premium);
|
||||
// // // Set the calculated value with two decimal places
|
||||
// // $('#earned_premium_' + increment).val(earned_premium_roundoff);
|
||||
// }
|
||||
|
||||
function calculatePolicyMetrics(input) {
|
||||
|
||||
console.log('calculatePolicyRunDays function called');
|
||||
console.log('increment', increment);
|
||||
let lead_type = $('#lead_type').val();
|
||||
var policyStartDate = $("#source_policy_start_date");
|
||||
if(lead_type == 3){
|
||||
policyStartDate = $("#policy_start_date");
|
||||
}
|
||||
var policyStartDate = flatpickr.parseDate(policyStartDate.val(), "d/m/Y");
|
||||
var incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date_" + increment).val(), "d/m/Y");
|
||||
console.log('Lead Type:', lead_type);
|
||||
|
||||
console.log('policyStartDate', policyStartDate)
|
||||
console.log('incurredClaimDate', incurredClaimDate)
|
||||
let increment = input.id.split('_').pop(); // Extract increment
|
||||
if(lead_type == 1){
|
||||
return;
|
||||
}
|
||||
|
||||
let input_id = input.id;
|
||||
console.log('--- calculatePolicyMetrics called ---');
|
||||
console.log('Input ID:', input_id);
|
||||
console.log('Increment:', increment);
|
||||
|
||||
let sourcePolicyDateVal = $('#source_policy_start_date').val()?.trim();
|
||||
let policyStartDateVal = $('#policy_start_date').val()?.trim() || $('#policy_start_date_1').val()?.trim();
|
||||
|
||||
let policyStartDateInput = null;
|
||||
|
||||
if (sourcePolicyDateVal && lead_type == 2) {
|
||||
policyStartDateInput = $('#source_policy_start_date');
|
||||
console.log('Using Source Policy Start Date:', sourcePolicyDateVal);
|
||||
} else if (policyStartDateVal) {
|
||||
if(input_id == "policy_start_date_1"){
|
||||
policyStartDateInput = $('#policy_start_date_1');
|
||||
}else{
|
||||
policyStartDateInput = $('#policy_start_date');
|
||||
}
|
||||
console.log('Using Policy Start Date:', policyStartDateVal);
|
||||
} else {
|
||||
toastr.warning('Policy start date or Date of Commencement is empty. Please fill in the date field.', "WARNING.. !");
|
||||
console.warn('Both policy start dates are missing or invalid');
|
||||
$(input).val('');
|
||||
return; // stop further execution
|
||||
}
|
||||
|
||||
// let policyStartDateInput = (lead_type == 3) ? $('#policy_start_date') : $('#source_policy_start_date');
|
||||
console.log('Policy Start Date Input:', policyStartDateInput.val());
|
||||
|
||||
let policyStartDate = flatpickr.parseDate(policyStartDateInput.val(), "d/m/Y");
|
||||
let incurredClaimDate = flatpickr.parseDate($("#incurred_claim_date").val(), "d/m/Y");
|
||||
|
||||
console.log('Parsed Policy Start Date:', policyStartDate);
|
||||
console.log('Parsed Incurred Claim Date:', incurredClaimDate);
|
||||
|
||||
if (policyStartDate && incurredClaimDate) {
|
||||
var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
|
||||
console.log('timeDiff', timeDiff);
|
||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
|
||||
console.log('daysDiff', daysDiff);
|
||||
$("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
|
||||
let timeDiff = Math.abs(incurredClaimDate - policyStartDate);
|
||||
console.log('Time Difference (ms):', timeDiff);
|
||||
|
||||
let daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1);
|
||||
console.log('Policy Run Days:', daysDiff);
|
||||
|
||||
$('#policy_run_days').val(daysDiff);
|
||||
}
|
||||
}
|
||||
|
||||
function incurredClaimSum(input) {
|
||||
let paid_claims = Number($('#paid_claims').val()) || 0;
|
||||
let outstanding_claims = Number($('#outstanding_claims').val()) || 0;
|
||||
console.log('Paid Claims:', paid_claims);
|
||||
console.log('Outstanding Claims:', outstanding_claims);
|
||||
|
||||
let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
console.log('increment', increment);
|
||||
|
||||
// Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
let paid_claims = Number($('#paid_claims_' + increment).val()) || 0;
|
||||
console.log('paid_claims', paid_claims);
|
||||
|
||||
let outstanding_claims = Number($('#outstanding_claims_' + increment).val()) || 0;
|
||||
console.log('outstanding_claims', outstanding_claims);
|
||||
|
||||
// Calculate the incurred claim
|
||||
let incurred_claims = paid_claims + outstanding_claims;
|
||||
console.log('incurred_claims', incurred_claims);
|
||||
console.log('Incurred Claims:', incurred_claims);
|
||||
$('#incurred_claims').val(incurred_claims);
|
||||
|
||||
// Set the calculated value
|
||||
$('#incurred_claims_' + increment).val(incurred_claims);
|
||||
let policy_run_days = Number($('#policy_run_days').val()) || 0;
|
||||
console.log('Policy Run Days (Final):', policy_run_days);
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
let policy_run_days = Number($('#policy_run_days_' + increment).val()) || 0;
|
||||
console.log('policy_run_days', policy_run_days);
|
||||
console.log('incurred claims ' + incurred_claims);
|
||||
// Prevent division by zero in annualised claims calculation
|
||||
let annualised_claims = policy_run_days > 0 ? incurred_claims / policy_run_days * 365 : 0;
|
||||
let annualised_claims = policy_run_days > 0 ? (incurred_claims / policy_run_days) * 365 : 0;
|
||||
let annualised_claims_roundoff = Math.round(annualised_claims);
|
||||
console.log('annualised_claims', annualised_claims_roundoff);
|
||||
console.log('Annualised Claims:', annualised_claims);
|
||||
console.log('Annualised Claims (Rounded):', annualised_claims_roundoff);
|
||||
$('#annualised_claims').val(annualised_claims_roundoff);
|
||||
|
||||
$('#annualised_claims_' + increment).val(annualised_claims_roundoff);
|
||||
let premium_as_on_date = Number($('#premium_date').val()) || 0;
|
||||
console.log('Premium as on Date:', premium_as_on_date);
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
// Prevent division by zero in incurred claim ratio calculation
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
let incurred_claim_ratio = (annualised_claims > 0 && premium_as_on_date > 0)
|
||||
? (annualised_claims / premium_as_on_date)
|
||||
: 0;
|
||||
let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio) ? Math.round(incurred_claim_ratio) : 0;
|
||||
console.log('Incurred Claim Ratio:', incurred_claim_ratio);
|
||||
console.log('Incurred Claim Ratio (Rounded):', incurred_claim_ratio_roundoff);
|
||||
$('#incurred_claims_ratio').val(incurred_claim_ratio_roundoff);
|
||||
|
||||
let incurred_claim_ratio_roundoff = isFinite(incurred_claim_ratio)
|
||||
? Math.round(incurred_claim_ratio)
|
||||
: 0;
|
||||
|
||||
console.log('incurred_claim_ratio', incurred_claim_ratio_roundoff);
|
||||
|
||||
$('#incurred_claims_ratio_' + increment).val(incurred_claim_ratio_roundoff);
|
||||
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
let earnedPremium = parseFloat($('#earned_premium_' + increment).val()) || 0;
|
||||
console.log('earnedPremium:', earnedPremium);
|
||||
|
||||
// Prevent division by zero
|
||||
let earnedClaimsRatio = earnedPremium > 0 ? annualised_claims / earnedPremium : 0;
|
||||
|
||||
// Round to nearest integer
|
||||
let earnedClaimsRatioRounded = Math.round(earnedClaimsRatio);
|
||||
console.log('earnedClaimsRatio:', earnedClaimsRatio);
|
||||
|
||||
// Set the value to the corresponding input
|
||||
$('#earned_claims_ratio_' + increment).val(earnedClaimsRatioRounded);
|
||||
|
||||
}
|
||||
|
||||
function earnedPremiumCalc(input) {
|
||||
|
||||
let increment = input.id.split('_').pop(); // Extract the increment part
|
||||
console.log('increment', increment);
|
||||
|
||||
let premium_as_on_date = Number($('#premium_date_' + increment).val()) || 0;
|
||||
|
||||
// Retrieve and convert the values to numbers, fallback to 0 if empty or invalid
|
||||
let premium_at_inception = Number($('#premium_at_inception_' + increment).val()) || 0;
|
||||
console.log('premium_at_inception', premium_at_inception);
|
||||
|
||||
let policy_run_days = Number($('#policy_run_days_' + increment).val()) || 0;
|
||||
console.log('policy_run_days', policy_run_days);
|
||||
|
||||
// Prevent division by zero and calculate earned premium
|
||||
let earned_premium = premium_as_on_date > 0 ? (premium_as_on_date / 365) * 364 : 0;
|
||||
console.log('earned_premium', earned_premium);
|
||||
let earned_premium_roundoff = Math.round(earned_premium);
|
||||
// Set the calculated value with two decimal places
|
||||
$('#earned_premium_' + increment).val(earned_premium_roundoff);
|
||||
console.log('Earned Premium:', earned_premium);
|
||||
console.log('Earned Premium (Rounded):', earned_premium_roundoff);
|
||||
$('#earned_premium').val(earned_premium_roundoff);
|
||||
|
||||
let earnedClaimsRatio = earned_premium > 0 ? annualised_claims / earned_premium : 0;
|
||||
let earnedClaimsRatioRounded = Math.round(earnedClaimsRatio);
|
||||
console.log('Earned Claims Ratio:', earnedClaimsRatio);
|
||||
console.log('Earned Claims Ratio (Rounded):', earnedClaimsRatioRounded);
|
||||
$('#earned_claims_ratio').val(earnedClaimsRatioRounded);
|
||||
|
||||
console.log('--- End of calculatePolicyMetrics ---\n');
|
||||
}
|
||||
|
||||
|
||||
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
|
||||
calculateTotalLives(this);
|
||||
});
|
||||
@ -1421,6 +1605,83 @@
|
||||
removeExtraForms();
|
||||
}
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
$("#client_branch_id").prop("selectedIndex", 0);
|
||||
$("#source_policy_id").empty();
|
||||
$('#source_policy_id').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Policy"
|
||||
}));
|
||||
$("#pan").val("");
|
||||
|
||||
$('#policy_type_id_1').prop("selectedIndex", 0)
|
||||
$('#insurer_1').prop("selectedIndex", 0)
|
||||
$('#tpa_1').prop("selectedIndex", 0);
|
||||
$('#policy_start_date').val("");
|
||||
$('#policy_end_date').val("");
|
||||
$("#appendArea_1").empty();
|
||||
|
||||
// $('#source_policy_start_date').val("");
|
||||
// $('#source_policy_end_date').val("");
|
||||
// $('#incurred_claims_date').val("");
|
||||
// $('#paid_claims').val("");
|
||||
// $('#outstanding_claims').val("");
|
||||
// $('#incurred_claims').val("");
|
||||
// $('#policy_run_days').val("");
|
||||
// $('#premium_at_inception').val("");
|
||||
// $('#premium_date').val("");
|
||||
// $('#earned_premium').val("");
|
||||
// $('#annualised_claims').val("");
|
||||
// $('#incurred_claims_ratio').val("");
|
||||
// $('#earned_claims_ratio').val("");
|
||||
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
if ($('#' + incurred_claim_date_id).length) {
|
||||
flatpickr("#" + incurred_claim_date_id, {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function (selectedDates) {
|
||||
try {
|
||||
let increment = this.input.id.split('_').pop();
|
||||
let policyStartDate = $("#source_policy_start_date");
|
||||
if (policyStartDate.val()) {
|
||||
calculatePolicyRunDays(increment);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error in incurred_claim_datepicker:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function insurerChange(input, unique_id) {
|
||||
@ -1660,6 +1921,8 @@
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').removeAttr('required');
|
||||
|
||||
} else {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
@ -1680,6 +1943,23 @@
|
||||
$("#source_policy_start_date").removeAttr("required");
|
||||
$("#source_policy_end_date").removeAttr("required");
|
||||
|
||||
$('#source_policy_id').show();
|
||||
$('#source_policy_start_date').show();
|
||||
$('#source_policy_end_date').show();
|
||||
|
||||
$('#source_policy_id').closest('.form-group').show();
|
||||
$('#source_policy_start_date').closest('.form-group').show();
|
||||
$('#source_policy_end_date').closest('.form-group').show();
|
||||
|
||||
}else{
|
||||
|
||||
$('#source_policy_id').hide();
|
||||
$('#source_policy_start_date').hide();
|
||||
$('#source_policy_end_date').hide();
|
||||
|
||||
$('#source_policy_id').closest('.form-group').hide();
|
||||
$('#source_policy_start_date').closest('.form-group').hide();
|
||||
$('#source_policy_end_date').closest('.form-group').hide();
|
||||
}
|
||||
|
||||
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
@ -1732,6 +2012,7 @@
|
||||
}
|
||||
|
||||
function updateRenewalFields(increment) {
|
||||
console.log('updateRenewalFields function called');
|
||||
$(".renewalCalculation input, .renewalCalculation select").each(function() {
|
||||
let oldId = $(this).attr("id");
|
||||
if (oldId) {
|
||||
@ -1741,6 +2022,62 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#exixting_client').change(function () {
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#pan").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").select2();
|
||||
$("#client_branch_id").select2();
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
|
||||
} else {
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -64,6 +64,74 @@
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
/* background-color: #f0f0f0; */
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<?php
|
||||
@ -174,7 +242,9 @@ if (isset($selected_lead_type)) {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-cn': item.client_name,
|
||||
'data-csn': item.short_name,
|
||||
'data-ct': item.client_type,
|
||||
'data-cet': item.entity_type_id,
|
||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
||||
});
|
||||
|
||||
@ -244,6 +314,24 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
let client_id = $(this).val();
|
||||
|
||||
const $selected = $(this).find('option:selected');
|
||||
|
||||
const clientId = $selected.val();
|
||||
const clientName = $selected.data('cn');
|
||||
const shortName = $selected.data('csn');
|
||||
const clientType = $selected.data('ct');
|
||||
const entityTypeId = $selected.data('cet');
|
||||
|
||||
console.log('Client ID:', clientId);
|
||||
console.log('Client Name:', clientName);
|
||||
console.log('Short Name:', shortName);
|
||||
console.log('Client Type:', clientType);
|
||||
console.log('Entity Type ID:', entityTypeId);
|
||||
|
||||
$("#client_type").val(clientType);
|
||||
$("#entity_type_id").val(entityTypeId);
|
||||
$("#client_name").val(clientName);
|
||||
$("#client_short_name").val(shortName);
|
||||
|
||||
if (client_id == 'add_client') {
|
||||
// alert("Hello");
|
||||
@ -583,6 +671,57 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
if (lead_type == 1) {
|
||||
$('.claim-row').hide();
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#gst").prop('readonly', false);
|
||||
$("#pan").prop('readonly', false);
|
||||
$("#branch_name").prop('readonly', false);
|
||||
$("#branch_code").prop('readonly', false);
|
||||
$("#contact_person_name").prop('readonly', false);
|
||||
$("#contact_person_mobile").prop('readonly', false);
|
||||
$("#contact_person_email").prop('readonly', false);
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
|
||||
}else{
|
||||
|
||||
$('#exixting_client').prop('checked', true);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#gst").prop('readonly', true);
|
||||
$("#pan").prop('readonly', true);
|
||||
$("#branch_name").prop('readonly', true);
|
||||
$("#branch_code").prop('readonly', true);
|
||||
$("#contact_person_name").prop('readonly', true);
|
||||
$("#contact_person_mobile").prop('readonly', true);
|
||||
$("#contact_person_email").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.claim-row').show();
|
||||
if (policy_type_id == 1) {
|
||||
@ -593,9 +732,8 @@ if (isset($selected_lead_type)) {
|
||||
$('.lifeClaimFields').show();
|
||||
} else {
|
||||
// updateRenewalFields(dataIncrement);
|
||||
|
||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
||||
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||
let incurred_claim_date_id = 'incurred_claim_date';
|
||||
|
||||
if ($('#' + incurred_claim_date_id).length) {
|
||||
flatpickr("#" + incurred_claim_date_id, {
|
||||
@ -617,15 +755,6 @@ if (isset($selected_lead_type)) {
|
||||
console.warn(`Incurred claim date field #${incurred_claim_date_id} not found.`);
|
||||
}
|
||||
|
||||
// if ($('#' + premium_date_id).length) {
|
||||
// flatpickr("#" + premium_date_id, {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
// } else {
|
||||
// console.warn(`Premium date field #${premium_date_id} not found.`);
|
||||
// }
|
||||
|
||||
// console.log($('#proposed_insurer_' + dataIncrement).length);
|
||||
$('#proposed_insurer_' + dataIncrement).select2();
|
||||
$('#proposed_tpa_' + dataIncrement).select2();
|
||||
@ -780,6 +909,59 @@ if (isset($selected_lead_type)) {
|
||||
temp_client_id = data.client_id
|
||||
}
|
||||
|
||||
if(lead_type == 1){
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#gst").prop('readonly', false);
|
||||
$("#pan").prop('readonly', false);
|
||||
$("#branch_name").prop('readonly', false);
|
||||
$("#branch_code").prop('readonly', false);
|
||||
$("#contact_person_name").prop('readonly', false);
|
||||
$("#contact_person_mobile").prop('readonly', false);
|
||||
$("#contact_person_email").prop('readonly', false);
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
|
||||
}else{
|
||||
|
||||
$('#exixting_client').prop('checked', true);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#gst").prop('readonly', true);
|
||||
$("#pan").prop('readonly', true);
|
||||
$("#branch_name").prop('readonly', true);
|
||||
$("#branch_code").prop('readonly', true);
|
||||
$("#contact_person_name").prop('readonly', true);
|
||||
$("#contact_person_mobile").prop('readonly', true);
|
||||
$("#contact_person_email").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#page_title').text('Edit Lead');
|
||||
$('#leads_primarykey').val(data.id || '');
|
||||
|
||||
@ -100,6 +100,30 @@
|
||||
<!-- client row -->
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label class="switch" style="position: relative;top: 33px;left: 0px;">
|
||||
<input id="exixting_client" type="checkbox" name="exixting_client">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="exixting_client" style="position: relative;top: 39px;left: 20px;">Existing Client</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 freshFields">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
@ -140,21 +164,6 @@
|
||||
placeholder="Enter Client Short Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_id">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||
class="text-danger">*</span></label>
|
||||
@ -300,7 +309,8 @@
|
||||
|
||||
<div id="appendArea"></div>
|
||||
|
||||
<div id="appendAreaForClaim"></div>
|
||||
<div id="appendAreaForClaim">
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
@ -528,6 +538,9 @@
|
||||
console.log('finyearJsonString', finyearJsonString);
|
||||
formData.append('fin_years_claims', finyearJsonString);
|
||||
|
||||
cliam_history_status = $("#claim_history").prop("checked") ? 1 : 0;
|
||||
|
||||
formData.append('claim_history',cliam_history_status);
|
||||
|
||||
// Append the JSON string to the FormData object
|
||||
formData.append('salse_person_id', jsonString);
|
||||
@ -584,11 +597,15 @@
|
||||
|
||||
$("#source_policy_id").prop("required",false);
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
$('#source_policy_id').closest('.form-group').hide();
|
||||
|
||||
|
||||
} else if (value != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_id").prop("required", true);
|
||||
if(value == 2){
|
||||
$("#source_policy_id").closest('.form-group').show();
|
||||
}
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
@ -608,6 +625,49 @@
|
||||
}
|
||||
|
||||
leadTypeBsedHideAndShow(value, true)
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
$("#client_branch_id").prop("selectedIndex", 0);
|
||||
$("#source_policy_id").empty();
|
||||
$('#source_policy_id').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Policy"
|
||||
}));
|
||||
$("#pan").val("");
|
||||
|
||||
$('#policy_type_id_1').prop("selectedIndex", 0)
|
||||
$('#insurer_1').prop("selectedIndex", 0)
|
||||
$('#tpa_1').prop("selectedIndex", 0);
|
||||
$('#policy_start_date').val("");
|
||||
$('#policy_end_date').val("");
|
||||
$("#appendArea_1").empty();
|
||||
|
||||
})
|
||||
|
||||
function leadTypeBsedHideAndShow(value, resetValues = false) {
|
||||
@ -648,6 +708,8 @@
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').removeAttr('required');
|
||||
|
||||
} else {
|
||||
|
||||
$('.btnDiv').hide();
|
||||
@ -665,9 +727,10 @@
|
||||
|
||||
if (value == 3) {
|
||||
$("#source_policy_id").removeAttr("required");
|
||||
$("#source_policy_start_date").removeAttr("required");
|
||||
$("#source_policy_end_date").removeAttr("required");
|
||||
$('#source_policy_id').closest('.form-group').hide();
|
||||
|
||||
}else if(value == 2){
|
||||
$('#source_policy_id').closest('.form-group').show();
|
||||
}
|
||||
|
||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
@ -879,9 +942,15 @@
|
||||
|
||||
function appendThreeYearsClaims() {
|
||||
|
||||
let claimsFields = `
|
||||
let claimsFields = `${!document.querySelector('#claim_history') ? `<div class="custom-control custom-switch">
|
||||
<input type="checkbox" onchange="claimHistoryToggle()" class="custom-control-input" id="claim_history" name="claim_history" checked />
|
||||
<label class="custom-control-label" for="claim_history">Claims History</label>
|
||||
</div><br>`: ``}`
|
||||
|
||||
<div class="row claim-row">
|
||||
claimsFields += `
|
||||
|
||||
|
||||
<div id = "claimHistoryRow" class="row claim-row">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||
@ -990,4 +1059,77 @@
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
function claimHistoryToggle() {
|
||||
cliam_history_status = $("#claim_history").prop("checked") ? 1 : 0;
|
||||
// alert(cliam_history_status);
|
||||
if (cliam_history_status == 1) {
|
||||
if ($(".claim-row").length > 0) {
|
||||
// Rows already exist, just show them
|
||||
$(".claim-row").show();
|
||||
} else {
|
||||
// No rows yet, so create them
|
||||
appendThreeYearsClaims();
|
||||
}
|
||||
} else {
|
||||
|
||||
$(".claim-row").hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#exixting_client').change(function () {
|
||||
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
$("#gst").val("");
|
||||
$("#pan").val("");
|
||||
$("#branch_name").val("");
|
||||
$("#branch_code").val("");
|
||||
$("#contact_person_name").val("");
|
||||
$("#contact_person_mobile").val("");
|
||||
$("#contact_person_email").val("");
|
||||
|
||||
|
||||
// Fresh fields
|
||||
$("#client_type").prop("selectedIndex", 0);
|
||||
$("#entity_type_id").prop("selectedIndex", 0);
|
||||
$("#client_name").val("");
|
||||
$("#client_short_name").val("");
|
||||
|
||||
// Renewal fields
|
||||
$("#client_id").prop("selectedIndex", 0);
|
||||
$("#client_branch_id").prop("selectedIndex", 0);
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#client_id').closest('.form-group').show();
|
||||
$('#client_branch_id').closest('.form-group').show();
|
||||
|
||||
$('#client_type').addClass('readonly-select');
|
||||
$('#entity_type_id').addClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', true);
|
||||
$("#client_short_name").prop('readonly', true);
|
||||
|
||||
$("#client_id").prop("required", true);
|
||||
$("#client_branch_id").prop("required", true);
|
||||
|
||||
} else {
|
||||
$('#client_id').closest('.form-group').hide();
|
||||
$('#client_branch_id').closest('.form-group').hide();
|
||||
|
||||
$('#client_type').removeClass('readonly-select');
|
||||
$('#entity_type_id').removeClass('readonly-select');
|
||||
|
||||
$("#client_name").prop('readonly', false);
|
||||
$("#client_short_name").prop('readonly', false);
|
||||
|
||||
$("#client_id").prop("required", false);
|
||||
$("#client_branch_id").prop("required", false);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -241,10 +241,14 @@
|
||||
}));
|
||||
|
||||
setTimeout(function(){
|
||||
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, 1000)
|
||||
|
||||
}, 2000)
|
||||
}, 3000)
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
@ -744,23 +744,23 @@
|
||||
<div class = "row">
|
||||
<div class="form-group col-md-4 multi_location_company">
|
||||
<label for="building_${increment2}">Building</label>
|
||||
<input type="number" id="building_${increment2}" name="building[]" class="form-control multi_location_company " />
|
||||
<input type="text" id="building_${increment2}" name="building[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company ">
|
||||
<label for="content_${increment2}">Content</label>
|
||||
<input type="number" id="content_${increment2}" name="content[]" class="form-control multi_location_company " />
|
||||
<input type="text" id="content_${increment2}" name="content[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company ">
|
||||
<label for="furniture_${increment2}">Furniture/Office Equipment</label>
|
||||
<input type="number" id="furniture_${increment2}" name="furniture[]" class="form-control multi_location_company " />
|
||||
<input type="text" id="furniture_${increment2}" name="furniture[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company ">
|
||||
<label for="plantAndMachinery_${increment2}">Plant and Machinery</label>
|
||||
<input type="number" id="plantAndMachinery_${increment2}" name="plant_and_machinery[]" class="form-control multi_location_company " />
|
||||
<input type="text" id="plantAndMachinery_${increment2}" name="plant_and_machinery[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company">
|
||||
<label for="electricalFittings_${increment2}">Electrical Fittings</label>
|
||||
<input type="number" id="electricalFittings_${increment2}" name="electrical_fittings[]" class="form-control multi_location_company "/>
|
||||
<input type="text" id="electricalFittings_${increment2}" name="electrical_fittings[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)"/>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@ -769,15 +769,15 @@
|
||||
<div class = "row">
|
||||
<div class="form-group col-md-4 multi_location_company">
|
||||
<label for="stockInProcess_${increment2}">Stock In Process</label>
|
||||
<input type="number" id="stockInProcess_${increment2}" name="stock_in_process[]" class="form-control multi_location_company" />
|
||||
<input type="text" id="stockInProcess_${increment2}" name="stock_in_process[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company">
|
||||
<label for="rawMaterial_${increment2}">Raw Material</label>
|
||||
<input type="number" id="rawMaterial_${increment2}" name="raw_material[]" class="form-control multi_location_company" />
|
||||
<input type="text" id="rawMaterial_${increment2}" name="raw_material[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)" />
|
||||
</div>
|
||||
<div class="form-group col-md-4 multi_location_company">
|
||||
<label for="finishedStock_${increment2}">Stock</label>
|
||||
<input type="number" id="finishedStock_${increment2}" name="finished_stock[]" class="form-control multi_location_company"/>
|
||||
<input type="text" id="finishedStock_${increment2}" name="finished_stock[]" class="form-control multi_location_company" onkeypress="return onlyNumbers(event)"/>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
@ -1229,6 +1229,7 @@
|
||||
changeTerrorism(Number($("#policySI").val()));
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
saveRFQ();
|
||||
// console.log("Updated policy data in localStorage:", existingData);
|
||||
}
|
||||
|
||||
@ -1659,4 +1660,10 @@
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@ -169,11 +169,11 @@
|
||||
style="width: 35%;;" type="number" name="self_max_age" id="self_max_age"
|
||||
onchange="lowerIsEighteen(this)"></div>
|
||||
</td>
|
||||
<td style="width: 11%;"><span class="self-age"
|
||||
<!-- <td style="width: 11%;"><span class="self-age"
|
||||
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||
<td style="width: 11%;"><input class="self-age" type="checkbox"
|
||||
style="margin-right: 70px;" name="is_payable_employee_for_self"
|
||||
id="is_payable_employee_for_self"> </td>
|
||||
id="is_payable_employee_for_self"> </td> -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
@ -202,11 +202,11 @@
|
||||
style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age"
|
||||
onchange="lowerIsEighteen(this)"></div>
|
||||
</td>
|
||||
<td style="width: 11%;"><span class="spouse-age"
|
||||
<!-- <td style="width: 11%;"><span class="spouse-age"
|
||||
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||
<td style="width: 11%;"><input class="spouse-age" type="checkbox"
|
||||
style="margin-right: 70px;" name="is_payable_employee_for_spouse"
|
||||
id="is_payable_employee_for_spouse"> </td>
|
||||
id="is_payable_employee_for_spouse"> </td> -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
@ -241,11 +241,11 @@
|
||||
style="width: 35%;;" type="number" name="child_max_age" id="child_max_age"
|
||||
oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div>
|
||||
</td>
|
||||
<td style="width: 11%;"><span class="child-age"
|
||||
<!-- <td style="width: 11%;"><span class="child-age"
|
||||
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||
<td style="width: 11%;"><input class="child-age" type="checkbox"
|
||||
style="margin-right: 70px;" name="is_payable_employee_for_child"
|
||||
id="is_payable_employee_for_child"> </td>
|
||||
id="is_payable_employee_for_child"> </td> -->
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
@ -304,12 +304,12 @@
|
||||
name="other_member_max_age" id="other_member_max_age"
|
||||
onchange="lowerIsEighteen(this)"></div>
|
||||
</td>
|
||||
<td style="width: 11%;"><span class="other-member-age"
|
||||
<!-- <td style="width: 11%;"><span class="other-member-age"
|
||||
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span>
|
||||
</td>
|
||||
<td style="width: 11%;"><input class="other-member-age" type="checkbox"
|
||||
style="margin-right: 70px;" name="is_payable_employee_for_elders"
|
||||
id="is_payable_employee_for_elders"> </td>
|
||||
id="is_payable_employee_for_elders"> </td> -->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1373,46 +1373,46 @@
|
||||
$('#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 != "") {
|
||||
|
||||
|
||||
@ -108,6 +108,7 @@
|
||||
onchange="addGridHTML(this)" required>
|
||||
</select>
|
||||
</div>
|
||||
<input type="hidden" id="hidden_unit" />
|
||||
|
||||
<div class="form-group col-md-6"
|
||||
style="position: relative; left: 45px; display:none" id="premium_type">
|
||||
@ -385,6 +386,14 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
// console.log('rack rate responce.premium data', res.premiumData)
|
||||
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
|
||||
|
||||
branch_units = JSON.parse(res.branch_units) ?? [];
|
||||
|
||||
if (branch_units && branch_units.length == 1) {
|
||||
|
||||
$("#hidden_unit").val(branch_units[0]);
|
||||
console.log('unit', branch_units[0]);
|
||||
$("#gpa_unit1").val(branch_units[0]);
|
||||
}
|
||||
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
|
||||
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
|
||||
rarc_rate_json_array.push(res.jsonArray);
|
||||
@ -673,8 +682,12 @@ $('#grid').change(function()
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000); // Run after DOM updates
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -734,6 +747,9 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
var id_var = 'grid_';
|
||||
|
||||
var default_unit = $('#hidden_unit').val();
|
||||
|
||||
|
||||
var dataIdValue = ''
|
||||
if (event === false) {
|
||||
var dataIdValue = ui_type
|
||||
@ -801,14 +817,14 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
<div id="si_or_bp_sum_insure" class="form-row">
|
||||
|
||||
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
|
||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<div class="form-row col-md-4" style="margin-left: 381px; margin-top: -114px;">
|
||||
<label for="mobile" style = "margin-bottom: -10px;margin-top: 17px;">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Multiplier" name="gpa_sum_multiplier" id="gpa_sum_multiplier" onchange="gpaSumInsureMultiplier(this)" required>
|
||||
</div>
|
||||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : default_unit) : default_unit}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
@ -1341,8 +1357,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
}
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// alert("Hello World");
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000); // Run after DOM updates
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -1399,7 +1420,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
<input value="${data !== false && data !== undefined && data !== default_unit ? data.unit : default_unit}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
@ -1840,8 +1861,12 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
// Count++
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000); // Run after DOM updates
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -2770,7 +2795,7 @@ function si_orbp_change_function()
|
||||
$('#gpa_sum_multiplier').attr('required', true);
|
||||
$('#gpa_sum_si').attr('required', true);
|
||||
$('#gpa_sum_premium').attr('required', true);
|
||||
$('#gpa_unit1').attr('required', true);
|
||||
$('#gpa_unit1').attr('required', false);
|
||||
|
||||
var gridContentInput = $('#grid_content_input');
|
||||
|
||||
@ -3936,8 +3961,12 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000); // Run after DOM updates
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
|
||||
@ -121,8 +121,8 @@
|
||||
<input type="hidden" name="cd_ac_no" id="cd_ac_no">
|
||||
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
|
||||
<input type="hidden" name="ct_type" id="ct_type">
|
||||
<input type="hidden" name="" id="bro_payable_by">
|
||||
<input type="hidden" name="" id="cop_yes">
|
||||
<input type="hidden" name="bro_payable_by" id="bro_payable_by">
|
||||
<input type="hidden" name="cop_yes" id="cop_yes">
|
||||
|
||||
|
||||
<!-- Client Row -->
|
||||
@ -560,7 +560,10 @@ $(document).ready(function(){
|
||||
if(policyListByClient != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = policyListByClient[client_id];
|
||||
if (data) {
|
||||
appendPolicies(data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@ -445,10 +445,11 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
</script>
|
||||
<script>
|
||||
|
||||
var client_list = ''; // local variable for storing the client branch list
|
||||
var branch_list = ''; // local variable for storing the client branch list
|
||||
var policy_list = ''; // local variable for storing the client policy list
|
||||
var policyListByClient = ''; // local variable for storing the client policy list
|
||||
var client_list = '';
|
||||
var branch_list = '';
|
||||
var policy_list = <?= json_encode($endorsementPolicies) ?>;
|
||||
// console.log("POLICY List",policy_list);
|
||||
var policyListByClient = <?= json_encode($endorsementPolicyListByClient) ?>;
|
||||
var branch_policy = '';
|
||||
var unit_list = '';
|
||||
|
||||
@ -607,8 +608,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
if(res.status == true){
|
||||
branch_list = res.branch_data;
|
||||
policy_list = res.policy_data;
|
||||
policyListByClient = res.policyListByClient;
|
||||
// policy_list = res.policy_data;
|
||||
// policyListByClient = res.policyListByClient;
|
||||
client_list = res.client_data;
|
||||
unit_list = res.unit_data;
|
||||
appendClients(res.client_data);
|
||||
@ -674,6 +675,10 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
function appendPolicies(data)
|
||||
{
|
||||
if (!data) {
|
||||
|
||||
toastr.warning("There are no policies in Inception for the selected client and branch.");
|
||||
}
|
||||
console.log('appendPolicies', data);
|
||||
console.log('appendPolicies', $('#client_policy_id'));
|
||||
|
||||
|
||||
@ -1675,11 +1675,12 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||
}
|
||||
|
||||
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||
$('#hide_file_upload').show();
|
||||
}else{
|
||||
$('#hide_file_upload').hide();
|
||||
}
|
||||
// if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||
// $('#hide_file_upload').show();
|
||||
// }else{
|
||||
// $('#hide_file_upload').hide();
|
||||
// }
|
||||
$('#hide_file_upload').show();
|
||||
|
||||
if (res.data.master_policy_type_id) {
|
||||
$('#policy_type_id').val(res.data.master_policy_type_id).change();
|
||||
@ -3234,12 +3235,11 @@ $("#inception_form_id").submit(function(event) {
|
||||
$('#policy_tranction_primarykey_for_file_upload').val(res.pt_id);
|
||||
$('#client_policy_id_for_file_upload').val(res.data.client_policy_id);
|
||||
|
||||
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||
$('#hide_file_upload').show();
|
||||
}else{
|
||||
$('#hide_file_upload').hide();
|
||||
}
|
||||
|
||||
//if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||
// $('#hide_file_upload').show();
|
||||
//}else{
|
||||
// $('#hide_file_upload').hide();
|
||||
//}
|
||||
$('#client_id_for_vehicle_file_upload').val(res.data.client_id);
|
||||
$('#vehicle_id_for_file_upload').val(res.data.vehicle_id);
|
||||
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
<?php if(isset($lead_edit_data)) {
|
||||
$claims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : [ ['year' => '', 'claim_amount' => '', 'status' => '', 'claim_type' => '', 'cause_of_death' => '', 'death_date' => ''] ];
|
||||
foreach ($claims as $key => $value) { ?>
|
||||
?>
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" onchange="claimHistoryToggle()" class="custom-control-input" id="claim_history" name="claim_history" <?= $lead_edit_data['claim_history'] == 1 ? "checked" : "" ?> />
|
||||
<label class="custom-control-label" for="claim_history">Claims History</label>
|
||||
</div><br>
|
||||
<?php
|
||||
|
||||
if ($lead_edit_data['claim_history'] == 1) {
|
||||
foreach ($claims as $key => $value) { ?>
|
||||
|
||||
<div class="row claim-row">
|
||||
<div class="form-group col-md-2">
|
||||
@ -51,5 +59,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
<?php } ?>
|
||||
@ -1,4 +1,6 @@
|
||||
<?php $increment = isset($lead_edit_data) ? "_1" : ''; ?>
|
||||
|
||||
|
||||
<?php $increment = isset($lead_edit_data) ? "" : ''; ?>
|
||||
<hr>
|
||||
|
||||
<div class="form-row renewalCalculation">
|
||||
@ -6,71 +8,87 @@
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claim_date">Incurred Claim Date<span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_date']) ? $lead_edit_data['incurred_claims_date'] : '' ?>" type="text" class="form-control incurred_claim" id="incurred_claim_date<?= $increment ?>"
|
||||
name="incurred_claim_date[]" placeholder="Enter DOE">
|
||||
name="incurred_claim_date[]" placeholder="Enter DOE" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['paid_claims']) ? $lead_edit_data['paid_claims'] : '' ?>" type="text" class="form-control" id="paid_claims<?= $increment ?>" name="paid_claims[]"
|
||||
placeholder="Enter Paid Claims" oninput="incurredClaimSum(this)">
|
||||
placeholder="Enter Paid Claims" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['outstanding_claims']) ? $lead_edit_data['outstanding_claims'] : '' ?>" type="text" class="form-control" id="outstanding_claims<?= $increment ?>" name="outstanding_claims[]"
|
||||
placeholder="Enter Outstanding Claims" oninput="incurredClaimSum(this)">
|
||||
placeholder="Enter Outstanding Claims" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims']) ? $lead_edit_data['incurred_claims'] : '' ?>" type="text" class="form-control" id="incurred_claims<?= $increment ?>" name="incurred_claims[]"
|
||||
placeholder="Enter Incurred Claim" oninput="incurredClaimSum(this)">
|
||||
placeholder="Enter Incurred Claim" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="policy_run_days">Policy Run Days<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['policy_run_days']) ? $lead_edit_data['policy_run_days'] : '' ?>" type="text" class="form-control" id="policy_run_days<?= $increment ?>" name="policy_run_days[]"
|
||||
placeholder="Enter Policy Run Days" oninput="earnedPremiumCalc(this); incurredClaimSum(this)">
|
||||
placeholder="Enter Policy Run Days" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="premium_at_inception">Premium Paid at Inception<span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_at_inception']) ? $lead_edit_data['premium_at_inception'] : '' ?>" type="text" class="form-control" id="premium_at_inception<?= $increment ?>" name="premium_at_inception[]"
|
||||
placeholder="Enter Premium Paid" oninput="earnedPremiumCalc(this)">
|
||||
placeholder="Enter Premium Paid" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="premium_date">Premium as on Date<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['premium_date']) ? $lead_edit_data['premium_date'] : '' ?>" type="text" class="form-control" id="premium_date<?= $increment ?>" name="premium_date[]"
|
||||
placeholder="Enter Premium Date" oninput="incurredClaimSum(this); earnedPremiumCalc(this)">
|
||||
placeholder="Enter Premium Date" oninput="calculatePolicyMetrics(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_premium']) ? $lead_edit_data['earned_premium'] : '' ?>" type="text" class="form-control" id="earned_premium<?= $increment ?>" name="earned_premium[]"
|
||||
placeholder="Enter Earned Premium" oninput="incurredClaimSum(this)">
|
||||
placeholder="Enter Earned Premium" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['annualised_claims']) ? $lead_edit_data['annualised_claims'] : '' ?>" type="text" class="form-control" id="annualised_claims<?= $increment ?>" name="annualised_claims[]"
|
||||
placeholder="Enter Annualised Claims" oninput="incurredClaimSum(this)">
|
||||
placeholder="Enter Annualised Claims" oninput="calculatePolicyMetrics(this)" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio<span
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio(%) <span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['incurred_claims_ratio']) ? $lead_edit_data['incurred_claims_ratio'] : '' ?>" type="text" class="form-control" id="incurred_claims_ratio<?= $increment ?>"
|
||||
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio">
|
||||
name="incurred_claims_ratio[]" placeholder="Enter Incurred Claims Ratio" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="earned_claims_ratio">Earned Claims Ratio<span class="text-danger">*</span></label>
|
||||
<label for="earned_claims_ratio">Earned Claims Ratio(%) <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['earned_claims_ratio']) ? $lead_edit_data['earned_claims_ratio'] : '' ?>" type="text" class="form-control" id="earned_claims_ratio<?= $increment ?>" name="earned_claims_ratio[]"
|
||||
placeholder="Enter Earned Claims Ratio">
|
||||
placeholder="Enter Earned Claims Ratio" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<span class="info-icon-wrapper">
|
||||
<i class="fa fa-info-circle text-primary"></i>
|
||||
<div class="info-tooltip">
|
||||
<strong>Formulas:</strong><br>
|
||||
1. Incurred Claims = Paid Claims + Outstanding Claims<br>
|
||||
2. Policy Run Days = Incurred Claim Date - Policy Start Date + 1<br>
|
||||
3. Earned Premium = (Premium as on Date / 365) × 364<br>
|
||||
4. Annualised Claims = (Incurred Claims / Policy Run Days) × 365<br>
|
||||
5. Incurred Claim Ratio = Annualised Claims / Premium as on Date<br>
|
||||
6. Earned Claims Ratio = Annualised Claims / Earned Premium
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="location">Location <span class="text-danger">*</span></label>
|
||||
<input value="<?php //echo isset($lead_edit_data['location']) ? $lead_edit_data['location'] : '' ?>" type="text" class="form-control" id="location" name="location[]" placeholder="Enter Location">
|
||||
@ -114,46 +132,69 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['incept_emp_count']) ? $lead_edit_data['incept_emp_count'] : '' ?>" type="text" class="form-control" id="incept_emp_count" name="incept_emp_count[]"
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['incept_dept_count']) ? $lead_edit_data['incept_dept_count'] : '' ?>" type="text" class="form-control" id="incept_dept_count" name="incept_dept_count[]"
|
||||
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="incept_no_of_lives" class="total_title"> Total Lives at Inception <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['incept_no_of_lives']) ? $lead_edit_data['incept_no_of_lives'] : '' ?>" type="text" class="form-control" id="incept_no_of_lives" name="incept_no_of_lives[]"
|
||||
placeholder="Enter Lives" required>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_emp_count"> No of Employees at Expiry <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_emp_count']) ? $lead_edit_data['exp_emp_count'] : '' ?>" type="text" class="form-control" id="exp_emp_count" name="exp_emp_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_dept_count"> No of Dependents at Expiry <span
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_dept_count']) ? $lead_edit_data['exp_dept_count'] : '' ?>" type="text" class="form-control" id="exp_dept_count" name="exp_dept_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_no_of_lives"> Total Lives at Expiry <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_no_of_lives']) ? $lead_edit_data['exp_no_of_lives'] : '' ?>" type="text" class="form-control" id="exp_no_of_lives" name="exp_no_of_lives[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="renewal_emp_count"> No of Employees at Renewal <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_emp_count']) ? $lead_edit_data['renewal_emp_count'] : '' ?>" type="text" class="form-control" id="renewal_emp_count" name="renewal_emp_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="renewal_dept_count"> No of Dependents at Renewal <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_dept_count']) ? $lead_edit_data['renewal_dept_count'] : '' ?>" type="text" class="form-control" id="renewal_dept_count" name="renewal_dept_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="renewal_no_of_lives"> Total Lives at Renewal <span
|
||||
class="text-danger">*</span></label>
|
||||
class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['renewal_no_of_lives']) ? $lead_edit_data['renewal_no_of_lives'] : '' ?>" type="text" class="form-control" id="renewal_no_of_lives" name="renewal_no_of_lives[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
@ -162,25 +203,3 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_emp_count"> No of Employees at Expiry <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_emp_count']) ? $lead_edit_data['exp_emp_count'] : '' ?>" type="text" class="form-control" id="exp_emp_count" name="exp_emp_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_dept_count"> No of Dependents at Expiry <span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_dept_count']) ? $lead_edit_data['exp_dept_count'] : '' ?>" type="text" class="form-control" id="exp_dept_count" name="exp_dept_count[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="exp_no_of_lives"> Total Lives at Expiry <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['exp_no_of_lives']) ? $lead_edit_data['exp_no_of_lives'] : '' ?>" type="text" class="form-control" id="exp_no_of_lives" name="exp_no_of_lives[]"
|
||||
placeholder="Enter Lives">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -102,7 +102,7 @@
|
||||
name="policy_no" placeholder="Policy Number">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA ID <span class="text-danger"></span></label>
|
||||
<label for="tpa_no">TPA ID <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
||||
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
||||
name="tpa_no">
|
||||
@ -145,7 +145,7 @@
|
||||
<div class="form-group">
|
||||
<label>Policy <span class="text-danger">*</span></label>
|
||||
<select id="emp_client_policy" name="client_policy_id"
|
||||
class="form-control custom-select" required onchange="setMinDateDOA(this.value)">
|
||||
class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
|
||||
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
||||
<?php } else { ?>
|
||||
@ -156,7 +156,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA <span class="text-danger"></span></label>
|
||||
<label for="tpa_name">TPA <span class="text-danger"></span></label>
|
||||
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
@ -1048,7 +1048,11 @@
|
||||
if (ticket_type == 1 && item.policy_type_id != 1) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
text: item.client_policy_name,
|
||||
'data-insurerid' : item.insurer_id ?? "",
|
||||
'data-tpaid' : item.tpa_id ?? "",
|
||||
'data-insurername' : item.insurer_name ?? "",
|
||||
'data-tpaname' : item.tpa_name ?? "",
|
||||
}));
|
||||
$("#policy_no").val("");
|
||||
if (policyCount == 1) {
|
||||
@ -1139,6 +1143,26 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setInsurerAndTPAData(input) {
|
||||
let selectedOption = $(input).find('option:selected');
|
||||
|
||||
let insurer_id = selectedOption.data('insurerid');
|
||||
let insurer_name = selectedOption.data('insurername');
|
||||
let tap_name = selectedOption.data('tpaname');
|
||||
let tap_id = selectedOption.data('tpaid');
|
||||
|
||||
console.log('Insurer ID:', insurer_id);
|
||||
console.log('Insurer Name:', insurer_name);
|
||||
console.log('TPA Name:', tap_name);
|
||||
console.log('TPA ID:', tap_id);
|
||||
|
||||
$('#insurer_id').val(insurer_id);
|
||||
$('#insurer_name').val(insurer_name);
|
||||
$('#tpa_id').val(tap_id);
|
||||
$('#tpa_name').val(tap_name);
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
$("#infoIcon").click(function() {
|
||||
|
||||
@ -111,7 +111,7 @@
|
||||
<div class="form-group">
|
||||
<label>Policy <span class="text-danger">*</span></label>
|
||||
<select id="emp_client_policy" name="client_policy_id"
|
||||
class="form-control custom-select" required onchange="setDateValidation(this.value,true)"
|
||||
class="form-control custom-select" required onchange="setDateValidation(this.value,true); setInsurerAndTPAData(this)"
|
||||
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
|
||||
>
|
||||
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||
@ -705,7 +705,11 @@
|
||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
text: item.client_policy_name,
|
||||
'data-insurerid' : item.insurer_id ?? "",
|
||||
'data-tpaid' : item.tpa_id ?? "",
|
||||
'data-insurername' : item.insurer_name ?? "",
|
||||
'data-tpaname' : item.tpa_name ?? "",
|
||||
}));
|
||||
console.log("policy count from loop","");
|
||||
$("#policy_no").val("");
|
||||
@ -813,6 +817,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
function setInsurerAndTPAData(input) {
|
||||
let selectedOption = $(input).find('option:selected');
|
||||
|
||||
let insurer_id = selectedOption.data('insurerid');
|
||||
let insurer_name = selectedOption.data('insurername');
|
||||
let tap_name = selectedOption.data('tpaname');
|
||||
let tap_id = selectedOption.data('tpaid');
|
||||
|
||||
console.log('Insurer ID:', insurer_id);
|
||||
console.log('Insurer Name:', insurer_name);
|
||||
console.log('TPA Name:', tap_name);
|
||||
console.log('TPA ID:', tap_id);
|
||||
|
||||
$('#insurer_id').val(insurer_id);
|
||||
$('#tpa_id').val(tap_id);
|
||||
$('#insurer_name').val(insurer_name);
|
||||
$('#tpa_name').val(tap_name);
|
||||
}
|
||||
|
||||
// function setMinDateDOA(policy_id) {
|
||||
// console.log("Function set min date called ");
|
||||
// console.log("Existing DOA instance: ", doa);
|
||||
|
||||
@ -582,7 +582,7 @@ if (!isset($view_ticket_page)) {
|
||||
// if (response.data.emp_id == null || response.data.emp_id == ''){
|
||||
unSetClientPolicy();
|
||||
// }
|
||||
setClientAndInsurerData(response.data);
|
||||
setClientAndInsurerData(response.data, true);
|
||||
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
|
||||
appendACMS(response.acms)
|
||||
|
||||
@ -742,12 +742,15 @@ if (!isset($view_ticket_page)) {
|
||||
|
||||
}
|
||||
|
||||
function setClientAndInsurerData(data) {
|
||||
function setClientAndInsurerData(data, insurer_data = false) {
|
||||
|
||||
if(insurer_data == false){
|
||||
$('#insurer_id').val(data.insurer_id);
|
||||
$('#insurer_name').val(data.insurer_name);
|
||||
$('#tpa_id').val(data.tpa_id);
|
||||
$('#tpa_name').val(data.tpa_name);
|
||||
}
|
||||
|
||||
$('#insurer_id').val(data.insurer_id);
|
||||
$('#insurer_name').val(data.insurer_name);
|
||||
$('#tpa_id').val(data.tpa_id);
|
||||
$('#tpa_name').val(data.tpa_name);
|
||||
$('#client_id').val(data.client_id);
|
||||
$('#client_name').val(data.client_name);
|
||||
|
||||
|
||||
@ -2560,6 +2560,15 @@ function popInsurerInArray(proposal_name, insurerName) {
|
||||
|
||||
function changeInsurer(event) {
|
||||
|
||||
console.log('change insure event', event);
|
||||
|
||||
let proposal_name = getParentHeaderTh(event);
|
||||
console.log('proposel Name', proposal_name)
|
||||
|
||||
if(proposal_name == null || proposal_name == ""){
|
||||
toastr.warning("Could not change the insurer", "WARNING")
|
||||
return;
|
||||
}
|
||||
|
||||
// let newInsurerName = prompt("Enter New insurer name:");
|
||||
const insurers = <?= json_encode($insurer); ?>;
|
||||
@ -2577,77 +2586,164 @@ function changeInsurer(event) {
|
||||
console.log('newInsurerName', newInsurerName)
|
||||
console.log('newversion', newversion)
|
||||
|
||||
if (newInsurerName) {
|
||||
const closestTh = event.target.closest('th');
|
||||
let oldInsurerName = closestTh.innerText.split('⋮')[0].trim();
|
||||
console.log(oldInsurerName + ' - ' + newInsurerName);
|
||||
|
||||
const closestTh = event.target.closest('th');
|
||||
let oldInsurerName = closestTh.innerText.split('⋮')[0].trim();
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log(oldInsurerName + ' - ' + newInsurerName);
|
||||
// Iterate over child nodes to find the text node containing "Myname"
|
||||
closestTh.childNodes.forEach(node => {
|
||||
if (node.nodeType === Node.TEXT_NODE && node.textContent.includes(oldInsurerName)) {
|
||||
// Replace the old name with the new name
|
||||
node.textContent = node.textContent.replace(oldInsurerName, newInsurerName);
|
||||
|
||||
if (!checkExistingInsurer(proposal_name, newInsurerName) && oldInsurerName != newInsurerName) {
|
||||
|
||||
Swal.fire({
|
||||
title: "Insurer Dublicate Found?",
|
||||
text: "Do you want version control!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, Procced!"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
let modifiedInsurerName = constructInsurerNameWithVersion(proposal_name, newInsurerName);
|
||||
console.log('modifiedInsurerName', modifiedInsurerName);
|
||||
changeInsurerData(event, modifiedInsurerName, dataId)
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
//find parent th index then it's text content
|
||||
|
||||
|
||||
// Get the sub TH from the second header row
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
|
||||
accumulatedColspan += currentColspan;
|
||||
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
changeInsurerForPremiumTable(event, newInsurerName, subThIndex)
|
||||
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0].trim();
|
||||
|
||||
if (over_all_column_data[proposal_name]) {
|
||||
// let tempInsurerList = over_all_column_data[proposal_name].insurers;
|
||||
// console.log(tempInsurerList);
|
||||
// if(!tempInsurerList.length) { return true; }
|
||||
//replace the old insurer with the new insuren in global array
|
||||
over_all_column_data[proposal_name].insurers.forEach(item => {
|
||||
if (item.display_name === oldInsurerName) {
|
||||
item.display_name = newInsurerName; // Replace with new name
|
||||
item.ins_name = newInsurerName.split('-')[0].trim(); // Replace with new name
|
||||
item.id = dataId
|
||||
}
|
||||
});
|
||||
// console.log(tempInsurerList);
|
||||
// over_all_column_data[proposal_name].insurers = tempInsurerList;
|
||||
console.log('insurer name replaced in golbal variable');
|
||||
console.log(over_all_column_data[proposal_name].insurers);
|
||||
// over_all_column_data[proposal_name].insurers = tempInsurerList
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('insurer name not replaced in golbal variable');
|
||||
|
||||
|
||||
}else{
|
||||
changeInsurerData(event, newInsurerName)
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function changeInsurerData(event, newInsurerName, dataId){
|
||||
|
||||
if (newInsurerName) {
|
||||
|
||||
const closestTh = event.target.closest('th');
|
||||
let oldInsurerName = closestTh.innerText.split('⋮')[0].trim();
|
||||
let subThIndex = closestTh.cellIndex;
|
||||
console.log(oldInsurerName + ' - ' + newInsurerName);
|
||||
// Iterate over child nodes to find the text node containing "Myname"
|
||||
closestTh.childNodes.forEach(node => {
|
||||
if (node.nodeType === Node.TEXT_NODE && node.textContent.includes(oldInsurerName)) {
|
||||
// Replace the old name with the new name
|
||||
node.textContent = node.textContent.replace(oldInsurerName, newInsurerName);
|
||||
}
|
||||
});
|
||||
//find parent th index then it's text content
|
||||
|
||||
|
||||
// Get the sub TH from the second header row
|
||||
const table = document.getElementById('rfqTable');
|
||||
const headerRows = table.querySelectorAll('thead tr');
|
||||
const subTh = headerRows[1].children[subThIndex];
|
||||
|
||||
let accumulatedColspan = 0;
|
||||
let parentTh = null;
|
||||
const firstHeaderRow = headerRows[0];
|
||||
// Find the parent TH for the specified sub TH index
|
||||
for (let i = 0; i < firstHeaderRow.children.length; i++) {
|
||||
const currentParentTh = firstHeaderRow.children[i];
|
||||
const currentColspan = parseInt(currentParentTh.getAttribute('colspan')) || 1;
|
||||
|
||||
accumulatedColspan += currentColspan;
|
||||
|
||||
if (subThIndex < accumulatedColspan) {
|
||||
parentTh = currentParentTh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
changeInsurerForPremiumTable(event, newInsurerName, subThIndex)
|
||||
|
||||
let proposal_name = parentTh.innerText.split('⋮')[0].trim();
|
||||
|
||||
if (over_all_column_data[proposal_name]) {
|
||||
// let tempInsurerList = over_all_column_data[proposal_name].insurers;
|
||||
// console.log(tempInsurerList);
|
||||
// if(!tempInsurerList.length) { return true; }
|
||||
//replace the old insurer with the new insuren in global array
|
||||
over_all_column_data[proposal_name].insurers.forEach(item => {
|
||||
if (item.display_name === oldInsurerName) {
|
||||
item.display_name = newInsurerName; // Replace with new name
|
||||
item.ins_name = newInsurerName.split('-')[0].trim(); // Replace with new name
|
||||
item.id = dataId
|
||||
}
|
||||
});
|
||||
// console.log(tempInsurerList);
|
||||
// over_all_column_data[proposal_name].insurers = tempInsurerList;
|
||||
console.log('insurer name replaced in golbal variable');
|
||||
console.log(over_all_column_data[proposal_name].insurers);
|
||||
// over_all_column_data[proposal_name].insurers = tempInsurerList
|
||||
|
||||
isFormDataModified = true; // if any value changeing in the table to set true
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('insurer name not replaced in golbal variable');
|
||||
|
||||
|
||||
}else{
|
||||
toastr.warning("Could not change the insurer", "WARNING")
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function getParentHeaderTh(event) {
|
||||
|
||||
const currentTh = event.target.closest('th');
|
||||
if (!currentTh) return;
|
||||
|
||||
const colIndex = currentTh.cellIndex;
|
||||
|
||||
// Get all header rows
|
||||
const thead = currentTh.closest('thead');
|
||||
const headerRows = thead.querySelectorAll('tr');
|
||||
|
||||
if (headerRows.length < 2) return; // need at least 2 header rows
|
||||
|
||||
const secondRowThs = headerRows[1].querySelectorAll('th');
|
||||
const firstRowThs = headerRows[0].querySelectorAll('th');
|
||||
|
||||
// Step 1: Find actual column span index of clicked th in 2nd row
|
||||
let actualColIndex = 0;
|
||||
for (let i = 0; i < secondRowThs.length; i++) {
|
||||
const th = secondRowThs[i];
|
||||
const colspan = parseInt(th.getAttribute('colspan')) || 1;
|
||||
|
||||
if (th === currentTh) break;
|
||||
|
||||
actualColIndex += colspan;
|
||||
}
|
||||
|
||||
// Step 2: Match it with first row <th>s
|
||||
let colSpanCounter = 0;
|
||||
for (let i = 0; i < firstRowThs.length; i++) {
|
||||
const th = firstRowThs[i];
|
||||
const colspan = parseInt(th.getAttribute('colspan')) || 1;
|
||||
|
||||
if (actualColIndex >= colSpanCounter && actualColIndex < colSpanCounter + colspan) {
|
||||
let proposelName = th.innerText.split('⋮')[0].trim();
|
||||
console.log("Parent TH Proposel innerText:", proposelName);
|
||||
console.log("Parent TH Proposel textContent:", th.textContent.trim());
|
||||
return proposelName;
|
||||
}
|
||||
|
||||
colSpanCounter += colspan;
|
||||
}
|
||||
|
||||
console.log("Parent header not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function changeState(event) {
|
||||
|
||||
console.log('changeState Function called')
|
||||
|
||||
@ -2408,6 +2408,11 @@
|
||||
// alert(policy.quote_asked[0]);
|
||||
// var policySI = policies[]
|
||||
policySI = rfq_count == 0 && !tdChanged ? policy.quote_asked[0] : (changedNewSI) != "" && changedNewSI != 0? changedNewSI : policy.quote_asked[0];
|
||||
// alert(policySI)
|
||||
if (policySI == "-" || policySI == 0 || policySI == undefined){
|
||||
toastr.warning("Please Enter the Sum Insured in the RFQ First","Warning");
|
||||
return;
|
||||
}
|
||||
console.log("policy si",policySI,"rfq ount ",rfq_count,"tdchanged ",tdChanged,"changedNewSI",changedNewSI);
|
||||
$("#policyName").val(policyName);
|
||||
$("#policySI").val(policySI);
|
||||
|
||||
@ -10,9 +10,9 @@ class ExcelMergeHelperTest extends TestCase
|
||||
{
|
||||
// Use the paths you provided
|
||||
$filePaths = [
|
||||
['file_path' =>WRITEPATH.'uploads/lead_files/Member_Data.xlsx','sheets' => []],
|
||||
['file_path' =>'/home/venba/Downloads/RFQ_qw_Office Package_20250326112828.xlsx','sheets' => []],
|
||||
|
||||
['file_path' =>WRITEPATH.'/tmp/RFQ_ABC_GMC_20241220140640.xlsx','sheets' => []],
|
||||
['file_path' =>'/home/venba/Downloads/RFQ_qw_Office Package_20250326112828 (copy).xlsx','sheets' => []],
|
||||
|
||||
// ['file_path' =>'/home/venba/Downloads/Employee_data.xlsx','sheets' => []],
|
||||
];
|
||||
|
||||
0
writable/venbaehn_nhance_manual
Normal file
0
writable/venbaehn_nhance_manual
Normal file
Loading…
Reference in New Issue
Block a user