MERGE_TEST_RFQ_LIVE_ISSUES&FEEDBACK
This commit is contained in:
commit
a1cfca14e2
@ -45,6 +45,9 @@ class Database extends Config
|
|||||||
'numberNative' => false,
|
'numberNative' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
public array $book_stack = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This database connection is used when
|
* This database connection is used when
|
||||||
* running PHPUnit database tests.
|
* running PHPUnit database tests.
|
||||||
@ -75,6 +78,29 @@ class Database extends Config
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
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
|
// Ensure that we always set the database group to 'tests' if
|
||||||
// we are currently running an automated test suite, so that
|
// we are currently running an automated test suite, so that
|
||||||
// we don't overwrite live data on accident.
|
// we don't overwrite live data on accident.
|
||||||
@ -82,4 +108,5 @@ class Database extends Config
|
|||||||
$this->defaultGroup = 'tests';
|
$this->defaultGroup = 'tests';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -448,6 +448,7 @@ $routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDr
|
|||||||
//crone job
|
//crone job
|
||||||
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
|
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
|
||||||
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
|
$routes->cli('cli/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||||
|
|
||||||
//Employee login api's
|
//Employee login api's
|
||||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||||
@ -462,7 +463,9 @@ $routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::upda
|
|||||||
|
|
||||||
//HR login api's
|
//HR login api's
|
||||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||||
|
$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||||
|
$routes->post("/employeeRest/updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||||
|
|
||||||
// Test initiate Claim
|
// Test initiate Claim
|
||||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||||
@ -513,7 +516,12 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
$routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||||
|
|
||||||
$routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId");
|
$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("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||||
|
|
||||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||||
@ -525,8 +533,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||||
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
||||||
|
|
||||||
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||||
|
|
||||||
});
|
});
|
||||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||||
@ -538,7 +546,7 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol
|
|||||||
|
|
||||||
// Ticketing System End's
|
// Ticketing System End's
|
||||||
|
|
||||||
|
$routes->get("autobookstackLogin", "RestAuthenticationController::bookstackLoginToken");
|
||||||
//BDSReports
|
//BDSReports
|
||||||
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
||||||
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
||||||
|
|||||||
@ -618,7 +618,7 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In your controller
|
// In your controller
|
||||||
public function deposit($id = null)
|
public function deposit($id = null , $requestFrom = null )
|
||||||
{
|
{
|
||||||
$headerData['page_name'] = 'Client Deposit';
|
$headerData['page_name'] = 'Client Deposit';
|
||||||
|
|
||||||
@ -629,13 +629,15 @@ class ClientController extends AdminController
|
|||||||
// Fetch associated insurer names and balances
|
// Fetch associated insurer names and balances
|
||||||
$balances = $this->clientPolicyModel->getBalances($id);
|
$balances = $this->clientPolicyModel->getBalances($id);
|
||||||
$data['balances'] = $balances;
|
$data['balances'] = $balances;
|
||||||
// dd($data);
|
|
||||||
|
if($requestFrom == 'rest'){ return $data; }
|
||||||
|
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_deposit_list', $data);
|
echo view('client_deposit_list', $data);
|
||||||
echo view('layout/footer');
|
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
|
// Load your model to fetch data based on $clientId and $insurerId
|
||||||
// $subTypeOptions = [
|
// $subTypeOptions = [
|
||||||
@ -660,15 +662,23 @@ class ClientController extends AdminController
|
|||||||
$headerData['page_name'] = 'Client Deposit';
|
$headerData['page_name'] = 'Client Deposit';
|
||||||
$loggedInUserID = get_session_userid();
|
$loggedInUserID = get_session_userid();
|
||||||
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
||||||
|
if($requestFrom == 'rest')
|
||||||
|
{
|
||||||
|
$clientId = $param['client_id'];
|
||||||
|
$cd_ac_pk = $param['cd_ac_pk'];
|
||||||
|
}else{
|
||||||
$clientId = $this->request->getGet('client_id');
|
$clientId = $this->request->getGet('client_id');
|
||||||
|
$cd_ac_pk = $this->request->getGet('cd_ac_pk');
|
||||||
|
}
|
||||||
|
|
||||||
$data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId);
|
$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['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);
|
if($requestFrom == 'rest'){ return $data; }
|
||||||
|
|
||||||
// print_r($data['depositdata'] );die;
|
|
||||||
// Load the view for the new list page;
|
// Load the view for the new list page;
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('view_deposit', $data);
|
echo view('view_deposit', $data);
|
||||||
@ -689,9 +699,16 @@ class ClientController extends AdminController
|
|||||||
->where('insurer_id', $insurer_id)
|
->where('insurer_id', $insurer_id)
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($record_date)){
|
||||||
// Prepare the array with data
|
// Prepare the array with data
|
||||||
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
$date = \DateTime::createFromFormat('d/m/Y', $record_date);
|
||||||
$record_date = $date->format('Y-m-d');
|
$record_date = $date->format('Y-m-d');
|
||||||
|
}else{
|
||||||
|
$record_date = null;
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'amount' => $this->request->getPost('amount'),
|
'amount' => $this->request->getPost('amount'),
|
||||||
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
'sub_type_id' => $this->request->getPost('sub_type_id'),
|
||||||
@ -1273,7 +1290,12 @@ class ClientController extends AdminController
|
|||||||
$data['insurer_id'] = $insurerId;
|
$data['insurer_id'] = $insurerId;
|
||||||
|
|
||||||
$tpaValue = (string) $this->request->getPost('tpa');
|
$tpaValue = (string) $this->request->getPost('tpa');
|
||||||
|
if(!empty($tpaValue) || $tpaValue !== ''){
|
||||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||||
|
}else{
|
||||||
|
$tpaBranchId = null;
|
||||||
|
$tpaId = null;
|
||||||
|
}
|
||||||
|
|
||||||
$data['tpa_branch_id'] = $tpaBranchId;
|
$data['tpa_branch_id'] = $tpaBranchId;
|
||||||
$data['client_id'] = $client_id;
|
$data['client_id'] = $client_id;
|
||||||
@ -4053,13 +4075,13 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// Additional logic for non-individual clients (client_type != 2)
|
// Additional logic for non-individual clients (client_type != 2)
|
||||||
if ($client_type != 2) {
|
if ($client_type != 2) {
|
||||||
$unit = $postData['short_name'] . '-' . $postData['branch_code'];
|
$unit[] = $postData['short_name'] . '-' . $postData['branch_code'];
|
||||||
$branch_data = [
|
$branch_data = [
|
||||||
'client_id' => $client_insert,
|
'client_id' => $client_insert,
|
||||||
'branch_name' => $postData['branch_name'],
|
'branch_name' => $postData['branch_name'],
|
||||||
'branch_code' => $postData['branch_code'],
|
'branch_code' => $postData['branch_code'],
|
||||||
'gst' => $postData['gst'],
|
'gst' => $postData['gst'],
|
||||||
'units' => $unit,
|
'units' => json_encode($unit) ?? null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
$branch_insert = $this->clientBranchModel->insert($branch_data);
|
||||||
@ -4825,10 +4847,22 @@ class ClientController extends AdminController
|
|||||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||||
|
|
||||||
// $batch_data = [
|
// $batch_data = [
|
||||||
// 'client_id' => 17,
|
// 'client_id' => 29,
|
||||||
// 'client_policy_id' => 30,
|
// 'client_policy_id' => 17,
|
||||||
// 'client_branch_id' => 18,
|
// 'client_branch_id' => 15,
|
||||||
// 'event_type' => "inception",
|
// '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';
|
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||||
@ -4844,13 +4878,17 @@ class ClientController extends AdminController
|
|||||||
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||||
|
|
||||||
$EmpDataServiceController = new EmpDataServiceController();
|
$EmpDataServiceController = new EmpDataServiceController();
|
||||||
|
// $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die;
|
||||||
|
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
|
||||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||||
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||||
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
||||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||||
|
|
||||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
// $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();
|
// $empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
|
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
|
||||||
@ -4859,7 +4897,7 @@ class ClientController extends AdminController
|
|||||||
// $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
|
// $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
|
||||||
|
|
||||||
// $empServiceController = new EmployeeServiceController();
|
// $empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '319']);
|
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1101']);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
// $EmpDataServiceController = new EmpDataServiceController();
|
// $EmpDataServiceController = new EmpDataServiceController();
|
||||||
@ -5192,8 +5230,10 @@ class ClientController extends AdminController
|
|||||||
->where('insurers.is_active', 1)
|
->where('insurers.is_active', 1)
|
||||||
->where('tpa.is_active', 1)
|
->where('tpa.is_active', 1)
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_status', "active")
|
||||||
->where('employees.relationship', "Self")
|
->where('employees.relationship', "Self")
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', "active")
|
||||||
->where($field_name, $param);
|
->where($field_name, $param);
|
||||||
|
|
||||||
if (!empty($client_id)) {
|
if (!empty($client_id)) {
|
||||||
|
|||||||
@ -185,7 +185,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$balance = $this->CDMasterModel
|
$balance = $this->CDMasterModel
|
||||||
->where('client_id', $export_data['client_id'])
|
->where('client_id', $export_data['client_id'])
|
||||||
->where('insurer_id', $policy_details['insurer_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();
|
->first();
|
||||||
|
|
||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
@ -683,7 +683,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$balance = $this->CDMasterModel
|
$balance = $this->CDMasterModel
|
||||||
->where('client_id', $export_data['client_id'])
|
->where('client_id', $export_data['client_id'])
|
||||||
->where('insurer_id', $policy_details['insurer_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();
|
->first();
|
||||||
|
|
||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
@ -1411,7 +1411,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
// dd($inceptionHeader);
|
// dd($inceptionHeader);
|
||||||
foreach ($inceptionHeader as $key => $value) {
|
foreach ($inceptionHeader as $key => $value) {
|
||||||
|
|
||||||
if($excel_header[$key] != $value){
|
if (!isset($excel_header[$key]) || $excel_header[$key] != $value) {
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'status' => 'failed-5',
|
'status' => 'failed-5',
|
||||||
];
|
];
|
||||||
@ -3046,6 +3047,8 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// dd($emp_policy_ids, $emp_details, $endorsement_details);
|
// dd($emp_policy_ids, $emp_details, $endorsement_details);
|
||||||
|
|
||||||
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
$this->employeePolicyModel->updateBatch($emp_policy_ids, 'id');
|
$this->employeePolicyModel->updateBatch($emp_policy_ids, 'id');
|
||||||
|
|
||||||
// $this->employeePolicyModel->insertBatch($emp_details);
|
// $this->employeePolicyModel->insertBatch($emp_details);
|
||||||
@ -3065,6 +3068,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
@ -3537,13 +3541,21 @@ class EmpDataServiceController extends BaseController
|
|||||||
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
// return ['status' => 'error', 'message' => 'Employees table data is empty or null.'];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if ($file['insurer_or_tpa'] == 'insurer') {
|
||||||
|
|
||||||
// Check if $employee_policy_table_data is null or empty
|
// Check if $employee_policy_table_data is null or empty
|
||||||
if (empty($employee_policy_table_data)) {
|
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.'];
|
return ['status' => 'error', 'message' => 'Employee policy table data is empty or null.'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if $emp_endorsement_table_data is null or empty
|
// Check if $emp_endorsement_table_data is null or empty
|
||||||
if (empty($emp_endorsement_table_data)) {
|
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.'];
|
return ['status' => 'error', 'message' => 'Employee endorsement table data is empty or null.'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3551,6 +3563,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
$this->employeePolicyModel->updateBatch($employee_policy_table_data, 'id');
|
||||||
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
$this->employeePolicyModel->bulkUpdateForEndorsement($emp_endorsement_table_data);
|
||||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Update batch file status and amount
|
// Update batch file status and amount
|
||||||
$this->batchFileModel->update($file_id, [
|
$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('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
->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('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 (in_array($role_id, [2, 3])) {
|
||||||
|
|
||||||
// If the user is a Account Manager or Manager, filter by user_id
|
// If the user is a Account Manager or Manager, filter by user_id
|
||||||
$query->where('cr.user_id', $user_id);
|
$query->where('cr.user_id', $user_id);
|
||||||
}
|
}
|
||||||
// ->where('files.created_by', get_session_userid())
|
// ->where('files.created_by', get_session_userid())
|
||||||
$data['fileList'] = $query->orderBy('files.created_at', 'desc')
|
$data['fileList'] = $query->groupBy("c.id")->orderBy('files.created_at', 'desc')
|
||||||
->limit(100)
|
->limit(1500)
|
||||||
->find();
|
->find();
|
||||||
// dd($data['fileList']);
|
// dd($data['fileList']);
|
||||||
|
|
||||||
@ -386,15 +387,16 @@ class EmployeeController extends AdminController
|
|||||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_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 (in_array($role_id, [2, 3])) {
|
||||||
|
|
||||||
// If the user is a Account Manager or Manager, filter by user_id
|
// If the user is a Account Manager or Manager, filter by user_id
|
||||||
$query2->where('cr.user_id', $user_id);
|
$query2->where('cr.user_id', $user_id);
|
||||||
}
|
}
|
||||||
// ->where('files.created_by', get_session_userid())
|
// ->where('files.created_by', get_session_userid())
|
||||||
$data['batch_list'] = $query2->orderBy('batch_files.id', 'desc')
|
$data['batch_list'] = $query2->groupBy("clients.id")->orderBy('batch_files.id', 'desc')
|
||||||
->limit(1000)
|
->limit(1500)
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
|
|
||||||
@ -1040,6 +1042,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$data = $this->employeePolicyModel->select('employee_polices.id')
|
$data = $this->employeePolicyModel->select('employee_polices.id')
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
->where('employee_polices.client_policy_id', $id)
|
->where('employee_polices.client_policy_id', $id)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
@ -2401,7 +2404,7 @@ class EmployeeController extends AdminController
|
|||||||
} else if ($actionType == 'deletion') {
|
} else if ($actionType == 'deletion') {
|
||||||
$filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Deletion.xlsx';
|
$filePath = ROOTPATH . 'public/sample_import_excel/sample_import_Deletion.xlsx';
|
||||||
}else if ($actionType == 'missed_inception') {
|
}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
|
// Check if the file exists
|
||||||
|
|||||||
@ -2276,38 +2276,17 @@ 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')
|
$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_id', $this->request->getGet('client_id') )
|
||||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||||
->where('client_policy.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', $this->request->getGet('policy_status'))
|
||||||
->groupBy('client_policy.insurer_id')
|
|
||||||
->findAll();
|
->findAll();
|
||||||
$result = [];
|
$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);
|
// dd( $ClientPolicyData);
|
||||||
foreach ($ClientPolicyData as $key => $value)
|
foreach ($ClientPolicyData as $key => $value)
|
||||||
{
|
{
|
||||||
@ -2315,30 +2294,26 @@ class EmployeeRestController extends AdminController
|
|||||||
$value['type'] = $policyTypeData->policy_type;
|
$value['type'] = $policyTypeData->policy_type;
|
||||||
$value['policy_name'] = $policyTypeData->long_name;
|
$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'));
|
$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;
|
// dd($employeeDetails);
|
||||||
$draftCount = 0;
|
$activeCount = 0;
|
||||||
|
$inactiveCount = 0;
|
||||||
if(count($employeeDetails))
|
if(count($employeeDetails))
|
||||||
{
|
{
|
||||||
foreach ($employeeDetails as $item) {
|
foreach ($employeeDetails as $item) {
|
||||||
if ($item['emp_status'] === 'enrolled') {
|
if ($item['emp_status'] === 'active') {
|
||||||
$enrolledCount++;
|
$activeCount++;
|
||||||
} elseif ($item['emp_status'] === 'draft') {
|
} elseif ($item['emp_status'] === 'inactive') {
|
||||||
$draftCount++;
|
$inactiveCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$value['totalMembersCount'] = count($employeeDetails);
|
$value['totalMembersCount'] = count($employeeDetails);
|
||||||
$value['membersCountOfEnrolled'] = $enrolledCount;
|
$value['membersCountOfActive'] = $activeCount;
|
||||||
$value['membersCountOfDraft'] = $draftCount;
|
$value['membersCountOfInactive'] = $inactiveCount;
|
||||||
|
|
||||||
array_push($data['policyDetails'],$value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
array_push($result,$data);
|
array_push($result,$value);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -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()
|
public function exportCashDepositData()
|
||||||
@ -2501,8 +2688,9 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
function getEmployeeActiveOrInactivePolicy()
|
function getEmployeeActiveOrInactivePolicy()
|
||||||
{
|
{
|
||||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; $policy_status_key = "Active"; }else{ $policy_status = 0; $policy_status_key = "InActive";}
|
||||||
$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')
|
$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('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
@ -2532,6 +2720,10 @@ class EmployeeRestController extends AdminController
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||||
|
|
||||||
|
if (strtotime(date('Y-m-d') > strtotime($ClientPolicyValue['claims_grace_date']))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1)
|
if($ClientPolicyValue['policy_type_id'] == 1)
|
||||||
{
|
{
|
||||||
$policyGroup = 'gpa';
|
$policyGroup = 'gpa';
|
||||||
@ -2565,6 +2757,8 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||||
$data['heading'] = $ClientPolicyValue['policy_long_name'];
|
$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;
|
// $data['policy_terms'] = $terms;
|
||||||
|
|
||||||
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||||
@ -3325,7 +3519,8 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
public function getWellnessUrl()
|
public function getWellnessUrl()
|
||||||
{
|
{
|
||||||
$url = "https://aam.mohfw.gov.in/home/login";
|
// $url = "https://aam.mohfw.gov.in/home/login";
|
||||||
|
$url = "";
|
||||||
|
|
||||||
if (!empty($url)) {
|
if (!empty($url)) {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
@ -3335,7 +3530,7 @@ class EmployeeRestController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'No link found'
|
'message' => 'Coming soon........!'
|
||||||
], 200);
|
], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,6 +42,7 @@ use App\Controllers\Jobs;
|
|||||||
use App\Controllers\JobWorker;
|
use App\Controllers\JobWorker;
|
||||||
use Google\Service\FactCheckTools\Resource\Claims;
|
use Google\Service\FactCheckTools\Resource\Claims;
|
||||||
use GPBMetadata\Google\Type\Datetime;
|
use GPBMetadata\Google\Type\Datetime;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
|
|
||||||
class LeadsController extends BaseController
|
class LeadsController extends BaseController
|
||||||
{
|
{
|
||||||
@ -213,11 +214,15 @@ class LeadsController extends BaseController
|
|||||||
$data['client_short_name'] = $client_data['short_name'];
|
$data['client_short_name'] = $client_data['short_name'];
|
||||||
$data['entity_type_id'] = $client_data['entity_type_id'];
|
$data['entity_type_id'] = $client_data['entity_type_id'];
|
||||||
$data['client_type'] = $client_data['client_type'];
|
$data['client_type'] = $client_data['client_type'];
|
||||||
|
} else {
|
||||||
|
if(!empty($data['client_id'])){
|
||||||
|
$data['is_client_created'] = $data['client_id'];
|
||||||
}else{
|
}else{
|
||||||
$data['client_id'] = 0;
|
$data['client_id'] = 0;
|
||||||
$data['client_branch_id'] = 0;
|
$data['client_branch_id'] = 0;
|
||||||
$data['source_policy_id'] = 0;
|
$data['source_policy_id'] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data['client_code'] = generate_client_code();
|
$data['client_code'] = generate_client_code();
|
||||||
if ($data['client_code'] == 2) {
|
if ($data['client_code'] == 2) {
|
||||||
@ -361,13 +366,13 @@ class LeadsController extends BaseController
|
|||||||
// $premium_date = null;
|
// $premium_date = null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!empty($data['source_policy_start_date'])) {
|
if (!empty($data['source_policy_start_date']) && $data['lead_type'] == 2) {
|
||||||
$data['source_policy_start_date'] = change_date_format($data['source_policy_start_date'], 'd/m/Y', 'Y-m-d');
|
$data['source_policy_start_date'] = change_date_format($data['source_policy_start_date'], 'd/m/Y', 'Y-m-d');
|
||||||
} else {
|
} else {
|
||||||
$data['source_policy_start_date'] = null;
|
$data['source_policy_start_date'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['source_policy_end_date'])) {
|
if (!empty($data['source_policy_end_date']) && $data['lead_type'] == 2) {
|
||||||
$data['source_policy_end_date'] = change_date_format($data['source_policy_end_date'], 'd/m/Y', 'Y-m-d');
|
$data['source_policy_end_date'] = change_date_format($data['source_policy_end_date'], 'd/m/Y', 'Y-m-d');
|
||||||
} else {
|
} else {
|
||||||
$data['source_policy_end_date'] = null;
|
$data['source_policy_end_date'] = null;
|
||||||
@ -394,6 +399,7 @@ class LeadsController extends BaseController
|
|||||||
'contact_person_email' => $data['contact_person_email'],
|
'contact_person_email' => $data['contact_person_email'],
|
||||||
'client_id' => $data['client_id'] ?? 0,
|
'client_id' => $data['client_id'] ?? 0,
|
||||||
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
'client_branch_id' => $data['client_branch_id'] ?? 0,
|
||||||
|
'is_client_created' => $data['is_client_created'] ?? null,
|
||||||
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
'source_policy_id' => $data['source_policy_id'] ?? 0,
|
||||||
'policy_type_id' => $value,
|
'policy_type_id' => $value,
|
||||||
'salse_person_id' => $data['salse_person_id'] ?? 0,
|
'salse_person_id' => $data['salse_person_id'] ?? 0,
|
||||||
@ -447,6 +453,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
|
'source_policy_start_date' => $data['source_policy_start_date'] ?? null,
|
||||||
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
|
||||||
|
'claim_history' => $data['claim_history'] ?? 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
// print_r($processedData);die();
|
// print_r($processedData);die();
|
||||||
@ -486,7 +493,7 @@ class LeadsController extends BaseController
|
|||||||
{
|
{
|
||||||
if ($this->leadsModel->where('id', $id)->set($data[0])->update()) {
|
if ($this->leadsModel->where('id', $id)->set($data[0])->update()) {
|
||||||
|
|
||||||
$this->insertMultiFilesData($data[0]['multi_file_data'], $id);
|
$this->insertMultiFilesData($data[0]['multi_file_data'], $id, $data[0]['lead_form_type']);
|
||||||
$this->insertLeadStatus($id, $data[0]['status'], 3);
|
$this->insertLeadStatus($id, $data[0]['status'], 3);
|
||||||
return $this->respond(['status' => true, 'lead_id' => $id, 'message' => "Lead updated successfully", 'data' => $data], 200);
|
return $this->respond(['status' => true, 'lead_id' => $id, 'message' => "Lead updated successfully", 'data' => $data], 200);
|
||||||
}
|
}
|
||||||
@ -584,14 +591,18 @@ class LeadsController extends BaseController
|
|||||||
return $multi_file_data;
|
return $multi_file_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertMultiFilesData($data, $lead_id)
|
public function insertMultiFilesData($data, $lead_id, $lead_form_type = null)
|
||||||
{
|
{
|
||||||
// print_r($data); die;
|
log_message('info', 'insertMultiFilesData() called with lead_id: ' . $lead_id);
|
||||||
|
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
|
log_message('info', 'Data is not empty. Total items: ' . count($data));
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
|
log_message('info', "Processing item at index {$key}: " . json_encode($value));
|
||||||
|
|
||||||
if (!empty($value['id'])) {
|
if (!empty($value['id'])) {
|
||||||
|
log_message('info', "Record with ID {$value['id']} exists. Preparing to update.");
|
||||||
|
|
||||||
$lead_file_data = [
|
$lead_file_data = [
|
||||||
'lead_id' => $lead_id,
|
'lead_id' => $lead_id,
|
||||||
@ -600,10 +611,22 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
if (!empty($value['file_name'])) {
|
if (!empty($value['file_name'])) {
|
||||||
$lead_file_data['file_name'] = $value['file_name'];
|
$lead_file_data['file_name'] = $value['file_name'];
|
||||||
|
log_message('info', "file_name found: {$value['file_name']}");
|
||||||
|
|
||||||
|
if (!empty($lead_form_type) && $lead_form_type == 1 && $key == 0) {
|
||||||
|
//for this push the job to the calculateMembersDemography() function
|
||||||
|
$job_details = new Jobs();
|
||||||
|
$r = Jobs::addJob(['job_name' => 'calculateMembersDemography', 'payload' => [
|
||||||
|
'lead_id' => $lead_id,
|
||||||
|
]]);
|
||||||
|
log_message('info', "calculateMembersDemography JOB PUSHED");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_message('info', "Updating leadFilesModel where id = {$value['id']} with data: " . json_encode($lead_file_data));
|
||||||
$this->leadFilesModel->where('id', $value['id'])->set($lead_file_data)->update();
|
$this->leadFilesModel->where('id', $value['id'])->set($lead_file_data)->update();
|
||||||
} else {
|
} else {
|
||||||
|
log_message('info', "No ID found. Preparing to insert new record.");
|
||||||
|
|
||||||
if (!empty($value['file_name'])) {
|
if (!empty($value['file_name'])) {
|
||||||
$lead_file_data = [
|
$lead_file_data = [
|
||||||
@ -611,16 +634,24 @@ class LeadsController extends BaseController
|
|||||||
'docs_name' => $value['docs_name'],
|
'docs_name' => $value['docs_name'],
|
||||||
'file_name' => $value['file_name'],
|
'file_name' => $value['file_name'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
log_message('info', "Inserting into leadFilesModel: " . json_encode($lead_file_data));
|
||||||
$this->leadFilesModel->insert($lead_file_data);
|
$this->leadFilesModel->insert($lead_file_data);
|
||||||
|
} else {
|
||||||
|
log_message('warning', "Skipped insert: file_name missing in data at index {$key}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($key == 0 && !empty($value['file_name'])) {
|
if ($key == 0 && !empty($value['file_name'])) {
|
||||||
|
log_message('info', "Setting first file_name '{$value['file_name']}' to leadsModel for lead_id: {$lead_id}");
|
||||||
$this->leadsModel->where('id', $lead_id)->set('file_name', $value['file_name'])->update();
|
$this->leadsModel->where('id', $lead_id)->set('file_name', $value['file_name'])->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_message('warning', 'insertMultiFilesData() received empty data array.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_message('info', 'insertMultiFilesData() completed successfully.');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,7 +967,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
foreach ($original as $key => $value) {
|
foreach ($original as $key => $value) {
|
||||||
// Match only keys that look like 'Proposal X'
|
// Match only keys that look like 'Proposal X'
|
||||||
if (preg_match('/^Proposal\s+\d+$/', $key)) {
|
if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key)) {
|
||||||
// Get the insurer entry (not 'Quote Asked')
|
// Get the insurer entry (not 'Quote Asked')
|
||||||
foreach ($value as $subKey => $subVal) {
|
foreach ($value as $subKey => $subVal) {
|
||||||
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
|
||||||
@ -996,7 +1027,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
// Collect proposal keys that match the pattern "Proposal X"
|
// Collect proposal keys that match the pattern "Proposal X"
|
||||||
foreach ($premiumProposals as $key) {
|
foreach ($premiumProposals as $key) {
|
||||||
if (preg_match('/^Proposal\s+\d+$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
|
if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
|
||||||
$filteredProposals[$key] = $data['proposal_data']['over_all_column_data'][$key];
|
$filteredProposals[$key] = $data['proposal_data']['over_all_column_data'][$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1042,8 +1073,12 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// print_rr($reorderedHeaders); die;
|
// print_rr($reorderedHeaders); die;
|
||||||
|
$proposel_count = 1;
|
||||||
foreach ($reorderedHeaders as $key => &$value) {
|
foreach ($reorderedHeaders as $key => &$value) {
|
||||||
$value['parentHeader'] = 'Proposal ' . ($key + 1);
|
if(!in_array($value['parentHeader'], ["Existing Renewal", "Existing Rollover"])){
|
||||||
|
$value['parentHeader'] = 'Proposal ' . $proposel_count;
|
||||||
|
$proposel_count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
|
||||||
@ -1083,13 +1118,17 @@ class LeadsController extends BaseController
|
|||||||
foreach ($reorderedProposalData as $key => &$value) {
|
foreach ($reorderedProposalData as $key => &$value) {
|
||||||
|
|
||||||
if ($dubParTh == $value['parentth']) {
|
if ($dubParTh == $value['parentth']) {
|
||||||
|
if(!in_array($value['parentth'], ["Existing Renewal", "Existing Rollover"])){
|
||||||
$value['parentth'] = 'Proposal ' . ($increament);
|
$value['parentth'] = 'Proposal ' . ($increament);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$dubParTh = $value['parentth'];
|
$dubParTh = $value['parentth'];
|
||||||
|
if(!in_array($value['parentth'], ["Existing Renewal", "Existing Rollover"])){
|
||||||
$increament = $increament + 1;
|
$increament = $increament + 1;
|
||||||
$value['parentth'] = 'Proposal ' . ($increament);
|
$value['parentth'] = 'Proposal ' . ($increament);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
|
||||||
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
|
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
|
||||||
@ -1143,7 +1182,6 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
|
return $this->respond(['status' => true, 'message' => 'Removed successfully'], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
//-----RFQ and QCR EXPORT------------------------------------------------------------------------------------------------
|
||||||
@ -1212,8 +1250,10 @@ class LeadsController extends BaseController
|
|||||||
//Construct excel file and save the file to the folder and return file path
|
//Construct excel file and save the file to the folder and return file path
|
||||||
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
public function constructExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
||||||
{
|
{
|
||||||
|
helper('excel_util_helper');
|
||||||
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||||
$is_placement = false;
|
$is_placement = false;
|
||||||
|
$length = 0;
|
||||||
|
|
||||||
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
|
// dd($rfq_data, $lead_id, $type, $propsal_and_insurer);
|
||||||
// print_r($propsal_and_insurer); die;
|
// print_r($propsal_and_insurer); die;
|
||||||
@ -1229,7 +1269,9 @@ class LeadsController extends BaseController
|
|||||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
|
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
];
|
];
|
||||||
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
|
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
|
||||||
@ -1237,11 +1279,12 @@ class LeadsController extends BaseController
|
|||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||||
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
|
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) {
|
if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
@ -1261,22 +1304,26 @@ class LeadsController extends BaseController
|
|||||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
|
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
'Inception Premium' => $rfq_data['premium_at_inception'],
|
'Inception Premium' => formatIndianCurrency($rfq_data['premium_at_inception']),
|
||||||
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
'Premium as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['premium_date']),
|
||||||
'Earned Premium' => $rfq_data['earned_premium'],
|
'Earned Premium' => $rfq_data['earned_premium'],
|
||||||
'Incurred Claims as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['incurred_claims_date'],
|
'Incurred Claims as on (' . date('d-m-Y', strtotime($rfq_data['incurred_claims_date'])) . ')' => formatIndianCurrency($rfq_data['incurred_claims']),
|
||||||
'Annualised Claims' => $rfq_data['annualised_claims'],
|
'Annualised Claims' => formatIndianCurrency($rfq_data['annualised_claims']),
|
||||||
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
|
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'] . " %",
|
||||||
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
|
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'] . " %",
|
||||||
];
|
];
|
||||||
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
|
} else if (in_array($rfq_data['policy_type_id'], [1, 6, 7])) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||||
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
||||||
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
|
'Insurer' => $rfq_data['insurer_name'] ?? " - ",
|
||||||
|
'TPA' => $rfq_data['tpa_name'] ?? " - ",
|
||||||
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
|
||||||
'Existing Insurer' => $rfq_data['insurer_name'],
|
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||||
'TPA ' => $rfq_data['tpa_name'],
|
'TPA ' => $rfq_data['tpa_name'],
|
||||||
@ -1295,6 +1342,7 @@ class LeadsController extends BaseController
|
|||||||
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||||
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
$data = $this->transformProposelData($data, $proposal_key, $insurer_key);
|
||||||
$is_placement = true;
|
$is_placement = true;
|
||||||
|
$sheetName = 'Placement';
|
||||||
}
|
}
|
||||||
} else if ($type == 1) {
|
} else if ($type == 1) {
|
||||||
$sheetName = 'RFQ';
|
$sheetName = 'RFQ';
|
||||||
@ -1317,7 +1365,7 @@ class LeadsController extends BaseController
|
|||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
'font' => [
|
'font' => [
|
||||||
'bold' => true,
|
'bold' => true,
|
||||||
'size' => 20
|
'size' => 23
|
||||||
],
|
],
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
@ -1373,8 +1421,8 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
// // Set column width based on max content length (adjusted for padding)
|
// // Set column width based on max content length (adjusted for padding)
|
||||||
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||||
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 5);
|
// $sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.5);
|
||||||
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.6);
|
$sheet->getColumnDimension('C')->setWidth(35);
|
||||||
|
|
||||||
// $rowNumber += 2;
|
// $rowNumber += 2;
|
||||||
|
|
||||||
@ -1429,30 +1477,39 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
$columnLetter = 'A';
|
$columnLetter = 'A';
|
||||||
|
|
||||||
|
$header_actual_count = 0;
|
||||||
foreach ($headers as $header) {
|
foreach ($headers as $header) {
|
||||||
|
// Kint::dump($header);
|
||||||
|
|
||||||
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
if (in_array($header['parentHeader'], ['Item Key', 'Action'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!in_array($header['parentHeader'], ['Item Key', 'Action', 'Sno', 'Particulars'])) {
|
||||||
|
$header_actual_count++;
|
||||||
|
}
|
||||||
|
|
||||||
if ($header['parentHeader'] === 'Sno') {
|
if ($header['parentHeader'] === 'Sno') {
|
||||||
$header['parentHeader'] = 'S.No.';
|
$header['parentHeader'] = 'S.No.';
|
||||||
$sheet->getColumnDimension('A')->setWidth(10);
|
$sheet->getColumnDimension('A')->setWidth(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($header['parentHeader'] === 'Particulars') {
|
if ($header['parentHeader'] === 'Particulars') {
|
||||||
$sheet->getColumnDimension('B')->setWidth(80);
|
$sheet->getColumnDimension('B')->setWidth(35);
|
||||||
}
|
}
|
||||||
|
|
||||||
$startColumn = $columnLetter; // Start of the current header range
|
$startColumn = $columnLetter; // Start of the current header range
|
||||||
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
|
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
|
||||||
|
|
||||||
// Set parent header value
|
// Set parent header value
|
||||||
if ($is_placement == true && !in_array($header['parentHeader'], ['Particulars', 'S.No.'])) {
|
if ($is_placement == true && !in_array($header['parentHeader'], ['Particulars', 'S.No.'])) {
|
||||||
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms");
|
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms");
|
||||||
|
} else {
|
||||||
|
if(in_array($header['parentHeader'], ["Existing Renewal", "Existing Rollover"])){
|
||||||
|
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms");
|
||||||
}else{
|
}else{
|
||||||
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
|
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
'alignment' => [
|
'alignment' => [
|
||||||
@ -1493,9 +1550,19 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$columnLetter++; // Move to the next column for subheaders
|
$columnLetter++; // Move to the next column for subheaders
|
||||||
|
// Kint::dump($subHeader);
|
||||||
|
$length++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($header_actual_count == 1 && $type == 1){
|
||||||
|
$sheet->getColumnDimension('B')->setWidth(80);
|
||||||
|
}else{
|
||||||
|
$sheet->getColumnDimension('B')->setWidth(35);
|
||||||
|
}
|
||||||
|
|
||||||
|
// die();
|
||||||
|
|
||||||
// Apply border to the header range
|
// Apply border to the header range
|
||||||
$prevColumn1 = $this->getPreviousColumn($columnLetter);
|
$prevColumn1 = $this->getPreviousColumn($columnLetter);
|
||||||
$headerRange = "A{$rowNumber}:" . "{$prevColumn1}" . "{$subHeaderRow}";
|
$headerRange = "A{$rowNumber}:" . "{$prevColumn1}" . "{$subHeaderRow}";
|
||||||
@ -1570,10 +1637,17 @@ class LeadsController extends BaseController
|
|||||||
foreach ($premiumData as $proposal => $insurers) {
|
foreach ($premiumData as $proposal => $insurers) {
|
||||||
if ($proposal != 'Particulars') {
|
if ($proposal != 'Particulars') {
|
||||||
foreach ($insurers as $insurer => $values) {
|
foreach ($insurers as $insurer => $values) {
|
||||||
$premium[] = $values[$labelArray[0]];
|
if($insurer == 'Quote Asked'){
|
||||||
|
$premium[] = "";
|
||||||
|
$gst[] = "";
|
||||||
|
$gstAmt[] = "";
|
||||||
|
$total[] = "";
|
||||||
|
}else{
|
||||||
|
$premium[] = formatIndianCurrency($values[$labelArray[0]]);
|
||||||
$gst[] = $values[$labelArray[1]];
|
$gst[] = $values[$labelArray[1]];
|
||||||
$gstAmt[] = $values[$labelArray[2]];
|
$gstAmt[] = formatIndianCurrency($values[$labelArray[2]]);
|
||||||
$total[] = $values[$labelArray[3]];
|
$total[] = formatIndianCurrency($values[$labelArray[3]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1640,17 +1714,29 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sheet->getColumnDimension($columnLetter_img)->setWidth(40);
|
$sheet->getColumnDimension($columnLetter_img)->setWidth(35);
|
||||||
$sheet->getRowDimension(1)->setRowHeight(40); // Adjust as needed
|
$sheet->getRowDimension(1)->setRowHeight(50); // Adjust as needed
|
||||||
|
|
||||||
$drawing = new Drawing();
|
$drawing = new Drawing();
|
||||||
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
||||||
$drawing->setPath($path);
|
$drawing->setPath($path);
|
||||||
$drawing->setCoordinates("{$columnLetter_img}1"); // Set position in column B
|
$drawing->setCoordinates("{$columnLetter_img}1"); // Set position in column B
|
||||||
$drawing->setHeight(35); // Adjust image height
|
$drawing->setHeight(35); // Adjust image
|
||||||
|
$columnWidth = $sheet->getColumnDimension("C")->getWidth(); // e.g., 20
|
||||||
|
$cellPixelWidth = $columnWidth * 7; // Approximate conversion (1 unit ≈ 7 pixels)
|
||||||
|
$imagePixelWidth = 250; // Approximate width of your image (in pixels)
|
||||||
|
|
||||||
|
$offsetX = max(0, ($cellPixelWidth - $imagePixelWidth) / 2);
|
||||||
|
$offsetX = $offsetX + 97;
|
||||||
|
// dd($length);
|
||||||
|
if ($length >= 4) {
|
||||||
|
$offsetX = 65;
|
||||||
|
} else if ($length == 3) {
|
||||||
|
$offsetX = 65;
|
||||||
|
}
|
||||||
|
|
||||||
// Center align the image in the cell
|
// Center align the image in the cell
|
||||||
$drawing->setOffsetX(110); // Adjust horizontal offset
|
$drawing->setOffsetX($offsetX); // Adjust horizontal offset
|
||||||
$drawing->setOffsetY(10); // Adjust vertical offset
|
$drawing->setOffsetY(10); // Adjust vertical offset
|
||||||
$drawing->setWorksheet($sheet);
|
$drawing->setWorksheet($sheet);
|
||||||
|
|
||||||
@ -1842,7 +1928,8 @@ class LeadsController extends BaseController
|
|||||||
public function getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index)
|
public function getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index)
|
||||||
{
|
{
|
||||||
$first_loop = 0;
|
$first_loop = 0;
|
||||||
$col_index_si = array_search('si enhancement', array_map('strtolower', $members_heading));
|
// $col_index_si = array_search('si enhancement', array_map('strtolower', $members_heading));
|
||||||
|
$col_index_si = array_search('si', array_map('strtolower', $members_heading));
|
||||||
$col_index_relationship = array_search('relationship', array_map('strtolower', $members_heading));
|
$col_index_relationship = array_search('relationship', array_map('strtolower', $members_heading));
|
||||||
$relations = [];
|
$relations = [];
|
||||||
$si_amt = ['general']; // Initialize with 'general' as per first loop condition
|
$si_amt = ['general']; // Initialize with 'general' as per first loop condition
|
||||||
@ -2353,7 +2440,6 @@ class LeadsController extends BaseController
|
|||||||
->where(['contact_type' => 'insurer', 'is_active' => 1])
|
->where(['contact_type' => 'insurer', 'is_active' => 1])
|
||||||
->whereIn('id', $recipient_mail)
|
->whereIn('id', $recipient_mail)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
} else if ($recipient_type == 'client') {
|
} else if ($recipient_type == 'client') {
|
||||||
|
|
||||||
$mailIDS = explode(',', $params['contact_mail']);
|
$mailIDS = explode(',', $params['contact_mail']);
|
||||||
@ -2448,7 +2534,6 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($recipient_type == 'client') {
|
if ($recipient_type == 'client') {
|
||||||
@ -3077,7 +3162,6 @@ class LeadsController extends BaseController
|
|||||||
if (strpos($tableGroup['tableId'], 'summary') !== false) {
|
if (strpos($tableGroup['tableId'], 'summary') !== false) {
|
||||||
$policy_type = explode('_', $tableGroup['tableId'])[0] ?? '';
|
$policy_type = explode('_', $tableGroup['tableId'])[0] ?? '';
|
||||||
$finalItem = $policy_type . ' - ' . $item;
|
$finalItem = $policy_type . ' - ' . $item;
|
||||||
|
|
||||||
}
|
}
|
||||||
$terms_array[$finalItem] = $value;
|
$terms_array[$finalItem] = $value;
|
||||||
}
|
}
|
||||||
@ -3348,39 +3432,92 @@ class LeadsController extends BaseController
|
|||||||
public function constructNonEbExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
public function constructNonEbExcelToSaveTemp($lead_id, $type, $propsal_and_insurer = null)
|
||||||
{
|
{
|
||||||
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||||
|
$claim_history = $rfq_data['claim_history'];
|
||||||
|
// dd($claim_history);
|
||||||
$lead_data = json_decode($rfq_data['custom_fields'], true) ?? [];
|
$lead_data = json_decode($rfq_data['custom_fields'], true) ?? [];
|
||||||
|
$lead_data['claim_history'] = $claim_history;
|
||||||
|
// dd($lead_data);
|
||||||
if (!is_array($lead_data)) {
|
if (!is_array($lead_data)) {
|
||||||
$lead_data = [];
|
$lead_data = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($lead_data['pincode']) && isset($lead_data['address'])) {
|
||||||
|
// Reorder keys: address first, then pincode, then the rest
|
||||||
|
$reordered = ['address' => $lead_data['address'], 'pincode' => $lead_data['pincode']];
|
||||||
|
|
||||||
|
// Remove existing keys
|
||||||
|
unset($lead_data['address'], $lead_data['pincode']);
|
||||||
|
|
||||||
|
// Merge reordered with the rest
|
||||||
|
$lead_data = $reordered + $lead_data;
|
||||||
|
}
|
||||||
$lead_data = array_merge(['Insured' => $rfq_data['client_name']], $lead_data);
|
$lead_data = array_merge(['Insured' => $rfq_data['client_name']], $lead_data);
|
||||||
|
|
||||||
$policy_registration_data = [];
|
$policy_registration_data = [];
|
||||||
if (isset($rfq_data['registration_json']) && !empty($rfq_data['registration_json'])) {
|
if (isset($rfq_data['registration_json']) && !empty($rfq_data['registration_json'])) {
|
||||||
$policy_registration_data = json_decode($rfq_data['registration_json'], true);
|
$policy_registration_data = json_decode($rfq_data['registration_json'], true);
|
||||||
}
|
}
|
||||||
// dd($policy_registration_data);
|
|
||||||
|
|
||||||
// if(!empty($rfq_data['fin_years_claims'])){
|
|
||||||
// $claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
|
|
||||||
// if(!empty($claim_details['finyear'])){
|
|
||||||
// $lead_data['claim_details'] = $claim_details['finyear'];
|
|
||||||
// }
|
|
||||||
// Kint::dump($claim_details);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
$jsonData = json_decode($rfq_data['json'], true);
|
$jsonData = json_decode($rfq_data['json'], true);
|
||||||
$proposalData = end($jsonData);
|
$proposalData = end($jsonData);
|
||||||
array_pop($jsonData);
|
array_pop($jsonData);
|
||||||
|
$length = 0;
|
||||||
|
// dd($jsonData[0]['table_data']['headers']);
|
||||||
|
foreach ($jsonData as $key => $data) {
|
||||||
|
if ($type == 2) {
|
||||||
|
|
||||||
|
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData, $key);
|
||||||
|
|
||||||
|
// Kint::dump($data, 'Second');
|
||||||
|
|
||||||
|
if ($propsal_and_insurer !== null) {
|
||||||
|
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
|
||||||
|
$data = $this->transformNonEbProposelData($data, $proposal_key, $insurer_key, $key);
|
||||||
|
}
|
||||||
|
unset($data['proposalData']);
|
||||||
|
} else if ($type == 1) {
|
||||||
|
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData, $key);
|
||||||
|
unset($data['proposalData']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dd($data);
|
||||||
|
foreach ($data['table_data']['headers'] as $header) {
|
||||||
|
if ($header['parentHeader'] != "Action") {
|
||||||
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
|
// Kint::dump($header['parentHeader']);
|
||||||
|
// Kint::dump($subHeader);
|
||||||
|
|
||||||
|
$length++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dd($length);
|
||||||
|
$columnLetterForTitle = Coordinate::stringFromColumnIndex($length - 1);
|
||||||
|
$columnLetterForImage = Coordinate::stringFromColumnIndex($length);
|
||||||
|
|
||||||
|
// dd($columnLetter);
|
||||||
|
$sheetName = 'Worksheet';
|
||||||
|
if ($type == 2) {
|
||||||
|
$sheetName = 'QCR';
|
||||||
|
if ($propsal_and_insurer !== null) {
|
||||||
|
$sheetName = 'Placement';
|
||||||
|
}
|
||||||
|
} else if ($type == 1) {
|
||||||
|
$sheetName = 'RFQ';
|
||||||
|
}
|
||||||
|
|
||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
$sheet->setTitle($sheetName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Start with lead_data at the top
|
// Start with lead_data at the top
|
||||||
$rowNumber = 1;
|
$rowNumber = 1;
|
||||||
|
|
||||||
$title = "Nhance India Insurance Broking Pvt Ltd";
|
$title = "Nhance India Insurance Broking Pvt Ltd";
|
||||||
$mergeRange1 = "A{$rowNumber}:B{$rowNumber}";
|
$mergeRange1 = "A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}";
|
||||||
$sheet->mergeCells($mergeRange1);
|
$sheet->mergeCells($mergeRange1);
|
||||||
$sheet->setCellValue("A{$rowNumber}", $title);
|
$sheet->setCellValue("A{$rowNumber}", $title);
|
||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
@ -3397,24 +3534,23 @@ class LeadsController extends BaseController
|
|||||||
// Calculate title width
|
// Calculate title width
|
||||||
$maxWidthA = mb_strlen($title);
|
$maxWidthA = mb_strlen($title);
|
||||||
|
|
||||||
|
// dd($columnLetterForImage);
|
||||||
// Set column width to fit the image properly
|
// Set column width to fit the image properly
|
||||||
$sheet->getColumnDimension('C')->setWidth(20); // Adjust as needed
|
$sheet->getColumnDimension($columnLetterForImage)->setWidth(40); // Adjust as needed
|
||||||
$sheet->getRowDimension($rowNumber)->setRowHeight(40); // Adjust as needed
|
$sheet->getRowDimension($rowNumber)->setRowHeight(40); // Adjust as needed
|
||||||
|
|
||||||
|
|
||||||
$drawing = new Drawing();
|
$drawing = new Drawing();
|
||||||
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
$path = ROOTPATH . "public/assets/images/Nhance-Logo-Final.png"; // Use FCPATH for server path
|
||||||
$drawing->setPath($path);
|
$drawing->setPath($path);
|
||||||
$drawing->setCoordinates("C{$rowNumber}"); // Set position in column C
|
$drawing->setCoordinates("{$columnLetterForImage}{$rowNumber}"); // Set position in column C
|
||||||
$drawing->setHeight(35); // Adjust image height
|
$drawing->setHeight(35); // Adjust image height
|
||||||
|
|
||||||
// Center align the image in the cell
|
|
||||||
$drawing->setOffsetX(30); // Adjust horizontal offset
|
|
||||||
$drawing->setOffsetY(5); // Adjust vertical offset
|
|
||||||
$drawing->setWorksheet($sheet);
|
|
||||||
|
|
||||||
// Apply center alignment to the cell
|
// Apply center alignment to the cell
|
||||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
$sheet->getStyle("{$columnLetterForImage}{$rowNumber}")->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
|
||||||
$sheet->getStyle("C{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
$sheet->getStyle("{$columnLetterForImage}{$rowNumber}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
|
|
||||||
@ -3423,15 +3559,32 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
//Lead Data
|
//Lead Data
|
||||||
foreach ($lead_data as $key => $value) {
|
foreach ($lead_data as $key => $value) {
|
||||||
|
|
||||||
|
// if ($key == 'risk_location') {
|
||||||
|
// $key == 'risk_details';
|
||||||
|
// }
|
||||||
|
// Kint::dump($key);
|
||||||
|
// Kint::dump($value);
|
||||||
$formattedKey = ucwords(str_replace('_', ' ', $key));
|
$formattedKey = ucwords(str_replace('_', ' ', $key));
|
||||||
|
$formattedKey = $formattedKey == "Risk Location" ? "Risk Details" : $formattedKey;
|
||||||
|
$formattedKey = $formattedKey == "Address" ? "Communication Address" : $formattedKey;
|
||||||
|
$formattedValue = ucwords(str_replace("_", " ", $value));
|
||||||
|
|
||||||
|
if ($key == "claim_history") {
|
||||||
|
|
||||||
|
$formattedValue = $value == "1" ? "Yes" : "No";
|
||||||
|
$formattedKey = "Claim Experience";
|
||||||
|
|
||||||
|
}
|
||||||
|
// Kint::dump($formattedValue);
|
||||||
|
|
||||||
// Merge A:B for key
|
// Merge A:B for key
|
||||||
$mergeRangeKey = "A{$rowNumber}:B{$rowNumber}";
|
$mergeRangeKey = "A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}";
|
||||||
$sheet->mergeCells($mergeRangeKey);
|
$sheet->mergeCells($mergeRangeKey);
|
||||||
|
|
||||||
// Set values in merged cells
|
// Set values in merged cells
|
||||||
$sheet->setCellValue("A{$rowNumber}", $formattedKey);
|
$sheet->setCellValue("A{$rowNumber}", $formattedKey);
|
||||||
$sheet->setCellValue("C{$rowNumber}", $value);
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", $formattedValue);
|
||||||
|
|
||||||
// Apply styles for alignment and bold text in A:B
|
// Apply styles for alignment and bold text in A:B
|
||||||
$sheet->getStyle($mergeRangeKey)->applyFromArray([
|
$sheet->getStyle($mergeRangeKey)->applyFromArray([
|
||||||
@ -3452,16 +3605,22 @@ class LeadsController extends BaseController
|
|||||||
// Track max width needed for columns
|
// Track max width needed for columns
|
||||||
$maxWidthA = max($maxWidthA, mb_strlen($formattedKey)); // Consider title and keys
|
$maxWidthA = max($maxWidthA, mb_strlen($formattedKey)); // Consider title and keys
|
||||||
$maxWidthB = max($maxWidthB, mb_strlen((string) $value));
|
$maxWidthB = max($maxWidthB, mb_strlen((string) $value));
|
||||||
|
// if (!empty($policy_registration_data)) {
|
||||||
|
// dd($policy_registration_data);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
// die();
|
||||||
|
|
||||||
|
|
||||||
// Set column width based on max content length (adjusted for padding)
|
// Set column width based on max content length (adjusted for padding)
|
||||||
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
$sheet->getColumnDimension('A')->setWidth($maxWidthA * 1.2);
|
||||||
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
// $sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
||||||
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
// $sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
||||||
|
|
||||||
$rowNumber += 1;
|
// $rowNumber += 1;
|
||||||
//Policy Registration
|
//Policy Registration
|
||||||
if (!empty($policy_registration_data)) {
|
if (!empty($policy_registration_data)) {
|
||||||
foreach ($policy_registration_data as $key => $value) {
|
foreach ($policy_registration_data as $key => $value) {
|
||||||
@ -3469,7 +3628,7 @@ class LeadsController extends BaseController
|
|||||||
$startRow = $rowNumber; // Track where the block starts
|
$startRow = $rowNumber; // Track where the block starts
|
||||||
|
|
||||||
// Title Row
|
// Title Row
|
||||||
$titleMergeRangeKey = "A{$rowNumber}:C{$rowNumber}";
|
$titleMergeRangeKey = "A{$rowNumber}:{$columnLetterForImage}{$rowNumber}";
|
||||||
$sheet->mergeCells($titleMergeRangeKey);
|
$sheet->mergeCells($titleMergeRangeKey);
|
||||||
$sheet->setCellValue("A{$rowNumber}", ucfirst($key) . " Policy Details");
|
$sheet->setCellValue("A{$rowNumber}", ucfirst($key) . " Policy Details");
|
||||||
|
|
||||||
@ -3490,9 +3649,9 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
// Policy Type
|
// Policy Type
|
||||||
if (isset($value['policyType'])) {
|
if (isset($value['policyType'])) {
|
||||||
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
$sheet->setCellValue("A{$rowNumber}", "Policy Type");
|
$sheet->setCellValue("A{$rowNumber}", "Policy Type");
|
||||||
$sheet->setCellValue("C{$rowNumber}", $value['policyType']);
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", $value['policyType']);
|
||||||
|
|
||||||
$sheet->getStyle("A{$rowNumber}:C{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}:C{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
@ -3504,9 +3663,9 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
} else {
|
} else {
|
||||||
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
$sheet->setCellValue("A{$rowNumber}", "Policy Type");
|
$sheet->setCellValue("A{$rowNumber}", "Policy Type");
|
||||||
$sheet->setCellValue("C{$rowNumber}", ucfirst($key) . " Policy");
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", ucfirst($key) . " Policy");
|
||||||
|
|
||||||
$sheet->getStyle("A{$rowNumber}:C{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}:C{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
@ -3522,9 +3681,9 @@ class LeadsController extends BaseController
|
|||||||
// Type of Business & Nature of Business
|
// Type of Business & Nature of Business
|
||||||
if (isset($value['productSelection']) && !empty($value['productSelection'])) {
|
if (isset($value['productSelection']) && !empty($value['productSelection'])) {
|
||||||
// Type of Business
|
// Type of Business
|
||||||
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
$sheet->setCellValue("A{$rowNumber}", "Type of Business");
|
$sheet->setCellValue("A{$rowNumber}", "Type of Business");
|
||||||
$sheet->setCellValue("C{$rowNumber}", $this->buisnessType[$value['productSelection']['type_of_buisness']] ?? '');
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", $this->buisnessType[$value['productSelection']['type_of_buisness']] ?? '');
|
||||||
|
|
||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
@ -3537,9 +3696,9 @@ class LeadsController extends BaseController
|
|||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
|
|
||||||
// Nature of Business
|
// Nature of Business
|
||||||
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
$sheet->setCellValue("A{$rowNumber}", "Nature of Business");
|
$sheet->setCellValue("A{$rowNumber}", "Nature of Business");
|
||||||
$sheet->setCellValue("C{$rowNumber}", $value['productSelection']['buisness_nature'] ?? '');
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", $value['productSelection']['buisness_nature'] ?? '');
|
||||||
|
|
||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
@ -3554,9 +3713,9 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
if (isset($value['policyDetails']) && !empty($value['policyDetails'])) {
|
if (isset($value['policyDetails']) && !empty($value['policyDetails'])) {
|
||||||
// Type of Business
|
// Type of Business
|
||||||
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
$sheet->setCellValue("A{$rowNumber}", "Terrorism");
|
$sheet->setCellValue("A{$rowNumber}", "Terrorism");
|
||||||
$sheet->setCellValue("C{$rowNumber}", ucfirst($value['policyDetails']['terrorism'] ?? 'No'));
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", ucfirst($value['policyDetails']['terrorism'] ?? 'No'));
|
||||||
|
|
||||||
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
@ -3567,13 +3726,40 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
|
}
|
||||||
|
if (!empty($value['locations'])) {
|
||||||
|
|
||||||
|
foreach ($value['locations'] as $index => $location) {
|
||||||
|
// Merge title cell
|
||||||
|
$sheet->mergeCells("A{$rowNumber}:{$columnLetterForTitle}{$rowNumber}");
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", "Risk " . ($location['select_location'] ?? 'Unknown'));
|
||||||
|
|
||||||
|
// Clean and safe address string
|
||||||
|
$address1 = ucfirst($location['policyRisk']['address1'] ?? '');
|
||||||
|
$address2 = ucfirst($location['policyRisk']['address2'] ?? '');
|
||||||
|
$pinCode = $location['policyRisk']['pin_code'] ?? 'No';
|
||||||
|
|
||||||
|
$fullAddress = "{$address1}, {$address2}, {$pinCode}";
|
||||||
|
$sheet->setCellValue("{$columnLetterForImage}{$rowNumber}", $fullAddress);
|
||||||
|
|
||||||
|
// Style the title cell
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => ['bold' => true],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rowNumber++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$endRow = $rowNumber - 1; // Block ends at previous row
|
|
||||||
|
$endRow = $rowNumber; // Block ends at previous row
|
||||||
|
|
||||||
// Apply border to the whole block
|
// Apply border to the whole block
|
||||||
$sheet->getStyle("A{$startRow}:C{$endRow}")->applyFromArray([
|
$sheet->getStyle("A{$startRow}:{$columnLetterForImage}{$endRow}")->applyFromArray([
|
||||||
'borders' => [
|
'borders' => [
|
||||||
'allBorders' => [
|
'allBorders' => [
|
||||||
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
|
||||||
@ -3582,8 +3768,9 @@ class LeadsController extends BaseController
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rowNumber += 1; // Add space before the next block
|
// $rowNumber += 1; // Add space before the next block
|
||||||
}
|
}
|
||||||
|
$rowNumber--;
|
||||||
// die();
|
// die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3625,6 +3812,7 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sheet->getColumnDimension($columnLetter)->setWidth(60);
|
$sheet->getColumnDimension($columnLetter)->setWidth(60);
|
||||||
|
$sheet->getColumnDimension('C')->setWidth(35);
|
||||||
|
|
||||||
|
|
||||||
if ($header['parentHeader'] == 'Policy') {
|
if ($header['parentHeader'] == 'Policy') {
|
||||||
@ -3644,7 +3832,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
$startColumn = $columnLetter; // Start of the current header range
|
$startColumn = $columnLetter; // Start of the current header range
|
||||||
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
|
$subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
|
||||||
|
// Kint::dump($subHeaderCount);
|
||||||
// Set parent header value
|
// Set parent header value
|
||||||
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
|
$sheet->setCellValue("{$startColumn}{$rowNumber}", $header['parentHeader']);
|
||||||
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
|
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
|
||||||
@ -3667,6 +3855,7 @@ class LeadsController extends BaseController
|
|||||||
$endColumn = $startColumn; // No merge needed if only one subheader
|
$endColumn = $startColumn; // No merge needed if only one subheader
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Kint::dump($header);
|
||||||
// Add subheaders
|
// Add subheaders
|
||||||
foreach ($header['subHeaders'] as $subHeader) {
|
foreach ($header['subHeaders'] as $subHeader) {
|
||||||
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
|
||||||
@ -3699,7 +3888,6 @@ class LeadsController extends BaseController
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
// Apply border to the header range
|
// Apply border to the header range
|
||||||
$prevColumn4 = $this->getPreviousColumn($columnLetter);
|
$prevColumn4 = $this->getPreviousColumn($columnLetter);
|
||||||
$headerRange = "A{$rowNumber}:" . "{$prevColumn4}" . "{$subHeaderRow}";
|
$headerRange = "A{$rowNumber}:" . "{$prevColumn4}" . "{$subHeaderRow}";
|
||||||
@ -3819,7 +4007,7 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lastRow = count($lead_data) + 1;
|
$lastRow = count($lead_data) + 1;
|
||||||
$leadRange = "A1:C{$lastRow}";
|
$leadRange = "A1:{$columnLetterForImage}{$lastRow}";
|
||||||
|
|
||||||
$sheet->getStyle($leadRange)->applyFromArray([
|
$sheet->getStyle($leadRange)->applyFromArray([
|
||||||
'borders' => [
|
'borders' => [
|
||||||
@ -3831,6 +4019,92 @@ class LeadsController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$columnWidth = $sheet->getColumnDimension("C")->getWidth(); // e.g., 20
|
||||||
|
$cellPixelWidth = $columnWidth * 7; // Approximate conversion (1 unit ≈ 7 pixels)
|
||||||
|
$imagePixelWidth = 250; // Approximate width of your image (in pixels)
|
||||||
|
|
||||||
|
$offsetX = max(0, ($cellPixelWidth - $imagePixelWidth) / 2);
|
||||||
|
$offsetX = $offsetX + 97;
|
||||||
|
if ($length >= 4) {
|
||||||
|
$offsetX = 50;
|
||||||
|
} else if ($length == 3) {
|
||||||
|
$offsetX = 140;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($offsetX, $cellPixelWidth, $imagePixelWidth);
|
||||||
|
$drawing->setOffsetX($offsetX); // Dynamically center
|
||||||
|
$drawing->setOffsetY(10); // Dynamically center
|
||||||
|
|
||||||
|
$drawing->setWorksheet($sheet);
|
||||||
|
|
||||||
|
$sheet->getStyle('C1')->getAlignment()
|
||||||
|
->setHorizontal(Alignment::HORIZONTAL_CENTER)
|
||||||
|
->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
|
if (!empty($rfq_data['fin_years_claims']) && $claim_history == 1) {
|
||||||
|
|
||||||
|
$claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
|
||||||
|
|
||||||
|
if (!empty($claim_details['finyear'])) {
|
||||||
|
|
||||||
|
// Get headers dynamically
|
||||||
|
$headers = array_map(function ($key) {
|
||||||
|
return ucwords(str_replace('_', ' ', $key));
|
||||||
|
}, array_keys($claim_details['finyear'][0]));
|
||||||
|
|
||||||
|
$newSheet = new Worksheet($spreadsheet, 'Claims Experience');
|
||||||
|
$spreadsheet->addSheet($newSheet);
|
||||||
|
$spreadsheet->setActiveSheetIndexByName('Claims Experience');
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Set headers
|
||||||
|
$sheet->fromArray($headers, NULL, 'A1');
|
||||||
|
|
||||||
|
// Apply background color and bold style to headers
|
||||||
|
$headerCellRange = 'A1:' . chr(64 + count($headers)) . '1'; // e.g., A1:G1
|
||||||
|
|
||||||
|
$sheet->getStyle($headerCellRange)->getFont()->setBold(true);
|
||||||
|
$sheet->getStyle($headerCellRange)->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setRGB('ADD8E6');
|
||||||
|
|
||||||
|
// Add border to header
|
||||||
|
$sheet->getStyle($headerCellRange)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||||
|
|
||||||
|
// Fill data and apply borders
|
||||||
|
$row = 2;
|
||||||
|
foreach ($claim_details['finyear'] as $record) {
|
||||||
|
$col = 'A';
|
||||||
|
foreach ($record as $value) {
|
||||||
|
$sheet->setCellValue($col . $row, $value);
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply border to each data row
|
||||||
|
$sheet->getStyle('A' . $row . ':' . chr(64 + count($headers)) . $row)
|
||||||
|
->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN);
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
// Auto-size all columns based on header count
|
||||||
|
for ($i = 0; $i < count($headers); $i++) {
|
||||||
|
$colLetter = chr(65 + $i); // 'A', 'B', etc.
|
||||||
|
$sheet->getColumnDimension($colLetter)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable wrap text for all cells
|
||||||
|
$maxColLetter = chr(64 + count($headers)); // Last column letter
|
||||||
|
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setWrapText(true);
|
||||||
|
|
||||||
|
// Optional: center vertically for neatness
|
||||||
|
$sheet->getStyle("A2:{$maxColLetter}{$row}")->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||||
|
|
||||||
|
// Optional: Make row height auto (helps when wrap text is on)
|
||||||
|
for ($i = 2; $i < $row; $i++) {
|
||||||
|
$sheet->getRowDimension($i)->setRowHeight(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// dd($rowNumber);
|
// dd($rowNumber);
|
||||||
// Set filename
|
// Set filename
|
||||||
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||||
@ -3993,11 +4267,11 @@ class LeadsController extends BaseController
|
|||||||
// Ensure 'subHeaders' exists and is an array before filtering
|
// Ensure 'subHeaders' exists and is an array before filtering
|
||||||
if (isset($header['subHeaders']) && is_array($header['subHeaders'])) {
|
if (isset($header['subHeaders']) && is_array($header['subHeaders'])) {
|
||||||
$header['subHeaders'] = array_filter($header['subHeaders'], function ($subHeader) {
|
$header['subHeaders'] = array_filter($header['subHeaders'], function ($subHeader) {
|
||||||
return in_array($subHeader, ['Quote asked', '-'], true);
|
return in_array($subHeader, ['Sum Insured', '-'], true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Kint::dump($header);
|
||||||
//Remove insurer Row wise data for RFQ
|
//Remove insurer Row wise data for RFQ
|
||||||
$groupedRows = [];
|
$groupedRows = [];
|
||||||
foreach ($first_json['table_data']['data'] as &$row) {
|
foreach ($first_json['table_data']['data'] as &$row) {
|
||||||
|
|||||||
@ -462,7 +462,8 @@ class PolicyTransactionController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($data['bro_payable_by'] == 1) {
|
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);
|
$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 {
|
} else {
|
||||||
$cop_amt = $data['co_premium'][$index] ?? 0;
|
$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['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['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['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||||
// $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
|
// $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
|
||||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
$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);
|
$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_id', $client_id)
|
||||||
->where('policy_transaction.client_policy_id', $client_policy_id)
|
->where('policy_transaction.client_policy_id', $client_policy_id)
|
||||||
->where('policy_transaction.action_type', 'inception')
|
->where('policy_transaction.action_type', 'inception')
|
||||||
|
->where('policy_transaction.is_active', 1)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$is_copay_yes = $this->policyTransactionModel
|
$is_copay_yes = $this->policyTransactionModel
|
||||||
@ -2820,11 +2828,9 @@ class PolicyTransactionController extends BaseController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails();
|
$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', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData));
|
$this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData));
|
||||||
// dd($bdsInstallmentData);
|
// dd($bdsInstallmentData);
|
||||||
@ -2904,14 +2910,14 @@ class PolicyTransactionController extends BaseController
|
|||||||
'message' => $message,
|
'message' => $message,
|
||||||
'subject' => $subject
|
'subject' => $subject
|
||||||
];
|
];
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
$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");
|
$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();
|
||||||
@ -2928,10 +2934,10 @@ class PolicyTransactionController extends BaseController
|
|||||||
|
|
||||||
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');
|
$installments = $this->request->getPost('installments');
|
||||||
|
|
||||||
@ -2956,6 +2962,49 @@ class PolicyTransactionController extends BaseController
|
|||||||
return $this->respond(['status' => true, 'message' => 'Data saved successfully'], 200);
|
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()
|
public function verifyEmployeeWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -78,7 +84,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
->where('employees.emp_status !=', 'truncated')
|
->where('employees.emp_status !=', 'truncated')
|
||||||
->where('employees.mobile', $mobile_number)
|
->where('employees.mobile', $mobile_number)
|
||||||
->where('EP.is_active', 1)
|
->where('EP.is_active', 1)
|
||||||
->whereIn('EP.status', ['active'])
|
->whereIn('EP.status', ['active', 'expired'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +124,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
->where('employees.emp_status !=', 'truncated')
|
->where('employees.emp_status !=', 'truncated')
|
||||||
->where('employees.email_corporate', $email)
|
->where('employees.email_corporate', $email)
|
||||||
->where('EP.is_active', 1)
|
->where('EP.is_active', 1)
|
||||||
->whereIn('EP.status', ['active'])
|
->whereIn('EP.status', ['active', 'expired'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (isset($employeeData['employee_id'])) {
|
if (isset($employeeData['employee_id'])) {
|
||||||
@ -272,6 +278,13 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function verifyHrWithMobileNumber()
|
public function verifyHrWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -296,15 +309,104 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
public function getVerifiedHrData()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
// mobile number
|
||||||
$otp_verification = $this->request->getJSON()->otp_verification;
|
$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();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
@ -320,14 +422,33 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($this->request->getJSON()->mobile_number)){
|
||||||
|
|
||||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
->where('level_contacts.mobile', $mobile_number )
|
->where('level_contacts.mobile', $mobile_number )
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
->find();
|
->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.email', $email )
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
|
->find();
|
||||||
|
}
|
||||||
|
|
||||||
$result = JWTToken::encode($hrData['0']);
|
$result = JWTToken::encode($hrData['0']);
|
||||||
|
|
||||||
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" ],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" ],200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -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
|
$policies = $this->employeePolicyModel
|
||||||
->select('client_policy_id')
|
->select('client_policy_id')
|
||||||
->where('employee_id', $emp_id)
|
->where('employee_id', $emp_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('status', 'active')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
if (empty($policies)) {
|
if (empty($policies)) {
|
||||||
@ -1670,8 +1672,20 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
// Fetch all policy names and IDs in one query
|
// Fetch all policy names and IDs in one query
|
||||||
$policyNameandID = $this->clientPolicyModel
|
$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('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)
|
->whereIn('client_policy.id', $policy_ids)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
@ -1840,8 +1854,12 @@ class TicketController extends BaseController
|
|||||||
$this->loadLayout("ticket_feedback_list",$data);
|
$this->loadLayout("ticket_feedback_list",$data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMoreInfo() {
|
public function getMoreInfo($requestFrom = null , $ticket_id) {
|
||||||
|
|
||||||
|
if($requestFrom == null){
|
||||||
$ticket_id = $this->request->getPost('ticket_id');
|
$ticket_id = $this->request->getPost('ticket_id');
|
||||||
|
}
|
||||||
|
|
||||||
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
||||||
|
|
||||||
$fields = $this->extraFields;
|
$fields = $this->extraFields;
|
||||||
@ -1905,6 +1923,9 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
||||||
|
|
||||||
|
if($requestFrom == 'rest'){
|
||||||
|
return $data_to_send;
|
||||||
|
}
|
||||||
// Send response based on data availability
|
// Send response based on data availability
|
||||||
if (!empty($data_to_send)) {
|
if (!empty($data_to_send)) {
|
||||||
return $this->respond(['status' => true, 'data' => $data_to_send], 200);
|
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\RoleModel;
|
||||||
use App\Models\TeamModel;
|
use App\Models\TeamModel;
|
||||||
use App\Models\UserTeamsModel;
|
use App\Models\UserTeamsModel;
|
||||||
|
use App\Helpers\BookStackUserHelper;
|
||||||
|
|
||||||
|
|
||||||
class UserController extends AdminController
|
class UserController extends AdminController
|
||||||
@ -21,6 +22,7 @@ class UserController extends AdminController
|
|||||||
protected $roleModel;
|
protected $roleModel;
|
||||||
protected $teamModel;
|
protected $teamModel;
|
||||||
protected $userTeamsModel;
|
protected $userTeamsModel;
|
||||||
|
protected $bookStack;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -31,6 +33,7 @@ class UserController extends AdminController
|
|||||||
$this->roleModel = new RoleModel();
|
$this->roleModel = new RoleModel();
|
||||||
$this->teamModel = new TeamModel();
|
$this->teamModel = new TeamModel();
|
||||||
$this->userTeamsModel = new UserTeamsModel();
|
$this->userTeamsModel = new UserTeamsModel();
|
||||||
|
$this->bookStack = new BookStackUserHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
@ -60,10 +63,17 @@ class UserController extends AdminController
|
|||||||
$userData['created_by'] = get_session_userid();
|
$userData['created_by'] = get_session_userid();
|
||||||
$temp_team = $userData['team'];
|
$temp_team = $userData['team'];
|
||||||
unset($userData['team']);
|
unset($userData['team']);
|
||||||
|
|
||||||
$insert = $this->userModel->insert($userData);
|
$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;
|
$teamData['user_id'] = $insert;
|
||||||
foreach ($teams as $value) {
|
foreach ($teams as $value) {
|
||||||
$teamData['team_id'] = $value;
|
$teamData['team_id'] = $value;
|
||||||
@ -137,10 +147,20 @@ class UserController extends AdminController
|
|||||||
unset($userData['csrf_test_name']);
|
unset($userData['csrf_test_name']);
|
||||||
unset($userData['PrimaryKey']);
|
unset($userData['PrimaryKey']);
|
||||||
|
|
||||||
|
$existingData = $this->userModel->where('id',$id)->first();;
|
||||||
|
|
||||||
// Update data in the 'users' table based on the $id
|
// Update data in the 'users' table based on the $id
|
||||||
$userData['updated_by'] = get_session_userid();
|
$userData['updated_by'] = get_session_userid();
|
||||||
$update = $this->userModel->where('id', $id)->set($userData)->update();
|
$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 ($update) {
|
||||||
|
|
||||||
if ($teams) {
|
if ($teams) {
|
||||||
@ -211,7 +231,11 @@ class UserController extends AdminController
|
|||||||
public function deactive($id = null)
|
public function deactive($id = null)
|
||||||
{
|
{
|
||||||
$model = new UserModel();
|
$model = new UserModel();
|
||||||
|
|
||||||
|
$emailToDelete = $model->where('id', $id)->first();
|
||||||
$deactive = $model->where('id', $id)->set(['is_active' => 0])->update();
|
$deactive = $model->where('id', $id)->set(['is_active' => 0])->update();
|
||||||
|
|
||||||
|
$this->bookStack->deleteUser($emailToDelete);
|
||||||
if($deactive)
|
if($deactive)
|
||||||
{
|
{
|
||||||
// $db = \Config\Database::connect();
|
// $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];
|
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||||
|
|
||||||
if(empty($cd_ac_pk)){
|
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];
|
$getLastBalanceParams = [$cd_ac_no];
|
||||||
}else{
|
}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];
|
$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)
|
//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
|
//set dependent si to 0
|
||||||
$emp_data['policy_details']['basic_cover_si'] = 0;
|
$emp_data['policy_details']['basic_cover_si'] = 0;
|
||||||
}
|
}
|
||||||
@ -2009,3 +2009,29 @@ if (!function_exists('generate_family_floater_key')) {
|
|||||||
return $relation;
|
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('client_policy.client_id', $id)
|
||||||
->where('cd_master.id = client_policy.cd_ac_pk')
|
->where('cd_master.id = client_policy.cd_ac_pk')
|
||||||
->where('cd_master.is_active', 1)
|
->where('cd_master.is_active', 1)
|
||||||
->groupBy('client_policy.insurer_id')
|
|
||||||
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||||
|
->groupBy('client_policy.insurer_id')
|
||||||
|
->groupBy('client_policy.cd_ac_pk')
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->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
|
// Fetch the deposit data based on client and insurer IDs
|
||||||
return $this->db->table('cash_deposit')
|
$query = $this->db->table('cash_deposit')
|
||||||
->select('cash_deposit.*')
|
->select('cash_deposit.*')
|
||||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
->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')
|
->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')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
|
||||||
->where('cash_deposit.client_id', $clientId)
|
->where('cash_deposit.client_id', $clientId)
|
||||||
->where('cash_deposit.insurer_id', $insurerId)
|
->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')
|
// ->where('cash_deposit.cd_ac_pk = cd_master.id')
|
||||||
->orderBy('cash_deposit.id', 'DESC')
|
if(!empty($cd_ac_pk)){
|
||||||
->get()
|
$query->where('cash_deposit.cd_ac_pk', $cd_ac_pk);
|
||||||
->getResult();
|
}
|
||||||
|
$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
|
// Fetch the sum of credit and debit transactions and calculate the balance
|
||||||
return $this->db->table('cash_deposit')
|
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')
|
->select('SUM(CASE WHEN sub_type = 3 THEN amount ELSE 0 END) AS total_refund')
|
||||||
->where('client_id', $clientId)
|
->where('client_id', $clientId)
|
||||||
->where('insurer_id', $insurerId)
|
->where('insurer_id', $insurerId)
|
||||||
|
->where('cd_ac_pk', $cd_ac_pk)
|
||||||
->where('cash_deposit.is_active', 1)
|
->where('cash_deposit.is_active', 1)
|
||||||
->get()
|
->get()
|
||||||
->getRow();
|
->getRow();
|
||||||
@ -315,10 +320,12 @@ class ClientPolicyModel extends Model
|
|||||||
public function getDepositlistsummary($id)
|
public function getDepositlistsummary($id)
|
||||||
{
|
{
|
||||||
return $this->db->table('cash_deposit')
|
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')
|
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
|
||||||
->where('client_id', $id)
|
->where('client_id', $id)
|
||||||
|
->where('is_active', 1)
|
||||||
->groupBy('insurer_id')
|
->groupBy('insurer_id')
|
||||||
|
// ->groupBy('cd_ac_pk')
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
@ -326,14 +333,18 @@ class ClientPolicyModel extends Model
|
|||||||
|
|
||||||
public function updateStatus()
|
public function updateStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Update client_policy table
|
// Update client_policy table
|
||||||
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
||||||
$client_count = $this->db->affectedRows();
|
$client_count = $this->db->affectedRows();
|
||||||
|
|
||||||
// Update employee_polices table
|
// Update employee_polices table
|
||||||
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
||||||
$emp_count = $this->db->affectedRows();
|
$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];
|
return ['client' => $client_count, 'emp' => $emp_count];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -416,7 +416,7 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.designation AS emp_designation,
|
employees.designation AS emp_designation,
|
||||||
employees.basic_pay AS emp_basic_pay,
|
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,
|
employees.emp_type as emp_type,
|
||||||
|
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT
|
||||||
a.id as endorsement_primarykey,
|
a.id AS endorsement_primarykey,
|
||||||
a.group_key,
|
a.group_key,
|
||||||
employee_polices.id AS primaryKey,
|
employee_polices.id AS primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
@ -616,10 +616,8 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.gender AS emp_gender,
|
employees.gender AS emp_gender,
|
||||||
employees.relationship_code AS emp_relationship_code,
|
employees.relationship_code AS emp_relationship_code,
|
||||||
employees.relationship AS emp_relationship,
|
employees.relationship AS emp_relationship,
|
||||||
employees.emp_type as emp_type,
|
employees.emp_type AS emp_type,
|
||||||
'SI' as event_type_data,
|
'SI' AS event_type_data,
|
||||||
|
|
||||||
|
|
||||||
employees.doj AS emp_doj,
|
employees.doj AS emp_doj,
|
||||||
employees.mobile AS emp_mobile,
|
employees.mobile AS emp_mobile,
|
||||||
employees.email_corporate AS emp_email_c,
|
employees.email_corporate AS emp_email_c,
|
||||||
@ -627,97 +625,59 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.band AS emp_grade,
|
employees.band AS emp_grade,
|
||||||
employees.designation AS emp_designation,
|
employees.designation AS emp_designation,
|
||||||
employees.basic_pay AS emp_basic_pay,
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
employee_polices.uhid AS uhid,
|
employee_polices.uhid AS uhid,
|
||||||
employee_polices.pre_existing_alignments,
|
employee_polices.pre_existing_alignments,
|
||||||
employee_polices.policy_end_date,
|
employee_polices.policy_end_date,
|
||||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
employee_polices.basic_cover_si AS old_basic_cover_si,
|
||||||
employee_polices.rata_premimum as old_si_premium,
|
employee_polices.premium AS old_si_premium,
|
||||||
|
employee_polices.rata_premimum AS old_rata_premium,
|
||||||
employee_polices.age_band,
|
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.new_si_premium,
|
||||||
|
sidata.old_si_premium,
|
||||||
sidata.date_of_coverage,
|
sidata.date_of_coverage,
|
||||||
|
|
||||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
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,
|
||||||
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(
|
ROUND(
|
||||||
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) +
|
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||||
|
2
|
||||||
|
) AS pro_rata_premium,
|
||||||
ROUND(
|
ROUND(
|
||||||
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
(
|
||||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2
|
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||||
), 2
|
(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
|
) AS total
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
emp_endorsement a
|
emp_endorsement a
|
||||||
LEFT JOIN
|
LEFT JOIN employees ON employees.emp_code = a.emp_code
|
||||||
employees ON employees.emp_code = a.emp_code
|
LEFT JOIN employee_polices ON employees.id = employee_polices.employee_id
|
||||||
LEFT JOIN
|
|
||||||
employee_polices ON employees.id = employee_polices.employee_id
|
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
aa.emp_code,
|
emp_code,
|
||||||
aa.new_value as 'new_basic_cover_si',
|
CAST(MAX(CASE WHEN field_name = 'basic_cover_si' THEN new_value END) AS UNSIGNED) AS new_basic_cover_si,
|
||||||
bb.new_value as 'new_si_premium',
|
CAST(MAX(CASE WHEN field_name = 'premium' THEN new_value END) AS DECIMAL(10,2)) AS new_si_premium,
|
||||||
cc.new_value as 'date_of_coverage'
|
CAST(MAX(CASE WHEN field_name = 'premium' THEN old_value END) AS DECIMAL(10,2)) AS old_si_premium,
|
||||||
FROM (
|
MAX(CASE WHEN field_name = 'si_enhancement_date' THEN new_value END) AS date_of_coverage
|
||||||
SELECT
|
FROM emp_endorsement
|
||||||
a1.emp_code,
|
GROUP BY emp_code
|
||||||
a1.field_name,
|
) AS sidata ON a.emp_code = sidata.emp_code
|
||||||
a1.new_value
|
|
||||||
FROM
|
|
||||||
emp_endorsement as a1
|
|
||||||
WHERE
|
|
||||||
a1.field_name = 'basic_cover_si'
|
|
||||||
) aa
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
b1.emp_code,
|
|
||||||
b1.field_name,
|
|
||||||
b1.new_value
|
|
||||||
FROM
|
|
||||||
emp_endorsement as b1
|
|
||||||
WHERE
|
|
||||||
b1.field_name = 'premium'
|
|
||||||
) bb ON aa.emp_code = bb.emp_code
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT
|
|
||||||
c1.emp_code,
|
|
||||||
c1.field_name,
|
|
||||||
c1.new_value
|
|
||||||
FROM
|
|
||||||
emp_endorsement as c1
|
|
||||||
WHERE
|
|
||||||
c1.field_name = 'si_enhancement_date'
|
|
||||||
) cc ON aa.emp_code = cc.emp_code
|
|
||||||
) as sidata ON a.emp_code = sidata.emp_code
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT DISTINCT
|
|
||||||
batch_list.emp_policy_id,
|
|
||||||
batch_list.batch_code AS bl,
|
|
||||||
batch_files.batch_code AS bf
|
|
||||||
FROM
|
|
||||||
batch_files
|
|
||||||
LEFT JOIN
|
|
||||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
|
||||||
WHERE
|
|
||||||
batch_files.event_type = 'si_enhancement'
|
|
||||||
AND batch_files.actions = 'export'
|
|
||||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
|
||||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
|
||||||
|
|
||||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
AND employees.client_branch_id = '{$client_branch_id}'
|
AND employees.client_branch_id = '{$client_branch_id}'
|
||||||
$endorsement_condition
|
$endorsement_condition
|
||||||
@ -741,9 +701,166 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
// dd($this->db->getLastQuery());
|
// dd($this->db->getLastQuery());
|
||||||
return $results;
|
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
|
// DO NOT DELETE this DELETION QUERY FUNCTION
|
||||||
|
|
||||||
// public function getDeletionEmployeeDataForExportExcel($ref_data, $return_type = 0)
|
// public function getDeletionEmployeeDataForExportExcel($ref_data, $return_type = 0)
|
||||||
@ -944,10 +1061,10 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$status_condition = "{$insurer_or_tpa}" === 'tpa'
|
$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'";
|
: "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("
|
$query = $this->db->query("
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
@ -972,7 +1089,8 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
employee_polices.basic_cover_si,
|
employee_polices.basic_cover_si,
|
||||||
employee_polices.uhid as uhid,
|
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.claim_status,
|
||||||
employee_polices.age_band,
|
employee_polices.age_band,
|
||||||
employee_polices.tpa_id,
|
employee_polices.tpa_id,
|
||||||
@ -998,22 +1116,22 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
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
|
ELSE
|
||||||
0
|
0
|
||||||
END AS pro_rata_premium,
|
END AS pro_rata_premium,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
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
|
ELSE
|
||||||
0
|
0
|
||||||
END AS gst,
|
END AS gst,
|
||||||
|
|
||||||
CASE
|
CASE
|
||||||
WHEN deletiondata.claimstatus = 0 OR deletiondata.claimstatus IS NULL THEN
|
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) +
|
ROUND(((employee_polices.premium * (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)
|
(((employee_polices.premium * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2)
|
||||||
ELSE
|
ELSE
|
||||||
0
|
0
|
||||||
END AS total,
|
END AS total,
|
||||||
|
|||||||
@ -97,6 +97,7 @@ class LeadsModel extends Model
|
|||||||
'is_installment',
|
'is_installment',
|
||||||
'no_of_installment',
|
'no_of_installment',
|
||||||
'is_policy_created',
|
'is_policy_created',
|
||||||
|
'claim_history'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -125,13 +125,13 @@ input:checked + .slider:before {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<!-- <div>
|
||||||
<label class="switch">
|
<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>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
<label for="is_download_btn" style=" position: relative;bottom: 5px;">Enable Client Export Option</label>
|
<label for="is_download_btn" style=" position: relative;bottom: 5px;">Enable Client Export Option</label>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="dropdown-item"
|
<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
|
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -94,16 +94,16 @@ body {
|
|||||||
<span class="d-none d-sm-inline-block">API</span>
|
<span class="d-none d-sm-inline-block">API</span>
|
||||||
</a>
|
</a>
|
||||||
</li> -->
|
</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">
|
<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="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">Others</span>
|
<span class="d-none d-sm-inline-block">Others</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<?php include("client_api.php"); ?>
|
<?php include("client_api.php"); ?>
|
||||||
<?php include('client_others_tab.php'); ?>
|
<?php // include('client_others_tab.php'); ?>
|
||||||
<?php include('notification.php'); ?>
|
<?php include('notification.php'); ?>
|
||||||
<?php include('client_basic_info.php'); ?>
|
<?php include('client_basic_info.php'); ?>
|
||||||
<?php include('client_kyc.php'); ?>
|
<?php include('client_kyc.php'); ?>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
<th>Client Branch</th>
|
<th>Client Branch</th>
|
||||||
<th>TPA</th>
|
<th>TPA</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Enrolment Status</th>
|
<!-- <th>Enrolment Status</th> -->
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
||||||
</div>
|
</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;">
|
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||||
<input id="inception_type" type="checkbox" name="inception_type">
|
<input id="inception_type" type="checkbox" name="inception_type">
|
||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
@ -159,7 +159,7 @@
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
<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" >
|
<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">
|
<div class="form-group col-md-12 EB">
|
||||||
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
||||||
@ -239,23 +239,23 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$('#inception_type').change(function () {
|
// $('#inception_type').change(function () {
|
||||||
var open_data = $('#open_date').parent();
|
// var open_data = $('#open_date').parent();
|
||||||
var close_data = $('#close_date').parent();
|
// var close_data = $('#close_date').parent();
|
||||||
var reminder_data = $('#reminder_date').parent();
|
// var reminder_data = $('#reminder_date').parent();
|
||||||
if($(this).prop('checked')){
|
// if($(this).prop('checked')){
|
||||||
$(open_data).show();
|
// $(open_data).show();
|
||||||
$(close_data).show();
|
// $(close_data).show();
|
||||||
$(reminder_data).show();
|
// $(reminder_data).show();
|
||||||
$('.dateofdata').attr('required', true);
|
// $('.dateofdata').attr('required', true);
|
||||||
}else{
|
// }else{
|
||||||
$(open_data).hide();
|
// $(open_data).hide();
|
||||||
$(close_data).hide();
|
// $(close_data).hide();
|
||||||
$(reminder_data).hide();
|
// $(reminder_data).hide();
|
||||||
$('.dateofdata').attr('required', false);
|
// $('.dateofdata').attr('required', false);
|
||||||
|
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
var policy_client = $('#policy_PrimaryKey').val();
|
var policy_client = $('#policy_PrimaryKey').val();
|
||||||
@ -348,28 +348,28 @@
|
|||||||
}
|
}
|
||||||
//console.log('search_term :', search_term)
|
//console.log('search_term :', search_term)
|
||||||
|
|
||||||
var enrollmentStatus = '';
|
// var enrollmentStatus = '';
|
||||||
if (item.inception_type == 1) {
|
// 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 +
|
// 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>'
|
// '" 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 =
|
// enrollmentStatus =
|
||||||
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
|
// '<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>'
|
// item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
var tpaValue = 'TPA Unavailable';
|
var tpaValue = 'TPA Unavailable';
|
||||||
|
|
||||||
@ -388,7 +388,7 @@
|
|||||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||||
<td>${tpaValue}</td>
|
<td>${tpaValue}</td>
|
||||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -434,6 +434,7 @@
|
|||||||
|
|
||||||
$('#policy_form')[0].reset();
|
$('#policy_form')[0].reset();
|
||||||
$('#add_form').show();
|
$('#add_form').show();
|
||||||
|
// console.log("Policy Form Added")
|
||||||
$('#table_list').hide();
|
$('#table_list').hide();
|
||||||
$('.btnBack').show();
|
$('.btnBack').show();
|
||||||
$('.btnAdd').hide();
|
$('.btnAdd').hide();
|
||||||
@ -442,9 +443,9 @@
|
|||||||
$('#tpa').val('').change();
|
$('#tpa').val('').change();
|
||||||
$('#policy_no').val('').change();
|
$('#policy_no').val('').change();
|
||||||
$('#policy_no').val('').change();
|
$('#policy_no').val('').change();
|
||||||
$('#start_date').val('').change();
|
// $('#start_date').val('').change();
|
||||||
$('#end_date').val('').change();
|
// $('#end_date').val('').change();
|
||||||
$('#close_date').val('').change();
|
// $('#close_date').val('').change();
|
||||||
// $('#policy').html('<option value="" selected>Select Policy</option>').change();
|
// $('#policy').html('<option value="" selected>Select Policy</option>').change();
|
||||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||||
$('#policy_status_field').hide()
|
$('#policy_status_field').hide()
|
||||||
@ -590,31 +591,31 @@
|
|||||||
|
|
||||||
// //console.log('search_term :', search_term)
|
// //console.log('search_term :', search_term)
|
||||||
|
|
||||||
var enrollmentStatus = '';
|
// var enrollmentStatus = '';
|
||||||
if (item.inception_type == 1) {
|
// 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 =
|
// enrollmentStatus =
|
||||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
// '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
||||||
item.id + '" id="' + item.policy_id +
|
// item.id + '" id="' + item.policy_id +
|
||||||
'" class="btnOpenEnroll">Open</a>'
|
// '" class="btnOpenEnroll">Open</a>'
|
||||||
|
|
||||||
|
|
||||||
} else if (item.open_for_enrollment == 0) {
|
// } else if (item.open_for_enrollment == 0) {
|
||||||
|
|
||||||
enrollmentStatus =
|
// enrollmentStatus =
|
||||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
// '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
||||||
item.id + '" id="' + item.policy_id +
|
// item.id + '" id="' + item.policy_id +
|
||||||
'" class="btnOpenEnroll">Closed</a>'
|
// '" class="btnOpenEnroll">Closed</a>'
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
var tpaValue = 'TPA Unavailable';
|
var tpaValue = 'TPA Unavailable';
|
||||||
|
|
||||||
@ -632,7 +633,6 @@
|
|||||||
<td>${tpaValue}</td>
|
<td>${tpaValue}</td>
|
||||||
|
|
||||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -725,10 +725,12 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/********* set the Policy_Type_id for Form Submit *******/
|
/********* set the Policy_Type_id for Form Submit *******/
|
||||||
$('#policy_type').change(function() {
|
$('#policy_type').change(function() {
|
||||||
|
// alert('policy_type change');
|
||||||
|
|
||||||
var policy_type_id = $(this).val();
|
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').prop('required', false);
|
||||||
$('#tpa_danger').hide()
|
$('#tpa_danger').hide()
|
||||||
} else {
|
} else {
|
||||||
@ -804,19 +806,19 @@
|
|||||||
|
|
||||||
|
|
||||||
//Open for enrollment yes or no
|
//Open for enrollment yes or no
|
||||||
if (res.data.inception_type == 2) {
|
// if (res.data.inception_type == 2) {
|
||||||
$('#inception_type').prop('checked', true);
|
// $('#inception_type').prop('checked', true);
|
||||||
$('#open_date').parent().show();
|
// $('#open_date').parent().show();
|
||||||
$('#close_date').parent().show();
|
// $('#close_date').parent().show();
|
||||||
$('#reminder_date').parent().show();
|
// $('#reminder_date').parent().show();
|
||||||
$('.dateofdata').attr('required', true);
|
// $('.dateofdata').attr('required', true);
|
||||||
} else {
|
// } else {
|
||||||
$('#inception_type').prop('checked', false);
|
// $('#inception_type').prop('checked', false);
|
||||||
$('#open_date').parent().hide();
|
// $('#open_date').parent().hide();
|
||||||
$('#close_date').parent().hide();
|
// $('#close_date').parent().hide();
|
||||||
$('#reminder_date').parent().hide();
|
// $('#reminder_date').parent().hide();
|
||||||
$('.dateofdata').attr('required', false);
|
// $('.dateofdata').attr('required', false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//Policy Visibility in Web App
|
//Policy Visibility in Web App
|
||||||
if (res.data.enrolment_visibility == 1) {
|
if (res.data.enrolment_visibility == 1) {
|
||||||
@ -904,7 +906,8 @@
|
|||||||
$('#third').show();
|
$('#third').show();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
$("#tpa").prop('required', false);
|
||||||
|
$('#tpa_danger').hide();
|
||||||
$(".EB").hide();
|
$(".EB").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1451,13 +1454,28 @@
|
|||||||
$('#base_danger').hide();
|
$('#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() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#base_policy').change(function() {
|
$('#base_policy').change(function() {
|
||||||
|
// alert('Base Policy Change');
|
||||||
|
|
||||||
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
||||||
var policy_type = $('#policy_type').val()
|
var policy_type = $('#policy_type').val()
|
||||||
@ -1882,19 +1901,19 @@
|
|||||||
$('#policy_status_field').show();
|
$('#policy_status_field').show();
|
||||||
|
|
||||||
|
|
||||||
if (res.data.inception_type == 2) {
|
// if (res.data.inception_type == 2) {
|
||||||
$('#inception_type').prop('checked', true);
|
// $('#inception_type').prop('checked', true);
|
||||||
$('#open_date').parent().show();
|
// $('#open_date').parent().show();
|
||||||
$('#close_date').parent().show();
|
// $('#close_date').parent().show();
|
||||||
$('#reminder_date').parent().show();
|
// $('#reminder_date').parent().show();
|
||||||
$('.dateofdata').attr('required', true);
|
// $('.dateofdata').attr('required', true);
|
||||||
} else {
|
// } else {
|
||||||
$('#inception_type').prop('checked', false);
|
// $('#inception_type').prop('checked', false);
|
||||||
$('#open_date').parent().hide();
|
// $('#open_date').parent().hide();
|
||||||
$('#close_date').parent().hide();
|
// $('#close_date').parent().hide();
|
||||||
$('#reminder_date').parent().hide();
|
// $('#reminder_date').parent().hide();
|
||||||
$('.dateofdata').attr('required', false);
|
// $('.dateofdata').attr('required', false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
if (res.data.enrolment_visibility == 1) {
|
if (res.data.enrolment_visibility == 1) {
|
||||||
@ -2002,7 +2021,8 @@
|
|||||||
$('#third').show();
|
$('#third').show();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
$("#tpa").prop('required', false);
|
||||||
|
$('#tpa_danger').hide();
|
||||||
$(".EB").hide();
|
$(".EB").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -627,10 +627,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isDuplicate) {
|
// if (isDuplicate) {
|
||||||
toastr.warning('This value is already selected in another dropdown.', 'Warning');
|
// toastr.warning('This value is already selected in another dropdown.', 'Warning');
|
||||||
selectElement.value = '';
|
// selectElement.value = '';
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.close').click(function()
|
$('.close').click(function()
|
||||||
|
|||||||
@ -849,9 +849,9 @@
|
|||||||
<?php if (in_array(get_role_id(), [1,2,3,5])) { ?>
|
<?php if (in_array(get_role_id(), [1,2,3,5])) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
|
<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 class="badge badge-success badge-pill float-right">2</span>
|
||||||
<span> App Content Management </span>
|
<span>App Content Mgmt</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="collapse" id="sidebarDashboardsmenu">
|
<div class="collapse" id="sidebarDashboardsmenu">
|
||||||
<ul class="nav-second-level">
|
<ul class="nav-second-level">
|
||||||
@ -865,7 +865,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- End Sidebar -->
|
<!-- End Sidebar -->
|
||||||
|
|||||||
@ -36,6 +36,53 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</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="row" id="leads_form">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -99,6 +146,30 @@
|
|||||||
<!-- client row -->
|
<!-- client row -->
|
||||||
<div class="form-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">
|
<div class="form-group col-md-3 freshFields">
|
||||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="client_type" name="client_type" required>
|
<select class="form-control" id="client_type" name="client_type" required>
|
||||||
@ -139,21 +210,6 @@
|
|||||||
placeholder="Enter Client Short Name" required>
|
placeholder="Enter Client Short Name" required>
|
||||||
</div>
|
</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;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
@ -393,12 +449,18 @@
|
|||||||
}
|
}
|
||||||
$("#source_policy_id").removeAttr("required");
|
$("#source_policy_id").removeAttr("required");
|
||||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
$("#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").removeAttr("required");
|
||||||
$("#source_policy_start_date").closest("div") .find("label .text-danger").remove();
|
$("#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").removeAttr("required");
|
||||||
$("#source_policy_end_date").closest("div") .find("label .text-danger").remove();
|
$("#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_start_date").prop("required", true);
|
||||||
$("#source_policy_end_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
|
// Check if the asterisk doesn't already exist, then add it
|
||||||
let $label = $("#source_policy_id")
|
let $label = $("#source_policy_id").closest("div") .find("label");
|
||||||
.closest("div")
|
|
||||||
.find("label");
|
|
||||||
|
|
||||||
if ($label.find(".text-danger").length === 0) {
|
if ($label.find(".text-danger").length === 0) {
|
||||||
$label.append(' <span class="text-danger">*</span>');
|
$label.append(' <span class="text-danger">*</span>');
|
||||||
}
|
}
|
||||||
let $label2 = $("#source_policy_start_date")
|
|
||||||
.closest("div")
|
let $label2 = $("#source_policy_start_date").closest("div") .find("label");
|
||||||
.find("label");
|
|
||||||
|
|
||||||
if ($label2.find(".text-danger").length === 0) {
|
if ($label2.find(".text-danger").length === 0) {
|
||||||
$label2.append(' <span class="text-danger">*</span>');
|
$label2.append(' <span class="text-danger">*</span>');
|
||||||
}
|
}
|
||||||
let $label3 = $("#source_policy_end_date")
|
let $label3 = $("#source_policy_end_date").closest("div").find("label");
|
||||||
.closest("div")
|
|
||||||
.find("label");
|
|
||||||
|
|
||||||
if ($label3.find(".text-danger").length === 0) {
|
if ($label3.find(".text-danger").length === 0) {
|
||||||
$label3.append(' <span class="text-danger">*</span>');
|
$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, {
|
var policy_end_datePicker = flatpickr("#policy_end_date_" + increment, {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
@ -448,6 +523,12 @@
|
|||||||
document.getElementById('source_policy_end_date').readOnly = true;
|
document.getElementById('source_policy_end_date').readOnly = true;
|
||||||
|
|
||||||
$('#source_policy_start_date, #source_policy_end_date').addClass('readonly-select');
|
$('#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);
|
console.log('increment count for insurer and tpa ', increment);
|
||||||
@ -470,12 +551,17 @@
|
|||||||
$('#tpa_' + increment).select2();
|
$('#tpa_' + increment).select2();
|
||||||
$('#proposed_insurer').select2();
|
$('#proposed_insurer').select2();
|
||||||
$('#proposed_tpa').select2();
|
$('#proposed_tpa').select2();
|
||||||
|
$('#client_id').select2();
|
||||||
|
$('#client_branch_id').select2();
|
||||||
|
$('#source_policy_id').val("");
|
||||||
|
|
||||||
|
console.log('---- completed ----')
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
//------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) ---------------------------------------------------------------------------
|
//------------------------------ 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) {
|
function getLeadsDataForEdit(input) {
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -531,9 +617,9 @@
|
|||||||
$('.lifeClaimFields').show();
|
$('.lifeClaimFields').show();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
updateRenewalFields(dataIncrement);
|
// updateRenewalFields(dataIncrement);
|
||||||
let incurred_claim_date_id = 'incurred_claim_date_' + 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';
|
||||||
|
|
||||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
@ -556,9 +642,9 @@
|
|||||||
console.log('Policy Start Date:', policyStartDate.val());
|
console.log('Policy Start Date:', policyStartDate.val());
|
||||||
|
|
||||||
// Recalculate policy_run_days if policy start date is already selected
|
// Recalculate policy_run_days if policy start date is already selected
|
||||||
if (policyStartDate.val()) {
|
// if (policyStartDate.val()) {
|
||||||
calculatePolicyRunDays(increment);
|
// calculatePolicyRunDays(increment);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -899,10 +985,12 @@
|
|||||||
$('.lifeClaimFields').show();
|
$('.lifeClaimFields').show();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if(lead_type == 1){
|
||||||
updateRenewalFields(dataIncrement);
|
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';
|
||||||
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
var incurred_claim_datepicker = flatpickr("#" + incurred_claim_date_id, {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
@ -924,17 +1012,12 @@
|
|||||||
console.log('Policy Start Date:', policyStartDate.val());
|
console.log('Policy Start Date:', policyStartDate.val());
|
||||||
|
|
||||||
// Recalculate policy_run_days if policy start date is already selected
|
// Recalculate policy_run_days if policy start date is already selected
|
||||||
if (policyStartDate.val()) {
|
// if (policyStartDate.val()) {
|
||||||
calculatePolicyRunDays(increment);
|
// calculatePolicyRunDays(increment);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// var premium_date_datepicker = flatpickr("#" + premium_date_id, {
|
|
||||||
// dateFormat: "d/m/Y",
|
|
||||||
// allowInput: false
|
|
||||||
// });
|
|
||||||
|
|
||||||
$('#proposed_insurer_' + dataIncrement).select2();
|
$('#proposed_insurer_' + dataIncrement).select2();
|
||||||
$('#proposed_tpa_' + dataIncrement).select2();
|
$('#proposed_tpa_' + dataIncrement).select2();
|
||||||
|
|
||||||
@ -1022,7 +1105,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="">Date of Commencement <span class="text-danger"></span></label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
@ -1104,14 +1187,14 @@
|
|||||||
|
|
||||||
$('#source_policy_id').on('change', function() {
|
$('#source_policy_id').on('change', function() {
|
||||||
let client_policy_id = $(this).val();
|
let client_policy_id = $(this).val();
|
||||||
console.log('increment given', increment)
|
console.log('increment given', increment);
|
||||||
getPolicyData(client_policy_id, increment);
|
getPolicyData(client_policy_id, increment);
|
||||||
})
|
})
|
||||||
|
|
||||||
if (check == 1) {
|
if (check == 1) {
|
||||||
let client_policy_id = $('#source_policy_id').val();
|
let client_policy_id = $('#source_policy_id').val();
|
||||||
if (client_policy_id) {
|
if (client_policy_id) {
|
||||||
getPolicyData(client_policy_id, increment)
|
getPolicyData(client_policy_id, increment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,116 +1244,217 @@
|
|||||||
//------------------------ CALCULATION ---------------------------------------------------------------------------------
|
//------------------------ 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();
|
let lead_type = $('#lead_type').val();
|
||||||
var policyStartDate = $("#source_policy_start_date");
|
console.log('Lead Type:', lead_type);
|
||||||
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)
|
let increment = input.id.split('_').pop(); // Extract increment
|
||||||
console.log('incurredClaimDate', incurredClaimDate)
|
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) {
|
if (policyStartDate && incurredClaimDate) {
|
||||||
var timeDiff = Math.abs(policyStartDate - incurredClaimDate); // Time difference in milliseconds
|
let timeDiff = Math.abs(incurredClaimDate - policyStartDate);
|
||||||
console.log('timeDiff', timeDiff);
|
console.log('Time Difference (ms):', timeDiff);
|
||||||
var daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1); // Convert to days and add 1
|
|
||||||
console.log('daysDiff', daysDiff);
|
let daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24) + 1);
|
||||||
$("#policy_run_days_" + increment).val(daysDiff); // Set value in the policy_run_days_ input
|
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;
|
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
|
let policy_run_days = Number($('#policy_run_days').val()) || 0;
|
||||||
$('#incurred_claims_' + increment).val(incurred_claims);
|
console.log('Policy Run Days (Final):', policy_run_days);
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------
|
let annualised_claims = policy_run_days > 0 ? (incurred_claims / policy_run_days) * 365 : 0;
|
||||||
|
|
||||||
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);
|
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)
|
let incurred_claim_ratio = (annualised_claims > 0 && premium_as_on_date > 0)
|
||||||
? (annualised_claims / premium_as_on_date)
|
? (annualised_claims / premium_as_on_date)
|
||||||
: 0;
|
: 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;
|
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);
|
let earned_premium_roundoff = Math.round(earned_premium);
|
||||||
// Set the calculated value with two decimal places
|
console.log('Earned Premium:', earned_premium);
|
||||||
$('#earned_premium_' + increment).val(earned_premium_roundoff);
|
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() {
|
$(document).on("input", "#incept_emp_count, #incept_dept_count, #renewal_emp_count, #renewal_dept_count, #exp_emp_count, #exp_dept_count", function() {
|
||||||
calculateTotalLives(this);
|
calculateTotalLives(this);
|
||||||
});
|
});
|
||||||
@ -1421,6 +1605,83 @@
|
|||||||
removeExtraForms();
|
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) {
|
function insurerChange(input, unique_id) {
|
||||||
@ -1660,6 +1921,8 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#exixting_client').removeAttr('required');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$('.btnDiv').hide();
|
$('.btnDiv').hide();
|
||||||
@ -1680,6 +1943,23 @@
|
|||||||
$("#source_policy_start_date").removeAttr("required");
|
$("#source_policy_start_date").removeAttr("required");
|
||||||
$("#source_policy_end_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');
|
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||||
@ -1732,6 +2012,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateRenewalFields(increment) {
|
function updateRenewalFields(increment) {
|
||||||
|
console.log('updateRenewalFields function called');
|
||||||
$(".renewalCalculation input, .renewalCalculation select").each(function() {
|
$(".renewalCalculation input, .renewalCalculation select").each(function() {
|
||||||
let oldId = $(this).attr("id");
|
let oldId = $(this).attr("id");
|
||||||
if (oldId) {
|
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;
|
color: #16181b !important;
|
||||||
cursor: pointer !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>
|
</style>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -174,7 +242,9 @@ if (isset($selected_lead_type)) {
|
|||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name,
|
text: item.client_name,
|
||||||
'data-cn': item.client_name,
|
'data-cn': item.client_name,
|
||||||
|
'data-csn': item.short_name,
|
||||||
'data-ct': item.client_type,
|
'data-ct': item.client_type,
|
||||||
|
'data-cet': item.entity_type_id,
|
||||||
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : ''
|
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();
|
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') {
|
if (client_id == 'add_client') {
|
||||||
// alert("Hello");
|
// alert("Hello");
|
||||||
@ -583,6 +671,57 @@ if (isset($selected_lead_type)) {
|
|||||||
|
|
||||||
if (lead_type == 1) {
|
if (lead_type == 1) {
|
||||||
$('.claim-row').hide();
|
$('.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 {
|
} else {
|
||||||
$('.claim-row').show();
|
$('.claim-row').show();
|
||||||
if (policy_type_id == 1) {
|
if (policy_type_id == 1) {
|
||||||
@ -593,9 +732,8 @@ if (isset($selected_lead_type)) {
|
|||||||
$('.lifeClaimFields').show();
|
$('.lifeClaimFields').show();
|
||||||
} else {
|
} else {
|
||||||
// updateRenewalFields(dataIncrement);
|
// updateRenewalFields(dataIncrement);
|
||||||
|
// let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
||||||
let incurred_claim_date_id = 'incurred_claim_date_' + dataIncrement;
|
let incurred_claim_date_id = 'incurred_claim_date';
|
||||||
// let premium_date_id = 'premium_date_' + dataIncrement;
|
|
||||||
|
|
||||||
if ($('#' + incurred_claim_date_id).length) {
|
if ($('#' + incurred_claim_date_id).length) {
|
||||||
flatpickr("#" + incurred_claim_date_id, {
|
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.`);
|
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);
|
// console.log($('#proposed_insurer_' + dataIncrement).length);
|
||||||
$('#proposed_insurer_' + dataIncrement).select2();
|
$('#proposed_insurer_' + dataIncrement).select2();
|
||||||
$('#proposed_tpa_' + dataIncrement).select2();
|
$('#proposed_tpa_' + dataIncrement).select2();
|
||||||
@ -780,6 +909,59 @@ if (isset($selected_lead_type)) {
|
|||||||
temp_client_id = data.client_id
|
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');
|
$('#page_title').text('Edit Lead');
|
||||||
$('#leads_primarykey').val(data.id || '');
|
$('#leads_primarykey').val(data.id || '');
|
||||||
|
|||||||
@ -100,6 +100,30 @@
|
|||||||
<!-- client row -->
|
<!-- client row -->
|
||||||
<div class="form-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">
|
<div class="form-group col-md-3 freshFields">
|
||||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="client_type" name="client_type" required>
|
<select class="form-control" id="client_type" name="client_type" required>
|
||||||
@ -140,21 +164,6 @@
|
|||||||
placeholder="Enter Client Short Name" required>
|
placeholder="Enter Client Short Name" required>
|
||||||
</div>
|
</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;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
<label for="source_policy_id"> Source Policy <span id="base_danger"
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
@ -300,7 +309,8 @@
|
|||||||
|
|
||||||
<div id="appendArea"></div>
|
<div id="appendArea"></div>
|
||||||
|
|
||||||
<div id="appendAreaForClaim"></div>
|
<div id="appendAreaForClaim">
|
||||||
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -528,6 +538,9 @@
|
|||||||
console.log('finyearJsonString', finyearJsonString);
|
console.log('finyearJsonString', finyearJsonString);
|
||||||
formData.append('fin_years_claims', 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
|
// Append the JSON string to the FormData object
|
||||||
formData.append('salse_person_id', jsonString);
|
formData.append('salse_person_id', jsonString);
|
||||||
@ -584,11 +597,15 @@
|
|||||||
|
|
||||||
$("#source_policy_id").prop("required",false);
|
$("#source_policy_id").prop("required",false);
|
||||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||||
|
$('#source_policy_id').closest('.form-group').hide();
|
||||||
|
|
||||||
|
|
||||||
} else if (value != 3) {
|
} else if (value != 3) {
|
||||||
$("#source_policy_id").prop("required",true);
|
$("#source_policy_id").prop("required",true);
|
||||||
$("#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
|
// Check if the asterisk doesn't already exist, then add it
|
||||||
let $label = $("#source_policy_id")
|
let $label = $("#source_policy_id")
|
||||||
@ -608,6 +625,49 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
leadTypeBsedHideAndShow(value, true)
|
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) {
|
function leadTypeBsedHideAndShow(value, resetValues = false) {
|
||||||
@ -648,6 +708,8 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#exixting_client').removeAttr('required');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$('.btnDiv').hide();
|
$('.btnDiv').hide();
|
||||||
@ -665,9 +727,10 @@
|
|||||||
|
|
||||||
if (value == 3) {
|
if (value == 3) {
|
||||||
$("#source_policy_id").removeAttr("required");
|
$("#source_policy_id").removeAttr("required");
|
||||||
$("#source_policy_start_date").removeAttr("required");
|
$('#source_policy_id').closest('.form-group').hide();
|
||||||
$("#source_policy_end_date").removeAttr("required");
|
|
||||||
|
|
||||||
|
}else if(value == 2){
|
||||||
|
$('#source_policy_id').closest('.form-group').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
$('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||||
@ -879,9 +942,15 @@
|
|||||||
|
|
||||||
function appendThreeYearsClaims() {
|
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">
|
<div class="form-group col-md-2">
|
||||||
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||||
@ -990,4 +1059,77 @@
|
|||||||
return jsonString;
|
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>
|
</script>
|
||||||
@ -241,10 +241,14 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
||||||
$('#client_branch_id').val(res.branch_id).change();
|
$('#client_branch_id').val(res.branch_id).change();
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
}, 2000)
|
}, 3000)
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
|||||||
@ -744,23 +744,23 @@
|
|||||||
<div class = "row">
|
<div class = "row">
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="building_${increment2}">Building</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="content_${increment2}">Content</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="furniture_${increment2}">Furniture/Office Equipment</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="plantAndMachinery_${increment2}">Plant and Machinery</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="electricalFittings_${increment2}">Electrical Fittings</label>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@ -769,15 +769,15 @@
|
|||||||
<div class = "row">
|
<div class = "row">
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="stockInProcess_${increment2}">Stock In Process</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="rawMaterial_${increment2}">Raw Material</label>
|
<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>
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="finishedStock_${increment2}">Stock</label>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@ -1229,6 +1229,7 @@
|
|||||||
changeTerrorism(Number($("#policySI").val()));
|
changeTerrorism(Number($("#policySI").val()));
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
saveRFQ();
|
||||||
// console.log("Updated policy data in localStorage:", existingData);
|
// 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>
|
</script>
|
||||||
@ -169,11 +169,11 @@
|
|||||||
style="width: 35%;;" type="number" name="self_max_age" id="self_max_age"
|
style="width: 35%;;" type="number" name="self_max_age" id="self_max_age"
|
||||||
onchange="lowerIsEighteen(this)"></div>
|
onchange="lowerIsEighteen(this)"></div>
|
||||||
</td>
|
</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>
|
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||||
<td style="width: 11%;"><input class="self-age" type="checkbox"
|
<td style="width: 11%;"><input class="self-age" type="checkbox"
|
||||||
style="margin-right: 70px;" name="is_payable_employee_for_self"
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -202,11 +202,11 @@
|
|||||||
style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age"
|
style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age"
|
||||||
onchange="lowerIsEighteen(this)"></div>
|
onchange="lowerIsEighteen(this)"></div>
|
||||||
</td>
|
</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>
|
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||||
<td style="width: 11%;"><input class="spouse-age" type="checkbox"
|
<td style="width: 11%;"><input class="spouse-age" type="checkbox"
|
||||||
style="margin-right: 70px;" name="is_payable_employee_for_spouse"
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -241,11 +241,11 @@
|
|||||||
style="width: 35%;;" type="number" name="child_max_age" id="child_max_age"
|
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>
|
oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div>
|
||||||
</td>
|
</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>
|
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
|
||||||
<td style="width: 11%;"><input class="child-age" type="checkbox"
|
<td style="width: 11%;"><input class="child-age" type="checkbox"
|
||||||
style="margin-right: 70px;" name="is_payable_employee_for_child"
|
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>
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -304,12 +304,12 @@
|
|||||||
name="other_member_max_age" id="other_member_max_age"
|
name="other_member_max_age" id="other_member_max_age"
|
||||||
onchange="lowerIsEighteen(this)"></div>
|
onchange="lowerIsEighteen(this)"></div>
|
||||||
</td>
|
</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>
|
style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 11%;"><input class="other-member-age" type="checkbox"
|
<td style="width: 11%;"><input class="other-member-age" type="checkbox"
|
||||||
style="margin-right: 70px;" name="is_payable_employee_for_elders"
|
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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -1373,46 +1373,46 @@
|
|||||||
$('#other_member_max_age').val(jsonObject[key].elders.max);
|
$('#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) {
|
// if (jsonObject[key].self == 0) {
|
||||||
$('#is_payable_employee_for_self').prop('checked',
|
// $('#is_payable_employee_for_self').prop('checked',
|
||||||
false);
|
// false);
|
||||||
} else {
|
// } else {
|
||||||
$('#is_payable_employee_for_self').prop('checked',
|
// $('#is_payable_employee_for_self').prop('checked',
|
||||||
true);
|
// true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (jsonObject[key].spouse == 0) {
|
// if (jsonObject[key].spouse == 0) {
|
||||||
$('#is_payable_employee_for_spouse').prop('checked',
|
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||||
false);
|
// false);
|
||||||
} else {
|
// } else {
|
||||||
$('#is_payable_employee_for_spouse').prop('checked',
|
// $('#is_payable_employee_for_spouse').prop('checked',
|
||||||
true);
|
// true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (jsonObject[key].childern == 0) {
|
// if (jsonObject[key].childern == 0) {
|
||||||
$('#is_payable_employee_for_child').prop('checked',
|
// $('#is_payable_employee_for_child').prop('checked',
|
||||||
false);
|
// false);
|
||||||
} else {
|
// } else {
|
||||||
$('#is_payable_employee_for_child').prop('checked',
|
// $('#is_payable_employee_for_child').prop('checked',
|
||||||
true);
|
// true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (jsonObject[key].elders == 0) {
|
// // if (jsonObject[key].elders == 0) {
|
||||||
$('#is_payable_employee_for_elders').prop('checked',
|
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||||
false);
|
// // false);
|
||||||
} else {
|
// // } else {
|
||||||
$('#is_payable_employee_for_elders').prop('checked',
|
// // $('#is_payable_employee_for_elders').prop('checked',
|
||||||
true);
|
// // true);
|
||||||
}
|
// // }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (key.includes("enrollment_display_key") && key != "") {
|
if (key.includes("enrollment_display_key") && key != "") {
|
||||||
|
|
||||||
|
|||||||
@ -108,6 +108,7 @@
|
|||||||
onchange="addGridHTML(this)" required>
|
onchange="addGridHTML(this)" required>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" id="hidden_unit" />
|
||||||
|
|
||||||
<div class="form-group col-md-6"
|
<div class="form-group col-md-6"
|
||||||
style="position: relative; left: 45px; display:none" id="premium_type">
|
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', res.premiumData)
|
||||||
// console.log('rack rate responce.premium data parsed', JSON.parse(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 data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
|
||||||
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
|
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
|
||||||
rarc_rate_json_array.push(res.jsonArray);
|
rarc_rate_json_array.push(res.jsonArray);
|
||||||
@ -673,8 +682,12 @@ $('#grid').change(function()
|
|||||||
|
|
||||||
if(unit_length == 1 || unit_length == 0){
|
if(unit_length == 1 || unit_length == 0){
|
||||||
|
|
||||||
|
// $('.unitDiv').hide();
|
||||||
|
// $('.unitDiv').find('input').removeAttr('required');
|
||||||
|
setTimeout(() => {
|
||||||
$('.unitDiv').hide();
|
$('.unitDiv').hide();
|
||||||
$('.unitDiv').find('input').removeAttr('required');
|
$('.unitDiv input').removeAttr('required');
|
||||||
|
}, 1000); // Run after DOM updates
|
||||||
}else{
|
}else{
|
||||||
$('.unitDiv').show();
|
$('.unitDiv').show();
|
||||||
$('.unitDiv').find('input').attr('required', true);
|
$('.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 id_var = 'grid_';
|
||||||
|
|
||||||
|
var default_unit = $('#hidden_unit').val();
|
||||||
|
|
||||||
|
|
||||||
var dataIdValue = ''
|
var dataIdValue = ''
|
||||||
if (event === false) {
|
if (event === false) {
|
||||||
var dataIdValue = ui_type
|
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 id="si_or_bp_sum_insure" class="form-row">
|
||||||
|
|
||||||
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
|
<div class="form-row col-md-4" style="margin-left: 381px; margin-top: -114px;">
|
||||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
<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>
|
<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>
|
||||||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||||||
<div class="form-group col-md-3 unitDiv">
|
<div class="form-group col-md-3 unitDiv">
|
||||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
<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>
|
||||||
<div class="form-group col-md-3" id="">
|
<div class="form-group col-md-3" id="">
|
||||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
<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){
|
if(unit_length == 1 || unit_length == 0){
|
||||||
|
// alert("Hello World");
|
||||||
|
// $('.unitDiv').hide();
|
||||||
|
// $('.unitDiv').find('input').removeAttr('required');
|
||||||
|
setTimeout(() => {
|
||||||
$('.unitDiv').hide();
|
$('.unitDiv').hide();
|
||||||
$('.unitDiv').find('input').removeAttr('required');
|
$('.unitDiv input').removeAttr('required');
|
||||||
|
}, 1000); // Run after DOM updates
|
||||||
}else{
|
}else{
|
||||||
$('.unitDiv').show();
|
$('.unitDiv').show();
|
||||||
$('.unitDiv').find('input').attr('required', true);
|
$('.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}">
|
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||||||
<div class="form-group col-md-3 unitDiv">
|
<div class="form-group col-md-3 unitDiv">
|
||||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
<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>
|
||||||
<div class="form-group col-md-3" id="">
|
<div class="form-group col-md-3" id="">
|
||||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
<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++
|
// Count++
|
||||||
|
|
||||||
if(unit_length == 1 || unit_length == 0){
|
if(unit_length == 1 || unit_length == 0){
|
||||||
|
// $('.unitDiv').hide();
|
||||||
|
// $('.unitDiv').find('input').removeAttr('required');
|
||||||
|
setTimeout(() => {
|
||||||
$('.unitDiv').hide();
|
$('.unitDiv').hide();
|
||||||
$('.unitDiv').find('input').removeAttr('required');
|
$('.unitDiv input').removeAttr('required');
|
||||||
|
}, 1000); // Run after DOM updates
|
||||||
}else{
|
}else{
|
||||||
$('.unitDiv').show();
|
$('.unitDiv').show();
|
||||||
$('.unitDiv').find('input').attr('required', true);
|
$('.unitDiv').find('input').attr('required', true);
|
||||||
@ -2770,7 +2795,7 @@ function si_orbp_change_function()
|
|||||||
$('#gpa_sum_multiplier').attr('required', true);
|
$('#gpa_sum_multiplier').attr('required', true);
|
||||||
$('#gpa_sum_si').attr('required', true);
|
$('#gpa_sum_si').attr('required', true);
|
||||||
$('#gpa_sum_premium').attr('required', true);
|
$('#gpa_sum_premium').attr('required', true);
|
||||||
$('#gpa_unit1').attr('required', true);
|
$('#gpa_unit1').attr('required', false);
|
||||||
|
|
||||||
var gridContentInput = $('#grid_content_input');
|
var gridContentInput = $('#grid_content_input');
|
||||||
|
|
||||||
@ -3936,8 +3961,12 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
|||||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||||
|
|
||||||
if(unit_length == 1 || unit_length == 0){
|
if(unit_length == 1 || unit_length == 0){
|
||||||
|
// $('.unitDiv').hide();
|
||||||
|
// $('.unitDiv').find('input').removeAttr('required');
|
||||||
|
setTimeout(() => {
|
||||||
$('.unitDiv').hide();
|
$('.unitDiv').hide();
|
||||||
$('.unitDiv').find('input').removeAttr('required');
|
$('.unitDiv input').removeAttr('required');
|
||||||
|
}, 1000); // Run after DOM updates
|
||||||
}else{
|
}else{
|
||||||
$('.unitDiv').show();
|
$('.unitDiv').show();
|
||||||
$('.unitDiv').find('input').attr('required', true);
|
$('.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_no" id="cd_ac_no">
|
||||||
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
|
<input type="hidden" name="cd_ac_pk" id="cd_ac_pk">
|
||||||
<input type="hidden" name="ct_type" id="ct_type">
|
<input type="hidden" name="ct_type" id="ct_type">
|
||||||
<input type="hidden" name="" id="bro_payable_by">
|
<input type="hidden" name="bro_payable_by" id="bro_payable_by">
|
||||||
<input type="hidden" name="" id="cop_yes">
|
<input type="hidden" name="cop_yes" id="cop_yes">
|
||||||
|
|
||||||
|
|
||||||
<!-- Client Row -->
|
<!-- Client Row -->
|
||||||
@ -560,7 +560,10 @@ $(document).ready(function(){
|
|||||||
if(policyListByClient != '') {
|
if(policyListByClient != '') {
|
||||||
// console.log(branch_list[client_id]);
|
// console.log(branch_list[client_id]);
|
||||||
let data = policyListByClient[client_id];
|
let data = policyListByClient[client_id];
|
||||||
|
if (data) {
|
||||||
appendPolicies(data);
|
appendPolicies(data);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@ -445,10 +445,11 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var client_list = ''; // local variable for storing the client branch list
|
var client_list = '';
|
||||||
var branch_list = ''; // local variable for storing the client branch list
|
var branch_list = '';
|
||||||
var policy_list = ''; // local variable for storing the client policy list
|
var policy_list = <?= json_encode($endorsementPolicies) ?>;
|
||||||
var policyListByClient = ''; // local variable for storing the client policy list
|
// console.log("POLICY List",policy_list);
|
||||||
|
var policyListByClient = <?= json_encode($endorsementPolicyListByClient) ?>;
|
||||||
var branch_policy = '';
|
var branch_policy = '';
|
||||||
var unit_list = '';
|
var unit_list = '';
|
||||||
|
|
||||||
@ -607,8 +608,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
if(res.status == true){
|
if(res.status == true){
|
||||||
branch_list = res.branch_data;
|
branch_list = res.branch_data;
|
||||||
policy_list = res.policy_data;
|
// policy_list = res.policy_data;
|
||||||
policyListByClient = res.policyListByClient;
|
// policyListByClient = res.policyListByClient;
|
||||||
client_list = res.client_data;
|
client_list = res.client_data;
|
||||||
unit_list = res.unit_data;
|
unit_list = res.unit_data;
|
||||||
appendClients(res.client_data);
|
appendClients(res.client_data);
|
||||||
@ -674,6 +675,10 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
function appendPolicies(data)
|
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', data);
|
||||||
console.log('appendPolicies', $('#client_policy_id'));
|
console.log('appendPolicies', $('#client_policy_id'));
|
||||||
|
|
||||||
|
|||||||
@ -1675,11 +1675,12 @@ function getPolicyTransactionDataForEdit(input) {
|
|||||||
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
$('#is_cd_reduce_from_bds').prop('disabled',false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
// 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();
|
$('#hide_file_upload').show();
|
||||||
}else{
|
|
||||||
$('#hide_file_upload').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res.data.master_policy_type_id) {
|
if (res.data.master_policy_type_id) {
|
||||||
$('#policy_type_id').val(res.data.master_policy_type_id).change();
|
$('#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);
|
$('#policy_tranction_primarykey_for_file_upload').val(res.pt_id);
|
||||||
$('#client_policy_id_for_file_upload').val(res.data.client_policy_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){
|
//if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
|
||||||
$('#hide_file_upload').show();
|
// $('#hide_file_upload').show();
|
||||||
}else{
|
//}else{
|
||||||
$('#hide_file_upload').hide();
|
// $('#hide_file_upload').hide();
|
||||||
}
|
//}
|
||||||
|
|
||||||
$('#client_id_for_vehicle_file_upload').val(res.data.client_id);
|
$('#client_id_for_vehicle_file_upload').val(res.data.client_id);
|
||||||
$('#vehicle_id_for_file_upload').val(res.data.vehicle_id);
|
$('#vehicle_id_for_file_upload').val(res.data.vehicle_id);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,13 @@
|
|||||||
<?php if(isset($lead_edit_data)) {
|
<?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' => ''] ];
|
$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' => ''] ];
|
||||||
|
?>
|
||||||
|
<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) { ?>
|
foreach ($claims as $key => $value) { ?>
|
||||||
|
|
||||||
<div class="row claim-row">
|
<div class="row claim-row">
|
||||||
@ -51,5 +59,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -1,4 +1,6 @@
|
|||||||
<?php $increment = isset($lead_edit_data) ? "_1" : ''; ?>
|
|
||||||
|
|
||||||
|
<?php $increment = isset($lead_edit_data) ? "" : ''; ?>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="form-row renewalCalculation">
|
<div class="form-row renewalCalculation">
|
||||||
@ -6,71 +8,87 @@
|
|||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<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>
|
<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 ?>"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="paid_claims">Paid Claims<span class="text-danger">*</span></label>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="outstanding_claims">Outstanding Claims<span class="text-danger">*</span></label>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="incurred_claims">Incurred Claim<span class="text-danger">*</span></label>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<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>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="premium_at_inception">Premium Paid at Inception<span
|
<label for="premium_at_inception">Premium Paid at Inception<span
|
||||||
class="text-danger">*</span></label>
|
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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<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>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="earned_premium">Earned Premium<span class="text-danger">*</span></label>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="annualised_claims">Annualised Claims<span class="text-danger">*</span></label>
|
<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[]"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<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>
|
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 ?>"
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<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[]"
|
<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>
|
||||||
|
|
||||||
|
<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;">
|
<!-- <div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="location">Location <span class="text-danger">*</span></label>
|
<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">
|
<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">
|
<div class="form-group col-md-3">
|
||||||
<label for="incept_emp_count" class="emp_title"> No of Employees at Inception <span
|
<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[]"
|
<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)">
|
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="incept_dept_count" class="depnd_title"> No of Dependents at Inception <span
|
<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[]"
|
<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)">
|
placeholder="Enter Lives" required oninput="calculateTotalLives(this)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="incept_no_of_lives" class="total_title"> Total Lives at Inception <span
|
<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[]"
|
<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>
|
placeholder="Enter Lives" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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-row">
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="renewal_emp_count"> No of Employees at Renewal <span
|
<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[]"
|
<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">
|
placeholder="Enter Lives">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="renewal_dept_count"> No of Dependents at Renewal <span
|
<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[]"
|
<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">
|
placeholder="Enter Lives">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||||
<label for="renewal_no_of_lives"> Total Lives at Renewal <span
|
<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[]"
|
<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">
|
placeholder="Enter Lives">
|
||||||
</div>
|
</div>
|
||||||
@ -162,25 +203,3 @@
|
|||||||
|
|
||||||
</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>
|
|
||||||
@ -102,7 +102,7 @@
|
|||||||
name="policy_no" placeholder="Policy Number">
|
name="policy_no" placeholder="Policy Number">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<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"
|
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
||||||
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
||||||
name="tpa_no">
|
name="tpa_no">
|
||||||
@ -145,7 +145,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Policy <span class="text-danger">*</span></label>
|
<label>Policy <span class="text-danger">*</span></label>
|
||||||
<select id="emp_client_policy" name="client_policy_id"
|
<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'])) { ?>
|
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||||
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -156,7 +156,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<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=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>
|
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
|
||||||
</div>
|
</div>
|
||||||
@ -1048,7 +1048,11 @@
|
|||||||
if (ticket_type == 1 && item.policy_type_id != 1) {
|
if (ticket_type == 1 && item.policy_type_id != 1) {
|
||||||
$('#emp_client_policy').append($('<option>', {
|
$('#emp_client_policy').append($('<option>', {
|
||||||
value: item.client_policy_value,
|
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("");
|
$("#policy_no").val("");
|
||||||
if (policyCount == 1) {
|
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>
|
||||||
<script>
|
<script>
|
||||||
$("#infoIcon").click(function() {
|
$("#infoIcon").click(function() {
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Policy <span class="text-danger">*</span></label>
|
<label>Policy <span class="text-danger">*</span></label>
|
||||||
<select id="emp_client_policy" name="client_policy_id"
|
<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'":'' ?>
|
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
|
||||||
>
|
>
|
||||||
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
<?php if (!empty($ticket_data['client_policy_id'])) { ?>
|
||||||
@ -705,7 +705,11 @@
|
|||||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||||
$('#emp_client_policy').append($('<option>', {
|
$('#emp_client_policy').append($('<option>', {
|
||||||
value: item.client_policy_value,
|
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","");
|
console.log("policy count from loop","");
|
||||||
$("#policy_no").val("");
|
$("#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) {
|
// function setMinDateDOA(policy_id) {
|
||||||
// console.log("Function set min date called ");
|
// console.log("Function set min date called ");
|
||||||
// console.log("Existing DOA instance: ", doa);
|
// 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 == ''){
|
// if (response.data.emp_id == null || response.data.emp_id == ''){
|
||||||
unSetClientPolicy();
|
unSetClientPolicy();
|
||||||
// }
|
// }
|
||||||
setClientAndInsurerData(response.data);
|
setClientAndInsurerData(response.data, true);
|
||||||
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
|
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
|
||||||
appendACMS(response.acms)
|
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_id').val(data.insurer_id);
|
||||||
$('#insurer_name').val(data.insurer_name);
|
$('#insurer_name').val(data.insurer_name);
|
||||||
$('#tpa_id').val(data.tpa_id);
|
$('#tpa_id').val(data.tpa_id);
|
||||||
$('#tpa_name').val(data.tpa_name);
|
$('#tpa_name').val(data.tpa_name);
|
||||||
|
}
|
||||||
|
|
||||||
$('#client_id').val(data.client_id);
|
$('#client_id').val(data.client_id);
|
||||||
$('#client_name').val(data.client_name);
|
$('#client_name').val(data.client_name);
|
||||||
|
|
||||||
|
|||||||
@ -2560,6 +2560,15 @@ function popInsurerInArray(proposal_name, insurerName) {
|
|||||||
|
|
||||||
function changeInsurer(event) {
|
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:");
|
// let newInsurerName = prompt("Enter New insurer name:");
|
||||||
const insurers = <?= json_encode($insurer); ?>;
|
const insurers = <?= json_encode($insurer); ?>;
|
||||||
@ -2577,6 +2586,43 @@ function changeInsurer(event) {
|
|||||||
console.log('newInsurerName', newInsurerName)
|
console.log('newInsurerName', newInsurerName)
|
||||||
console.log('newversion', newversion)
|
console.log('newversion', newversion)
|
||||||
|
|
||||||
|
const closestTh = event.target.closest('th');
|
||||||
|
let oldInsurerName = closestTh.innerText.split('⋮')[0].trim();
|
||||||
|
console.log(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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
changeInsurerData(event, newInsurerName)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeInsurerData(event, newInsurerName, dataId){
|
||||||
|
|
||||||
if (newInsurerName) {
|
if (newInsurerName) {
|
||||||
|
|
||||||
const closestTh = event.target.closest('th');
|
const closestTh = event.target.closest('th');
|
||||||
@ -2644,10 +2690,60 @@ function changeInsurer(event) {
|
|||||||
console.log('insurer name not replaced in golbal variable');
|
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) {
|
function changeState(event) {
|
||||||
|
|
||||||
console.log('changeState Function called')
|
console.log('changeState Function called')
|
||||||
|
|||||||
@ -2408,6 +2408,11 @@
|
|||||||
// alert(policy.quote_asked[0]);
|
// alert(policy.quote_asked[0]);
|
||||||
// var policySI = policies[]
|
// var policySI = policies[]
|
||||||
policySI = rfq_count == 0 && !tdChanged ? policy.quote_asked[0] : (changedNewSI) != "" && changedNewSI != 0? changedNewSI : policy.quote_asked[0];
|
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);
|
console.log("policy si",policySI,"rfq ount ",rfq_count,"tdchanged ",tdChanged,"changedNewSI",changedNewSI);
|
||||||
$("#policyName").val(policyName);
|
$("#policyName").val(policyName);
|
||||||
$("#policySI").val(policySI);
|
$("#policySI").val(policySI);
|
||||||
|
|||||||
@ -10,9 +10,9 @@ class ExcelMergeHelperTest extends TestCase
|
|||||||
{
|
{
|
||||||
// Use the paths you provided
|
// Use the paths you provided
|
||||||
$filePaths = [
|
$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' => []],
|
// ['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