Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
c0d5d49a93
@ -130,6 +130,7 @@ class BDSReportController extends AdminController
|
|||||||
];
|
];
|
||||||
return $this->loadLayout('irba_report', $data);
|
return $this->loadLayout('irba_report', $data);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$fromDate = $this->request->getPost('fromDate');
|
$fromDate = $this->request->getPost('fromDate');
|
||||||
$toDate = $this->request->getPost('toDate');
|
$toDate = $this->request->getPost('toDate');
|
||||||
$category = $this->request->getPost('category');
|
$category = $this->request->getPost('category');
|
||||||
@ -150,6 +151,7 @@ class BDSReportController extends AdminController
|
|||||||
$html = view('bds_report_Insurer_wise_Data', $viewData);
|
$html = view('bds_report_Insurer_wise_Data', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
} else if ($report_type == 'bap') {
|
} else if ($report_type == 'bap') {
|
||||||
|
|
||||||
$life = $category == 'life' ? 1 : 0;
|
$life = $category == 'life' ? 1 : 0;
|
||||||
$viewData = $this->Bap_wise_Data($life, $fromDate, $toDate);
|
$viewData = $this->Bap_wise_Data($life, $fromDate, $toDate);
|
||||||
if (isset($data['message'])) {
|
if (isset($data['message'])) {
|
||||||
@ -163,6 +165,31 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
$html = view('bds_report_bap_wise_data', $viewData);
|
$html = view('bds_report_bap_wise_data', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
} else if($report_type == 'bapInsurer'){
|
||||||
|
|
||||||
|
//Condition for BAP Insurer wise date
|
||||||
|
$category = $category == 'life' ? 1 : 0;
|
||||||
|
$viewData['data'] = $this->getBAPInsurerData($category, $fromDate, $toDate);
|
||||||
|
|
||||||
|
$html = view('irda_bap_insurer_report_list', $viewData);
|
||||||
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
|
||||||
|
}else if($report_type == 'bapClient'){
|
||||||
|
|
||||||
|
//Condition for BAP Client wise date
|
||||||
|
$category = $category == 'life' ? 1 : 0;
|
||||||
|
$viewData['data'] = $this->getBAPClientData($category, $fromDate, $toDate);
|
||||||
|
|
||||||
|
$html = view('irda_bap_client_report_list', $viewData);
|
||||||
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
|
||||||
|
}else if($report_type == 'client'){
|
||||||
|
|
||||||
|
//Condition for Client wise date
|
||||||
|
$category = $category == 'life' ? 1 : 0;
|
||||||
|
$viewData['data'] = $this->getClientData($category, $fromDate, $toDate);
|
||||||
|
|
||||||
|
$html = view('irda_client_report_list', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,8 +211,8 @@ class BDSReportController extends AdminController
|
|||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
if (!empty($start_date) && !empty($end_date)) {
|
if (!empty($start_date) && !empty($end_date)) {
|
||||||
$fromDate = $start_date;
|
$fromDate = change_date_format($start_date);
|
||||||
$toDate = $end_date;
|
$toDate = change_date_format($end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||||
@ -242,7 +269,47 @@ class BDSReportController extends AdminController
|
|||||||
-- Marine Hull Policies
|
-- Marine Hull Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue,
|
||||||
|
|
||||||
|
-- Grand Totals
|
||||||
|
COALESCE(
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END)+
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END),
|
||||||
|
0
|
||||||
|
) AS total_policy_count,
|
||||||
|
|
||||||
|
COALESCE(
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END),
|
||||||
|
0
|
||||||
|
) AS total_premium,
|
||||||
|
|
||||||
|
COALESCE(
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||||
|
SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END),
|
||||||
|
0
|
||||||
|
) AS total_revenue
|
||||||
|
|
||||||
from insurers ins
|
from insurers ins
|
||||||
left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||||
@ -292,8 +359,8 @@ class BDSReportController extends AdminController
|
|||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
if (!empty($start_date) && !empty($end_date)) {
|
if (!empty($start_date) && !empty($end_date)) {
|
||||||
$fromDate = $start_date;
|
$fromDate = change_date_format($start_date);
|
||||||
$toDate = $end_date;
|
$toDate = change_date_format($end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||||
@ -339,7 +406,11 @@ class BDSReportController extends AdminController
|
|||||||
|
|
||||||
-- Marine Hull Policies
|
-- Marine Hull Policies
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium
|
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||||
|
|
||||||
|
-- Grand Totals
|
||||||
|
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
||||||
|
COALESCE(SUM(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt), 0) AS total_premium
|
||||||
|
|
||||||
FROM clients c
|
FROM clients c
|
||||||
LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||||
@ -390,8 +461,8 @@ class BDSReportController extends AdminController
|
|||||||
$toDate = date('Y-m-d 23:59:59');
|
$toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
if (!empty($start_date) && !empty($end_date)) {
|
if (!empty($start_date) && !empty($end_date)) {
|
||||||
$fromDate = $start_date;
|
$fromDate = change_date_format($start_date);
|
||||||
$toDate = $end_date;
|
$toDate = change_date_format($end_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||||
@ -428,12 +499,9 @@ class BDSReportController extends AdminController
|
|||||||
), 0) as premium
|
), 0) as premium
|
||||||
|
|
||||||
from clients c
|
from clients c
|
||||||
join policy_transaction on c.id = policy_transaction.client_id
|
join policy_transaction on c.id = policy_transaction.client_id AND policy_transaction.policy_issue_date >= '$fromDate' AND policy_transaction.policy_issue_date <= '$toDate'
|
||||||
join policy_type on policy_transaction.policy_type_id = policy_type.id
|
join policy_type on policy_transaction.policy_type_id = policy_type.id and policy_type.policy_category = $category
|
||||||
where c.is_active = 1
|
where c.is_active = 1
|
||||||
and policy_type.policy_category = $category
|
|
||||||
AND policy_transaction.policy_issue_date >= '$fromDate'
|
|
||||||
AND policy_transaction.policy_issue_date <= '$toDate'
|
|
||||||
group by client_name
|
group by client_name
|
||||||
order by premium desc
|
order by premium desc
|
||||||
");
|
");
|
||||||
|
|||||||
@ -4049,13 +4049,13 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$BDSReportController = new BDSReportController();
|
$BDSReportController = new BDSReportController();
|
||||||
|
|
||||||
$data['data'] = $BDSReportController->getBAPInsurerData();
|
// $data['data'] = $BDSReportController->getBAPInsurerData();
|
||||||
return $this->loadLayout('irda_bap_insurer_report_list', $data);
|
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
|
||||||
|
|
||||||
// $data['data'] = $BDSReportController->getBAPClientData();
|
$data['data'] = $BDSReportController->getBAPClientData();
|
||||||
// return $this->loadLayout('irda_bap_client_report_list', $data);
|
return $this->loadLayout('irda_bap_client_report_list', $data);
|
||||||
|
|
||||||
// $data['data'] = $BDSReportController->getClientData();
|
// $data['data'] = $BDSReportController->getClientData(1);
|
||||||
// return $this->loadLayout('irda_client_report_list', $data);
|
// return $this->loadLayout('irda_client_report_list', $data);
|
||||||
|
|
||||||
// $BDSReportController->getBAPClientData();
|
// $BDSReportController->getBAPClientData();
|
||||||
|
|||||||
@ -546,6 +546,7 @@ if (!function_exists('change_date_format')) {
|
|||||||
'Y,m,d', // 2024,12,01
|
'Y,m,d', // 2024,12,01
|
||||||
|
|
||||||
'd/m/Y', // 01/01/2025
|
'd/m/Y', // 01/01/2025
|
||||||
|
'd-m-Y', // 01-01-2025
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,9 @@
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$('#category').on('click', function(){
|
$('#category').on('click', function(){
|
||||||
|
|
||||||
var choosed_option = $('#category').val();
|
var choosed_option = $('#category').val();
|
||||||
|
$("#report_type").val('0');
|
||||||
if (choosed_option == 'life' ){
|
if (choosed_option == 'life' ){
|
||||||
$("#report_type option[value='insurer']").show();
|
$("#report_type option[value='insurer']").show();
|
||||||
$("#report_type option[value='bap']").hide();
|
$("#report_type option[value='bap']").hide();
|
||||||
|
|||||||
@ -33,6 +33,7 @@ table.dataTable tbody td {
|
|||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||||
|
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -47,6 +48,7 @@ table.dataTable tbody td {
|
|||||||
<th colspan="2" style="text-align: center;">Misc</th>
|
<th colspan="2" style="text-align: center;">Misc</th>
|
||||||
<th colspan="2" style="text-align: center;">Motor</th>
|
<th colspan="2" style="text-align: center;">Motor</th>
|
||||||
<th colspan="2" style="text-align: center;">Marine Hull</th>
|
<th colspan="2" style="text-align: center;">Marine Hull</th>
|
||||||
|
<th colspan="2" style="text-align: center;">Grand Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -56,42 +58,37 @@ table.dataTable tbody td {
|
|||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
<th>Policies</th>
|
||||||
|
<th>Premium</th>
|
||||||
|
|
||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
<th>Policies</th>
|
||||||
|
<th>Premium</th>
|
||||||
|
|
||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
<th>Policies</th>
|
||||||
|
<th>Premium</th>
|
||||||
|
|
||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
<th>Policies</th>
|
||||||
|
<th>Premium</th>
|
||||||
|
|
||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
|
||||||
<th>Policies</th>
|
<th>Policies</th>
|
||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
|
|
||||||
|
|
||||||
<th>Policies</th>
|
|
||||||
<th>Premium</th>
|
|
||||||
|
|
||||||
|
|
||||||
<th>Policies</th>
|
|
||||||
<th>Premium</th>
|
|
||||||
|
|
||||||
|
|
||||||
<th>Policies</th>
|
|
||||||
<th>Premium</th>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if (isset($data) && !empty($data)) { ?>
|
<?php if (isset($data) && !empty($data)) { ?>
|
||||||
|
|
||||||
@ -128,11 +125,53 @@ table.dataTable tbody td {
|
|||||||
<td class="right-align-input"><?php echo $row['motor_policy_count'] ?></td>
|
<td class="right-align-input"><?php echo $row['motor_policy_count'] ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
||||||
|
|
||||||
|
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
|
||||||
|
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Grand Total</th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -165,47 +204,9 @@ $(document).ready(function() {
|
|||||||
extend: 'excel',
|
extend: 'excel',
|
||||||
text: 'Excel',
|
text: 'Excel',
|
||||||
title: 'IRDA-BAP-CLIENT-List',
|
title: 'IRDA-BAP-CLIENT-List',
|
||||||
customize: function(xlsx) {
|
|
||||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
|
||||||
var total = 0;
|
|
||||||
|
|
||||||
// Find cells in column AB (28th column in Excel)
|
|
||||||
$('row c[r^="AB"]', sheet).each(function() {
|
|
||||||
var value = parseFloat($('v', this)
|
|
||||||
.text()); // Get the value inside the cell
|
|
||||||
if (!isNaN(value)) {
|
|
||||||
total += value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get the last row index and append the total row
|
|
||||||
var lastRow = $('row:last', sheet);
|
|
||||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
|
||||||
2; // Find the next row index
|
|
||||||
var totalRow = '<row r="' + rowIndex + '">' +
|
|
||||||
'<c t="inlineStr" r="AA' + rowIndex +
|
|
||||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
|
||||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
|
||||||
'</v></c>' + // Insert sum in AB
|
|
||||||
'</row>';
|
|
||||||
|
|
||||||
// Append the new total row to the sheet
|
|
||||||
$(sheet).find('sheetData').append(totalRow);
|
|
||||||
},
|
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
orthogonal: 'sort'
|
orthogonal: 'sort'
|
||||||
},
|
},
|
||||||
customizeData: function(data) {
|
|
||||||
for (var i = 0; i < data.body.length; i++) {
|
|
||||||
for (var j = 0; j < data.body[i].length; j++) {
|
|
||||||
// Check if the column is the 9th index (10th column)
|
|
||||||
if (j === 9) {
|
|
||||||
data.body[i][j] = '\u200C' + data.body[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
@ -214,8 +215,57 @@ $(document).ready(function() {
|
|||||||
searchPlaceholder: "Search..."
|
searchPlaceholder: "Search..."
|
||||||
},
|
},
|
||||||
paging: true, // Enable pagination
|
paging: true, // Enable pagination
|
||||||
pageLength: 25, // Set default number of rows per page (optional)
|
pageLength: 20, // Set default number of rows per page (optional)
|
||||||
ordering: false,
|
ordering: false,
|
||||||
|
footerCallback: function(row, data, start, end, display) {
|
||||||
|
var api = this.api();
|
||||||
|
|
||||||
|
// Helper function to parse numbers
|
||||||
|
var parseNumber = function(value) {
|
||||||
|
return typeof value === 'string'
|
||||||
|
? parseFloat(value.replace(/[\$,]/g, ''))
|
||||||
|
: typeof value === 'number'
|
||||||
|
? value
|
||||||
|
: 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define column groups for total calculations
|
||||||
|
var columnGroups = [
|
||||||
|
{ policy: 2, premium: 3 },
|
||||||
|
{ policy: 4, premium: 5},
|
||||||
|
{ policy: 6, premium: 7 },
|
||||||
|
{ policy: 8, premium: 9 },
|
||||||
|
{ policy: 10, premium: 11 },
|
||||||
|
{ policy: 12, premium: 13 },
|
||||||
|
{ policy: 14, premium: 15 },
|
||||||
|
{ policy: 16, premium: 17 },
|
||||||
|
{ policy: 18, premium: 19 },
|
||||||
|
{ policy: 20, premium: 21 }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Loop through each column group to calculate totals and update the footer
|
||||||
|
columnGroups.forEach(function(group) {
|
||||||
|
var totalPolicies = api
|
||||||
|
.column(group.policy)
|
||||||
|
.data()
|
||||||
|
.reduce(function(a, b) {
|
||||||
|
return parseNumber(a) + parseNumber(b);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
var totalPremium = api
|
||||||
|
.column(group.premium)
|
||||||
|
.data()
|
||||||
|
.reduce(function(a, b) {
|
||||||
|
return parseNumber(a) + parseNumber(b);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
// Update the footer
|
||||||
|
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
|
||||||
|
$(api.column(group.premium).footer()).html(
|
||||||
|
"₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error("Table atet found.");
|
console.error("Table atet found.");
|
||||||
|
|||||||
@ -46,6 +46,7 @@ table.dataTable tbody td {
|
|||||||
<th colspan="3" style="text-align: center;">Misc</th>
|
<th colspan="3" style="text-align: center;">Misc</th>
|
||||||
<th colspan="3" style="text-align: center;">Motor</th>
|
<th colspan="3" style="text-align: center;">Motor</th>
|
||||||
<th colspan="3" style="text-align: center;">Marine Hull</th>
|
<th colspan="3" style="text-align: center;">Marine Hull</th>
|
||||||
|
<th colspan="3" style="text-align: center;">Grand Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -88,9 +89,14 @@ table.dataTable tbody td {
|
|||||||
<th>Premium</th>
|
<th>Premium</th>
|
||||||
<th>Revenue</th>
|
<th>Revenue</th>
|
||||||
|
|
||||||
|
<th>Policies</th>
|
||||||
|
<th>Premium</th>
|
||||||
|
<th>Revenue</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if (isset($data) && !empty($data)) { ?>
|
<?php if (isset($data) && !empty($data)) { ?>
|
||||||
|
|
||||||
@ -136,11 +142,64 @@ table.dataTable tbody td {
|
|||||||
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['motor_revenue']; ?></td>
|
<td class="right-align-input"><?php echo $row['motor_revenue']; ?></td>
|
||||||
|
|
||||||
|
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
|
||||||
|
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||||
|
<td class="right-align-input"><?php echo $row['total_revenue']; ?></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Grand Total</th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
<th class="right-align-input"></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -222,8 +281,68 @@ $(document).ready(function() {
|
|||||||
searchPlaceholder: "Search..."
|
searchPlaceholder: "Search..."
|
||||||
},
|
},
|
||||||
paging: true, // Enable pagination
|
paging: true, // Enable pagination
|
||||||
pageLength: 25, // Set default number of rows per page (optional)
|
pageLength: 20, // Set default number of rows per page (optional)
|
||||||
ordering: false,
|
ordering: false,
|
||||||
|
footerCallback: function(row, data, start, end, display) {
|
||||||
|
var api = this.api();
|
||||||
|
|
||||||
|
// Helper function to parse numbers
|
||||||
|
var parseNumber = function(value) {
|
||||||
|
return typeof value === 'string'
|
||||||
|
? parseFloat(value.replace(/[\$,]/g, ''))
|
||||||
|
: typeof value === 'number'
|
||||||
|
? value
|
||||||
|
: 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define column groups for total calculations
|
||||||
|
var columnGroups = [
|
||||||
|
{ policy: 2, premium: 3, revenue: 4 },
|
||||||
|
{ policy: 5, premium: 6, revenue: 7 },
|
||||||
|
{ policy: 8, premium: 9, revenue: 10 },
|
||||||
|
{ policy: 11, premium: 12, revenue: 13 },
|
||||||
|
{ policy: 14, premium: 15, revenue: 16 },
|
||||||
|
{ policy: 17, premium: 18, revenue: 19 },
|
||||||
|
{ policy: 20, premium: 21, revenue: 22 },
|
||||||
|
{ policy: 23, premium: 24, revenue: 25 },
|
||||||
|
{ policy: 26, premium: 27, revenue: 28 },
|
||||||
|
{ policy: 29, premium: 30, revenue: 31 }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Loop through each column group to calculate totals and update the footer
|
||||||
|
columnGroups.forEach(function(group) {
|
||||||
|
var totalPolicies = api
|
||||||
|
.column(group.policy)
|
||||||
|
.data()
|
||||||
|
.reduce(function(a, b) {
|
||||||
|
return parseNumber(a) + parseNumber(b);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
var totalPremium = api
|
||||||
|
.column(group.premium)
|
||||||
|
.data()
|
||||||
|
.reduce(function(a, b) {
|
||||||
|
return parseNumber(a) + parseNumber(b);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
var totalRevenue = api
|
||||||
|
.column(group.revenue)
|
||||||
|
.data()
|
||||||
|
.reduce(function(a, b) {
|
||||||
|
return parseNumber(a) + parseNumber(b);
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
// Update the footer
|
||||||
|
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
|
||||||
|
$(api.column(group.premium).footer()).html(
|
||||||
|
"₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||||
|
);
|
||||||
|
$(api.column(group.revenue).footer()).html(
|
||||||
|
"₹ " + totalRevenue.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error("Table atet found.");
|
console.error("Table atet found.");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user