FIX_MERGE_CONFLICT_FOR THE RACK_RATE_FLOW_CHANGE_AND_OTHERS : RV

This commit is contained in:
VENKATESHWARAN 2024-07-23 11:44:29 +05:30
commit b20ff8662f
16 changed files with 1706 additions and 1350 deletions

View File

@ -28,17 +28,17 @@ class Email extends BaseConfig
/** /**
* SMTP Server Hostname * SMTP Server Hostname
*/ */
public string $SMTPHost = 'mail.venbait.in'; public string $SMTPHost = 'smtp.gmail.com';
/** /**
* SMTP Username * SMTP Username
*/ */
public string $SMTPUser = 'bbone@venbait.in'; public string $SMTPUser = 'venbatechnologies@gmail.com';
/** /**
* SMTP Password * SMTP Password
*/ */
public string $SMTPPass = 'xk!L(N_-R#};'; public string $SMTPPass = 'dsfllmxdzxxkcxgz';
/** /**
* SMTP Port * SMTP Port

View File

@ -138,6 +138,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->post("upload", "EmployeeController::employeesUplodWithEvents"); $routes->post("upload", "EmployeeController::employeesUplodWithEvents");
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1"); $routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
$routes->get("endorsement-list", "EmployeeController::endorsementList"); $routes->get("endorsement-list", "EmployeeController::endorsementList");
$routes->get("enrollment-list", "EmployeeController::enrollmentClientList");
$routes->get("empby_client_clientbranch/(:any)/(:any)", "EmployeeController::empby_client_clientbranch/$1/$2");
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1"); $routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
}); });
@ -275,6 +277,8 @@ $routes->get("processjob", "JobWorker::processJob");
//Employee login api's //Employee login api's
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); $routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
//HR login api's //HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
@ -286,10 +290,12 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->get("getChatResponse", "ChatBotController::getChatResponse"); $routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->get("getChatResponse", "ChatBotController::getChatResponse"); $routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile"); $routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
@ -321,6 +327,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage"); $routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
}); });
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");

View File

@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "push-notification-enrollment",
"private_key_id": "979d0fcd0ce95d31367f3150d34ee0044ca51b0d",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4Xsan6ESIzM12\nG15gRU361Yy6PVmoMzTToWtZHPEcDRd9weFNlCXjmX+WAqdgD/hQ42GcZQVCndse\nEQGJHbRu/ifMKGo53zxOpshNZnCSxojAGWIGrIHFE5kFumiKz9drW9vPWsFLtgx0\nEAW0T7su1MejjH33GftHG8k/q3uyWoU0+OFRD6emhYkFdVsucwR27hE7GsFwE+CF\nnRdSWQ5mu2e8J7q9Qbpgot5d7uk7iJgpiyNdChPvqUZ7XeknVrw1F4REZlbAkVjb\nFuwKg5qtG97LZ1NkyYqFmssA1rNkqSi4+T+2/ERegdwyA6W4/HLT9fPbSl4v1MvB\ntJlGYkMpAgMBAAECggEABhspdCUmo+s4gMleQkz5TK3m58IhZocvoDSv4/cn6xhp\n50HVDucxrAyI47R5y54ryK4HLRFRb8ffmmrQxLRFpgln0wShpAIHMsmmR531a38E\nx2vvya3L7HV+M2jdjn9csJMNwBvO3A2O8wcW0UZ0uhPU+s8r2tOy9UNv0lqBEcKM\nUxCtk7UxcLEM3btDP5I4oEHVo2f5jzPeb99KHbYQV/vc0BtA1wtuYTzGT2EhBpTG\nN1rbQhlj6iJ6vMwHETWrctNMohCQNQEv/QIC/NWYPNRqmtrJfNe29XGWN9IIhv0e\n/ZmhdzoO+uhJW4VaWpI93nB5ZAa6LHqJSg+OyrPoawKBgQDd45Aiq7d+4Z+kDZYu\n72bgW5CGhyck2hrqHpBdHA960AYIftw/wHgI9xb9Z8hi+Lh+W18xDywOLoaz7TJV\nElj2Gh3oj2ZLzDpeyqV9UOgz11dbm6yYUK8jl7zyajBt7RhGcdj+4x+YjUTT6O61\nuxm2ZbKsb/0er/W6DlKDVvpWSwKBgQDUtqowATEaGTrd+eutanRwtv+rdptVcadj\nD4H3XdY4PAsVSp1mT9knGgh7c5elI0lBH/VD/IbM5uPXOc7judnIK4RgKScrJT2P\nekyEJnXyFAZGS3WTFG7fzeXn/cNNx5MCZE2Yay7LqqON8Kg08IvvesiTushrDlMJ\nX8cunSyz2wKBgDIOwZigxq/QNNSs4AHMrpfU8GD5IqKUtde1d3oZ94AMaCAIhqW3\nRR04qS4X+MQjOnP/JxWJR7YXVvpGe8FndzxmHfM2Tqyw8UYrT3RbCVeQsDuRfjmK\nkkhkVhMWU8Co6X4S9xJhqOIglLN97ESBZkaY4Ns4FJGUvsnvqzvIJofLAoGBAKJO\ny2eb0TK/46ozJEELxNOo30efVgGJmpa844e0A1yffDl/2MCT1ve+JpDEcAbi+OeH\nkieRTe6Vk27LvnEHhAT4J6cUX73NSb7sK+x+SGsyGmOS+qEC62M8gdxWRqtXyHX/\nwTG3P1rK1sfcxQy4K57NSrVmxbzijjvN6HdKGS0XAoGATtsid5pypcZ0BsYUp/27\neS6z++ewo7QCVCBPa4Ag4nX56/0kdrECvy/ISMDjggNv+mR8hpyCjfm9ztJ88njB\nUBu1jzLBZ+u5gEjmtu43qvuDJNobyb+evDSReEJmify943vFZqnkIhFlwg1PcS6S\nCd+pr559KWURPIgfxb7S/JU=\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-gzzkw@push-notification-enrollment.iam.gserviceaccount.com",
"client_id": "109128197176743587316",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-gzzkw%40push-notification-enrollment.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}

View File

@ -4129,6 +4129,7 @@ class EmpDataServiceController extends BaseController
public function sendMailForDownloadingECard(array $ids) public function sendMailForDownloadingECard(array $ids)
{ {
$this->myLogger->logme('error', 'sendMailForDownloadingECard - function called'); $this->myLogger->logme('error', 'sendMailForDownloadingECard - function called');
if (count($ids) > 0) { if (count($ids) > 0) {
@ -4184,13 +4185,14 @@ class EmpDataServiceController extends BaseController
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details; $params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
// $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',); // $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') { if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] == 'Self') {
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params); $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
// print_r($wholeData);die;
$count++; $count++;
} }
$counts++;
$counts++;
if ($count == 20 || $counts == count($ids) - 1) { if ($count == 20 || $counts == count($ids) - 1) {
if(count($wholeData) > 0){ if(count($wholeData) > 0){

View File

@ -721,14 +721,14 @@ class EmployeeController extends AdminController
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB // client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
public function initiateManualEmployeesOnboardProcess($client_policy_id) public function initiateManualEmployeesOnboardProcess($client_policy_id)
{ {
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name') $client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name,client_branch_id')
->join('clients', 'clients.id = client_policy.client_id') ->join('clients', 'clients.id = client_policy.client_id')
->join('policies', 'policies.id = client_policy.policy_id') ->join('policies', 'policies.id = client_policy.policy_id')
->where('client_policy.id', $client_policy_id) ->where('client_policy.id', $client_policy_id)
->first(); ->first();
$empServiceController = new EmployeeServiceController(); $empServiceController = new EmployeeServiceController();
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id]); $res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
// dd($res); // dd($res);
$count = count($res); $count = count($res);
@ -964,7 +964,7 @@ class EmployeeController extends AdminController
// Step 1: Attempt to fetch employee code and client policy ID // Step 1: Attempt to fetch employee code and client policy ID
$this->myLogger->logme('error', 'Fetching employee code and client policy ID.'); $this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
$get_emp_code_and_client_policy_id = $this->employeePolicyModel $get_emp_code_and_client_policy_id = $this->employeePolicyModel
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name') ->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('employees', 'employees.id = employee_polices.employee_id') ->join('employees', 'employees.id = employee_polices.employee_id')
->join('tpa', 'tpa.id = client_policy.tpa_id') ->join('tpa', 'tpa.id = client_policy.tpa_id')
@ -986,14 +986,15 @@ class EmployeeController extends AdminController
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id']; $client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
$emp_code = $get_emp_code_and_client_policy_id['emp_code']; $emp_code = $get_emp_code_and_client_policy_id['emp_code'];
$client_id = $get_emp_code_and_client_policy_id['client_id'];
// Step 2: Fetch ECard data // Step 2: Fetch ECard data
$this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code); $this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code); $data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
if ($people == 0) { if ($people == 0) {
$this->myLogger->logme('error', 'Fetching single ECard data using rand_string: ' . $rand_string . ' and emp_code: ' . $emp_code); $this->myLogger->logme('error', 'Fetching single ECard data using rand_string: ' . $rand_string . ' and emp_code: ' . $emp_code);
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code); $data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
} }
// Step 3: Prepare template path // Step 3: Prepare template path

View File

@ -42,6 +42,11 @@ use Illuminate\Http\Request;
use App\Controllers\EmployeeServiceController; use App\Controllers\EmployeeServiceController;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;
use Kreait\Firebase\Exception\MessagingException;
class EmployeeRestController extends AdminController class EmployeeRestController extends AdminController
{ {
@ -632,6 +637,7 @@ class EmployeeRestController extends AdminController
$policy_id = $this->request->getPost('policy_id'); $policy_id = $this->request->getPost('policy_id');
$client_data = $this->clientModel->where('id', $client_id)->first(); $client_data = $this->clientModel->where('id', $client_id)->first();
$notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
$jwt = $this->request->getHeader('Authorization'); $jwt = $this->request->getHeader('Authorization');
@ -661,7 +667,6 @@ class EmployeeRestController extends AdminController
$empServiceController = new EmployeeServiceController(); $empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]); $result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
if(isset($result['error_summary']) && count($result['error_summary'])) if(isset($result['error_summary']) && count($result['error_summary']))
{ {
$result = $empServiceController->getExcelErrorData($file_id); $result = $empServiceController->getExcelErrorData($file_id);
@ -743,13 +748,13 @@ class EmployeeRestController extends AdminController
$basic_cover_si= []; $basic_cover_si= [];
foreach ($extra['0'] as $index => $id) { foreach ($extra['0'] as $index => $id) {
$relation =''; $relation ='';
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') { if (strtolower(trim($extra['5'][$index])) === 'mother' || strtolower(trim($extra['5'][$index])) === 'father') {
$relation = 'parent'; $relation = 'parent';
} else if($extra['5'][$index] === 'Son' || $extra['5'][$index] === 'Daughter'){ } else if(strtolower(trim($extra['5'][$index])) === 'son' || strtolower(trim($extra['5'][$index])) === 'daughter'){
$relation = 'child'; $relation = 'child';
}else if($extra['5'][$index] === 'Father in Law' || $extra['5'][$index] === 'Mother in Law'){ }else if(strtolower(trim($extra['5'][$index])) === 'father in law' || strtolower(trim($extra['5'][$index])) === 'mother in law'){
$relation = 'parent_in_law'; $relation = 'parent_in_law';
}else if($extra['5'][$index] === 'Spouse'){ }else if(strtolower(trim($extra['5'][$index])) === 'spouse'){
$relation = 'spouse'; $relation = 'spouse';
}else{ }else{
$relation = 'self'; $relation = 'self';
@ -778,7 +783,7 @@ class EmployeeRestController extends AdminController
// Check if the 'doj' key exists before accessing it // Check if the 'doj' key exists before accessing it
'doj' => $doj_new_format, 'doj' => $doj_new_format,
'gender' => $extra['4'][$index], 'gender' => $extra['4'][$index],
'relationship' => ucfirst($extra['5'][$index]), 'relationship' => ucfirst(trim($extra['5'][$index])),
'family_floater_key' => $relation, 'family_floater_key' => $relation,
'dob' => $dob_new_format, 'dob' => $dob_new_format,
'email_corporate' => $extra['7'][$index], 'email_corporate' => $extra['7'][$index],
@ -786,6 +791,8 @@ class EmployeeRestController extends AdminController
'client_id' => $client_id, 'client_id' => $client_id,
'emp_status'=>'draft', 'emp_status'=>'draft',
'band'=> $extra['10'][$index], 'band'=> $extra['10'][$index],
'basic_pay'=> $extra['11'][$index],
'unit'=> $extra['12'][$index],
'client_branch_id' => $client_branch_id 'client_branch_id' => $client_branch_id
]; ];
@ -888,10 +895,10 @@ class EmployeeRestController extends AdminController
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data); $emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
} }
$notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first(); if (isset($notification) && $notification['enabled'] == 1 && !empty($notification['mail_content'])) {
if (isset($notification) && $notification['enabled'] == 1) {
//trigger //trigger
$wholeData=[];
if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) { if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) {
$params['dataToInsert'] = $dataToInsert[$a]; $params['dataToInsert'] = $dataToInsert[$a];
@ -929,9 +936,9 @@ class EmployeeRestController extends AdminController
} }
//------------------------------------- //-------------------------------------
public function getAgeRange($terms,$familyFloatesValue) public function getAgeRange($terms,$familyFloatesValue)
{ {
$ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ]; $ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ];
@ -943,10 +950,10 @@ public function getAgeRange($terms,$familyFloatesValue)
} }
} }
public function getEmployeePolicy() public function getEmployeePolicy()
{ {
// try { // try {
$id = $this->request->getGet('id'); $id = $this->request->getGet('id');
@ -1160,11 +1167,11 @@ public function getEmployeePolicy()
// } catch (\Exception $e) { // } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); // return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
// } // }
} }
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id) public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id)
{ {
$employeeData = $this->employeeModel->where('emp_code',$emp_code) $employeeData = $this->employeeModel->where('emp_code',$emp_code)
->where('client_id',$client_id) ->where('client_id',$client_id)
@ -1317,9 +1324,9 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
} }
} }
public function FloterConvertion($array){ public function FloterConvertion($array){
$result = []; $result = [];
@ -1349,9 +1356,9 @@ public function FloterConvertion($array){
} }
return $result; return $result;
} }
public function FloterNotesConvertion($array){ public function FloterNotesConvertion($array){
$result = ' '; $result = ' ';
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
@ -1375,10 +1382,10 @@ public function FloterNotesConvertion($array){
} }
return $result; return $result;
} }
public function getClientDetails() public function getClientDetails()
{ {
try { try {
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first(); $client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
@ -1394,10 +1401,10 @@ public function getClientDetails()
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
} }
} }
public function getAddOnPolicy() public function getAddOnPolicy()
{ {
try { try {
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 ) $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )
@ -1749,14 +1756,14 @@ public function getAddOnPolicy()
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
} }
} }
public function iAgreeForAddOn()
{
public function iAgreeForAddOn()
{
$postData = json_decode($this->request->getBody(), true); $postData = json_decode($this->request->getBody(), true);
$client_policy_id = $postData['client_policy_id']; $client_policy_id = $postData['client_policy_id'];
sort($client_policy_id);
// Alternatively, you can use echo to see the type
$emp_code = $postData['emp_code']; $emp_code = $postData['emp_code'];
$client_id = $postData['client_id']; $client_id = $postData['client_id'];
@ -1766,18 +1773,27 @@ public function iAgreeForAddOn()
->set(array('emp_status'=>'enrolled')) ->set(array('emp_status'=>'enrolled'))
->update(); ->update();
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
if (!is_null($client_policy_id) && is_array($client_policy_id)) if (!is_null($client_policy_id) && is_array($client_policy_id))
{ {
$array_list = []; $array_list = [];
foreach ($client_policy_id as $key => $value) foreach ($client_policy_id as $key => $value)
{
foreach ($empData as $empDataKey => $empDataValue)
{ {
$this->employeePolicyModel->where('client_policy_id', $value ) $this->employeePolicyModel->where('client_policy_id', $value )
->where('is_active', 1 ) ->where('is_active', 1 )
->where('employee_id', $empDataValue['id'] )
->set(array('status'=>'enrolled')) ->set(array('status'=>'enrolled'))
->update(); ->update();
}
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']); $find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
if(count($find) > 0){
$array_list[] = $find; $array_list[] = $find;
} }
}
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first(); $notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
@ -1788,22 +1804,25 @@ public function iAgreeForAddOn()
$params ['emp_code'] = $emp_code; $params ['emp_code'] = $emp_code;
$params ['client_id'] = $client_id; $params ['client_id'] = $client_id;
$params ['notification'] = $notification; $params ['notification'] = $notification;
// print_r($params);die;
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params); $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
MailHelper::send_email($wholeData[0]); $mail_send_return = MailHelper::send_email($wholeData[0]);
$this->myLogger->logme("info", $mail_send_return);
if (isset($wholeData[0])) { if (isset($wholeData[0])) {
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params); $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
foreach ($account_manager_wholeData as $key => $value) { foreach ($account_manager_wholeData as $key => $value) {
MailHelper::send_email($value); $mail_send_return1 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return1);
} }
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params); $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
foreach ($client_hr_wholeData as $key => $value) { foreach ($client_hr_wholeData as $key => $value) {
MailHelper::send_email($value); $mail_send_return2 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return2);
} }
} }
} }
@ -1811,13 +1830,13 @@ public function iAgreeForAddOn()
} }
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200); return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
} }
//Post method - which receives client_policy id and empcode of the family. //Post method - which receives client_policy id and empcode of the family.
//Pull records againest emp code and calculate premium //Pull records againest emp code and calculate premium
// retun array // retun array
public function calculatePremium($clientPolicyId = null , $empCode = null, $default_si = null)//family level public function calculatePremium($clientPolicyId = null , $empCode = null, $default_si = null)//family level
{ {
helper('excel_util_helper'); helper('excel_util_helper');
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId; $client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode; $emp_code = $this->request->getVar('emp_code') ?? $empCode;
@ -1870,11 +1889,11 @@ public function calculatePremium($clientPolicyId = null , $empCode = null, $defa
} }
} }
public function getCashDepositData() public function getCashDepositData()
{ {
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name') $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') ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
@ -1946,13 +1965,13 @@ public function getCashDepositData()
return $this->respond(['status' => 'failed','code' => (count($result) ? 200 : 404),'data' => [] ], 200); return $this->respond(['status' => 'failed','code' => (count($result) ? 200 : 404),'data' => [] ], 200);
} }
} }
public function exportCashDepositData() public function exportCashDepositData()
{ {
$CashDepositData = $this->clientPolicyModel->getdepositData($this->request->getGet('client_id'),$this->request->getGet('insurer_id')); $CashDepositData = $this->clientPolicyModel->getdepositData($this->request->getGet('client_id'),$this->request->getGet('insurer_id'));
@ -2014,11 +2033,11 @@ public function exportCashDepositData()
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
} }
} }
public function removeEmpAndEmpPolicyData() public function removeEmpAndEmpPolicyData()
{ {
try { try {
$clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))->findAll(); $clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))->findAll();
@ -2080,11 +2099,11 @@ public function removeEmpAndEmpPolicyData()
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
} }
} }
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; }else{ $policy_status = 0; }
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type') $ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
@ -2185,11 +2204,11 @@ function getEmployeeActiveOrInactivePolicy()
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200); return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
} }
} }
function policyTermsFiter($terms , $type) function policyTermsFiter($terms , $type)
{ {
$gpa = [ $gpa = [
"sumInsured2" => "Sum Insured", "sumInsured2" => "Sum Insured",
@ -2223,7 +2242,7 @@ function policyTermsFiter($terms , $type)
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases", "waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
"maternitycoverage" => "Maternity Coverage", "maternitycoverage" => "Maternity Coverage",
"babyday1cover" => "Baby Day 1 Cover", "babyday1cover" => "Baby Day 1 Cover",
"9monthwaitingperiodwaived" => "9-month waiting Period waived", "9monthwaitingperiodwaived" => "9-month waiting Period <EFBFBD>waived",
"coverfromthedateofjoining" => "Cover from the date of Joining", "coverfromthedateofjoining" => "Cover from the date of Joining",
"waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions", "waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions",
"waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period", "waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period",
@ -2251,11 +2270,11 @@ function policyTermsFiter($terms , $type)
return $finalarray; return $finalarray;
} }
private function convertDateFormatDisplay($dateString) private function convertDateFormatDisplay($dateString)
{ {
// Attempt to create a DateTime object from the provided date string // Attempt to create a DateTime object from the provided date string
$dateTime = \DateTime::createFromFormat('Y-m-d', $dateString); $dateTime = \DateTime::createFromFormat('Y-m-d', $dateString);
@ -2264,10 +2283,10 @@ private function convertDateFormatDisplay($dateString)
} else { } else {
return null; return null;
} }
} }
public function getFEContent() public function getFEContent()
{ {
try { try {
$feContentData = $this->feContentModel->findAll(); $feContentData = $this->feContentModel->findAll();
@ -2282,10 +2301,10 @@ public function getFEContent()
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
} }
} }
public function getAdvertisementImage() public function getAdvertisementImage()
{ {
try { try {
$img = $this->addImgModel->where('is_active',1)->findAll(); $img = $this->addImgModel->where('is_active',1)->findAll();
@ -2306,6 +2325,93 @@ public function getAdvertisementImage()
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
} }
} }
public function storeFireBase()
{
// try {
$json = $this->request->getJSON();
$firebase_token = $json->firebase_token;
$mobile = $json->mobile;
// Ensure the mobile number is provided
if (empty($mobile)) {
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Mobile number is required'], 400);
}
// Fetch employee by mobile number
$employee = $this->employeeModel->where('mobile', $mobile)->first();
if ($employee) {
// Check if firebase_token is provided
if (!empty($firebase_token)) {
// Check if the current firebase_token is different from the new one
if ($employee['firebase_token'] !== $firebase_token) {
// Update the employee's firebase_token
$data['firebase_token'] = $firebase_token;
$id = $employee['id'];
// return json_encode($data);
// Direct database update query for testing
$db = \Config\Database::connect();
$builder = $db->table('employees');
$update_emp = $builder->update($data, ['id' => $id]);
// Check if the update was successful
if ($db->affectedRows() > 0) {
// Fetch the updated employee data
$updated_employee = $this->employeeModel->find($id);
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $updated_employee], 200);
} else {
log_message('error', 'Update failed. No rows affected.');
return $this->respond(['status' => 'failed', 'code' => 500, 'message' => 'Failed to update employee data'], 500);
}
} else {
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'New Firebase Token is the same as the current one'], 400);
}
} else {
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Firebase Token is required'], 400);
}
} else {
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'Employee not found'], 404);
}
// } catch (\Throwable $th) {
// log_message('error', 'An error occurred: ' . $th->getMessage());
// return $this->respond(['status' => 'failed', 'code' => 500, 'message' => 'An error occurred', 'error' => $th->getMessage()], 500);
// }
}
public function sendPushNotification()
{
$deviceToken = 'ffvc39yhRk-J-vGE9luw6l:APA91bFgNv7lzvA3lGuJ_pMDHdZ_rey6SMg11P2DvJk-WWiBs0nXWCF0lo5nEka3dn3DeTCS5yx0WrHs1yKj5faitBQYKeKxLg2VpUkDcmk3FrTDGkZdHcnW1Go0G0K8dYAkajRIjSEJ';
$title = 'Nhance';
$body = 'All your policy enrolled successfully ..!';
// Initialize Firebase with the service account
$firebase = (new Factory)
->withServiceAccount(APPPATH . 'Config/google-services.json')
->createMessaging();
$notification = Notification::create($title, $body);
$message = CloudMessage::withTarget('token', $deviceToken)
->withNotification($notification);
try {
$firebase->send($message);
return $this->response->setJSON(['status' => 'success']);
} catch (MessagingException $e) {
return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
}
}
} }

View File

@ -1206,7 +1206,7 @@ class EmployeeServiceController extends AdminController
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception']; // $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid()]; $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
// dd($this->employeeModel->getLastQuery()); // dd($this->employeeModel->getLastQuery());
// Kint::dump($existing_famility_details);die(); // Kint::dump($existing_famility_details);die();
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db'); $employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');

View File

@ -212,5 +212,123 @@ class RestAuthenticationController extends AdminController
} }
public function saveMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$mpin = $this->request->getJSON()->mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData) {
$id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){
$result = ['user_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['user_verification' => true , 'message' => "Mpin Not Updated"];
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 updateMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$old_mpin = $this->request->getJSON()->old_mpin;
$mpin = $this->request->getJSON()->new_mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('mpin', $old_mpin)->where('relationship', 'self')->first();
if ($employeeData) {
$id= $employeeData["id"];
$updateMpin = $this->employeeModel->where('id', $id)->set('mpin', $mpin)->update();
if($updateMpin){
$result = ['mpin_verification' => true , 'message' => "Mpin Updated"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['mpin_verification' => true , 'message' => "Mpin Not Updated"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} else {
$result = ['mpin_verification' => false , 'message' => "Wrong Mpin"];
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 verifyMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$mpin = $this->request->getJSON()->mpin;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData && $mpin == $employeeData["mpin"]) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
'user_id' => $employeeData['id'],
'user_type' => 'employee',
'ip' => $auth['ip'],
'platform' => $auth['platform'],
'broswer' => $auth['browser'],
];
$authdata= $this->authHistoryModel->insert($data);
}
$result = JWTToken::encode($employeeData);
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
}
}
public function checkMpin()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData && $employeeData["mpin"] != null) {
return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"]],200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Mpin - not found", 'Mpin' =>null],200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
}
}
} }

View File

@ -10,9 +10,10 @@ if(!function_exists('calculate_days_bw_dates'))
function calculate_days_bw_dates(string $from_date = "", string $to_date ="",bool $include_start_date = true) function calculate_days_bw_dates(string $from_date = "", string $to_date ="",bool $include_start_date = true)
{ {
if($to_date == ""){ $currentDateTime = new DateTime(); } if($to_date == ""){ $currentDateTime = new DateTime(); }
else{ $currentDateTime = new DateTime($to_date); } else{ $to_date = convert_string_to_date($to_date); $currentDateTime = new DateTime($to_date); }
if($from_date == ""){ $passedDateTime = new DateTime(); } if($from_date == ""){ $passedDateTime = new DateTime(); }
else{ $passedDateTime = new DateTime($from_date); } else{ $from_date = convert_string_to_date($from_date); $passedDateTime = new DateTime($from_date); }
$interval = $currentDateTime->diff($passedDateTime); $interval = $currentDateTime->diff($passedDateTime);
// $totalDays = $interval->days; // $totalDays = $interval->days;
@ -246,7 +247,7 @@ if(!function_exists('check_si'))
} }
// check age slab // check age slab
if(in_array(strtoupper($row['current_action']), ['I','A','DA']) && strtolower($row['5']) == 'self') if(in_array(strtoupper($row['current_action']), ['I','A','DA']) && (($slab_value['premium_type'] == 1 && strtolower($row['5']) == 'self' ) || ($slab_value['premium_type'] == 2) ) )
{ {
if($row[3] != '' && $row[3] != null)// dob if($row[3] != '' && $row[3] != null)// dob
{ {

View File

@ -12,6 +12,7 @@ class sendMailNotification
{ {
public static function sendMailNotification($action, $params) public static function sendMailNotification($action, $params)
{ {
print_r($params);die;
if ($action == 'member_welcome_mail') { if ($action == 'member_welcome_mail') {
$dataToInsert = $params['dataToInsert']; $dataToInsert = $params['dataToInsert'];
$notification = $params['notification']; $notification = $params['notification'];
@ -37,7 +38,6 @@ class sendMailNotification
return $wholeData; return $wholeData;
} else if($action == 'member_reminder_mail'){ } else if($action == 'member_reminder_mail'){
// print_r($params);die;
$EmployeeModel = new EmployeeModel(); $EmployeeModel = new EmployeeModel();
$emp_data = $params['emp_data']; $emp_data = $params['emp_data'];
$notification_data = $params['notification_data']; $notification_data = $params['notification_data'];
@ -100,11 +100,16 @@ class sendMailNotification
$mail_content = $notification['mail_content']; $mail_content = $notification['mail_content'];
$mail = $get_emp_email_and_other_details['email_corporate']; $mail = $get_emp_email_and_other_details['email_corporate'];
$subject = $notification['subject']; $subject = $notification['subject'];
$link = generate_download_link($rand_string); $link = generate_download_link($rand_string);
$app_link = $_ENV['App_Url']; $app_link = $_ENV['App_Url'];
$name = $get_emp_email_and_other_details['name']; $name = $get_emp_email_and_other_details['name'];
$mail_content = $notification['mail_content']; $mail_content = $notification['mail_content'];
$nhance_logo = $_ENV['NHANCE_LOGO']; $nhance_logo = $_ENV['NHANCE_LOGO'];
// dd("3333333333333");
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK']; $post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
@ -119,7 +124,6 @@ class sendMailNotification
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content); // $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content); $mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']]; $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
return $wholeData; return $wholeData;
@ -153,21 +157,26 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure // Step 1: Replace the placeholder with an HTML table structure
$mail = ''; $mail = '';
// print_r($array_list);die;
$table_content = ''; $table_content = '';
$addtional_premium = 0; $addtional_premium = 0;
$gst = 0; $gst = 0;
$Addon_list = [];
$name = '';
$emp_code = '';
foreach ($array_list as $item) { foreach ($array_list as $item) {
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : '; $table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data =''; $temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) { foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name']; $policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>'; $temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['relationship'].'</td><td>'. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .'</td><td style="width:20%">₹'.format_indian_number($inner_item['basic_cover_si']).'</td><td style="width:20%">₹'.format_indian_number($inner_item['premium']).'</td><td>₹'. format_indian_number($inner_item['gst']) .'</td></tr><tr>';
if($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self'){ if($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self'){
$mail = $inner_item['email_corporate']; $mail = $inner_item['email_corporate'];
$name = $inner_item['name']; $name = $inner_item['name'];
$emp_code = $inner_item['emp_code'];
} }
// print_r($inner_item);die;
$is_addon = $inner_item['is_addon']; $is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){ if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
@ -175,10 +184,10 @@ class sendMailNotification
$gst = $inner_item['gst'] + $gst; $gst = $inner_item['gst'] + $gst;
} }
} }
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>'; // echo $policy_name;die;
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Relation</th><th style="width:15%">Date Of Birth</th><th>Sum Insure</th><th>Premium</th><tj>GST</th></tr></thead><tbody>';
$table_content .= $temp_data; $table_content .= $temp_data;
$table_content .= '</tbody></table></div>'; $table_content .= '</tbody></table></div>';
if ($is_addon == 2 || $is_addon == 3) { if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [ $addon_list_array = [
'policy_name'=>$policy_name, 'policy_name'=>$policy_name,
@ -195,16 +204,21 @@ class sendMailNotification
$gst = 0; $gst = 0;
} }
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>'; }
if(count($Addon_list) != 0 && count($Addon_list) > 0){
$table_content .='<br><div style="text-align: left;"><div style="text-align:left;"><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
$sum_tolal = 0; $sum_tolal = 0;
foreach ($Addon_list as $key => $value) { foreach ($Addon_list as $key => $value) {
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal; $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>'; $table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
} }
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>'; $sum_total_words = numberToWords($sum_tolal);
$table_content .= '</tbody></table>'; $table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.format_indian_number($sum_tolal).'</td></tr>';
$mail_content = str_replace("[[member_name]]", $name, $mail_content); $table_content .= '</tbody></table></div></div>';
$table_content .= '<div style="width:60%;text-align:right">'. $sum_total_words .'</div>';
}
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
// $mail = "aadhavanvalli@gmail.com"; // $mail = "aadhavanvalli@gmail.com";
// if (isset($mail) && !empty($mail)) { // if (isset($mail) && !empty($mail)) {
@ -214,17 +228,16 @@ class sendMailNotification
return $wholeData; return $wholeData;
} }
// print_r($wholeData);die;
} else if($action == 'account_maneger_summary_mail'){ } else if($action == 'account_maneger_summary_mail'){
$client_id = $params['client_id']; $client_id = $params['client_id'];
$clientModel = new ClientModel(); $clientModel = new ClientModel();
$notificationModel = new NotificationModel();
$clientRMModel =new ClientRMModel();
$client_data =$clientModel->where('id', $client_id)->first(); $client_data =$clientModel->where('id', $client_id)->first();
$notificationModel = new NotificationModel();
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first(); $notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
$clientRMModel =new ClientRMModel();
if ($notification_data['enabled'] == 1) { if ($notification_data['enabled'] == 1) {
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll(); $client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
@ -255,30 +268,37 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure // Step 1: Replace the placeholder with an HTML table structure
$mail = ''; $mail = '';
// print_r($array_list);die;
$table_content = ''; $table_content = '';
$addtional_premium = 0; $addtional_premium = 0;
$gst = 0; $gst = 0;
$array_list = $params['array_list']; $array_list = $params['array_list'];
$Addon_list = [];
foreach ($array_list as $item) { foreach ($array_list as $item) {
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : '; $table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data =''; $temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) { foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name']; $policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>'; if($inner_item['relationship'] == 'Self'){
// print_r($inner_item);die; $emp_code = ' ('. $inner_item['emp_code'] . ')';
}else{
$emp_code ='';
}
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . $emp_code . '</td><td style="width:20%">'.$inner_item['relationship'].'</td><td>'. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .'</td><td style="width:20%">₹'.format_indian_number($inner_item['basic_cover_si']).'</td><td style="width:20%">₹'.format_indian_number($inner_item['premium']).'</td><td>₹'. format_indian_number($inner_item['gst']) .'</td></tr><tr>';
$is_addon = $inner_item['is_addon']; $is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){ if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium; $addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
$gst = $inner_item['gst'] + $gst; $gst = $inner_item['gst'] + $gst;
} }
} }
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>'; $table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Relation</th><th style="width:15%">Date Of Birth</th><th>Sum Insure</th><th>Premium</th><tj>GST</th></tr></thead><tbody>';
$table_content .= $temp_data; $table_content .= $temp_data;
$table_content .= '</tbody></table></div>'; $table_content .= '</tbody></table></div>';
if ($is_addon == 2 || $is_addon == 3) { if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [ $addon_list_array = [
'policy_name'=>$policy_name, 'policy_name'=>$policy_name,
@ -293,21 +313,28 @@ class sendMailNotification
$temp_data = ''; $temp_data = '';
$addtional_premium = 0; $addtional_premium = 0;
$gst = 0; $gst = 0;
} }
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
}
if(count($Addon_list) != 0 && count($Addon_list) > 0){
$table_content .='<br><div style="text-align: left;"><div style="text-align:left;"><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
$sum_tolal = 0; $sum_tolal = 0;
foreach ($Addon_list as $key => $value) { foreach ($Addon_list as $key => $value) {
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal; $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>'; $table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
} }
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>'; $sum_total_words = numberToWords($sum_tolal);
$table_content .= '</tbody></table>'; $table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.format_indian_number($sum_tolal).'</td></tr>';
$table_content .= '</tbody></table></div></div>';
$table_content .= '<div style="width:60%;text-align:right">'. $sum_total_words .'</div>';
}
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
$account_manager_mail_list = []; $account_manager_mail_list = [];
if(isset($user_list)){
foreach ($user_list as $key => $value) { foreach ($user_list as $key => $value) {
$full_name = $value['first_name'] .' ' .$value['last_name']; $full_name = $value['first_name'] .' ' .$value['last_name'];
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content); $mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
@ -317,6 +344,7 @@ class sendMailNotification
} }
return $wholeData; return $wholeData;
} }
}
} else if($action == 'client_hr_summary_mail'){ } else if($action == 'client_hr_summary_mail'){
$client_id = $params['client_id']; $client_id = $params['client_id'];
@ -357,19 +385,23 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure // Step 1: Replace the placeholder with an HTML table structure
$mail = ''; $mail = '';
// print_r($array_list);die;
$table_content = ''; $table_content = '';
$addtional_premium = 0; $addtional_premium = 0;
$gst = 0; $gst = 0;
$array_list = $params['array_list']; $array_list = $params['array_list'];
$Addon_list = [];
foreach ($array_list as $item) { foreach ($array_list as $item) {
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : '; $table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data =''; $temp_data ='';
foreach ($item as $inner_item) { foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name']; $policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>'; if($inner_item['relationship'] == 'Self'){
// print_r($inner_item);die; $emp_code = ' ('. $inner_item['emp_code'] . ')';
}else{
$emp_code ='';
}
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . $emp_code . '</td><td style="width:20%">'.$inner_item['relationship'].'</td><td>'. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .'</td><td style="width:20%">₹'.format_indian_number($inner_item['basic_cover_si']).'</td><td style="width:20%">₹'.format_indian_number($inner_item['premium']).'</td><td>₹'. format_indian_number($inner_item['gst']) .'</td></tr><tr>';
$is_addon = $inner_item['is_addon']; $is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){ if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
@ -377,7 +409,7 @@ class sendMailNotification
$gst = $inner_item['gst'] + $gst; $gst = $inner_item['gst'] + $gst;
} }
} }
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>'; $table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Relation</th><th style="width:15%">Date Of Birth</th><th>Sum Insure</th><th>Premium</th><tj>GST</th></tr></thead><tbody>';
$table_content .= $temp_data; $table_content .= $temp_data;
$table_content .= '</tbody></table></div>'; $table_content .= '</tbody></table></div>';
@ -397,23 +429,25 @@ class sendMailNotification
$gst = 0; $gst = 0;
} }
if(count($Addon_list) != 0 && count($Addon_list) > 0){
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>'; $table_content .='<br><div style="text-align: left;"><div style="text-align:left;"><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
$sum_tolal = 0; $sum_tolal = 0;
foreach ($Addon_list as $key => $value) { foreach ($Addon_list as $key => $value) {
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal; $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>'; $table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
} }
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>'; $sum_total_words = numberToWords($sum_tolal);
$table_content .= '</tbody></table>'; $table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.format_indian_number($sum_tolal).'</td></tr>';
$table_content .= '</tbody></table></div></div>';
$table_content .= '<div style="width:60%;text-align:right">'. $sum_total_words .'</div>';
}
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
$hr_mails = $client_data['hr_mails']; $hr_mails = $client_data['hr_mails'];
$mail_array = explode(',', $hr_mails); $mail_array = explode(',', $hr_mails);
$mail_array = array_map('trim', $mail_array); $mail_array = array_map('trim', $mail_array);
$wholeData = [];
foreach ($mail_array as $key => $value) { foreach ($mail_array as $key => $value) {
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content]; $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content];
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; // $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];

View File

@ -139,3 +139,9 @@ if (!function_exists('get_session_context')) {
return $session->get('context'); return $session->get('context');
} }
} }

View File

@ -248,3 +248,64 @@ if (!function_exists('get_role_id')) {
} }
function numberToWords($number)
{
$words = array(
'0' => 'Zero',
'1' => 'One',
'2' => 'Two',
'3' => 'Three',
'4' => 'Four',
'5' => 'Five',
'6' => 'Six',
'7' => 'Seven',
'8' => 'Eight',
'9' => 'Nine',
'10' => 'Ten',
'11' => 'Eleven',
'12' => 'Twelve',
'13' => 'Thirteen',
'14' => 'Fourteen',
'15' => 'Fifteen',
'16' => 'Sixteen',
'17' => 'Seventeen',
'18' => 'Eighteen',
'19' => 'Nineteen',
'20' => 'Twenty',
'30' => 'Thirty',
'40' => 'Forty',
'50' => 'Fifty',
'60' => 'Sixty',
'70' => 'Seventy',
'80' => 'Eighty',
'90' => 'Ninety'
);
if ($number < 21) {
return $words[$number];
}
if ($number < 100) {
$tens = (int)($number / 10) * 10;
$units = $number % 10;
return $words[$tens] . ($units ? ' ' . $words[$units] : '');
}
if ($number < 1000) {
$hundreds = (int)($number / 100);
$remainder = $number % 100;
return $words[$hundreds] . ' Hundred' . ($remainder ? ' and ' . numberToWords($remainder) : '');
}
$levels = array('', ' Thousand', ' Million', ' Billion', ' Trillion', ' Quadrillion', ' Quintillion');
for ($i = 0, $unit = 1; $i < count($levels); $i++, $unit *= 1000) {
if ($number < $unit * 1000) {
$current = (int)($number / $unit);
$remainder = $number % $unit;
return numberToWords($current) . $levels[$i] . ($remainder ? ' ' . numberToWords($remainder) : '');
}
}
return $number; // Fallback for numbers beyond the supported range
}

View File

@ -40,7 +40,8 @@ class EmployeeModel extends Model
"is_createdby_hr", "is_createdby_hr",
"client_branch_id", "client_branch_id",
"token_time_out", "token_time_out",
"emp_type" "emp_type",
"mpin"
]; ];
// Callbacks // Callbacks

View File

@ -101,6 +101,9 @@ class EmployeePolicyModel extends Model
'emp.emp_status', 'emp.emp_status',
'emp.is_active as emp_is_active', 'emp.is_active as emp_is_active',
'emp.mobile as mobile', 'emp.mobile as mobile',
'emp.doj',
'emp.basic_pay',
'emp.band as grade',
'policy_type.policy_type', 'policy_type.policy_type',
'cp.policy_no', 'cp.policy_no',
]) ])
@ -795,8 +798,7 @@ class EmployeePolicyModel extends Model
->get()->getResultArray(); ->get()->getResultArray();
} }
public function getECardDataUsingMd5($client_policy_id, $emp_code) public function getECardDataUsingMd5($client_policy_id, $emp_code,$client_id){
{
$result = $this->db->table('employees e') $result = $this->db->table('employees e')
->select('e.id, ->select('e.id,
@ -811,7 +813,7 @@ class EmployeePolicyModel extends Model
e.doj, e.doj,
e.band, e.band,
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age, TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self, (SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
ep.tpa_id, ep.tpa_id,
@ -863,7 +865,7 @@ class EmployeePolicyModel extends Model
} }
public function getECardSingleData($rand_string, $emp_code){ public function getECardSingleData($rand_string, $emp_code,$client_id){
$result = $this->db->table('employees e') $result = $this->db->table('employees e')
->select('e.id, ->select('e.id,
@ -878,7 +880,7 @@ class EmployeePolicyModel extends Model
e.doj, e.doj,
e.band, e.band,
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age, TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self, (SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
ep.tpa_id, ep.tpa_id,

View File

@ -22,6 +22,7 @@ class LevelContactModel extends Model
"updated_by", "updated_by",
"otp", "otp",
"is_active", "is_active",
"token_time_out"
]; ];
} }

View File

@ -23,7 +23,9 @@
"phpoffice/phpspreadsheet": "^2.1", "phpoffice/phpspreadsheet": "^2.1",
"psr/log": "^1.1", "psr/log": "^1.1",
"slim/slim": "^4.13", "slim/slim": "^4.13",
"zircote/swagger-php": "^4.8" "zircote/swagger-php": "^4.8",
"psr/http-message": "^1.0",
"kreait/firebase-php":"^7.0"
}, },
"require-dev": { "require-dev": {
"codeigniter/coding-standard": "^1.7", "codeigniter/coding-standard": "^1.7",