GWM : merger claim files to be pushed to TAP
This commit is contained in:
parent
a7dee02f91
commit
c64d32876a
@ -3785,6 +3785,14 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$this->handleCliamFiles($file_data, $ticket_id, $ticket_message_id);
|
||||
|
||||
// Merge all uploaded PDFs for this ticket into a single combined PDF
|
||||
try {
|
||||
helper('merge_pdf');
|
||||
merge_ticket_pdfs((int) $ticket_id);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'EmployeeRestController::initiateClaim | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
|
||||
}
|
||||
|
||||
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$message = 'Claim Iniated Successfully';
|
||||
@ -3923,16 +3931,6 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Merge all uploaded PDFs for this ticket into a single combined PDF
|
||||
if ($pdf_exist_in_the_file) {
|
||||
try {
|
||||
helper('merge_pdf');
|
||||
merge_ticket_pdfs((int) $ticket_id);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'EmployeeRestController::handleCliamFiles | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$count = $this->ticketMaster->where('id', $ticket_id)->where('is_active', 1)->where('tpa_claim_push_reference_no IS NULL')->countAllResults();
|
||||
log_message('error', 'Ticket validation | Ticket ID: ' . $ticket_id . ' | Matching active tickets with NULL TPA reference: ' . $count);
|
||||
if ($count > 0 && $pdf_exist_in_the_file && $tpa_claim_push == true) {
|
||||
@ -5454,6 +5452,14 @@ class EmployeeRestController extends AdminController
|
||||
$result = $this->handleCliamFiles($file_data, $ticket_id, null, false, true);
|
||||
|
||||
if (! empty($result)) {
|
||||
// Merge all uploaded PDFs for this ticket into a single combined PDF
|
||||
try {
|
||||
helper('merge_pdf');
|
||||
merge_ticket_pdfs((int) $ticket_id);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'EmployeeRestController::uploadIRDocs | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
|
||||
}
|
||||
|
||||
// $this->ticketMaster->where('id', $ticket_id)->set(['required_docs', $required_docs])->update();
|
||||
db_connect()->query(
|
||||
"UPDATE ticket_master SET required_docs = ? WHERE id = ?",
|
||||
|
||||
@ -92,7 +92,7 @@ class FhplApiController extends BaseController
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type='application/pdf'", 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
@ -113,7 +113,7 @@ class HealthIndiaApiController extends BaseController
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type='application/pdf'", 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
@ -67,7 +67,7 @@ class MediAssistApiController extends BaseController
|
||||
->join('employees e', 'e.id = tm.emp_id', 'left')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray(); // single record
|
||||
|
||||
@ -2066,16 +2066,6 @@ class TicketController extends BaseController
|
||||
$return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update();
|
||||
if ($return_value) {
|
||||
|
||||
// Merge all uploaded PDFs for this ticket into a single combined PDF
|
||||
try {
|
||||
helper('merge_pdf');
|
||||
merge_ticket_pdfs((int) $ticket_id, [
|
||||
'ticket_type' => (int) ($ticket_data['ticket_type_id'] ?? 1),
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'TicketController::updateTicket | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
|
||||
}
|
||||
|
||||
$mail_responce = null;
|
||||
if($old_ticket_data['claim_status_id'] != $ticket_data['claim_status_id']){
|
||||
//mail trigger part
|
||||
@ -2413,7 +2403,7 @@ class TicketController extends BaseController
|
||||
$claimFiles = new ClaimFilesModel();
|
||||
$file_record = $claimFiles->where('id', $claim_file_id)->where('is_active', 1)->first();
|
||||
|
||||
if ($file_record === null || (int) ($file_record['file_type'] ?? 0) !== 2) {
|
||||
if ($file_record === null || ! in_array((int) ($file_record['file_type'] ?? 0), [2, 4], true)) {
|
||||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
@ -3687,6 +3677,13 @@ class TicketController extends BaseController
|
||||
$employeeRest = new EmployeeRestController();
|
||||
$result = $employeeRest->handleCliamFiles($file_data, $ticket_id);
|
||||
if(!empty($result)){
|
||||
// Merge all uploaded PDFs for this ticket into a single combined PDF
|
||||
try {
|
||||
helper('merge_pdf');
|
||||
merge_ticket_pdfs((int) $ticket_id);
|
||||
} catch (\Throwable $e) {
|
||||
log_message('error', 'TicketController::upload_url | merge_ticket_pdfs failed | ticket_id=' . $ticket_id . ' | ' . $e->getMessage());
|
||||
}
|
||||
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
|
||||
@ -3714,7 +3711,7 @@ class TicketController extends BaseController
|
||||
->select("
|
||||
*,
|
||||
CASE
|
||||
WHEN file_type = 2 AND url IS NOT NULL AND url != ''
|
||||
WHEN file_type IN (2, 4) AND url IS NOT NULL AND url != ''
|
||||
THEN CONCAT('" . base_url('downloadClaimFile/') . "', id)
|
||||
ELSE url
|
||||
END AS url
|
||||
|
||||
@ -168,7 +168,7 @@ class VidalApiController extends BaseController
|
||||
->join('policy_type pt', 'pt.id = cp.policy_type_id', 'left')
|
||||
->join('employee_polices ep', 'ep.employee_id = e.id AND ep.client_policy_id = cp.id', 'left')
|
||||
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray(); // single record
|
||||
|
||||
@ -696,7 +696,7 @@ class VoloApiController extends BaseController
|
||||
cf.url as filePath
|
||||
')
|
||||
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 4 AND cf.is_active = 1 AND cf.mime_type = 'application/pdf'", 'left')
|
||||
->where('tm.id', $claimId)
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
@ -475,13 +475,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
function claimFileIsLocalUpload(item) {
|
||||
// file_type 2 = uploaded claim doc, 4 = merged combined PDF (both stored on disk)
|
||||
return item.file_type == 2 || item.file_type === '2'
|
||||
|| item.file_type == 4 || item.file_type === '4';
|
||||
}
|
||||
|
||||
function claimFileViewSupported(item) {
|
||||
var mime = String(item.mime_type || '').toLowerCase();
|
||||
if (mime === 'application/pdf' || mime === 'image/png' || mime === 'image/jpeg') {
|
||||
return true;
|
||||
}
|
||||
var ext = '';
|
||||
if (item.file_type == 2 || item.file_type === '2') {
|
||||
if (claimFileIsLocalUpload(item)) {
|
||||
ext = claimFileListExtension(item.file_name) || claimFileListExtension(item.doc_name);
|
||||
} else {
|
||||
ext = claimFileListExtensionFromUrl(item.url);
|
||||
@ -493,14 +499,14 @@
|
||||
}
|
||||
|
||||
function claimFileViewOpenUrl(item, base_url) {
|
||||
if (item.file_type == 2 || item.file_type === '2') {
|
||||
if (claimFileIsLocalUpload(item)) {
|
||||
return base_url + 'viewClaimFile/' + encodeURIComponent(item.id);
|
||||
}
|
||||
return String(item.url || '');
|
||||
}
|
||||
|
||||
function claimFileDownloadOpenUrl(item, base_url) {
|
||||
if (item.file_type == 2 || item.file_type === '2') {
|
||||
if (claimFileIsLocalUpload(item)) {
|
||||
return base_url + 'downloadClaimFile/' + encodeURIComponent(item.id);
|
||||
}
|
||||
return String(item.url || '');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user