diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index b868c229..fda37509 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -580,6 +580,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
$routes->get('feedback-list','TicketController::feedbackList');
+ $routes->match(['get', 'post'], 'claim-upload','TicketController::claimDumpUpload');
$routes->get('remove','TicketController::removeTicket');
$routes->get('new/(:any)','TicketController::ticket_form/$1');
$routes->post('create','TicketController::createTicket');
@@ -615,7 +616,7 @@ $routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_cla
-//Third party Api Call
+//Third party ICICILombard Api Call
$routes->get('generateAuthToken','ICICILombardController::generateAuthToken');
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
@@ -624,3 +625,17 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
$routes->get('testTracelog','TestBusinessController::a');
$routes->get("claimView", "EmployeeRestController::claimView");
+
+//Third party Vidal Api Call
+
+$routes->post('hospitalNetwork','VidalApiController::hospitalNetwork');
+$routes->post('eCardService','VidalApiController::eCardService');
+$routes->post('claimStatusCheck','VidalApiController::claimStatusCheck');
+$routes->post('newClaim','VidalApiController::newClaim');
+$routes->post('enrollment','VidalApiController::enrollment');
+
+
+$routes->post("ticketCreation", "ThzController::ticketCreation");
+$routes->post("ticketList", "ThzController::ticketList");
+$routes->post("ticketConversationSave", "ThzController::ticketConversationSave");
+$routes->post("conversationListPerTicket", "ThzController::conversationListPerTicket");
\ No newline at end of file
diff --git a/app/ControllerCleaners/ThzControllerCleaner.php b/app/ControllerCleaners/ThzControllerCleaner.php
new file mode 100644
index 00000000..5208921c
--- /dev/null
+++ b/app/ControllerCleaners/ThzControllerCleaner.php
@@ -0,0 +1,67 @@
+thzMasterModel = new ThzMasterModel();
+ $this->thzMasterNotesModel = new ThzMasterNotesModel();
+ }
+
+ public function index()
+ {
+ //
+ }
+
+ public function ticketCreation($data){
+
+ if(empty($data)){
+ return false;
+ }
+
+ $cleanedData = $data;
+
+ return $cleanedData;
+
+
+ }
+
+ public function ticketList($data){
+
+ if(empty($data)){
+ return false;
+ }
+
+ $cleanedData = $data;
+
+ return $cleanedData;
+
+ }
+
+ public function ticketConversation($data){
+
+ if(empty($data)){
+ return false;
+ }
+
+ $cleanedData = $data;
+
+ return $cleanedData;
+
+ }
+
+
+
+}
diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php
index b1db3311..fc4a4e86 100644
--- a/app/Controllers/LeadsController.php
+++ b/app/Controllers/LeadsController.php
@@ -44,6 +44,8 @@ use Google\Service\FactCheckTools\Resource\Claims;
use GPBMetadata\Google\Type\Datetime;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
+use function PHPSTORM_META\type;
+
class LeadsController extends BaseController
{
use ResponseTrait;
@@ -773,7 +775,7 @@ class LeadsController extends BaseController
// dd($data);
if ($data['lead_data']['lead_form_type'] == 1) {
-
+ $data['demogrphy_html_data'] = $this->generateDemographyDataTable(['lead_id' => $id]);
$this->loadLayout('view_rfq.php', $data);
} else if ($data['lead_data']['lead_form_type'] == 2) {
@@ -961,7 +963,7 @@ class LeadsController extends BaseController
}
- private function reorderProposalsByInsurerTotal(array $data): array
+ public function reorderProposalsByInsurerTotal(array $data): array
{
if (!isset($data['premium_data']['data'])) return $data;
@@ -973,7 +975,7 @@ class LeadsController extends BaseController
foreach ($original as $key => $value) {
// Match only keys that look like 'Proposal X'
- if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key)) {
+ if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key)) {
// Get the insurer entry (not 'Quote Asked')
foreach ($value as $subKey => $subVal) {
if ($subKey !== 'Quote Asked' && isset($subVal['Total'])) {
@@ -994,6 +996,18 @@ class LeadsController extends BaseController
}
}
+ foreach ($proposals as $proposalKey => &$proposal) {
+ $quoteAsked = $proposal['Quote Asked']; // Keep Quote Asked separately
+ unset($proposal['Quote Asked']);
+
+ uasort($proposal, function ($a, $b) {
+ return $a['Total'] <=> $b['Total']; // Ascending by Total
+ });
+
+ // Add Quote Asked back at the top
+ $proposal = array_merge(['Quote Asked' => $quoteAsked], $proposal);
+ }
+
// Sort proposals by their insurer's total
uasort($proposals, function ($a, $b) {
$totalA = 0;
@@ -1028,9 +1042,48 @@ class LeadsController extends BaseController
return $data;
}
+ $porposalData = $data['premium_data']['data'];
$premiumProposals = array_keys($data['premium_data']['data']);
$filteredProposals = [];
+ //Reorder the Insurer based on the Premium data insurer
+ foreach ($porposalData as $key => $value) {
+
+ if(in_array($key, ['Particulars', ""])){
+ continue;
+ }
+
+ // Ensure the premium data is an array and not empty
+ if (!is_array($value) || empty($value)) {
+ continue;
+ }
+
+ // Step 1: Get the premium display_name order (excluding "Quote Asked")
+ $premiumOrder = array_keys(array_diff_key($value, ["Quote Asked" => ""]));
+
+ // Skip if no valid order found
+ if (empty($premiumOrder)) {
+ continue;
+ }
+
+ // usort($data['proposal_data']['over_all_column_data'][$key]['insurers'], function($a, $b) use ($premiumOrder) {
+ // return array_search($a['display_name'], $premiumOrder) - array_search($b['display_name'], $premiumOrder);
+ // });
+
+ // Step 2: Reorder proposal insurers based on premium order
+ usort($data['proposal_data']['over_all_column_data'][$key]['insurers'], function($a, $b) use ($premiumOrder) {
+ $posA = array_search($a['display_name'] ?? '', $premiumOrder);
+ $posB = array_search($b['display_name'] ?? '', $premiumOrder);
+
+ // If not found, push to the end
+ $posA = $posA === false ? PHP_INT_MAX : $posA;
+ $posB = $posB === false ? PHP_INT_MAX : $posB;
+
+ return $posA - $posB;
+ });
+
+ }
+
// Collect proposal keys that match the pattern "Proposal X"
foreach ($premiumProposals as $key) {
if (preg_match('/^(Proposal\s+\d+|Existing Renewal|Existing Rollover)$/', $key) && isset($data['proposal_data']['over_all_column_data'][$key])) {
@@ -1068,6 +1121,32 @@ class LeadsController extends BaseController
}
}
+ //Reorder the SubHeader of the Proposel
+ foreach ($sortedProposalOrder as $proposalKey => $proposalData) {
+ // Skip if insurers or subHeaders are missing
+ if (
+ !isset($proposalData['insurers']) ||
+ !is_array($proposalData['insurers']) ||
+ !isset($proposalHeaders[$proposalKey]['subHeaders']) ||
+ !is_array($proposalHeaders[$proposalKey]['subHeaders'])
+ ) {
+ continue;
+ }
+
+ // Keep "Quote Asked" fixed at index 0
+ $newSubHeaders = ["Quote Asked"];
+
+ // Add insurers in the sorted order
+ foreach ($proposalData['insurers'] as $insurer) {
+ if(in_array($insurer['display_name'], $proposalHeaders[$proposalKey]['subHeaders'])){
+ $newSubHeaders[] = $insurer['display_name'];
+ }
+ }
+
+ // Replace the subHeaders in the header array
+ $proposalHeaders[$proposalKey]['subHeaders'] = $newSubHeaders;
+ }
+
// dd($staticHeaders, $proposalHeaders, $sortedProposalOrder);
// Step 2: Reorder headers
@@ -1088,10 +1167,9 @@ class LeadsController extends BaseController
}
unset($value);
-
+ //merge the all headers
$reorderedHeaders = array_merge($staticHeaders, $reorderedHeaders, $actionHeader);
-
-
+
// Step 3: Reorder each row's `data` by matching parentth
foreach ($dataRows as $dataRowIndex => &$row) {
$staticData = [];
@@ -1137,6 +1215,12 @@ class LeadsController extends BaseController
}
unset($value);
+ //Reorder the Row Data based on the Insurer
+ $reorderedProposalData = $this->reorderProposalRowData($reorderedProposalData, $proposalHeaders);
+
+
+ // print_rr($reorderedProposalData); die;
+
$row['data'] = array_merge($staticData, $reorderedProposalData, $actionData);
}
@@ -1151,6 +1235,44 @@ class LeadsController extends BaseController
return $data;
}
+ private function reorderProposalRowData(array $proposalRowData, array $proposalHeaderData): array
+ {
+ $newRowData = [];
+
+ // Group rows by parentth
+ $groupedRows = [];
+ foreach ($proposalRowData as $row) {
+ if (!isset($row['parentth'])) {
+ continue; // skip invalid rows
+ }
+ $groupedRows[$row['parentth']][] = $row;
+ }
+
+ // Reorder each group's rows based on header subHeaders
+ foreach ($proposalHeaderData as $proposalKey => $headerInfo) {
+ if (
+ !isset($groupedRows[$proposalKey]) ||
+ !isset($headerInfo['subHeaders']) ||
+ !is_array($headerInfo['subHeaders'])
+ ) {
+ continue;
+ }
+
+ $order = $headerInfo['subHeaders'];
+ $rows = $groupedRows[$proposalKey];
+
+ // Sort whole rows according to subth position in $order
+ usort($rows, function ($a, $b) use ($order) {
+ return array_search($a['subth'], $order) - array_search($b['subth'], $order);
+ });
+
+ // Append sorted rows to final array
+ $newRowData = array_merge($newRowData, $rows);
+ }
+
+ return $newRowData;
+ }
+
private function renumberProposalKeys(array $input): array
{
$result = [];
@@ -1284,7 +1406,7 @@ class LeadsController extends BaseController
$lead_data = [
'Insured' => $rfq_data['client_name'],
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
- 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
+ // 'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
'Policy Period' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d-m-Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d-m-Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
@@ -1455,7 +1577,20 @@ class LeadsController extends BaseController
],
],
]);
- $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
+
+ if($type == 2){
+ $subheader_count = array_sum(
+ array_map(
+ fn($header) => count(array_filter(
+ $header['subHeaders'],
+ fn($sub) => $sub !== "Quote Asked"
+ )),
+ $data['table_data']['headers']
+ )
+ );
+ }else{
+ $subheader_count = array_sum(array_map(fn($header) => count($header['subHeaders']), $data['table_data']['headers']));
+ }
if ($is_placement == false) {
$subheader_count = $subheader_count - 2;
@@ -1484,7 +1619,8 @@ class LeadsController extends BaseController
if ($type == 2) {
$subHeaderRow = $rowNumber + 1;
} else {
- $subHeaderRow = $rowNumber_for_remove_quote_asked;
+ // $subHeaderRow = $rowNumber_for_remove_quote_asked;
+ $subHeaderRow = $rowNumber + 1;
}
$columnLetter = 'A';
@@ -1505,6 +1641,13 @@ class LeadsController extends BaseController
if (!in_array($header['parentHeader'], ['Item Key', 'Action', 'Sno', 'Particulars'])) {
$header_actual_count++;
+
+ //Quote asked not showed in the QCR excel so some proposel has only one Quote Asked, So that case avoid the proposel name
+ $subHeaderCount = count($header['subHeaders'] ?? []) ?? 0;
+ if($subHeaderCount <= 1 && $type == 2 && $is_placement == false){
+ // print_rr($header);
+ continue;
+ }
}
if ($header['parentHeader'] === 'Sno') {
@@ -1525,7 +1668,14 @@ class LeadsController extends BaseController
}
$startColumn = $columnLetter; // Start of the current header range
- $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
+ if($type == 2){
+ $subHeaderCount = count(array_filter($header['subHeaders'], function($subHeader) {
+ return $subHeader !== "Quote Asked";
+ }));
+ }else{
+ $subHeaderCount = count($header['subHeaders']); // Number of subheaders for this parent header
+ }
+
// Set parent header value
if ($is_placement == true && !in_array($header['parentHeader'], ['Particulars', 'S.No.'])) {
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Terms");
@@ -1539,6 +1689,7 @@ class LeadsController extends BaseController
$sheet->setCellValue("{$startColumn}{$rowNumber}", "Proposal Terms " . $headerIndex);
}
}
+
$sheet->getStyle("{$startColumn}{$rowNumber}")->applyFromArray([
'font' => ['bold' => true],
'alignment' => [
@@ -1558,7 +1709,11 @@ class LeadsController extends BaseController
// Add subheaders
foreach ($header['subHeaders'] as $subHeader) {
- if ($type == 2 && $is_placement == false) {
+ if($type == 2 && in_array($subHeader, ['Quote Asked'])){
+ continue;
+ }
+
+ if ($is_placement == false) {
$sheet->setCellValue("{$columnLetter}{$subHeaderRow}", $subHeader);
}
@@ -1583,7 +1738,7 @@ class LeadsController extends BaseController
$length++;
}
}
-
+
if($header_actual_count == 1 && $type == 1){
$sheet->getColumnDimension('B')->setWidth(80);
}else{
@@ -1625,6 +1780,10 @@ class LeadsController extends BaseController
continue;
}
+ if($type == 2 && in_array($cellData['subth'], ['Quote Asked'])){
+ continue;
+ }
+
if ($cellData['parentth'] == 'Sno') {
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no);
} else {
@@ -1651,7 +1810,7 @@ class LeadsController extends BaseController
//premium data
if ($type == 2) {
- if($is_placement == true){$columnLetterForPremium = "B";}else{$columnLetterForPremium = "C";}
+ if($is_placement == true){$columnLetterForPremium = "B";}else{$columnLetterForPremium = "B";}
$rowNumber += 2;
// Add premium data
@@ -1665,20 +1824,20 @@ class LeadsController extends BaseController
// $gstAmt = [$labelArray[1]];
// $total = [$labelArray[2]];
- if($is_placement == true){
+ // if($is_placement == true){
$premium[] = $labelArray[0];
$gstAmt[] = $labelArray[1];
$total[] = $labelArray[2];
- }
+ // }
foreach ($premiumData as $proposal => $insurers) {
if ($proposal != 'Particulars') {
foreach ($insurers as $insurer => $values) {
if($insurer == 'Quote Asked'){
- $premium[] = count($insurers ?? []) > 1 ? $labelArray[0] : "";
+ // $premium[] = count($insurers ?? []) > 1 ? $labelArray[0] : "";
// $gst[] = "";
- $gstAmt[] = count($insurers ?? []) > 1 ? $labelArray[1] : "";
- $total[] = count($insurers ?? []) > 1 ? $labelArray[2] : "";
+ // $gstAmt[] = count($insurers ?? []) > 1 ? $labelArray[1] : "";
+ // $total[] = count($insurers ?? []) > 1 ? $labelArray[2] : "";
}else{
$premium[] = formatIndianCurrency($values[$labelArray[0]]);
// $gst[] = $values[$labelArray[1]];
@@ -1912,7 +2071,7 @@ class LeadsController extends BaseController
return true;
}
- public function calculateMembersDemography($params)
+ public function calculateMembersDemography($params, $returnType = null)
{
$lead_id = $params['lead_id'];
$lead_data = $this->leadsModel->find($lead_id);
@@ -1921,87 +2080,102 @@ class LeadsController extends BaseController
if (!$lead_data) {
return ['status' => 'failed', 'message' => 'Lead data not found'];
}
- if ($lead_data['file_name']) {
- // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx";
- //check physical file
- if (!file_exists($file_name_with_path)) {
- //file not found update status and reason
- $message = "Lead Physcial file not found";
- // echo $message;
- $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path));
- return ['status' => 'failed', 'message' => 'no physical file'];
- }
+ try{
+ if ($lead_data['file_name']) {
+ // $file_name_with_path = WRITEPATH . "/uploads/lead_files/NonPrintableCharacters.xlsx";
- $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
-
- //get members data
- $members_sheet = $spreadsheet->getSheet(0);
- $highestRowAndColumn = $members_sheet->getHighestRowAndColumn();
- // dd($highestRowAndColumn);
- $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
- $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members);
- //get age band data
- $age_band_sheet = $spreadsheet->getSheet(1);
- $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn();
- $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
-
-
- //check age or dob column
- $members_heading = $members[0];
- $available_col = null;
- $col_index = null;
-
- if (in_array('age', array_map('strtolower', $members_heading))) {
- $available_col = 'age';
- $col_index = array_search('age', array_map('strtolower', $members_heading));
- } elseif (in_array('dob', array_map('strtolower', $members_heading))) {
- $available_col = 'dob';
- $col_index = array_search('dob', array_map('strtolower', $members_heading));
- }
-
- if ($available_col == null) {
- $message = 'No DOB or Age column ';
- $this->myLogger->logme('error', ($message . $file_name_with_path));
- return ['status' => 'failed', 'message' => $message];
- }
- try {
- $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index);
- } catch (Exception $e) {
- return ['status' => 'fail', 'message' => $e->getMessage()];
- }
-
- try {
- $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/');
- if ($result['success']) {
- $this->myLogger->logme('error', "Spreadsheet generated successfully!");
-
- echo "Location: " . $result['fullpath'] . "\n";
- echo "Filename: " . $result['filename'] . "\n";
- $filePaths = [
- ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]],
- ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []],
- ];
- $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'];
- $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
- if ($result_merge) {
- // Call the delete function after the file is successfully created
- $deleteResponse = $this->deleteGeneratedFile($result['fullpath']);
-
- // Add delete message to response
- $response['deleteMessage'] = $deleteResponse['message'];
- return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully'];
- }
- } else {
- echo "Error generating spreadsheet: " . $result['error'];
+ //check physical file
+ if (!file_exists($file_name_with_path)) {
+ //file not found update status and reason
+ $message = "Lead Physcial file not found";
+ // echo $message;
+ $this->myLogger->logme('error', ($message . ' for file ' . $file_name_with_path));
+ return ['status' => 'failed', 'message' => 'no physical file'];
}
- } catch (Exception $e) {
- echo "Error: " . $e->getMessage();
- return ['status' => 'fail', 'message' => $e->getMessage()];
+
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
+
+ //get members data
+ $members_sheet = $spreadsheet->getSheet(0);
+ $highestRowAndColumn = $members_sheet->getHighestRowAndColumn();
+ // dd($highestRowAndColumn);
+ $uncleaned_members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
+ $members = ExcelSanitizeHelper::sanitizeArrayData($uncleaned_members);
+ //get age band data
+ $age_band_sheet = $spreadsheet->getSheet(1);
+ $highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn();
+ $age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
+
+
+ //check age or dob column
+ $members_heading = $members[0];
+ $available_col = null;
+ $col_index = null;
+
+ if (in_array('age', array_map('strtolower', $members_heading))) {
+ $available_col = 'age';
+ $col_index = array_search('age', array_map('strtolower', $members_heading));
+ } elseif (in_array('dob', array_map('strtolower', $members_heading))) {
+ $available_col = 'dob';
+ $col_index = array_search('dob', array_map('strtolower', $members_heading));
+ }
+
+ if ($available_col == null) {
+ $message = 'No DOB or Age column ';
+ $this->myLogger->logme('error', ($message . $file_name_with_path));
+ return ['status' => 'failed', 'message' => $message];
+ }
+
+ try {
+ $classifiers = $this->getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index);
+ } catch (Exception $e) {
+ return ['status' => 'fail', 'message' => $e->getMessage()];
+ }
+
+ //for this to view the demography in the RFQ and QCR page to using internal
+ if($returnType == "internal"){
+ return ['data' => $classifiers];
+ // print_rr($classifiers); die;
+ }
+
+
+ try {
+ $result = $this->generateClassifierSpreadsheet($classifiers, WRITEPATH . 'uploads/lead_files/');
+ if ($result['success']) {
+ $this->myLogger->logme('error', "Spreadsheet generated successfully!");
+
+ echo "Location: " . $result['fullpath'] . "\n";
+ echo "Filename: " . $result['filename'] . "\n";
+ $filePaths = [
+ ['file_path' => WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'], 'sheets' => [0, 1]],
+ ['file_path' => WRITEPATH . '/uploads/lead_files/' . $result['filename'], 'sheets' => []],
+ ];
+ $outputPath = WRITEPATH . 'uploads/lead_files/' . $lead_data['file_name'];
+ $result_merge = ExcelMergeHelper::mergeExcelFiles($filePaths, $outputPath);
+ if ($result_merge) {
+ // Call the delete function after the file is successfully created
+ $deleteResponse = $this->deleteGeneratedFile($result['fullpath']);
+
+ // Add delete message to response
+ $response['deleteMessage'] = $deleteResponse['message'];
+ return ['status' => 'success', 'message' => 'Member_Data Merged Suceesfully'];
+ }
+ } else {
+ echo "Error generating spreadsheet: " . $result['error'];
+ }
+ } catch (Exception $e) {
+ echo "Error: " . $e->getMessage();
+ return ['status' => 'fail', 'message' => $e->getMessage()];
+ }
+ } else {
+ $this->myLogger->logme('error', (' no file found ' . $file_name_with_path));
+ return ['status' => 'failed', 'message' => 'no file found'];
}
- } else {
- $this->myLogger->logme('error', (' no file found ' . $file_name_with_path));
- return ['status' => 'failed', 'message' => 'no file found'];
+
+ }catch(Exception $e){
+ $this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
+ return ['status' => 'fail', 'error' => "File not found / Wrong file"];
}
}
@@ -4668,4 +4842,55 @@ class LeadsController extends BaseController
return [];
}
+
+
+ public function generateDemographyDataTable($param)
+ {
+ $returnData = $this->calculateMembersDemography($param, "internal");
+
+ $html = "";
+
+ if (isset($returnData['data'])) {
+
+ $data = $returnData['data'];
+ foreach ($data as $category => $records) {
+ // Extract all column headers (age groups) dynamically
+ $allColumns = [];
+ foreach ($records as $person => $ages) {
+ $allColumns = array_merge($allColumns, array_keys($ages));
+ }
+ $allColumns = array_unique($allColumns);
+ $allColumns = array_values($allColumns); // reset index
+
+ $category = ucfirst($category);
+
+ // Start table with clean styling
+ $html .= "
{$category}
";
+ $html .= "";
+
+ // Table header with light background
+ $html .= "";
+ $html .= "| Relation | ";
+ foreach ($allColumns as $col) {
+ $html .= "{$col} | ";
+ }
+ $html .= "
";
+
+ // Table rows with clean styling
+ foreach ($records as $relation => $ages) {
+ $html .= "";
+ $html .= "| {$relation} | ";
+ foreach ($allColumns as $col) {
+ $value = isset($ages[$col]) ? $ages[$col] : "-";
+ $html .= "{$value} | ";
+ }
+ $html .= "
";
+ }
+
+ $html .= "
";
+ }
+ }
+
+ return $html;
+ }
}
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index dddedd54..d6bc5167 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -35,6 +35,7 @@ use App\Models\COShareStmtDetailsModel;
use App\Models\BdsPlacementModel;
use Kint\Kint;
use App\Helpers\MailHelper;
+use App\Helpers\ExcelSanitizeHelper;
use Exception;
class PolicyTransactionController extends BaseController
@@ -2270,6 +2271,7 @@ class PolicyTransactionController extends BaseController
// dd($highestRowAndColumn);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]);
+ $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
// Kint::dump($excel_data);die();
//get no of line items and update in DB
$line_items = 0;
@@ -2384,6 +2386,7 @@ class PolicyTransactionController extends BaseController
// dd($highestRowAndColumn);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]);
+ $excel_data = ExcelSanitizeHelper::sanitizeArrayData($excel_data);
// dd($excel_data);
//get no of line items and update in DB
$line_items = count($excel_data);
diff --git a/app/Controllers/ThzController.php b/app/Controllers/ThzController.php
new file mode 100644
index 00000000..6613cb6b
--- /dev/null
+++ b/app/Controllers/ThzController.php
@@ -0,0 +1,119 @@
+thzMasterModel = new ThzMasterModel();
+ $this->thzMasterNotesModel = new ThzMasterNotesModel();
+ $this->thzControllerCleaner = new ThzControllerCleaner();
+ }
+
+ public function index()
+ {
+ //
+ }
+
+ public function ticketCreation(){
+
+ $data = $this->request->getJSON(true);
+
+ $result = $this->thzMasterModel->insert($data);
+
+ return $this->response->setJSON((['status' => 'success', 'message' => 'Ticket created successfully']));
+
+ }
+
+ public function ticketList(){
+
+ $data = $this->request->getJson(true);
+
+ $id = $data['id'] ?? null;
+
+ if ( isset($id) && !empty($id) ) {
+ //Find Specific Ticket per id
+ $mobile = $data['mobile'] ?? null;
+ $result = $this->thzMasterModel->where('mobile',$mobile)->findAll();
+ }else{
+ // Find all the Ticket For the Manager who can see all the Tickets
+ $result = $this->thzMasterModel->findAll();
+ }
+
+ if(empty($result)){
+ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
+ }
+
+ return $this->response->setJSON((['status' => 'success', 'data' => $result]));
+
+ }
+
+
+ public function ticketConversationSave(){
+
+ $data = $this->request->getJson(true);
+
+ $result = $this->thzMasterNotesModel->insert($data);
+
+ if(empty($result)){
+ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
+ }
+
+ return $this->response->setJSON((['status' => 'success', 'data' => $result]));
+
+
+ }
+
+ public function conversationListPerTicket(){
+
+ $data = $this->request->getJson(true);
+
+ $thz_id = $data['thz_id'] ?? null;
+
+ $result = $this->thzMasterNotesModel->conversationListPerTicket($thz_id);
+
+ if(empty($result)){
+ return $this->response->setJSON((['status' => 'error', 'message' => 'No tickets found']));
+ }
+
+ return $this->response->setJSON((['status' => 'success', 'data' => $result]));
+
+ }
+
+
+
+
+ /************************************************** PRIVATE FUNCTIONS ********************************************************/
+
+
+ private function checkGeneralUserOrEmployee($data){
+
+ if($data['empcode']){
+ return $data['empcode'];
+ } elseif ($data['mobile']) {
+ return $data['mobile'];
+ } elseif ($data['email']) {
+ return $data['email'];
+ } else {
+ return null;
+ }
+
+ }
+
+
+
+}
diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php
index 5e119628..4c344c28 100644
--- a/app/Controllers/TicketController.php
+++ b/app/Controllers/TicketController.php
@@ -95,6 +95,7 @@ class TicketController extends BaseController
4 => "Smart Service Desk",
5 => "Direct to TPA"
];
+
$this->claimType = [
1 => [
1 => "Main Hospitalization",
@@ -829,11 +830,25 @@ class TicketController extends BaseController
$data['ticket_data'] = $ticket_data;
$data['acms'] = $this->employeeModel->getAcmUsingClientID($ticket_data['client_id']);
- $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ;
-
- $decoded_top = json_decode($raw_json ?? "", true) ?? [];
- $data['policy_terms'] = $this->recursive_json_decode($decoded_top);
+ // do not remove this
+ // $raw_json = $this->ticketMasterModel->getPolicyTermsJson($ticket_id) ;
+ // $decoded_top = json_decode($raw_json ?? "", true) ?? [];
+ // $data['policy_terms'] = $this->recursive_json_decode($decoded_top);
+
+ $policy_data = $this->ticketMasterModel
+ ->select('client_policy.policy_terms')
+ ->join('client_policy', 'ticket_master.client_policy_id = client_policy.id')
+ ->where('client_policy.is_active', 1)
+ ->where('ticket_master.is_active', 1)
+ ->where('ticket_master.id', $ticket_id)
+ ->first();
+
+ if(isset($policy_data['policy_terms']) && !empty($policy_data['policy_terms'])){
+ $terms = json_decode($policy_data['policy_terms'], true);
+ $data['policy_terms'] = $this->convertTermsToDisplay($terms);
+ // print_rr($data); die;
+ }
return $this->loadLayout('ticket_edit_onbording', $data);
}
@@ -2232,7 +2247,8 @@ class TicketController extends BaseController
}
}
- public function recursive_json_decode($input) {
+ public function recursive_json_decode($input)
+ {
if (is_string($input)) {
$decoded = json_decode($input, true);
if (json_last_error() === JSON_ERROR_NONE) {
@@ -2251,6 +2267,182 @@ class TicketController extends BaseController
return $input;
}
+ function convertTermsToDisplay(array $data)
+ {
+ $result = [];
+
+ $LableKeys = [
+ "sum_insured" => "Sum Insured",
+ "family_floater" => "Family Floater",
+ "family_floaters" => "Family Floater Details",
+ "age_ratio" => "Age Ratio",
+ "is_payable_employee" => "Payable by Employee",
+ "waiverofpreexistingdiseases" => "Waivers of Pre Existing Diseases",
+ "waiverof1,2,3&4thyearexclusions" => "Waivers of 1, 2, 3 & 4th Year Exclusions",
+ "waiverof30dayswaitingperiod" => "Waivers of 30 Days Waiting Period",
+ "waiver_of_90_days_waiting_period" => "Waiver of 90 Days Waiting Period",
+ "waiver_of_other_waiting_periods" => "Waiver of Other Waiting Periods",
+ "maternity_benefit" => "Maternity Benefit",
+ "9monthwaitingperiodwaived" => "9 Month Waiting Period Waived",
+ "maternitycoverage" => "Maternity Coverage",
+ "twindelivery" => "Twin Delivery",
+ "well_baby_well_mother_expenses" => "Well Baby & Well Mother Expenses",
+ "preandpostnatal" => "Pre and Post Natal",
+ "infertility_treatment_coverage" => "Infertility Treatment Coverage",
+ "babyday1cover" => "Baby Day 1 Cover",
+ "coverfromthedateofjoining" => "Cover from the Date of Joining",
+ "mid_term_addition_of_new_born_newly_wedded_spouse" => "Mid Term Addition of New Born / Newly Wedded Spouse",
+ "prehospitalizationcover" => "Pre Hospitalization Cover",
+ "posthospitalizationcover" => "Post Hospitalization Cover",
+ "congenitaldiseasesinternal" => "Congenital Diseases - Internal",
+ "congenitaldiseasesexternal" => "Congenital Diseases - External",
+ "copayzonewisecopay" => "Co-Pay (Zone Wise)",
+ "roomrentlimit" => "Room Rent Limit",
+ "icu_limit" => "ICU Limit",
+ "proportionatedeductionclause" => "Proportionate Deduction Clause",
+ "ailmentcapping" => "Ailment Capping",
+ "ailment_capping_details" => "Ailment Capping Details",
+ "corporatebuffer" => "Corporate Buffer",
+ "non_admissible_contingency_corporate_buffer" => "Non-Admissible Contingency Corporate Buffer",
+ "ambulancecharges" => "Ambulance Charges",
+ "airambulance" => "Air Ambulance",
+ "reasonableandcustomarycharges" => "Reasonable and Customary Charges",
+ "daycaretreatment" => "Day Care Treatment",
+ "lasiksurgery" => "Lasik Surgery",
+ "ayudhtreatmentcover" => "Ayudh Treatment Cover",
+ "moderntreatmentsasperirdai" => "Modern Treatments as per IRDAI",
+ "opd_treatment" => "OPD Treatment",
+ "days_of_discharge" => "Days of Discharge",
+ "days_from_dod" => "Days from Date of Discharge",
+ "terrorism" => "Terrorism Cover",
+ "widower_cover" => "Widower Cover",
+ "breavement_cover" => "Breavement Cover",
+ "suminsuredenhancement" => "Sum Insured Enhancement",
+ "special_condition_label" => "Special Condition Label",
+ "special_condition_input" => "Special Condition Input"
+ ];
+
+ // // 1. Family Floaters
+ // $floatersMap = [
+ // 'self' => 'Self',
+ // 'spouse' => 'Spouse',
+ // 'childrens' => 'Childrens',
+ // 'parents' => 'Parents',
+ // 'parents-in-law' => 'Parents-in-law',
+ // 'either-parents-pil' => 'Either Parents/PIL',
+ // 'elders_count' => 'Elders'
+ // ];
+
+ // 1. Family Floaters
+ $floatersMap = [
+ 'self' => 'Self',
+ 'spouse' => 'Spouse',
+ 'childrens' => 'Childrens',
+ 'parents' => 'Parents',
+ 'parents-in-law' => 'Parents-in-law',
+ 'either-parents-pil' => 'Either Parents/PIL',
+ 'elders_count' => 'Total Elders Count'
+ ];
+
+ if(isset($data['family_floaters'])){
+ $floatersOutput = [];
+ foreach ($floatersMap as $key => $label) {
+ if (isset($data['family_floaters'][$key])) {
+ $val = $data['family_floaters'][$key];
+ $floatersOutput[] = "$label : " . ($val > 0 ? $val : 'No');
+ }
+ }
+ $data['family_floaters'] = implode(', ', $floatersOutput);
+ }
+
+ // 2. Age Ratio
+ if (!empty($data['age_ratio'])) {
+ $ageOutput = [];
+ foreach ($data['age_ratio'] as $person => $age) {
+ if (isset($age['min']) && isset($age['max'])) {
+ // $ageOutput[] = ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}";
+ $ageOutput[] = "" . ucfirst($person) . " - Min : {$age['min']}, Max : {$age['max']}";
+ }
+ }
+ $data['age_ratio'] = implode(', ', $ageOutput);
+ }
+
+ // 3. Is Payable Employee
+ if (!empty($data['is_payable_employee'])) {
+ $payableOutput = [];
+ foreach ($data['is_payable_employee'] as $person => $status) {
+ // $payableOutput[] = ucfirst($person) . " : " . ($status ? 'Yes' : 'No');
+ $payableOutput[] = "" . ucfirst($person) . " : " . ($status ? 'Yes' : 'No');
+ }
+ $data['is_payable_employee'] = implode(', ', $payableOutput);
+ }
+
+ // 4. Remove the Enrollment display key
+ if(isset($data['enrollment_display_key'])){
+ unset($data['enrollment_display_key']);
+ }
+
+ // 5. Merge the Sum Insured value if the multiple sum insured exists
+ if(isset($data['multiple_sum_insured'])){
+ if(isset($data['sumInsured2'])){
+ $data['sumInsured2'] = $data['sumInsured2'] . ", " . implode(", ", $data['multiple_sum_insured']);
+ }else{
+ $data['sum_insured'] = $data['sum_insured'] . ", " . implode(", ", $data['multiple_sum_insured']);
+ }
+ unset($data['multiple_sum_insured']);
+ }
+
+ // 6. Add the special condition to key value pair
+
+ if(!empty($data['special_condition_label'])){
+ foreach ($data['special_condition_label'] as $key => $value) {
+ if($value != "" && $value != null) {
+ $data[$value] = $data['special_condition_input'][$key];
+ }
+ }
+ }//GMC
+
+ if(!empty($data['gpa_special_condition_label'])){
+ foreach ($data['gpa_special_condition_label'] as $key => $value) {
+ if($value != "" && $value != null) {
+ $data[$value] = $data['gpa_special_condition_input'][$key];
+ }
+ }
+ }//GPA
+
+ // 7. Remove the special condition keys
+ unset($data['special_condition_label']);
+ unset($data['special_condition_input']);
+ unset($data['gpa_special_condition_label']);
+ unset($data['gpa_special_condition_input']);
+
+ if(isset($data['sumInsured2'])){
+ $firstItem = ["Sum Insured" => $data['sumInsured2']];
+ unset($data['sumInsured2']);
+ $data = $firstItem + $data;
+ }
+
+ // 8. Change the key name to lable name
+ $result = [];
+ foreach ($data as $key => $value) {
+
+ // $label = isset($LableKeys[$key]) ? $LableKeys[$key] : $key;
+ if (isset($LableKeys[$key])) {
+ $label = $LableKeys[$key];
+ // echo "1";
+ } else {
+ // Handle camelCase first, then snake_case
+ $label = preg_replace('/(?request->getJSON(true);
+
+
+ helper('api');
+
+ $url = ''. getenv('VIDAL_API_BASE_URL').'/hospitalnetwork';
+ $method = 'POST';
+
+ $headers = [
+ 'Content-Type: application/json',
+ 'Authorization:'. getenv('VIDAL_API_KEY').'',
+ 'username:'. getenv('VIDAL_API_USERNAME').'',
+ 'password:'. getenv('VIDAL_API_PASSWORD').'',
+ 'policynumber:'. $postData['policyNo'] ?? '',
+ ];
+
+
+
+ $body = [];
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+
+ if($response['status'] != true){
+ return $this->response->setJSON([
+ 'status' => false,
+ 'message' => 'Token generation failed.',
+ 'data' => $response
+ ]);
+ }
+
+ return $this->response->setJSON($response);
+
+ }
+
+ public function eCardService(){
+
+ $postData = $this->request->getJSON(true);
+
+ helper('api');
+
+ $url = ''. getenv('VIDAL_API_BASE_URL').'/ecardservice';
+ $method = 'POST';
+
+
+ $headers = [
+ 'Content-Type: application/json',
+ 'Authorization:'.getenv('VIDAL_API_KEY').'',
+ 'username:' .getenv('VIDAL_API_USERNAME').'',
+ 'password:' .getenv('VIDAL_API_PASSWORD').'',
+ 'PolicyNo:' .$postData['PolicyNo'] ?? '',
+ 'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
+ ];
+
+ $body = [
+ ];
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+ if($response['status'] != true){
+ return $this->response->setJSON([
+ 'status' => false,
+ 'message' => 'Token generation failed.',
+ 'data' => $response
+ ]);
+ }
+
+ return $this->response->setJSON($response);
+
+ }
+
+ public function claimStatusCheck(){
+
+ $postData = $this->request->getJSON(true);
+
+ helper('api');
+
+ $url = ''. getenv('VIDAL_API_BASE_URL').'/claimpreauthservice';
+ $method = 'POST';
+
+ $headers = [
+ 'Content-Type: application/json',
+ 'Authorization:' .getenv('VIDAL_API_KEY').'',
+ 'username:' .getenv('VIDAL_API_USERNAME').'',
+ 'password:' .getenv('VIDAL_API_PASSWORD').'',
+ 'PolicyNo:' .$postData['policyNo'] ?? '',
+ 'enrollmentNo:' .$postData['enrollmentNo'] ?? '',
+ 'empNo:' .$postData['empNo'] ?? '',
+ 'startdate:' .$postData['startdate'] ?? '',
+ 'enddate:' .$postData['enddate'] ?? '',
+ 'tpaclaimNo:' .$postData['tpaclaimNo'] ?? ''
+ ];
+
+ $body = [];
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+ if($response['status'] != true){
+ return $this->response->setJSON([
+ 'status' => false,
+ 'message' => 'Token generation failed.',
+ 'data' => $response
+ ]);
+ }
+
+ return $this->response->setJSON($response);
+
+ }
+
+ public function newClaim(){
+
+ $postData = $this->request->getPost();
+
+ helper('api');
+
+ $url = ''. getenv('VIDAL_API_BASE_URL').'/submitClaim';
+ $method = 'POST';
+
+ $headers = [
+ 'Content-Type: multipart/form-data',
+ 'Authorization:' .getenv('VIDAL_API_KEY').'',
+ ];
+
+ $body = [
+ 'username:' .getenv('VIDAL_API_USERNAME').'',
+ 'password:' .getenv('VIDAL_API_PASSWORD').'',
+ 'PolicyNo:' .$postData['policyNo'] ?? '',
+ 'enrollmentId:' .$postData['enrollmentId'] ?? '',
+ 'typeOfClaim:' .$postData['typeOfClaim'] ?? '',
+ 'claimSubType:' .$postData['claimSubType'] ?? '',
+ 'requestedAmount:' .$postData['requestedAmount'] ?? '',
+ 'ailmentType:' .$postData['ailmentType'] ?? '',
+ 'admissionDate:' .$postData['admissionDate'] ?? '',
+ 'dischargeDate:' .$postData['dischargeDate'] ?? '',
+ 'hospitalName:' .$postData['hospitalName'] ?? '',
+ 'empanelmentNo:' .$postData['empanelmentNo'] ?? '',
+ 'documentType:' .$postData['documentType'] ?? '',
+ 'ailmentName:' .$postData['ailmentName'] ?? '',
+ 'hospitalAddress:' .$postData['hospitalAddress'] ?? '',
+ 'hospitalState:' .$postData['hospitalState'] ?? '',
+ 'hospitalCity:' .$postData['hospitalCity'] ?? '',
+ 'hospitalPinCode:' .$postData['hospitalPinCode'] ?? '',
+ 'hospitalPhoneNo:' .$postData['hospitalPhoneNo'] ?? ''
+ ];
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+ if($response['status'] != true){
+ return $this->response->setJSON([
+ 'status' => false,
+ 'message' => 'Token generation failed.',
+ 'data' => $response
+ ]);
+ }
+
+ return $this->response->setJSON($response);
+
+ }
+
+
+ public function enrollment(){
+
+ $postData = $this->request->getJSON(true);
+
+ helper('api');
+
+ $url = ''. getenv('VIDAL_API_BASE_URL').'/enrollmendataservice';
+ $method = 'POST';
+
+ $headers = [
+ 'Content-Type: application/json',
+ 'Authorization:'. getenv('VIDAL_API_KEY').'',
+ 'username:' . getenv('VIDAL_API_USERNAME').'',
+ 'password:' . getenv('VIDAL_API_PASSWORD').'',
+ 'policyNo:' .$postData['policyNo'] ?? '',
+ 'startindex:' .$postData['startindex'] ?? '',
+ 'endindex:' .$postData['endindex'] ?? ''
+ ];
+
+ $body = [
+ ];
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+
+ if($response['status'] != true){
+ return $this->response->setJSON([
+ 'status' => false,
+ 'message' => 'Token generation failed.',
+ 'data' => $response
+ ]);
+ }
+
+ return $this->response->setJSON($response);
+ }
+
+
+}
diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php
index ba9b2fcd..c1249a7d 100644
--- a/app/Models/PolicyTransactionModel.php
+++ b/app/Models/PolicyTransactionModel.php
@@ -767,11 +767,17 @@ class PolicyTransactionModel extends Model
) AS unbilled_amt,
created_user.first_name as user_name,
CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
-
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
// ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
@@ -993,10 +999,17 @@ class PolicyTransactionModel extends Model
DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at,
user_profiles.first_name as user_name,
CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1068,7 +1081,7 @@ class PolicyTransactionModel extends Model
{
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
$builder = $this->db->table('policy_transaction')
- ->select('
+ ->select("
policy_transaction.*,
clients.short_name as client_short_name,
clients.client_code,
@@ -1077,11 +1090,18 @@ class PolicyTransactionModel extends Model
insurers.short_name AS insurer_short_name,
policy_type.policy_type ,
CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
- ')
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
+ ")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
@@ -1245,12 +1265,17 @@ class PolicyTransactionModel extends Model
2
) AS variance_amt,
CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
-
-
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
@@ -1348,10 +1373,17 @@ class PolicyTransactionModel extends Model
'pt_co_share_details.tep_amt',
'policy_transaction.status',
'CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`'
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ""
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no'
])
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1443,10 +1475,17 @@ class PolicyTransactionModel extends Model
pt_co_share_details.variance,
policy_transaction.status,
CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1554,11 +1593,18 @@ class PolicyTransactionModel extends Model
AND inv_payment_details.is_active = 1
),
2) AS outstanding_amount,
- CASE
- WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
- WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
- ELSE `policy_transaction`.`policy_no` -- Default fallback
- END AS `policy_no`
+ CASE
+ WHEN pt_co_share_details.co_share_type IN (0, 1)
+ THEN policy_transaction.policy_no
+ WHEN pt_co_share_details.co_share_type > 1
+ THEN CASE
+ WHEN pt_co_share_details.follower_policy_no IS NULL
+ OR pt_co_share_details.follower_policy_no = ''
+ THEN policy_transaction.policy_no
+ ELSE pt_co_share_details.follower_policy_no
+ END
+ ELSE policy_transaction.policy_no
+ END AS policy_no
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
diff --git a/app/Models/ThzMasterModel.php b/app/Models/ThzMasterModel.php
new file mode 100644
index 00000000..410a84ba
--- /dev/null
+++ b/app/Models/ThzMasterModel.php
@@ -0,0 +1,42 @@
+ $thz_id ];
+
+ $result = $this->db->query($sql,$binds)->getResultArray() ;
+
+ return $result;
+
+ }
+
+
+}
diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php
index 08e08855..b0cefc4e 100755
--- a/app/Views/DashBoard.php
+++ b/app/Views/DashBoard.php
@@ -171,79 +171,109 @@
margin: 0 5px 10px!important;
}
+ .nav-link{
+ color:black !important;
+ background-color: #D4F5F6 !important;
+ font-size: small;
+ padding:8px;
+ border-radius: 10px !important;
+ }
+ .nav-link.active-tab {
+ color: white !important;
+ background-color: #00999E !important;
+ font-size: small;
+ padding:8px;
+ border-radius: 10px !important;
+
+ }
+ .tab-content-styles{
+ background-color:#F4F4F4;
+ margin-right:20px;
+ border-radius:25px!important;
+ min-height: 70vh !important;
+ }
+
+
+Dashboard
+