MERGE_UAT_DASHBOARD&REPORTS
This commit is contained in:
commit
23d0278be5
@ -323,8 +323,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("test_mail", "MasterController::testGmailAPI");
|
||||
$routes->post("test_mail", "MasterController::testGmailAPI");
|
||||
$routes->get("check_policy_no/(:any)", "ClientController::check_policy_no/$1");
|
||||
$routes->get("get_client_policy_data_using_policy_no/(:any)", "ClientController::get_client_policy_data_using_policy_no/$1");
|
||||
$routes->get("get_client_policy_data_using_policy_no_and_endo_no/(:any)", "ClientController::get_client_policy_data_using_policy_no_and_endo_no/$1");
|
||||
$routes->get("get_client_policy_data_using_policy_no", "ClientController::get_client_policy_data_using_policy_no");
|
||||
$routes->get("get_client_policy_data_using_policy_no_and_endo_no", "ClientController::get_client_policy_data_using_policy_no_and_endo_no");
|
||||
$routes->get("checkInvoiceStatus/(:any)", "PolicyTransactionController::checkInvoiceStatus/$1");
|
||||
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
||||
@ -362,7 +362,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("inception", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list", "PolicyTransactionController::viewInception");
|
||||
$routes->match(['get', 'post'], 'list', 'PolicyTransactionController::viewInception');
|
||||
$routes->post("create", "PolicyTransactionController::createInceptionPolicy");
|
||||
$routes->get("list/(:any)", "PolicyTransactionController::getInceptionDataForEdit/$1");
|
||||
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
|
||||
@ -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
|
||||
@ -554,6 +555,7 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
|
||||
$routes->post('getPolicyStartDate','TicketController::getPolicyStartDate');
|
||||
$routes->post("getPoliciesbyEmpID","TicketController::getPoliciesbyEmpID");
|
||||
$routes->post("getMoreInfo","TicketController::getMoreInfo");
|
||||
// $routes->post('ticket_messages','TicketController::getTicketMessage');
|
||||
});
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3999,8 +3999,9 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function get_client_policy_data_using_policy_no($policy_no)
|
||||
{
|
||||
public function get_client_policy_data_using_policy_no()
|
||||
{
|
||||
$policy_no = $this->request->getGet('policy_no');
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
client_policy.*,
|
||||
@ -4020,8 +4021,11 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function get_client_policy_data_using_policy_no_and_endo_no($policy_no, $endorsement_no)
|
||||
{
|
||||
public function get_client_policy_data_using_policy_no_and_endo_no()
|
||||
{
|
||||
$policy_no = $this->request->getGet('policy_no');
|
||||
$endorsement_no = $this->request->getGet('endorsement_no');
|
||||
|
||||
$data = $this->clientPolicyModel
|
||||
->select('client_policy.*, endorsement.endorsement_type')
|
||||
->join('endorsement', 'client_policy.id = endorsement.client_policy_id')
|
||||
@ -4602,7 +4606,7 @@ class ClientController extends AdminController
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '873']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '874']);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '874']);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '829']);
|
||||
// dd('-----', $res);
|
||||
|
||||
|
||||
@ -4627,8 +4631,10 @@ class ClientController extends AdminController
|
||||
// $ids = array_column($emp_data, 'id');
|
||||
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
$EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||
// $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||
// $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live
|
||||
|
||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
||||
// print_rr($result); die;
|
||||
|
||||
@ -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
|
||||
@ -755,12 +756,13 @@ class DashboardController extends AdminController
|
||||
case 'instalment_pending':
|
||||
$groupedData['instalment_pending'][] = $row;
|
||||
break;
|
||||
default:
|
||||
case 'under_process':
|
||||
$groupedData['under_process'][] = $row;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $groupedData;
|
||||
}
|
||||
|
||||
|
||||
@ -2420,8 +2420,17 @@ class EmpDataServiceController extends BaseController
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$client_branch_id = $file['client_branch_id'];
|
||||
$batch_code = $file['batch_code'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$ref_data = [
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'insurer_or_tpa' => $insurer_or_tpa,
|
||||
'event_type' => $file['event_type'],
|
||||
];
|
||||
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
|
||||
@ -2453,92 +2462,92 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
$endorsement_data = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($ref_data, 1);
|
||||
// $db = \Config\Database::connect();
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
// // Raw SQL query
|
||||
// $sql = "
|
||||
// SELECT
|
||||
// a.id as endorsement_primarykey,
|
||||
// a.group_key,
|
||||
// employee_polices.id AS primaryKey,
|
||||
// employees.id AS emp_primary,
|
||||
// employees.name AS emp_name,
|
||||
// employees.emp_code AS emp_code,
|
||||
// employees.dob AS emp_dob,
|
||||
// employees.gender AS emp_gender,
|
||||
// employees.relationship_code AS emp_relationship_code,
|
||||
// 'Has Define' AS emp_type,
|
||||
// employee_polices.uhid AS risk_id,
|
||||
// employee_polices.pre_existing_alignments,
|
||||
// employee_polices.policy_end_date,
|
||||
// employee_polices.basic_cover_si as old_basic_cover_si,
|
||||
// employee_polices.rata_premimum as old_si_premium,
|
||||
// sidata.new_basic_cover_si,
|
||||
// sidata.new_si_premium,
|
||||
// sidata.date_of_coverage,
|
||||
// DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
// sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||
// ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||
// ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
// ((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
||||
// FROM
|
||||
// emp_endorsement a
|
||||
// LEFT JOIN
|
||||
// employees ON employees.emp_code = a.emp_code
|
||||
// LEFT JOIN
|
||||
// employee_polices ON employees.id = employee_polices.employee_id
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// aa.emp_code,
|
||||
// aa.new_value as new_basic_cover_si,
|
||||
// bb.new_value as new_si_premium,
|
||||
// cc.new_value as date_of_coverage
|
||||
// FROM (
|
||||
// SELECT
|
||||
// a1.emp_code,
|
||||
// a1.field_name,
|
||||
// a1.new_value
|
||||
// FROM
|
||||
// emp_endorsement as a1
|
||||
// WHERE
|
||||
// a1.field_name = 'basic_cover_si'
|
||||
// ) aa
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// b1.emp_code,
|
||||
// b1.field_name,
|
||||
// b1.new_value
|
||||
// FROM
|
||||
// emp_endorsement as b1
|
||||
// WHERE
|
||||
// b1.field_name = 'premium'
|
||||
// ) bb ON aa.emp_code = bb.emp_code
|
||||
// LEFT JOIN (
|
||||
// SELECT
|
||||
// c1.emp_code,
|
||||
// c1.field_name,
|
||||
// c1.new_value
|
||||
// FROM
|
||||
// emp_endorsement as c1
|
||||
// WHERE
|
||||
// c1.field_name = 'si_enhancement_date'
|
||||
// ) cc ON aa.emp_code = cc.emp_code
|
||||
// ) as sidata ON a.emp_code = sidata.emp_code
|
||||
// WHERE
|
||||
// employee_polices.client_policy_id = '$client_policy_id'
|
||||
// AND employees.client_branch_id = '$client_branch_id'
|
||||
// AND employee_polices.is_active = '1'
|
||||
// AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
// AND a.actions = 'si'
|
||||
// GROUP BY group_key
|
||||
// ";
|
||||
|
||||
// Raw SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
a.id as endorsement_primarykey,
|
||||
a.group_key,
|
||||
employee_polices.id AS primaryKey,
|
||||
employees.id AS emp_primary,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
'Has Define' AS emp_type,
|
||||
employee_polices.uhid AS risk_id,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
||||
employee_polices.rata_premimum as old_si_premium,
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON employees.emp_code = a.emp_code
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
aa.emp_code,
|
||||
aa.new_value as new_basic_cover_si,
|
||||
bb.new_value as new_si_premium,
|
||||
cc.new_value as date_of_coverage
|
||||
FROM (
|
||||
SELECT
|
||||
a1.emp_code,
|
||||
a1.field_name,
|
||||
a1.new_value
|
||||
FROM
|
||||
emp_endorsement as a1
|
||||
WHERE
|
||||
a1.field_name = 'basic_cover_si'
|
||||
) aa
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
b1.emp_code,
|
||||
b1.field_name,
|
||||
b1.new_value
|
||||
FROM
|
||||
emp_endorsement as b1
|
||||
WHERE
|
||||
b1.field_name = 'premium'
|
||||
) bb ON aa.emp_code = bb.emp_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
c1.emp_code,
|
||||
c1.field_name,
|
||||
c1.new_value
|
||||
FROM
|
||||
emp_endorsement as c1
|
||||
WHERE
|
||||
c1.field_name = 'si_enhancement_date'
|
||||
) cc ON aa.emp_code = cc.emp_code
|
||||
) as sidata ON a.emp_code = sidata.emp_code
|
||||
WHERE
|
||||
employee_polices.client_policy_id = '$client_policy_id'
|
||||
AND employees.client_branch_id = '$client_branch_id'
|
||||
AND employee_polices.is_active = '1'
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.actions = 'si'
|
||||
GROUP BY group_key
|
||||
";
|
||||
// // Execute the query
|
||||
// $query = $db->query($sql);
|
||||
|
||||
// Execute the query
|
||||
$query = $db->query($sql);
|
||||
|
||||
// Fetch the results
|
||||
$endorsement_data = $query->getResultArray();
|
||||
// // Fetch the results
|
||||
// $endorsement_data = $query->getResultArray();
|
||||
|
||||
|
||||
|
||||
@ -2745,11 +2754,11 @@ class EmpDataServiceController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
if ($endorsement_value['pro_rata_premimum'] != $excel_data[$key][16]) {
|
||||
if ($endorsement_value['pro_rata_premium'] != $excel_data[$key][16]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 16,
|
||||
'db_data' => $endorsement_value['pro_rata_premimum'],
|
||||
'db_data' => $endorsement_value['pro_rata_premium'],
|
||||
'excel_data' => $excel_data[$key][16]
|
||||
];
|
||||
}
|
||||
@ -2950,7 +2959,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$empData['basic_cover_si'] = $value[8];
|
||||
$empData['premium'] = $value[14];
|
||||
$empData['si_enhancement_date'] = $value[10];
|
||||
$empData['si_enhancement_date'] = date('Y-m-d', strtotime($value[10])) ?? null;
|
||||
$empData['rata_premimum'] = $value[16];
|
||||
$empData['gst'] = $value[17];
|
||||
$empData['created_by'] = $user_id;
|
||||
@ -2964,26 +2973,20 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$this->employeePolicyModel->updateBatch($emp_policy_ids, 'id');
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
|
||||
$this->employeePolicyModel->insertBatch($emp_details);
|
||||
// $this->employeePolicyModel->insertBatch($emp_details);
|
||||
// $insertedIds = [];
|
||||
// $startId = $db->insertID(); // Get the first inserted ID
|
||||
|
||||
// for ($i = 0; $i < count($emp_details); $i++) {
|
||||
// $insertedIds[] = $startId + $i;
|
||||
// }
|
||||
|
||||
$insertedIds = [];
|
||||
$startId = $db->insertID(); // Get the first inserted ID
|
||||
|
||||
for ($i = 0; $i < count($emp_details); $i++) {
|
||||
$insertedIds[] = $startId + $i;
|
||||
foreach ($emp_details as $emp) {
|
||||
$insertedIds[] = $this->employeePolicyModel->insert($emp);
|
||||
}
|
||||
|
||||
$db->transComplete();
|
||||
|
||||
// if ($db->transStatus() === FALSE) {
|
||||
// // Handle the error, rollback, etc.
|
||||
// } else {
|
||||
// // Transaction successful
|
||||
// print_r($insertedIds); // This will print the array of inserted IDs
|
||||
// }
|
||||
// dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
|
||||
@ -434,7 +434,7 @@ class EmployeeController extends AdminController
|
||||
$filePath = ROOTPATH . 'public/sample_excel/sample_correction .xls';
|
||||
} else if ($actionType == 'si_enhancement') {
|
||||
$filePath = ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls';
|
||||
} else if ($actionType == 'dependent_addtion') {
|
||||
} else if ($actionType == 'dependent_addition') {
|
||||
$filePath = ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls';
|
||||
} else if ($actionType == 'addition') {
|
||||
$filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls';
|
||||
|
||||
@ -3226,18 +3226,12 @@ class EmployeeRestController extends AdminController
|
||||
$message = 'Claim Iniated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$mail_sent_status = json_decode($mail_sent_status);
|
||||
$mail_sent_status_object = json_decode($mail_sent_status);
|
||||
}
|
||||
// dd(gettype($mail_sent_status));
|
||||
|
||||
if ($mail_sent_status->status == 'success') {
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
if ($mail_sent_status_object->status == 'success') {
|
||||
|
||||
$message_insert_status = $this->ticketMessage->insert($sent_message_data);
|
||||
$message_insert_status = $this->ticketController->autoMessageInsertBasedOnMailResponse($mail_sent_status, $ticket_id);
|
||||
|
||||
if ($message_insert_status) {
|
||||
$message = 'Claim Initiated Successfully';
|
||||
@ -3248,11 +3242,11 @@ class EmployeeRestController extends AdminController
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$message = 'Claim Initiated, Failed to send Mail ';
|
||||
$this->myLogger->logme('error', "Claim initiated, Failed to send Mail :$ticket_id ");
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
$message = 'Something Went Wrong';
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
|
||||
|
||||
@ -1530,8 +1530,21 @@ class EmployeeServiceController extends AdminController
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
$employee = $this->employeeModel
|
||||
->where('emp_code', $row[1])
|
||||
->where('name',$row[2])
|
||||
->where('client_id',$file['client_id'])
|
||||
->where('client_branch_id',$file['client_branch_id'])
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id',$employee['id'])
|
||||
->where('client_policy_id',$file['policy_id'])
|
||||
->where('status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
// dd($employee, $employee_policy);
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
@ -1573,6 +1586,8 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$data = transform_si_excel_row_to_calculatable_format(employee: $employee,employee_policy: $employee_policy,maxage_and_maxcount: $max_age_and_max_count_of_current_member,slab_details: $slab_details,applicable_slab_name: $applicable_rack_rate_name,augmented_si: $row[3],grid_master: $applicable_rack_rate_master);
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];
|
||||
// dd($policy_terms);
|
||||
//grouping slab details by rack rate name
|
||||
$temp_slab_rates = group_slab_rates_basedon_name($slab_details);
|
||||
|
||||
|
||||
@ -169,17 +169,38 @@ class PolicyTransactionController extends BaseController
|
||||
$issuer = empty($issuer) ? 0 : $issuer;
|
||||
$status = empty($status) ? 0 : $status; // Corrected from `$issuer`
|
||||
|
||||
// Fetch inception data list
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$client_id,
|
||||
$insurer_id,
|
||||
$policy_type_id,
|
||||
$date_type,
|
||||
$issuer,
|
||||
$status
|
||||
);
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
// Fetch inception data list
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$client_id,
|
||||
$insurer_id,
|
||||
$policy_type_id,
|
||||
$date_type,
|
||||
$issuer,
|
||||
$status
|
||||
);
|
||||
|
||||
}else{
|
||||
|
||||
$ids = $this->request->getPost('ids');
|
||||
$ids = array_filter(explode(',', $ids));
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date = 0,
|
||||
$end_date = 0,
|
||||
$client_id = 0,
|
||||
$insurer_id = 0,
|
||||
$policy_type_id = 0,
|
||||
$date_type = 0,
|
||||
$issuer = 0,
|
||||
$status = 0,
|
||||
$ids
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Fetch additional data
|
||||
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
|
||||
@ -54,6 +54,8 @@ class TicketController extends BaseController
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
set_session_context('Ticket Master Controller');
|
||||
|
||||
|
||||
$this->ticketMasterModel = new TicketMasterModel();
|
||||
|
||||
@ -123,6 +125,7 @@ class TicketController extends BaseController
|
||||
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
||||
'((SETTLED_LETTER))' => 'settle_letter',
|
||||
'((APPROVED_LETTER))' => 'approved_letter',
|
||||
'((APPROVED_DESCRIBTION))' => 'approved_description',
|
||||
];
|
||||
$this->extraFields = [
|
||||
1 => ['non_id_reason'],
|
||||
@ -132,13 +135,13 @@ class TicketController extends BaseController
|
||||
5 => ['claim_number', 'registration_date'],
|
||||
7 => ['query_received_date'],
|
||||
8 => ['denial_reason','denial_date'],
|
||||
9 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
9 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
11 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
40 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
40 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
44 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
30 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
30 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
34 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
20 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
20 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
24 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
14 => ['return_remark', 'awb_no_courier_name'],
|
||||
48 => ['return_remark', 'awb_no_courier_name'],
|
||||
@ -173,6 +176,9 @@ class TicketController extends BaseController
|
||||
public function ticketList()
|
||||
{
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$data['modeOFIntimate'] = $this->modeOFIntimate;
|
||||
$data['priorityType'] = $this->priorityType;
|
||||
$data['claimType'] = $this->claimType;
|
||||
if ($this->request->is('get')) {
|
||||
$data['page_name'] = "Claims";
|
||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
@ -183,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);
|
||||
@ -199,13 +215,13 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
public function ticketSearch($action = null)
|
||||
{
|
||||
{
|
||||
$db = db_connect();
|
||||
|
||||
$subquery = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id AS ticket_id',
|
||||
"CASE
|
||||
->select([
|
||||
'tm.id AS ticket_id',
|
||||
"CASE
|
||||
WHEN DATEDIFF(
|
||||
CURDATE(),
|
||||
COALESCE(latest_history.created_at, tm.created_at)
|
||||
@ -220,20 +236,20 @@ class TicketController extends BaseController
|
||||
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||
ELSE 'Above 20 Days'
|
||||
END AS tat"
|
||||
])
|
||||
->join(
|
||||
'(SELECT th.ticket_id, MAX(th.created_at) AS created_at
|
||||
])
|
||||
->join(
|
||||
'(SELECT th.ticket_id, MAX(th.created_at) AS created_at
|
||||
FROM ticket_history th
|
||||
WHERE th.field_name = "claim_status_id"
|
||||
GROUP BY th.ticket_id) AS latest_history',
|
||||
'latest_history.ticket_id = tm.id',
|
||||
'left'
|
||||
)
|
||||
->where('tm.is_active', 1)
|
||||
->groupBy('tm.id, tm.created_at, latest_history.created_at');
|
||||
'latest_history.ticket_id = tm.id',
|
||||
'left'
|
||||
)
|
||||
->where('tm.is_active', 1)
|
||||
->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')
|
||||
@ -248,12 +264,63 @@ class TicketController extends BaseController
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat',
|
||||
|
||||
'tm.claim_status_id',
|
||||
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.tpa_id',
|
||||
'tm.client_policy_id',
|
||||
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.relationship',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
@ -262,13 +329,12 @@ class TicketController extends BaseController
|
||||
->where('tm.is_active', 1)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
$data = $query->get()->getResultArray();
|
||||
|
||||
// dd(db_connect()->getLastQuery());
|
||||
|
||||
return $data;
|
||||
|
||||
}else if ($action == 3) {
|
||||
} else if ($action == 3) {
|
||||
$ids = $this->request->getPost('ids');
|
||||
$ids = array_filter(explode(',', $ids));
|
||||
|
||||
@ -280,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()
|
||||
@ -290,41 +366,90 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
// print_rr($where);
|
||||
|
||||
|
||||
}
|
||||
$query = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||
->where('tm.is_active', 1)
|
||||
->where($where)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat',
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
return $data;
|
||||
'tm.claim_status_id',
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.tpa_id',
|
||||
'tm.client_policy_id',
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.relationship',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||
->where('tm.is_active', 1)
|
||||
->where($where)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function ticket_form($ticket_type)
|
||||
@ -1259,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',
|
||||
@ -1277,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{
|
||||
@ -1295,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);
|
||||
}
|
||||
@ -1573,7 +1701,7 @@ class TicketController extends BaseController
|
||||
} else {
|
||||
|
||||
$this->myLogger->logme('error', "Failed to send Mail :$ticket_id ");
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1658,4 +1786,84 @@ class TicketController extends BaseController
|
||||
$this->loadLayout("ticket_feedback_list",$data);
|
||||
}
|
||||
|
||||
public function getMoreInfo() {
|
||||
$ticket_id = $this->request->getPost('ticket_id');
|
||||
$this->myLogger->logme("error", "Ticket ID : " . $ticket_id);
|
||||
|
||||
$fields = $this->extraFields;
|
||||
$data_to_send = [];
|
||||
|
||||
// Get ticket data
|
||||
$ticket_data = $this->ticketMasterModel->where("id", $ticket_id)->where("is_active", 1)->first();
|
||||
|
||||
// Query previous status
|
||||
$ticket_previous_status = $this->ticketMasterModel
|
||||
->select("th.old_value, tcs.claim_status")
|
||||
->join("ticket_history th", "th.ticket_id = ticket_master.id AND th.field_name = 'claim_status_id' AND th.is_active = 1")
|
||||
->join("ticket_claim_status tcs", "tcs.id = th.old_value AND tcs.is_active = 1")
|
||||
->where("ticket_master.is_active", 1)
|
||||
->where("ticket_master.id", $ticket_id)
|
||||
->groupBy("th.old_value, tcs.claim_status")
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Loop through previous status and gather the required data
|
||||
foreach ($ticket_previous_status as $status) {
|
||||
$this->myLogger->logme("error", "Status : " . json_encode($status));
|
||||
|
||||
if (isset($fields[$status['old_value']])) {
|
||||
$field = $fields[$status['old_value']];
|
||||
|
||||
// Ensure claim_status is a scalar value (string or int)
|
||||
$claim_status = (string)$status['claim_status']; // Cast to string to avoid issues
|
||||
|
||||
// Initialize claim_status if it doesn't exist in the array
|
||||
if (!isset($data_to_send[$claim_status])) {
|
||||
$data_to_send[$claim_status] = [];
|
||||
}
|
||||
|
||||
// Handle case where $field is an array
|
||||
if (is_array($field)) {
|
||||
foreach ($field as $f) {
|
||||
// Check if the field exists in the ticket data
|
||||
$data_to_send[$claim_status][$f] = isset($ticket_data[$f]) ? $ticket_data[$f] : null;
|
||||
|
||||
// Check if the field contains a date and format it
|
||||
if ($this->isDate($data_to_send[$claim_status][$f])) {
|
||||
$data_to_send[$claim_status][$f] = date('d-m-Y', strtotime($data_to_send[$claim_status][$f]));
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error", "Data for field {$f}: " . json_encode($data_to_send[$claim_status][$f]));
|
||||
}
|
||||
} else {
|
||||
// If field is not an array, handle it as a single field
|
||||
$data_to_send[$claim_status][$field] = isset($ticket_data[$field]) ? $ticket_data[$field] : null;
|
||||
|
||||
// Check if the field contains a date and format it
|
||||
if ($this->isDate($data_to_send[$claim_status][$field])) {
|
||||
$data_to_send[$claim_status][$field] = date('d-m-Y', strtotime($data_to_send[$claim_status][$field]));
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error", "Data for field {$field}: " . json_encode($data_to_send[$claim_status][$field]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', "Total data: " . json_encode($data_to_send));
|
||||
|
||||
// Send response based on data availability
|
||||
if (!empty($data_to_send)) {
|
||||
return $this->respond(['status' => true, 'data' => $data_to_send], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
|
||||
private function isDate($value) {
|
||||
// Check if the value is a valid date string (basic validation)
|
||||
return strtotime($value) !== false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -594,7 +594,7 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getSIEnhancementEmployeesDataForExportExcel($ref_data)
|
||||
public function getSIEnhancementEmployeesDataForExportExcel($ref_data, $return_type = 0)
|
||||
{
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
@ -732,7 +732,14 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
// Get the result set
|
||||
$results = $query->getResult();
|
||||
// dd($this->db->getLastQuery(), $results);
|
||||
|
||||
if($return_type == 1){
|
||||
$results = $query->getResultArray();
|
||||
}else{
|
||||
$results = $query->getResult();
|
||||
}
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
return $results;
|
||||
|
||||
}
|
||||
@ -1528,73 +1535,120 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdateForEndorsement($endorsement_details)
|
||||
// public function bulkUpdateForEndorsement($endorsement_details)
|
||||
// {
|
||||
// // dd($endorsement_details, '---');
|
||||
// // Extract IDs, endorsement_ids, and statuses
|
||||
// $ids = array_column($endorsement_details, 'group_key');
|
||||
// $endorsement_ids = array_column($endorsement_details, 'endorsement_id');
|
||||
// $statuses = array_column($endorsement_details, 'status');
|
||||
|
||||
// // Escape values for SQL
|
||||
// $escapedIds = array_map([$this->db, 'escape'], $ids);
|
||||
// $escapedEndorsementIds = array_map([$this->db, 'escape'], $endorsement_ids);
|
||||
// $escapedStatuses = array_map([$this->db, 'escape'], $statuses);
|
||||
|
||||
// // Construct the CASE statements
|
||||
// $caseEndorsementId = array_map(function ($id, $endorsement_id) {
|
||||
// return "WHEN group_key = $id THEN $endorsement_id";
|
||||
// }, $escapedIds, $escapedEndorsementIds);
|
||||
|
||||
// // $caseStatus = array_map(function ($id, $status) {
|
||||
// // return "WHEN status = $id THEN $status";
|
||||
// // }, $escapedIds, $escapedStatuses);
|
||||
|
||||
// // Convert cases to a string
|
||||
// $caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
||||
// // $caseStatusString = implode(' ', $caseStatus);
|
||||
|
||||
// // Convert ids to a string
|
||||
// $idsString = implode(', ', $escapedIds);
|
||||
|
||||
// // Construct the SQL query
|
||||
// $sql = "
|
||||
// UPDATE emp_endorsement
|
||||
// SET
|
||||
// endorsement_id = CASE {$caseEndorsementIdString} END,
|
||||
// status = 'complete'
|
||||
// WHERE group_key IN ({$idsString})
|
||||
// ";
|
||||
|
||||
|
||||
// // dd($sql);
|
||||
// // Begin a transaction
|
||||
// $this->db->transBegin();
|
||||
|
||||
// try {
|
||||
// // Start the transaction
|
||||
// $this->db->transBegin();
|
||||
|
||||
// // Execute the query
|
||||
// $this->db->query($sql);
|
||||
|
||||
// // Check transaction status
|
||||
// if ($this->db->transStatus() === false) {
|
||||
// $error = $this->db->error(); // Get the last database error
|
||||
// $this->db->transRollback();
|
||||
|
||||
// // Optionally log the error
|
||||
// log_message('error', 'Bulk update failed. Error: ' . json_encode($error));
|
||||
|
||||
// throw new \Exception('Bulk update failed. Error: ' . $error['message']);
|
||||
// }
|
||||
|
||||
// // Commit if everything is fine
|
||||
// $this->db->transCommit();
|
||||
|
||||
// return $this->db->getLastQuery(); // Optional: return last executed query for debugging
|
||||
// } catch (\Exception $e) {
|
||||
// $this->db->transRollback();
|
||||
|
||||
// // Optionally log the exception
|
||||
// log_message('error', 'Exception during bulk update: ' . $e->getMessage());
|
||||
|
||||
// // Re-throw with detailed context
|
||||
// throw new \RuntimeException('Exception during bulk update: ' . $e->getMessage(), $e->getCode(), $e);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
public function bulkUpdateForEndorsement(array $endorsement_details)
|
||||
{
|
||||
|
||||
// Extract IDs, endorsement_ids, and statuses
|
||||
$ids = array_column($endorsement_details, 'group_key');
|
||||
$endorsement_ids = array_column($endorsement_details, 'endorsement_id');
|
||||
$statuses = array_column($endorsement_details, 'status');
|
||||
|
||||
// Escape values for SQL
|
||||
$escapedIds = array_map([$this->db, 'escape'], $ids);
|
||||
$escapedEndorsementIds = array_map([$this->db, 'escape'], $endorsement_ids);
|
||||
$escapedStatuses = array_map([$this->db, 'escape'], $statuses);
|
||||
|
||||
// Construct the CASE statements
|
||||
$caseEndorsementId = array_map(function ($id, $endorsement_id) {
|
||||
return "WHEN group_key = $id THEN $endorsement_id";
|
||||
}, $escapedIds, $escapedEndorsementIds);
|
||||
|
||||
// $caseStatus = array_map(function ($id, $status) {
|
||||
// return "WHEN status = $id THEN $status";
|
||||
// }, $escapedIds, $escapedStatuses);
|
||||
|
||||
// Convert cases to a string
|
||||
$caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
||||
// $caseStatusString = implode(' ', $caseStatus);
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $escapedIds);
|
||||
|
||||
// Construct the SQL query
|
||||
if (empty($endorsement_details)) {
|
||||
throw new \InvalidArgumentException("No endorsement details provided.");
|
||||
}
|
||||
|
||||
$caseParts = [];
|
||||
$groupKeys = [];
|
||||
|
||||
foreach ($endorsement_details as $row) {
|
||||
$groupKey = $this->db->escape($row['group_key']);
|
||||
$endorsementId = $this->db->escape($row['endorsement_id']);
|
||||
$caseParts[] = "WHEN group_key = {$groupKey} THEN {$endorsementId}";
|
||||
$groupKeys[] = $groupKey;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
SET
|
||||
endorsement_id = CASE {$caseEndorsementIdString} END,
|
||||
endorsement_id = CASE " . implode(' ', $caseParts) . " END,
|
||||
status = 'complete'
|
||||
WHERE group_key IN ({$idsString})
|
||||
WHERE group_key IN (" . implode(', ', $groupKeys) . ")
|
||||
";
|
||||
|
||||
|
||||
// dd($sql);
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
// $this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
// Check if query was successful
|
||||
if ($this->db->affectedRows() === 0) {
|
||||
throw new \RuntimeException('No rows were updated.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function bulkUpdateForCorrection($emp_details){
|
||||
|
||||
foreach ($emp_details as $employee) {
|
||||
|
||||
@ -863,7 +863,7 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) {
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$fromDate = date('Y-m-d', strtotime('-60 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
if (empty($where)) {
|
||||
@ -962,7 +962,7 @@ class PolicyTransactionModel extends Model
|
||||
// return $result;
|
||||
// }
|
||||
|
||||
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0, $where = null)
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select('
|
||||
@ -1026,14 +1026,18 @@ class PolicyTransactionModel extends Model
|
||||
}
|
||||
|
||||
// Default to Last 30 Days if No Filters Are Applied
|
||||
if (empty($client_id) && empty($insurer_id) && empty($policy_type_id) && empty($date_type) && empty($issuer)) {
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
if (empty($client_id) && empty($insurer_id) && empty($policy_type_id) && empty($date_type) && empty($issuer) && empty($where)) {
|
||||
$fromDate = date('Y-m-d', strtotime('-60 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if (!empty($where)) {
|
||||
$builder->whereIn('policy_transaction.id', $where);
|
||||
}
|
||||
|
||||
// Optimize Query Execution
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
@ -1331,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);
|
||||
|
||||
@ -1422,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) {
|
||||
|
||||
|
||||
@ -74,7 +74,9 @@ class TicketMasterModel extends Model
|
||||
'head_rejection_reason',
|
||||
'pay_initiate_date',
|
||||
'emp_personal_mail',
|
||||
'client_policy_id'
|
||||
'client_policy_id',
|
||||
|
||||
'approved_description'
|
||||
|
||||
];
|
||||
|
||||
@ -605,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
|
||||
@ -621,7 +624,6 @@ class TicketMasterModel extends Model
|
||||
";
|
||||
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
// dd($result);
|
||||
|
||||
return $result;
|
||||
} else {
|
||||
@ -675,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,
|
||||
@ -694,8 +697,9 @@ class TicketMasterModel extends Model
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
122
app/Views/bds_multi_report.php
Normal file
122
app/Views/bds_multi_report.php
Normal 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>
|
||||
122
app/Views/bds_tat_wise_report.php
Normal file
122
app/Views/bds_tat_wise_report.php
Normal 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>
|
||||
@ -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>
|
||||
@ -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>
|
||||
|
||||
@ -268,13 +268,13 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
||||
}
|
||||
|
||||
function linkRedirectForPolicy(ids){
|
||||
var url = "<?= base_url("policy_tranction/report/list") ?>";
|
||||
var url = "<?= base_url("policy_tranction/inception/list") ?>";
|
||||
var data = {
|
||||
ids : ids,
|
||||
is_dashboard : 1
|
||||
}
|
||||
|
||||
redirectWithPost(url,data);
|
||||
redirectWithPost(url,data, "POST");
|
||||
}
|
||||
|
||||
function linkRedirectForLeads(status,ids){
|
||||
@ -285,14 +285,14 @@ $isActive = get_role_id() == STAFF_ROLE_ID && in_array(ENROLLMENT_TEAM_ID,user_t
|
||||
is_dashboard : 1
|
||||
}
|
||||
|
||||
redirectWithPost(url,data);
|
||||
redirectWithPost(url,data, "POST");
|
||||
}
|
||||
|
||||
function redirectWithPost(url, data = {}) {
|
||||
function redirectWithPost(url, data = {}, method = "GET") {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
const form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.method = method;
|
||||
form.action = url;
|
||||
|
||||
for (const key in data) {
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
margin: 1.75rem auto;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<div class="tab-pane fade" id="notification-tab">
|
||||
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>" />
|
||||
|
||||
@ -848,8 +848,9 @@ $('#endorsement_no').on('change', function(){
|
||||
|
||||
if(policy_no && endorsement_no){
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no_and_endo_no/');?>'+ policy_no + '/' + endorsement_no,
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no_and_endo_no/');?>',
|
||||
type: "GET",
|
||||
data : {policy_no : policy_no, endorsement_no : endorsement_no},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
|
||||
@ -3721,8 +3721,9 @@ $('#policy_no').change(function(){
|
||||
|
||||
if($pt_id == "" && policy_no != ""){
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no/');?>'+policy_no,
|
||||
url: '<?php echo base_url('util/get_client_policy_data_using_policy_no/');?>',
|
||||
type: "GET",
|
||||
data : { policy_no : policy_no },
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
|
||||
@ -11,6 +11,18 @@
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
color: #007bff;
|
||||
font-size: 15px;
|
||||
transition: 0.3s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info-icon:hover {
|
||||
color: #0056b3;
|
||||
font-size: 24px;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@ -168,7 +180,7 @@
|
||||
<!-- end first_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Claim Details</h5>
|
||||
<h5>Claim Details <span><i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for more details"></i></span></h5>
|
||||
<hr>
|
||||
|
||||
<!-- second_data_points -->
|
||||
@ -336,6 +348,12 @@
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_description">Approved Description</label>
|
||||
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
|
||||
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
@ -409,6 +427,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Modal -->
|
||||
<div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="fullWidthModalLabel">More Information</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="dynamicDivFillInfo"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
// var calim_status = $('#claim_status_id').val();
|
||||
@ -563,6 +599,27 @@
|
||||
$('#claim_status_id').on('change', function() {
|
||||
updateClaimStatusDisplay($(this).val());
|
||||
// claimStatusFieldChanges()
|
||||
const selectedVal = $(this).val();
|
||||
const elementId = $(this).attr('id');
|
||||
|
||||
console.log('Selected Value:', selectedVal);
|
||||
console.log('Element ID:', elementId);
|
||||
|
||||
if(selectedVal == 2 || selectedVal == 14){
|
||||
$field = $('#non_id_reason')
|
||||
$field.prop('required', false);
|
||||
}else if(selectedVal == 1){
|
||||
|
||||
if($('#tpa_no').val() != ""){
|
||||
$field = $('#non_id_reason')
|
||||
$field.prop('required', false);
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.find("label[for='non_id_reason'] .text-danger").remove();
|
||||
}else{
|
||||
$field = $('#non_id_reason')
|
||||
$field.prop('required', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function claimStatusFieldChanges(fields) {
|
||||
@ -690,6 +747,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$field = $('#approved_description')
|
||||
$field.prop('required', false);
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
||||
|
||||
});
|
||||
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
@ -931,7 +994,7 @@
|
||||
value: '',
|
||||
text: 'Select Client Policy'
|
||||
}));
|
||||
console.log("got data from backend ",data);
|
||||
console.log("got data from backend ", data);
|
||||
let policyCount = 1;
|
||||
var policyAppendCount = 0;
|
||||
$.each(data, function(index, item) {
|
||||
@ -939,19 +1002,19 @@
|
||||
|
||||
if (ticket_type == 1 && item.policy_type_id != 1) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
$("#policy_no").val("");
|
||||
if (policyCount == 1){
|
||||
console.log("policy count from if",item.policy_no);
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name
|
||||
}));
|
||||
$("#policy_no").val("");
|
||||
if (policyCount == 1) {
|
||||
console.log("policy count from if", item.policy_no);
|
||||
$("#policy_no").val(item.policy_no);
|
||||
}else{
|
||||
console.log("policy count from greter if ","");
|
||||
} else {
|
||||
console.log("policy count from greter if ", "");
|
||||
$("#policy_no").val("");
|
||||
}
|
||||
policyCount++;
|
||||
policyAppendCount++;
|
||||
policyAppendCount++;
|
||||
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||
// $('#emp_client_policy').select2();
|
||||
$("#emp_client_policy").select2();
|
||||
@ -965,9 +1028,9 @@
|
||||
}
|
||||
|
||||
})
|
||||
console.log('policy append count ',policyAppendCount);
|
||||
if (policyAppendCount == 0){
|
||||
toastr.warning("No Policies found for the Employee","Warning");
|
||||
console.log('policy append count ', policyAppendCount);
|
||||
if (policyAppendCount == 0) {
|
||||
toastr.warning("No Policies found for the Employee", "Warning");
|
||||
}
|
||||
}
|
||||
// $('#emp_client_policy').select2();
|
||||
@ -986,14 +1049,14 @@
|
||||
$("#policy_no").val(policy_no);
|
||||
console.log("Function set min date called ");
|
||||
console.log("Existing DOA instance: ", doa);
|
||||
console.log('sent data ',policy_id);
|
||||
console.log('sent data ', policy_id);
|
||||
$.ajax({
|
||||
url: '<?= base_url("ticket/getPolicyStartDate") ?>',
|
||||
method: "POST",
|
||||
data: {
|
||||
policy_id: policy_id
|
||||
},
|
||||
|
||||
|
||||
success: function(response) {
|
||||
console.log("mindate response ", response);
|
||||
|
||||
@ -1029,4 +1092,107 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
$("#infoIcon").click(function() {
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
getDataForInfo(ticket_id, function(data) {
|
||||
console.log("data: ", data);
|
||||
if (data && Object.keys(data).length) {
|
||||
// openModal();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal'));
|
||||
myModal.show();
|
||||
|
||||
appendHtmlToModal(data);
|
||||
} else {
|
||||
// toastr.warning("Data not Found");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function getDataForInfo(ticketId, callback) {
|
||||
$.ajax({
|
||||
url: "<?= base_url('ticket/getMoreInfo') ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
ticket_id: ticketId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
console.log("Info Response: ", response);
|
||||
callback(response.data); // pass data to the callback
|
||||
} else {
|
||||
toastr.warning("No Data Found");
|
||||
callback(null);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendHtmlToModal(data) {
|
||||
var container = document.getElementById('dynamicDivFillInfo');
|
||||
|
||||
// Clear any previous content inside the container
|
||||
container.innerHTML = '';
|
||||
|
||||
// Iterate over each status in the data
|
||||
for (let status in data) {
|
||||
if (data.hasOwnProperty(status)) {
|
||||
// Create the status subheading
|
||||
var statusHeading = document.createElement('h5');
|
||||
statusHeading.textContent = status;
|
||||
container.appendChild(statusHeading);
|
||||
|
||||
// Create a row container to group the fields in a row
|
||||
var rowContainer = document.createElement('div');
|
||||
rowContainer.classList.add('row'); // Add Bootstrap row class to group fields
|
||||
|
||||
// Iterate over each field within the current status
|
||||
for (let field in data[status]) {
|
||||
if (data[status].hasOwnProperty(field)) {
|
||||
// Create a container for each field with col-md-4 class
|
||||
var fieldContainer = document.createElement('div');
|
||||
fieldContainer.classList.add('form-group', 'col-md-4'); // Apply col-md-4 to each field
|
||||
|
||||
// Create a label for the field
|
||||
var fieldLabel = document.createElement('label');
|
||||
fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize
|
||||
fieldContainer.appendChild(fieldLabel);
|
||||
|
||||
// Create either an input field or a textarea based on the field name
|
||||
var fieldInput;
|
||||
if (field === 'approved_letter' || field == "settle_letter") {
|
||||
// Create a textarea for 'approved_letter'
|
||||
fieldInput = document.createElement('textarea');
|
||||
fieldInput.classList.add('form-control');
|
||||
fieldInput.textContent = data[status][field]; // Set the value to the field content
|
||||
} else {
|
||||
// Create an input field for other fields
|
||||
fieldInput = document.createElement('input');
|
||||
fieldInput.type = 'text';
|
||||
fieldInput.classList.add('form-control');
|
||||
fieldInput.value = data[status][field];
|
||||
}
|
||||
|
||||
fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly
|
||||
|
||||
// Append the input (or textarea) to the container
|
||||
fieldContainer.appendChild(fieldInput);
|
||||
|
||||
// Append the field container to the row container
|
||||
rowContainer.appendChild(fieldContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Append the row container to the main container
|
||||
container.appendChild(rowContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -4,6 +4,18 @@
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
color: #007bff;
|
||||
font-size: 15px;
|
||||
transition: 0.3s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info-icon:hover {
|
||||
color: #0056b3;
|
||||
font-size: 24px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
@ -130,7 +142,7 @@
|
||||
<!-- end first_data_points -->
|
||||
|
||||
<br><br>
|
||||
<h5>Claim Details</h5>
|
||||
<h5>Claim Details <span><i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for more details"></i></span></h5>
|
||||
<hr>
|
||||
|
||||
<!-- second_data_points -->
|
||||
@ -262,6 +274,12 @@
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_description">Approved Description</label>
|
||||
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
|
||||
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
@ -314,6 +332,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Modal -->
|
||||
<div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="fullWidthModalLabel">More Information</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="dynamicDivFillInfo"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let GlobelExtraFields = [];
|
||||
|
||||
@ -526,6 +561,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$field = $('#approved_description')
|
||||
$field.prop('required', false);
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
||||
|
||||
});
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
// // Find the field with the given name
|
||||
@ -803,4 +844,107 @@
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
<script>
|
||||
$("#infoIcon").click(function() {
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
getDataForInfo(ticket_id, function(data) {
|
||||
console.log("data: ", data);
|
||||
if (data && Object.keys(data).length) {
|
||||
// openModal();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal'));
|
||||
myModal.show();
|
||||
|
||||
appendHtmlToModal(data);
|
||||
} else {
|
||||
// toastr.warning("No Data Found");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function getDataForInfo(ticketId, callback) {
|
||||
$.ajax({
|
||||
url: "<?= base_url('ticket/getMoreInfo') ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
ticket_id: ticketId
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
console.log("Info Response: ", response);
|
||||
callback(response.data); // pass data to the callback
|
||||
} else {
|
||||
toastr.warning("No Data Found");
|
||||
callback(null);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function appendHtmlToModal(data) {
|
||||
var container = document.getElementById('dynamicDivFillInfo');
|
||||
|
||||
// Clear any previous content inside the container
|
||||
container.innerHTML = '';
|
||||
|
||||
// Iterate over each status in the data
|
||||
for (let status in data) {
|
||||
if (data.hasOwnProperty(status)) {
|
||||
// Create the status subheading
|
||||
var statusHeading = document.createElement('h5');
|
||||
statusHeading.textContent = status;
|
||||
container.appendChild(statusHeading);
|
||||
|
||||
// Create a row container to group the fields in a row
|
||||
var rowContainer = document.createElement('div');
|
||||
rowContainer.classList.add('row'); // Add Bootstrap row class to group fields
|
||||
|
||||
// Iterate over each field within the current status
|
||||
for (let field in data[status]) {
|
||||
if (data[status].hasOwnProperty(field)) {
|
||||
// Create a container for each field with col-md-4 class
|
||||
var fieldContainer = document.createElement('div');
|
||||
fieldContainer.classList.add('form-group', 'col-md-4'); // Apply col-md-4 to each field
|
||||
|
||||
// Create a label for the field
|
||||
var fieldLabel = document.createElement('label');
|
||||
fieldLabel.textContent = field.replace(/_/g, ' ').toUpperCase(); // Convert underscores to spaces and capitalize
|
||||
fieldContainer.appendChild(fieldLabel);
|
||||
|
||||
// Create either an input field or a textarea based on the field name
|
||||
var fieldInput;
|
||||
if (field === 'approved_letter' || field == "settle_letter") {
|
||||
// Create a textarea for 'approved_letter'
|
||||
fieldInput = document.createElement('textarea');
|
||||
fieldInput.classList.add('form-control');
|
||||
fieldInput.textContent = data[status][field]; // Set the value to the field content
|
||||
} else {
|
||||
// Create an input field for other fields
|
||||
fieldInput = document.createElement('input');
|
||||
fieldInput.type = 'text';
|
||||
fieldInput.classList.add('form-control');
|
||||
fieldInput.value = data[status][field];
|
||||
}
|
||||
|
||||
fieldInput.setAttribute('readonly', 'readonly'); // Set field as readonly
|
||||
|
||||
// Append the input (or textarea) to the container
|
||||
fieldContainer.appendChild(fieldInput);
|
||||
|
||||
// Append the field container to the row container
|
||||
rowContainer.appendChild(fieldContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Append the row container to the main container
|
||||
container.appendChild(rowContainer);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -65,6 +65,49 @@ table.dataTable tbody td {
|
||||
<th>Emp name</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Corporate name</th>
|
||||
|
||||
<th style="display: none;">ACM</th>
|
||||
<th style="display: none;">Insurer</th>
|
||||
<th style="display: none;">TPA</th>
|
||||
<th style="display: none;">Policy No</th>
|
||||
<th style="display: none;">Priority</th>
|
||||
<th style="display: none;">Relationship</th>
|
||||
<th style="display: none;">Emp Mobile</th>
|
||||
<th style="display: none;">Emp Email</th>
|
||||
<th style="display: none;">Emp Personal Email</th>
|
||||
<th style="display: none;">Mode of Intimation</th>
|
||||
<th style="display: none;">Claim Type</th>
|
||||
<th style="display: none;">Hospital Name</th>
|
||||
<th style="display: none;">DOA</th>
|
||||
<th style="display: none;">DOD</th>
|
||||
<th style="display: none;">Claim Amount</th>
|
||||
<th style="display: none;">POD No.</th>
|
||||
<th style="display: none;">Date of Join</th>
|
||||
<th style="display: none;">Date of Inception</th>
|
||||
<th style="display: none;">DOB</th>
|
||||
<th style="display: none;">Date of Accident</th>
|
||||
<th style="display: none;">Date of Death</th>
|
||||
<th style="display: none;">Date of Intimate</th>
|
||||
<th style="display: none;">Sum Insured</th>
|
||||
<th style="display: none;">Raised Date</th>
|
||||
<th style="display: none;">Registration Date</th>
|
||||
<th style="display: none;">Query Received Date</th>
|
||||
<th style="display: none;">Denial Date</th>
|
||||
<th style="display: none;">Approved Date</th>
|
||||
<th style="display: none;">Settled Date</th>
|
||||
<th style="display: none;">Denial Reason</th>
|
||||
<th style="display: none;">Approved Letter</th>
|
||||
<th style="display: none;">Approved Amount</th>
|
||||
<th style="display: none;">UTR Details</th>
|
||||
<th style="display: none;">Settle Letter</th>
|
||||
<th style="display: none;">Return Remark</th>
|
||||
<th style="display: none;">Cancel Remark</th>
|
||||
<th style="display: none;">AWB No. and Courier Name</th>
|
||||
<th style="display: none;">Non ID Reason</th>
|
||||
<th style="display: none;">Payment Initiate Date</th>
|
||||
<th style="display: none;">Approved Description</th>
|
||||
|
||||
|
||||
<th>TAT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -119,6 +162,59 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['emp_name']; ?></td>
|
||||
<td><?php echo $row['insured_name']; ?></td>
|
||||
<td><?php echo $row['short_name']; ?></td>
|
||||
|
||||
<td style="display: none;"><?php echo $row['acm_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['insurer_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['tpa_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['policy_no']; ?></td>
|
||||
<td style="display: none;"><?php echo isset($priorityType[$row['priority'] ?? 0]) ? $priorityType[$row['priority'] ?? 0] : ''; ?></td>
|
||||
<td style="display: none;"><?php echo $row['relationship']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_mobile']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_mail']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_personal_mail']; ?></td>
|
||||
<td style="display: none;"><?php echo isset($modeOFIntimate[$row['mode_of_intimation'] ?? '']) ? $modeOFIntimate[$row['mode_of_intimation']] : ''; ?></td>
|
||||
<td style="display: none;">
|
||||
<?php
|
||||
$typeId = $row['ticket_type_id'] ?? 0;
|
||||
$claimKey = $row['claim_type'] ?? '';
|
||||
if ($typeId == 1) {
|
||||
echo isset($claimType[1][$claimKey]) ? $claimType[1][$claimKey] : '';
|
||||
} else {
|
||||
echo isset($claimType[2][$claimKey]) ? $claimType[2][$claimKey] : '';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td style="display: none;"><?php echo $row['hospital_name']; ?></td>
|
||||
<td style="display: none;"><?php echo change_date_format($row['doa'], null, 'd-m-Y'); ?></td>
|
||||
<td style="display: none;"><?php echo $row['dod']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['claim_amount']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['pod_no']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_join']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_incep']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['dob']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_accident']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_death']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_intimat']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['si_amt']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['raised_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['registration_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['query_received_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['denial_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['settled_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['denial_reason']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_letter']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_amount']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['utr_details']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['settle_letter']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['return_remark']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['cancel_remark']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['awb_no_courier_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['non_id_reason']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['pay_initiate_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_description']; ?></td>
|
||||
|
||||
|
||||
<td><?php echo $row['tat']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user