getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['active'],policy_status:['active'],client_branch_id:[ $client_branch_id ],relationship:[$relationship],policy_type_id:[2,3,4,5]);//,relationship:[$relationship];
}
public static function getHospitalLink($emp_policy_id){
// $client_policy_id = 336;
// $emp_id = 12288;
$EmployeePolicyModel = new EmployeePolicyModel();
$res = $EmployeePolicyModel->getHospitalLinkByPolicyandEmp($emp_policy_id);
return is_array($res) && count($res) ? $res[0]['network_hospitals'] : null;
}
public static function getPhoneNumber($chat_session_info){
$emp_id = $chat_session_info['emp_id'];
$EmployeeModel = new EmployeeModel();
return $EmployeeModel->select('mobile')->where('id',$emp_id)->first()['mobile'];
}
public static function sendReimbursementProcessOverMail($chat_session_info)
{
$emp_id = $chat_session_info['emp_id'];
$emp_code = $chat_session_info['emp_code'];
$client_id = $chat_session_info['client_id'];
$client_branch_id = $chat_session_info['client_branch_id'];
// $policy_id = 0;
// $relationship ='Father';
$EmployeeModel = new EmployeeModel();
$data = $EmployeeModel->find((int)$emp_id);
if(isset($data) && isset($data['email_corporate']))
{
$message = SELF::ReimbursementProcessMailTemplate();
// $attachments = [
// ["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
// ["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
// ["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
// ];
$common = ['mail_type'=>'reimbursement_mail_process_bot'];
$email_id = $data['email_corporate'];
// $email_id = 'vitvelz@gmail.com';
// $res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Claim Reimbursement Process', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Claim Reimbursement Process', 'message' => $message,'common'=>$common]);
$res = json_decode($res);
if($res->status == 'success')
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
public static function ReimbursementProcessMailTemplate()
{
$template = '
How to Claim Your Insurance Reimbursement
How to Claim Your Insurance Reimbursement
Dear [Customer Name],
We are here to assist you in claiming your insurance reimbursement smoothly. Please follow the steps below:
- Gather Documents: Collect all required documents such as bills, invoices, and medical reports.
- Complete the Claim Form: Fill out the insurance claim form in the portal.
- Attach Supporting Documents: Attach all necessary documents to support your claim.
- Submit Your Claim: Send the completed form and documents via email or through our online portal.
- Track Your Claim: Use our tracking system to monitor the status of your claim.
- Receive Reimbursement: Once approved, the reimbursement will be processed to your registered account.
If you have any questions, feel free to contact our support team.
';
return $template;
}
public static function getInsurersList(){
$insurer = new InsurerModel();
$data = $insurer->select('short_name,name')->where('category','general')->where('is_active',1)->findAll();
return $data;
}
public static function sendQuotationRequestMail($data){
$message = SELF::quotationRequestMailTemplate($data);
$common = ['mail_type'=>'request_quotation_bot'];
$email_id = getenv('email.enquiryMail');
// $res = MailHelper::send_email(['mail' => $email_id, 'bcc' => 'vitvelz@gmail.com','subject' => '(TESTING)Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
$res = MailHelper::send_email(['mail' => $email_id,'subject' => 'Quotation Request Received from bot.', 'message' => $message,'common'=>$common]);
$res = json_decode($res);
log_message('error','res: '.json_encode($res));
if($res->status == 'success')
{
return true;
}
else
{
return false;
}
}
public static function quotationRequestMailTemplate($data){
$message = 'A customer has requested for a quotation using bot,Here are all the details for it:
'.$data;
return $message;
}
public static function getReimbursementClaimStatus($chat_session_info){
$client_claim_status = [
'Received' => [1,2,3,4],
'Under Process' => [5,6,7,10],
'Finished' => [9,11,12],
'Rejected' => [8],
'Cancelled' => [13,14]
];
$emp_id = $chat_session_info['emp_id'];
log_message('error','emp_id'.$emp_id);
$emp_code = $chat_session_info['emp_code'];
$client_id = $chat_session_info['client_id'];
$client_branch_id = $chat_session_info['client_branch_id'];
$ticketMaster = new TicketMasterModel();
$data = $ticketMaster->select('tcs.id as tcs_id,tcs.claim_status,ticket_master.claim_number,ticket_master.id,ticket_master.emp_name,ticket_master.emp_mail')
// ->join('client_policy cp',"cp.client_id = {$client_id} and cp.client_branch_id = {$client_branch_id} and cp.policy_id = {$policy_id} and cp.is_active = 1")
->join('ticket_claim_status tcs',"ticket_master.claim_status_id = tcs.id and tcs.is_active = 1")
->where('ticket_master.emp_id',$emp_id)
->where('ticket_master.emp_code',$emp_code)
->where('ticket_master.is_active',1)
->orderBy('ticket_master.created_at', 'DESC')
->first();
$server_claim_status = $data['tcs_id'];
$matched_key = null;
foreach ($client_claim_status as $key => $statuses) {
if (in_array($server_claim_status, $statuses)) {
$matched_key = $key;
break; // Stop loop once found
}
}
log_message('error','Data from ticket master'.json_encode($data));
// print_r($data);
// die();
$ticket_controller = new TicketController();
if (!empty($data) && !empty($matched_key)){
$ticket_id = $data['id'];
$mail_content = Self::ReimbursementStatusMailTemplate($data['emp_name'],$data['claim_number'],$matched_key);
$common = ['mail_type'=>'Claim Status'];
$email_id = $data['emp_mail'];
// $email_id = 'vitvelz@gmail.com';
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Claim status as you requested in bot.', 'message' => $mail_content,'common'=>$common]);
$res = json_decode($res);
log_message('error','res: '.json_encode($res));
if($res->status == 'success')
{
$data['client_status'] = $matched_key;
return $data;
}
else
{
return false;
}
}else{
return false;
}
}
public static function ReimbursementStatusMailTemplate($emp_name, $claim_number, $client_status) {
$template = '
Dear [[member_name]],
Your Claim Number [[claim_number]] is currently in the [[status]] status with us.
|
ⓒ2024 Nhance India Insurance Broking Pvt Ltd
|
|
';
// Replace placeholders with actual values
$replacedTemplate = str_replace(
['[[member_name]]', '[[claim_number]]', '[[status]]'],
[$emp_name, $claim_number, $client_status],
$template
);
return $replacedTemplate;
}
}
?>