FIX_CLAIM_CLIENT_EMP_SEARCH_ISSUE : RV
This commit is contained in:
parent
c7dacf02a7
commit
f888db2932
@ -364,7 +364,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
||||||
$routes->get('getCDAmount', 'ClientController::getCDAmount');
|
$routes->get('getCDAmount', 'ClientController::getCDAmount');
|
||||||
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
|
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
|
||||||
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
// $routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
||||||
|
$routes->get('getTheEmpDataForClaimSearchByMobile', 'ClientController::getTheEmpDataForClaimSearchByMobile');
|
||||||
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
$routes->get('getLeadNonEB/(:any)', 'LeadsController::getLeadNonEB/$1');
|
||||||
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
$routes->get('getPolicyTypeFields', 'LeadsController::getPolicyTypeFields');
|
||||||
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
$routes->get('removeMultiFile', 'LeadsController::removeMultiFile');
|
||||||
@ -674,6 +675,9 @@ $routes->get("ticketHistoryList", "ThzController::ticketHistoryList");
|
|||||||
$routes->group('test', function($routes) {
|
$routes->group('test', function($routes) {
|
||||||
$routes->post('api/saveForm', 'TestingController::saveForm');
|
$routes->post('api/saveForm', 'TestingController::saveForm');
|
||||||
$routes->get('insurerRFQRemainder', 'LeadsController::remainderForQcr');
|
$routes->get('insurerRFQRemainder', 'LeadsController::remainderForQcr');
|
||||||
|
$routes->get('ecard/generate-pdf', 'TestingController::generatePDF');
|
||||||
|
$routes->get('view-pdf', 'TestingController::viewPDF');
|
||||||
|
$routes->get('generate-pdf-view', 'TestingController::generatePDFWithView');
|
||||||
});
|
});
|
||||||
$routes->cli('cli/testcli', 'TestingController::testcli');
|
$routes->cli('cli/testcli', 'TestingController::testcli');
|
||||||
|
|
||||||
|
|||||||
@ -5405,7 +5405,8 @@ class ClientController extends AdminController
|
|||||||
employees.mobile AS emp_mobile,
|
employees.mobile AS emp_mobile,
|
||||||
employees.email_corporate AS emp_email,
|
employees.email_corporate AS emp_email,
|
||||||
employees.relationship AS emp_relationship,
|
employees.relationship AS emp_relationship,
|
||||||
employee_polices.uhid AS policy_no
|
employee_polices.uhid AS policy_no,
|
||||||
|
employee_polices.client_policy_id
|
||||||
")
|
")
|
||||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||||
@ -5418,10 +5419,16 @@ class ClientController extends AdminController
|
|||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
->where('employees.relationship', "Self")
|
->where('employees.relationship', "Self")
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
|
->whereIn('employees.emp_status', ['active'])
|
||||||
|
->whereIn('employee_polices.status', ['active'])
|
||||||
|
->where('employees.is_active', 1)
|
||||||
->where('client_policy.id', $param)
|
->where('client_policy.id', $param)
|
||||||
|
->groupBy('employees.emp_code')
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
|
// print_r(db_connect()->getLastQuery()); die;
|
||||||
|
|
||||||
$dataForClientAndInsurer = $this->clientPolicyModel
|
$dataForClientAndInsurer = $this->clientPolicyModel
|
||||||
->select("
|
->select("
|
||||||
clients.id AS client_id,
|
clients.id AS client_id,
|
||||||
@ -5464,18 +5471,37 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null, $ticket_type_id = null)
|
// public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile', $client_policy_id = null, $client_id = null, $ticket_type_id = null)
|
||||||
|
public function getTheEmpDataForClaimSearchByMobile()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$request = $this->request;
|
||||||
|
|
||||||
|
// Get parameters from GET request
|
||||||
|
$param = $request->getGet('param');
|
||||||
|
$type = $request->getGet('type') ?? 'mobile';
|
||||||
|
$client_policy_id = $request->getGet('client_policy_id');
|
||||||
|
$client_id = $request->getGet('client_id');
|
||||||
|
$ticket_type_id = $request->getGet('ticket_type_id');
|
||||||
|
|
||||||
|
// Validate required parameter
|
||||||
|
if (empty($param)) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Parameter is required'
|
||||||
|
])->setStatusCode(400);
|
||||||
|
}
|
||||||
|
|
||||||
$field_name = 'employees.' . $type;
|
$field_name = 'employees.' . $type;
|
||||||
|
|
||||||
$policy_type_id = [];
|
$policy_type_id = [];
|
||||||
if($ticket_type_id == 1){
|
if ($ticket_type_id == 1) {
|
||||||
$policy_type_id = [2, 3, 4, 5];
|
$policy_type_id = [2, 3, 4, 5];
|
||||||
}else if($ticket_type_id == 2){
|
} else if ($ticket_type_id == 2) {
|
||||||
$policy_type_id = [1];
|
$policy_type_id = [1];
|
||||||
}else if($ticket_type_id == 3){
|
} else if ($ticket_type_id == 3) {
|
||||||
$policy_type_id = [6];
|
$policy_type_id = [6];
|
||||||
}else if($ticket_type_id == 4){
|
} else if ($ticket_type_id == 4) {
|
||||||
$policy_type_id = [7];
|
$policy_type_id = [7];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5521,7 +5547,7 @@ class ClientController extends AdminController
|
|||||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($policy_type_id != null){
|
if ($policy_type_id != null) {
|
||||||
$query->whereIn('client_policy.policy_type_id', $policy_type_id);
|
$query->whereIn('client_policy.policy_type_id', $policy_type_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5542,14 +5568,14 @@ class ClientController extends AdminController
|
|||||||
// ->get()
|
// ->get()
|
||||||
// ->getResultArray();
|
// ->getResultArray();
|
||||||
|
|
||||||
if(!empty($data) && count($data) > 0){
|
if (!empty($data) && count($data) > 0) {
|
||||||
|
|
||||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $client_policy_id, $client_id);
|
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $client_policy_id, $client_id);
|
||||||
$acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']);
|
$acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']);
|
||||||
// if(!empty($acms_datas)){
|
// if(!empty($acms_datas)){
|
||||||
// $acms = $acms_datas;
|
// $acms = $acms_datas;
|
||||||
// }
|
// }
|
||||||
}else{
|
} else {
|
||||||
$acms_datas = "";
|
$acms_datas = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ namespace App\Controllers;
|
|||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use CodeIgniter\API\ResponseTrait;
|
use CodeIgniter\API\ResponseTrait;
|
||||||
|
use Dompdf\Dompdf;
|
||||||
|
use Dompdf\Options;
|
||||||
|
|
||||||
class TestingController extends BaseController
|
class TestingController extends BaseController
|
||||||
{
|
{
|
||||||
@ -36,4 +38,180 @@ class TestingController extends BaseController
|
|||||||
log_message('error', 'test message for log_message_function');
|
log_message('error', 'test message for log_message_function');
|
||||||
echo "hi 3";
|
echo "hi 3";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function generatePDF()
|
||||||
|
{
|
||||||
|
// Sample data - replace with your actual data source
|
||||||
|
$data = [
|
||||||
|
'NAME' => 'John Doe',
|
||||||
|
'GENDER' => 'Male',
|
||||||
|
'DOB' => '01/01/1990',
|
||||||
|
'RELATION' => 'Self',
|
||||||
|
'POLICY_NO' => 'POL123456789',
|
||||||
|
'TPA_ID' => 'TPA987654321',
|
||||||
|
'POLICY_START_DATE' => '01/01/2024',
|
||||||
|
'POLICY_DATE' => '31/12/2024',
|
||||||
|
'INSURER_NAME' => 'ABC Insurance Co.',
|
||||||
|
'TPA_NAME' => 'XYZ TPA Ltd.',
|
||||||
|
'FRONT_CARD' => base_url('assets/images/front-card.jpg'), // Your card images
|
||||||
|
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
|
||||||
|
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Load the HTML template
|
||||||
|
$html = $this->loadTemplate($data);
|
||||||
|
|
||||||
|
// Configure DomPDF options
|
||||||
|
$options = new Options();
|
||||||
|
$options->set('isRemoteEnabled', true); // Enable loading of remote images
|
||||||
|
$options->set('isHtml5ParserEnabled', true);
|
||||||
|
$options->set('isPhpEnabled', true);
|
||||||
|
$options->set('debugPng', false);
|
||||||
|
$options->set('debugKeepTemp', false);
|
||||||
|
$options->set('debugCss', false);
|
||||||
|
$options->set('debugLayout', false);
|
||||||
|
$options->set('debugLayoutLines', false);
|
||||||
|
$options->set('debugLayoutBlocks', false);
|
||||||
|
$options->set('debugLayoutInline', false);
|
||||||
|
$options->set('debugLayoutPaddingBox', false);
|
||||||
|
|
||||||
|
// Initialize DomPDF
|
||||||
|
$dompdf = new Dompdf($options);
|
||||||
|
|
||||||
|
// Load HTML content
|
||||||
|
$dompdf->loadHtml($html);
|
||||||
|
|
||||||
|
// Set paper size and orientation
|
||||||
|
$dompdf->setPaper('A4', 'landscape'); // or 'portrait'
|
||||||
|
|
||||||
|
// Render PDF
|
||||||
|
$dompdf->render();
|
||||||
|
|
||||||
|
// Output PDF to browser
|
||||||
|
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
||||||
|
$dompdf->stream($filename, ['Attachment' => true]); // Set to false for inline view
|
||||||
|
}
|
||||||
|
|
||||||
|
public function viewPDF()
|
||||||
|
{
|
||||||
|
// Same as generatePDF but with inline view
|
||||||
|
$data = [
|
||||||
|
'NAME' => 'John Doe',
|
||||||
|
'GENDER' => 'Male',
|
||||||
|
'DOB' => '01/01/1990',
|
||||||
|
'RELATION' => 'Self',
|
||||||
|
'POLICY_NO' => 'POL123456789',
|
||||||
|
'TPA_ID' => 'TPA987654321',
|
||||||
|
'POLICY_START_DATE' => '01/01/2024',
|
||||||
|
'POLICY_DATE' => '31/12/2024',
|
||||||
|
'INSURER_NAME' => 'ABC Insurance Co.',
|
||||||
|
'TPA_NAME' => 'XYZ TPA Ltd.',
|
||||||
|
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
|
||||||
|
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
|
||||||
|
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||||
|
];
|
||||||
|
|
||||||
|
$html = $this->loadTemplate($data);
|
||||||
|
$options = new Options();
|
||||||
|
$options->set('isRemoteEnabled', true);
|
||||||
|
$options->set('isHtml5ParserEnabled', true);
|
||||||
|
|
||||||
|
$dompdf = new Dompdf($options);
|
||||||
|
$dompdf->loadHtml($html);
|
||||||
|
$dompdf->setPaper('A4', 'portrait');
|
||||||
|
$dompdf->render();
|
||||||
|
|
||||||
|
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
||||||
|
$dompdf->stream($filename, ['Attachment' => false]); // Inline view
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadTemplate($data)
|
||||||
|
{
|
||||||
|
// Load your HTML template
|
||||||
|
$template = file_get_contents(WRITEPATH . 'e_card_template/common.html');
|
||||||
|
|
||||||
|
// Replace placeholders with actual data
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
$template = str_replace('{' . $key . '}', $value, $template);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternative method using CodeIgniter's view system
|
||||||
|
public function generatePDFWithView()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'NAME' => 'John Doe',
|
||||||
|
'GENDER' => 'Male',
|
||||||
|
'DOB' => '01/01/1990',
|
||||||
|
'RELATION' => 'Self',
|
||||||
|
'POLICY_NO' => 'POL123456789',
|
||||||
|
'TPA_ID' => 'TPA987654321',
|
||||||
|
'POLICY_START_DATE' => '01/01/2024',
|
||||||
|
'POLICY_DATE' => '31/12/2024',
|
||||||
|
'INSURER_NAME' => 'ABC Insurance Co.',
|
||||||
|
'TPA_NAME' => 'XYZ TPA Ltd.',
|
||||||
|
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
|
||||||
|
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
|
||||||
|
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Load view with data
|
||||||
|
$html = view('ecard_template', $data);
|
||||||
|
|
||||||
|
$options = new Options();
|
||||||
|
$options->set('isRemoteEnabled', true);
|
||||||
|
$options->set('isHtml5ParserEnabled', true);
|
||||||
|
|
||||||
|
$dompdf = new Dompdf($options);
|
||||||
|
$dompdf->loadHtml($html);
|
||||||
|
$dompdf->setPaper('A4', 'portrait');
|
||||||
|
$dompdf->render();
|
||||||
|
|
||||||
|
$filename = 'ecard_' . date('Y-m-d_H-i-s') . '.pdf';
|
||||||
|
$dompdf->stream($filename, ['Attachment' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generatePDFById($id)
|
||||||
|
{
|
||||||
|
// Get data from database
|
||||||
|
$ecardData = [];
|
||||||
|
|
||||||
|
if (!$ecardData) {
|
||||||
|
throw new \CodeIgniter\Exceptions\PageNotFoundException('E-card not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'NAME' => $ecardData['name'],
|
||||||
|
'GENDER' => $ecardData['gender'],
|
||||||
|
'DOB' => $ecardData['dob'],
|
||||||
|
'RELATION' => $ecardData['relation'],
|
||||||
|
'POLICY_NO' => $ecardData['policy_no'],
|
||||||
|
'TPA_ID' => $ecardData['tpa_id'],
|
||||||
|
'POLICY_START_DATE' => $ecardData['policy_start_date'],
|
||||||
|
'POLICY_DATE' => $ecardData['policy_end_date'],
|
||||||
|
'INSURER_NAME' => $ecardData['insurer_name'],
|
||||||
|
'TPA_NAME' => $ecardData['tpa_name'],
|
||||||
|
'FRONT_CARD' => base_url('assets/images/front-card.jpg'),
|
||||||
|
'BACK_CARD' => base_url('assets/images/back-card.jpg'),
|
||||||
|
'LEVELS' => 'Level 1: 1800-XXX-XXXX<br>Level 2: support@company.com'
|
||||||
|
];
|
||||||
|
|
||||||
|
$html = view('ecard_template', $data);
|
||||||
|
|
||||||
|
$options = new Options();
|
||||||
|
$options->set('isRemoteEnabled', true);
|
||||||
|
$options->set('isHtml5ParserEnabled', true);
|
||||||
|
|
||||||
|
$dompdf = new Dompdf($options);
|
||||||
|
$dompdf->loadHtml($html);
|
||||||
|
$dompdf->setPaper('A4', 'landscape');
|
||||||
|
$dompdf->render();
|
||||||
|
|
||||||
|
$filename = 'ecard_' . $ecardData['policy_no'] . '_' . date('Y-m-d') . '.pdf';
|
||||||
|
$dompdf->stream($filename, ['Attachment' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -601,8 +601,11 @@
|
|||||||
param = $(input).val();
|
param = $(input).val();
|
||||||
client_id = $('#emp_client_data_list').val()
|
client_id = $('#emp_client_data_list').val()
|
||||||
}
|
}
|
||||||
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
|
|
||||||
client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id;
|
// let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
|
||||||
|
// client_policy_id + '/' + client_id + '/'+ selected_ticket_type_id;
|
||||||
|
|
||||||
|
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile') ?>';
|
||||||
|
|
||||||
// Data to send in the AJAX request
|
// Data to send in the AJAX request
|
||||||
let requestData = {
|
let requestData = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user