FIX_HR_APIS_E_CARD_ATTACHMENTS_ISSUES

This commit is contained in:
VENKATESHWARAN 2026-01-30 09:16:27 +05:30
parent 9ec1413c8f
commit 83296fa4af
3 changed files with 77 additions and 4 deletions

View File

@ -2305,8 +2305,32 @@ class EmployeeRestController extends AdminController
}
if($this->request->getGet('policy_status') == 0){
$emp_policy_status = 'expired';
}else{
$emp_policy_status = 'active';
}
$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, client_policy.policy_no as policy_no, client_policy.insurer_id as insurer_id, DATE_FORMAT(client_policy.policy_end_date, "%d-%m-%Y") AS policy_expiry_date ')
$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,
client_policy.policy_no as policy_no,
client_policy.insurer_id as insurer_id,
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_expiry_date,
(
select round(sum(rata_premimum + gst))
from employee_polices
where is_active = 1
and status = $emp_policy_status
and client_policy_id = client_policy_id
) as total_premium
")
->where('md5(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)
@ -2443,7 +2467,12 @@ class EmployeeRestController extends AdminController
if ($this->request->is('get')) {
$data['claim_status'] = $this->claimStatusModel->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
$data['claim_status'] = $this->claimStatusModel
->select('id,ticket_type, display_name as claim_status')
->where('is_active', 1)
->groupBy('display_name')
->findAll();
$data['ticket_type'] = [
["ticket_type" => "1", "type_name" => "Claim-GMC"],
["ticket_type" => "2", "type_name" => "Claim-GPA"],
@ -2463,7 +2492,8 @@ class EmployeeRestController extends AdminController
$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']);
$claim_status_id = isset($search_data['claim_status_id']) ? $search_data['claim_status_id'] : null;
unset($search_data['from_date'], $search_data['to_date'], $search_data['claim_status_id']);
$where = [];
@ -2474,6 +2504,11 @@ class EmployeeRestController extends AdminController
}
}
$claim_status_ids = [];
if(!empty($claim_status_id)){
$claim_status_ids = $this->getTicketClaimStatusIdBasedOnTheDisplayName($claim_status_id);
}
$builder = $db->table('ticket_master tm');
$builder->select([
'tm.id',
@ -2485,6 +2520,12 @@ class EmployeeRestController extends AdminController
ELSE UPPER(tcs.display_name)
END AS status
",
"CASE
WHEN tm.tpa_claim_type IS NOT NULL OR tm.tpa_claim_type != ''
THEN tm.tpa_claim_type
ELSE 'Reimbursement'
END AS cl_type
",
'tm.claim_number AS claim_no',
'tm.claim_status_id',
'tm.is_head_approved',
@ -2568,6 +2609,10 @@ class EmployeeRestController extends AdminController
$builder->where($where);
}
if (!empty($claim_status_ids)) {
$builder->whereIn('claim_status_id', $claim_status_ids);
}
$builder->orderBy('tm.id', 'DESC');
$data = $builder->get()->getResultArray();
@ -5305,6 +5350,18 @@ class EmployeeRestController extends AdminController
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Failed to upload the file'], 200);
}
}
public function getTicketClaimStatusIdBasedOnTheDisplayName($claim_status_id)
{
$claim_status_data_display_name = $this->claimStatusModel->where('is_active', 1)->where('id', $claim_status_id)->first();
$claim_status_data_id = $this->claimStatusModel
->select('id')
->where('is_active', 1)
->where('display_name', $claim_status_data_display_name['display_name'])
->findAll();
return $claim_status_data_id;
}
}

View File

@ -116,6 +116,21 @@ class sendMailNotification
$tpa_id = $params['tpa_id'];
$common = $params['common'];
$mailAttachmentModel = new MailAttachmentModel();
$attachment_data = $mailAttachmentModel
->select('file_path, file_name')
->where('notification_id', $notification['id'])
->where('is_active', 1)
->findAll();
$attachments = [];
foreach ($attachment_data as $data) {
$attachments[] = [
"filePath" => WRITEPATH . $data['file_path'],
"fileName" => $data['file_name']
];
}
$mail_content = $notification['mail_content'];
$mail = $get_emp_email_and_other_details['email_corporate'];
@ -160,7 +175,7 @@ class sendMailNotification
$mail_content = view('mail_template', $data);
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to'], 'common' => $common];
return $wholeData;

View File

@ -92,6 +92,7 @@ class TicketMasterModel extends Model
'claim_description',
'required_docs',
'policy_transaction_id',
'tpa_claim_type',
];