Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3a8d09ce34
@ -579,6 +579,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');
|
||||
|
||||
@ -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);
|
||||
@ -1965,12 +2124,20 @@ class LeadsController extends BaseController
|
||||
$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']) {
|
||||
@ -4668,4 +4835,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 .= "<h3 style='color: #333; font-weight: 500; margin-bottom: 15px;'>{$category}</h3>";
|
||||
$html .= "<table style='width: 100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>";
|
||||
|
||||
// Table header with light background
|
||||
$html .= "<tr>";
|
||||
$html .= "<th style='background-color: #f8f9fa; color: #495057; padding: 6px 8px; text-align: left; border: 1px solid #dee2e6; font-weight: 500;'>Relation</th>";
|
||||
foreach ($allColumns as $col) {
|
||||
$html .= "<th style='background-color: #f8f9fa; color: #495057; padding: 6px 8px; text-align: center; border: 1px solid #dee2e6; font-weight: 500;'>{$col}</th>";
|
||||
}
|
||||
$html .= "</tr>";
|
||||
|
||||
// Table rows with clean styling
|
||||
foreach ($records as $relation => $ages) {
|
||||
$html .= "<tr>";
|
||||
$html .= "<td style='padding: 5px 8px; border: 1px solid #dee2e6; background-color: #fff;'>{$relation}</td>";
|
||||
foreach ($allColumns as $col) {
|
||||
$value = isset($ages[$col]) ? $ages[$col] : "-";
|
||||
$html .= "<td style='padding: 5px 8px; border: 1px solid #dee2e6; text-align: center; background-color: #fff;'>{$value}</td>";
|
||||
}
|
||||
$html .= "</tr>";
|
||||
}
|
||||
|
||||
$html .= "</table>";
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="total_lives_at_incept" class="total_title"> Total Lives at Inception <span class="text-danger">*</span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives" required>
|
||||
<label for="total_lives_at_incept" class="total_title"> Total Lives at Inception <span class="text-danger"></span></label>
|
||||
<input value="<?= isset($lead_edit_data['total_lives_at_incept']) ? $lead_edit_data['total_lives_at_incept'] : '' ?>" type="text" class="form-control" id="total_lives_at_incept" name="total_lives_at_incept[]" placeholder="Enter Lives" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 renewalFields">
|
||||
|
||||
@ -258,6 +258,11 @@
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.demographyTable .table th,
|
||||
.demographyTable .table td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
@ -288,6 +293,7 @@
|
||||
onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<?php } ?>
|
||||
<button id="submitPlacement" class="btn btn-primary" onclick="checkTheTableDataChanged(6)">Placement</button>
|
||||
<button id="viewDemography" class="btn btn-primary" onclick="viewDemography()">view Demography</button>
|
||||
<input type="hidden" id="lead_id" name="lead_id" value="<?= isset($lead_id) ? $lead_id : '' ?>">
|
||||
<input type="hidden" id="rfq_primaryKey" name="rfq_primaryKey" value="<?= isset($rfq_data['id']) ? $rfq_data['id'] : '' ?>">
|
||||
<input type="hidden" id="qcr_count" value="<?= isset($qcr_count) ? $qcr_count : 0 ?>">
|
||||
@ -685,6 +691,30 @@
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Modal content for View Demography Mail -->
|
||||
<div class="modal fade" id="view_demography_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="false">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="demographyCenterModalLabel">Demography</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div style='max-height: 400px; overflow-y: auto; margin-bottom: 30px;'>
|
||||
<?php
|
||||
if(isset($demogrphy_html_data) && !empty($demogrphy_html_data)){
|
||||
echo $demogrphy_html_data;
|
||||
}else{
|
||||
echo "<p style='text-align: center; color: #6c757d; font-style: italic;'>No Demography Data Found</p>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
|
||||
var isFormDataModified = false;
|
||||
@ -6711,6 +6741,12 @@ function appendMultiFileData(data) {
|
||||
});
|
||||
}, 2000)
|
||||
})
|
||||
|
||||
function viewDemography(){
|
||||
// Show the modal
|
||||
const myModal = new bootstrap.Modal(document.getElementById('view_demography_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user