Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-04-30 14:59:40 +05:30
commit 45a94bbc02
11 changed files with 592 additions and 32 deletions

View File

@ -536,7 +536,8 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
$routes->get('insurer_wise_data/(:any)','BDSReportController::Insurer_wise_Data/$1');
$routes->get('bap_wise_data/(:any)','BDSReportController::Bap_Wise_Data/$1');
$routes->match( ['get', 'post'], 'renewal_report','BDSReportController::renewalReport');
$routes->get('getTATReport','BDSReportController::bdsTATReport');
$routes->get("getMultiReport/(:any)", "BDSReportController::getMultiReport/$1");
});
//New Tickets

View File

@ -33,6 +33,7 @@ class BDSReportController extends AdminController
protected $PTCOShareDetailsModel;
protected $coShareStmtDetailsModel;
protected $policyTypeModel;
protected $policyTatReportType;
public function __construct()
{
@ -46,6 +47,13 @@ class BDSReportController extends AdminController
$this->PTCOShareDetailsModel = new PTCOShareDetailsModel();
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
$this->policyTypeModel = new PolicyTypeModel();
$this->policyTatReportType = [
'1' => "TAT Band Wise report",
'2' => "Account Manger Status Wise Report",
'3' => "Account Manger TAT Wise Report"
];
}
// public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate)
@ -209,7 +217,7 @@ class BDSReportController extends AdminController
$html = view('bds_report_bap_wise_data', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
} else if($report_type == 'bapInsurer'){
} else if ($report_type == 'bapInsurer') {
//Condition for BAP Insurer wise date
$category = $category == 'life' ? 1 : 0;
@ -217,8 +225,7 @@ class BDSReportController extends AdminController
$html = view('irda_bap_insurer_report_list', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else if($report_type == 'bapClient'){
} else if ($report_type == 'bapClient') {
//Condition for BAP Client wise date
$category = $category == 'life' ? 1 : 0;
@ -226,8 +233,7 @@ class BDSReportController extends AdminController
$html = view('irda_bap_client_report_list', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else if($report_type == 'client'){
} else if ($report_type == 'client') {
//Condition for Client wise date
$category = $category == 'life' ? 1 : 0;
@ -517,7 +523,7 @@ class BDSReportController extends AdminController
if (!empty($start_date) && !empty($end_date)) {
$fromDate = change_date_format($start_date);
$toDate = change_date_format($end_date);
$toDate = change_date_format($end_date);
}
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
@ -597,7 +603,7 @@ class BDSReportController extends AdminController
// $db = db_connect();
// $builder = $db->query("
// select ins.id, ins.name as insurer_name,
// -- Health Policies
@ -706,7 +712,7 @@ class BDSReportController extends AdminController
// life_premium DESC,
// marine_cargo_premium DESC,
// marine_hull_premium DESC;
// ");
// // Get the query
@ -745,7 +751,7 @@ class BDSReportController extends AdminController
// $db = db_connect();
// $builder = $db->query("
// SELECT
// c.id AS client_id,
// c.client_name,
@ -808,7 +814,7 @@ class BDSReportController extends AdminController
// life_premium DESC,
// marine_cargo_premium DESC,
// marine_hull_premium DESC
// ");
// // Get the query
@ -847,11 +853,11 @@ class BDSReportController extends AdminController
// $db = db_connect();
// $builder = $db->query("
// select
// c.id as client_id,
// c.client_name,
// (
// select
// count(policy_transaction.id)
@ -862,7 +868,7 @@ class BDSReportController extends AdminController
// and policy_transaction.is_active = 1
// ) as policy_count,
// COALESCE((
// select
// sum(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt) as premium
@ -873,9 +879,9 @@ class BDSReportController extends AdminController
// and stmt.is_active = 1
// and ptco.is_active = 1
// and pt.is_active = 1
// ), 0) as premium
// from clients c
// 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 and policy_type.policy_category = $category
@ -910,7 +916,6 @@ class BDSReportController extends AdminController
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['page_name'] = "Renewal Report";
return $this->loadLayout('renewal_search', $data);
} else {
$fromDate = $this->request->getPost('fromDate');
@ -927,4 +932,224 @@ class BDSReportController extends AdminController
return $this->respond(['status' => true, 'html' => $html], 200);
}
}
public function bdsTATReport()
{
$sql = "
SELECT
tc.TAT_Category,
COALESCE(SUM(CASE WHEN subquery.status = 'under_process' THEN 1 ELSE 0 END), 0) AS `Under Process`,
COALESCE(SUM(CASE WHEN subquery.status = 'client_pending' THEN 1 ELSE 0 END), 0) AS `Client Pending`,
COALESCE(SUM(CASE WHEN subquery.status = 'insurer_pending' THEN 1 ELSE 0 END), 0) AS `Insurer Pending`,
COALESCE(SUM(CASE WHEN subquery.status = 'instalment_pending' THEN 1 ELSE 0 END), 0) AS `Instalment Pending`,
COALESCE(SUM(CASE WHEN subquery.status = 'co_insurer_pending' THEN 1 ELSE 0 END), 0) AS `Co-Insurer Pending`,
COALESCE(SUM(CASE WHEN subquery.status = 'tpa_pending' THEN 1 ELSE 0 END), 0) AS `TPA Pending`,
COALESCE(SUM(CASE WHEN subquery.status = 'validated' THEN 1 ELSE 0 END), 0) AS `Validated`,
COALESCE(SUM(CASE WHEN subquery.status = 'cancelled' THEN 1 ELSE 0 END), 0) AS `Cancelled`,
COALESCE(SUM(CASE WHEN subquery.status = 'completed' THEN 1 ELSE 0 END), 0) AS `Completed`,
COALESCE(SUM(CASE WHEN subquery.status = 'lost' THEN 1 ELSE 0 END), 0) AS `Lost` FROM
(
SELECT 'Above 12 Days' AS TAT_Category
UNION ALL
SELECT '9-12 Days'
UNION ALL
SELECT '5-8 Days'
UNION ALL
SELECT '0-4 Days'
) AS tc
LEFT JOIN (
SELECT
pt.id AS policy_id,
ls.status,
CASE
WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 0 AND 4 THEN '0-4 Days'
WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 5 AND 8 THEN '5-8 Days'
WHEN DATEDIFF(CURRENT_DATE, pt.created_at) BETWEEN 9 AND 12 THEN '9-12 Days'
ELSE 'Above 12 Days'
END AS TAT_Category
FROM
policy_transaction pt
LEFT JOIN (
SELECT
pts1.*
FROM
policy_transaction_status pts1
INNER JOIN (
SELECT
policy_tran_id,
MAX(created_at) AS max_created_at
FROM
policy_transaction_status
WHERE is_active = 1
GROUP BY policy_tran_id
) pts2
ON pts1.policy_tran_id = pts2.policy_tran_id
AND pts1.created_at = pts2.max_created_at
WHERE pts1.is_active = 1
) ls
ON pt.id = ls.policy_tran_id
WHERE pt.is_active = 1
) AS subquery
ON tc.TAT_Category = subquery.TAT_Category
GROUP BY
tc.TAT_Category
ORDER BY
FIELD(tc.TAT_Category, '0-4 Days', '5-8 Days' , '9-12 Days' , 'Above 12 Days' )
";
// Run the query
$db = \Config\Database::connect();
$query = $db->query($sql);
// Get the result
$result = $query->getResultArray();
// dd(db_connect()->getLastQuery(),$result);
$data['data'] = $result;
// dd($data, get_role_id(), ENROLLMENT_TEAM_ID, user_team());
// return $this->loadLayout('bds_tat_wise_report', $data);
return $result;
}
public function accountMangerStatusBDSReport()
{
$data['page_name'] = "Account Manager BDS Report";
$sql = "
SELECT
COALESCE(ACM_Name, 'Total') AS ACM_Name,
COALESCE(SUM(CASE WHEN status = 'instalment_pending' THEN 1 ELSE 0 END), 0) AS `Instalment Pending`,
COALESCE(SUM(CASE WHEN status = 'under_process' THEN 1 ELSE 0 END), 0) AS `Under Process`,
COALESCE(SUM(CASE WHEN status = 'client_pending' THEN 1 ELSE 0 END), 0) AS `Client Pending`,
COALESCE(SUM(CASE WHEN status = 'co_insurer_pending' THEN 1 ELSE 0 END), 0) AS `Co Insurer Pending`,
COALESCE(SUM(CASE WHEN status = 'tpa_pending' THEN 1 ELSE 0 END), 0) AS `TPA Pending`,
COALESCE(SUM(CASE WHEN status = 'validated' THEN 1 ELSE 0 END), 0) AS `Validated`,
COALESCE(SUM(CASE WHEN status = 'cancelled' THEN 1 ELSE 0 END), 0) AS `Cancelled`,
COALESCE(SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END), 0) AS `Completed`,
COALESCE(SUM(CASE WHEN status = 'lost' THEN 1 ELSE 0 END), 0) AS `Lost`,
COALESCE(SUM(CASE WHEN status = 'insurer_pending' THEN 1 ELSE 0 END), 0) AS `Insurer Pending`
FROM (
SELECT
up.first_name AS ACM_Name,
ls.status
FROM policy_transaction pt
JOIN clients c ON pt.client_id = c.id AND c.is_active = 1
JOIN client_rm crm ON crm.client_id = c.id AND crm.is_active = 1 AND crm.level = 3
JOIN user_profiles up ON up.id = crm.user_id AND up.is_active = 1
LEFT JOIN (
SELECT
pts1.policy_tran_id,
pts1.status,
pts1.created_at
FROM policy_transaction_status pts1
INNER JOIN (
SELECT
policy_tran_id,
MAX(created_at) AS max_created_at
FROM policy_transaction_status
WHERE is_active = 1
GROUP BY policy_tran_id
) pts2
ON pts1.policy_tran_id = pts2.policy_tran_id
AND pts1.created_at = pts2.max_created_at
WHERE pts1.is_active = 1
) ls ON pt.id = ls.policy_tran_id
WHERE pt.is_active = 1
AND DATEDIFF(CURDATE(), ls.created_at) >= 4
) AS sub
GROUP BY ACM_Name;
";
$db = \Config\Database::connect();
$query = $db->query($sql);
// Get the result
$result = $query->getResultArray();
return $result;
}
public function accountManagerTatBDSReport(){
$sql = "
SELECT
COALESCE(ACM_Name, 'Total') AS ACM_Name,
COALESCE(SUM(CASE WHEN tat_bucket = '0-4 Days' THEN 1 ELSE 0 END), 0) AS `0-4 Days`,
COALESCE(SUM(CASE WHEN tat_bucket = '5-8 Days' THEN 1 ELSE 0 END), 0) AS `5-8 Days`,
COALESCE(SUM(CASE WHEN tat_bucket = '9-12 Days' THEN 1 ELSE 0 END), 0) AS `9-12 Days`,
COALESCE(SUM(CASE WHEN tat_bucket = 'Above 12 Days' THEN 1 ELSE 0 END), 0) AS `Above 12 Days`
FROM (
SELECT
up.first_name AS ACM_Name,
CASE
WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 0 AND 4 THEN '0-4 Days'
WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 5 AND 8 THEN '5-8 Days'
WHEN DATEDIFF(CURDATE(), ls.created_at) BETWEEN 9 AND 12 THEN '9-12 Days'
WHEN DATEDIFF(CURDATE(), ls.created_at) > 12 THEN 'Above 12 Days'
ELSE 'Unknown'
END AS tat_bucket
FROM policy_transaction pt
JOIN clients c ON pt.client_id = c.id AND c.is_active = 1
JOIN client_rm crm ON crm.client_id = c.id AND crm.is_active = 1 AND crm.level = 3
JOIN user_profiles up ON up.id = crm.user_id AND up.is_active = 1
LEFT JOIN (
SELECT
pts1.policy_tran_id,
pts1.status,
pts1.created_at
FROM policy_transaction_status pts1
INNER JOIN (
SELECT
policy_tran_id,
MAX(created_at) AS max_created_at
FROM policy_transaction_status
WHERE is_active = 1
GROUP BY policy_tran_id
) pts2
ON pts1.policy_tran_id = pts2.policy_tran_id
AND pts1.created_at = pts2.max_created_at
WHERE pts1.is_active = 1
) ls ON pt.id = ls.policy_tran_id
WHERE pt.is_active = 1
AND ls.created_at IS NOT NULL
) AS sub
GROUP BY ACM_Name;
";
$db = \Config\Database::connect();
$query = $db->query($sql);
// Get the result
$result = $query->getResultArray();
return $result;
}
public function getMultiReport($report_type){
$data['page_name'] = "BDS Report";
if ($report_type == 1){
$data['page_title'] = "BDS TAT Report";
$data['data'] = $this->bdsTATReport();
}else if ($report_type == 2){
$data['page_title'] = "Account Manager Status Report";
$data['data'] = $this->accountMangerStatusBDSReport();
}else{
$data['page_title'] = "Account Manager TAT Report";
$data['data'] = $this->accountManagerTatBDSReport();
}
return $this->loadLayout('bds_multi_report', $data);
}
}

View File

@ -238,6 +238,7 @@ class DashboardController extends AdminController
// echo "<pre>";
$data['pendingActionsData'] = $pendingActionsData;
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
// dd($businessTeamData);
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
$data['businessTeamStatusData'] = $businessTeamStatusData;
$data['financeTeamStatusData'] = $financeTeamStatusData;
@ -257,6 +258,7 @@ class DashboardController extends AdminController
}
// dd(get_role_id(),user_team());
// dd($data);
$data['page_name'] = 'Dashboard';
@ -725,7 +727,6 @@ class DashboardController extends AdminController
'validated' => [],
'cancelled' => [],
'instalment_pending' => [],
'completed' => [],
];
// Loop through results and group them by their status

View File

@ -189,13 +189,23 @@ class TicketController extends BaseController
$isFromDashboard = $this->request->getPost("is_dashboard");
if (isset($isFromDashboard) && !empty($isFromDashboard) && $isFromDashboard == 1) {
if (isset($isFromDashboard) && !empty($isFromDashboard)){
$data['page_name'] = "Claims";
$data['ticket_data'] = $this->ticketSearch(3);
if ($isFromDashboard == 1) {
$data['ticket_data'] = $this->ticketSearch(3);
}else if ($isFromDashboard == 2){
$data['ticket_data'] = $this->ticketSearch(4);
}
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active', 1)->findAll();
// dd($data);
return $this->loadLayout('ticket_search', $data);
}else{
}
else{
$data['ticket_data'] = $this->ticketSearch();
$html = view('ticket_list', $data);
return $this->respond(['status' => true, 'html' => $html], 200);
@ -239,7 +249,7 @@ class TicketController extends BaseController
->groupBy('tm.id, tm.created_at, latest_history.created_at');
//action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard
//action 1 get last 100 rows, action 2 filter and get all rows related to that, action 3 gets according to dashboard, action 4 gets according to ACM
if ($action == 1) {
$query = $db->table('ticket_master tm')
@ -336,6 +346,16 @@ class TicketController extends BaseController
}
// dd($where);
} else if ($action == 4){
$acm_id = $this->request->getPost('ids');
// dd($acm_id);
if (!empty($acm_id)) {
$where = "tm.acm_id = $acm_id";
} else {
$where = '1 = 0'; // No valid IDs, return empty result
}
} else {
$search_data = $this->request->getPost();
// print_r($search_data); die()
@ -1364,7 +1384,8 @@ class TicketController extends BaseController
if ($received_data['report_type'] == "acc_manager_wise_status"){
$viewData['policy_type'] = $received_data['policy_type'];
$viewData['account_manager_wise_data'] = $this->ticketMasterModel->accountManagerWiseReport($policy_type,$fromDate,$toDate);
// print_rr($viewData);
// print_rr($viewData);die();
if ($policy_type == 1){
$viewData['column_order'] = [
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
@ -1382,6 +1403,7 @@ class TicketController extends BaseController
$ordered_data[] = $temp;
}
$viewData['tpa_wise_data'] = $ordered_data;
// print_rr($viewData);die();
$html = view('claims_report_acc_manager_wise', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else{
@ -1400,6 +1422,7 @@ class TicketController extends BaseController
$ordered_data[] = $temp;
}
$viewData['tpa_wise_data'] = $ordered_data;
// print_rr($viewData);die();
$html = view('claims_report_acc_manager_wise', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}

View File

@ -1335,6 +1335,8 @@ class PolicyTransactionModel extends Model
)
->where("th.last_policy_status_change <= '{$dateThreshold}'", null, false)
->where('policy_transaction.is_active', 1)
->where("policy_transaction.status is not null", null, false)
->whereNotIn("policy_transaction.status", ['completed'])
// ->where('policy_transaction.status', 'completed')
->where('(pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0)', null, false);
@ -1426,8 +1428,9 @@ class PolicyTransactionModel extends Model
// ->where('policy_transaction.status', 'completed')
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
->where('COALESCE(pt_co_share_details.actual_bp_amt, 0) + COALESCE(pt_co_share_details.actual_tp_amt, 0) + COALESCE(pt_co_share_details.actual_tep_amt, 0) = 0')
->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0');
->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0')
->where("policy_transaction.status is not null", null, false)
->whereNotIn("policy_transaction.status", ['completed']);
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {

View File

@ -607,6 +607,7 @@ class TicketMasterModel extends Model
// Construct the final SQL query
$sql = "
SELECT
user_profiles.id as ACM_ID,
user_profiles.first_name AS ACM_NAME,
$dynamicSelect,
($dynamicTotal) AS TOTAL
@ -623,7 +624,6 @@ class TicketMasterModel extends Model
";
$result = $this->db->query($sql)->getResultArray();
// dd($result);
return $result;
} else {
@ -677,6 +677,7 @@ class TicketMasterModel extends Model
// Construct the final SQL query
$sql = "
SELECT
user_profiles.id as ACM_ID,
user_profiles.first_name AS ACM_NAME,
$dynamicSelect,
($dynamicTotal) AS TOTAL,
@ -696,8 +697,9 @@ class TicketMasterModel extends Model
// Execute the query
$result = $this->db->query($sql)->getResultArray();
// print_rr($result);die();
return $result;
}
}

View File

@ -259,10 +259,10 @@
<?php include('endorsement_dash.php'); ?>
<?php include('enrollment_dash.php'); ?>
<?php } ?>
<?php if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<?php include('bds_dash.php'); ?>
<?php } ?>
<!--
<?php // if(in_array(get_role_id(), [1,2,3,5]) || (get_role_id() == 4 && in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()))) { ?>
<?php // include('bds_dash.php'); ?>
<?php // } ?> -->
</div>

View File

@ -0,0 +1,122 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
</style>
<div class="row">
<div class="col-12" id="second_page">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;"><?= $page_title ?></h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead>
<tr>
<?php
// Get headers dynamically
$headers = array_keys($data[0]);
foreach ($headers as $header): ?>
<th><?= esc($header) ?></th>
<?php endforeach; ?>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<?php
// Initialize column-wise totals
$columnTotals = array_fill_keys($headers, 0);
foreach ($data as $row):
$rowTotal = 0; // Initialize row total
?>
<tr>
<?php foreach ($row as $key => $value):
$numValue = is_numeric($value) ? (int) $value : 0;
if ($key != 'TAT_Category') {
$columnTotals[$key] += $numValue;
$rowTotal += $numValue;
}
?>
<td><?= esc($value) ?></td>
<?php endforeach; ?>
<td><strong><?= esc($rowTotal) ?></strong></td> <!-- Row Total -->
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<?php foreach ($columnTotals as $key => $total): ?>
<th><?= ($key == "TAT_Category" || $key == 'ACM_Name') ? "TOTAL" : esc($total) ?></th>
<?php endforeach; ?>
<th><strong><?= array_sum(array_filter($columnTotals, 'is_numeric')) ?></strong></th> <!-- Grand Total -->
</tr>
</tfoot>
</table>
</div>
</div> <!-- end card-body -->
</div> <!-- end card -->
</div> <!-- end col-12 -->
</div> <!-- end row -->
<script>
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'BDS TAT BAND WISE DATA',
},
{
extend: 'excel',
text: 'Excel',
title: 'BDS TAT BAND WISE DATA',
},
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
pageLength: 10,
ordering: false
});
} else {
console.error("Table not found.");
}
});
</script>

View File

@ -0,0 +1,122 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
.col-12 {
max-width: 98% !important;
}
.dataTables_filter {
position: absolute;
}
.right-align-input {
text-align: right;
}
</style>
<div class="row">
<div class="col-12" id="second_page">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">BDS TAT Band Wise Report</h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead>
<tr>
<?php
// Get headers dynamically
$headers = array_keys($data[0]);
foreach ($headers as $header): ?>
<th><?= esc($header) ?></th>
<?php endforeach; ?>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<?php
// Initialize column-wise totals
$columnTotals = array_fill_keys($headers, 0);
foreach ($data as $row):
$rowTotal = 0; // Initialize row total
?>
<tr>
<?php foreach ($row as $key => $value):
$numValue = is_numeric($value) ? (int) $value : 0;
if ($key != 'TAT_Category') {
$columnTotals[$key] += $numValue;
$rowTotal += $numValue;
}
?>
<td><?= esc($value) ?></td>
<?php endforeach; ?>
<td><strong><?= esc($rowTotal) ?></strong></td> <!-- Row Total -->
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<?php foreach ($columnTotals as $key => $total): ?>
<th><?= ($key == "TAT_Category") ? "TOTAL" : esc($total) ?></th>
<?php endforeach; ?>
<th><strong><?= array_sum(array_filter($columnTotals, 'is_numeric')) ?></strong></th> <!-- Grand Total -->
</tr>
</tfoot>
</table>
</div>
</div> <!-- end card-body -->
</div> <!-- end card -->
</div> <!-- end col-12 -->
</div> <!-- end row -->
<script>
$(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'BDS TAT BAND WISE DATA',
},
{
extend: 'excel',
text: 'Excel',
title: 'BDS TAT BAND WISE DATA',
},
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true,
pageLength: 10,
ordering: false
});
} else {
console.error("Table not found.");
}
});
</script>

View File

@ -18,6 +18,10 @@
.right-align-input {
text-align: right;
}
#scroll-horizontal-datatable tbody tr:hover {
background-color: #e0e0e0;
}
</style>
<div class="col-12">
@ -47,7 +51,7 @@
<?php foreach ($account_manager_wise_data as $row): ?>
<tr>
<?php foreach ($column_order as $col_name): ?>
<td><?= $row[$col_name] ?></td>
<td onclick = "redirectToClaimList(<?=$row['ACM_ID'] ?>)"><?= $row[$col_name] ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
@ -101,3 +105,37 @@
}
});
</script>
<script>
function redirectToClaimList(id) {
// alert("Redirecting to claim list..."+id);
data = {
is_dashboard: 2,
ids : id
}
redirectWithPost("<?= base_url("ticket/list") ?>", data);
}
function redirectWithPost(url, data = {}) {
const form = document.createElement('form');
form.method = 'POST';
form.action = url;
for (const key in data) {
if (data.hasOwnProperty(key)) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = key;
input.value = data[key];
form.appendChild(input);
}
}
document.body.appendChild(form);
form.submit();
}
</script>

View File

@ -758,11 +758,34 @@
<li>
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/getTATReport') ?>">TAT Band Reports</a>
</li>
<?php } ?>
</ul>
</div>
</li>
<?php } ?>
<li>
<a href="#policy_tat_report_type" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i>
<span> Policy TAT Reports </span>
</a>
<div class="collapse" id="policy_tat_report_type">
<ul class="nav-third-level">
<li>
<a href="<?= base_url('/bdsReport/getMultiReport/1') ?>">TAT Band Wise</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/getMultiReport/2') ?>">ACM Status Wise</a>
</li>
<li>
<a href="<?= base_url('/bdsReport/getMultiReport/3') ?>">ACM TAT Wise</a>
</li>
</ul>
</div>
</li>
<?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(BUSINESS_TEAM_ID, user_team()) )) { ?>
<li>