Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2025-02-04 15:52:00 +05:30
commit 0cb231e87b
20 changed files with 1428 additions and 91 deletions

View File

@ -412,6 +412,7 @@ $routes->get('cli/sendZeptoMail', 'MasterController::testZeptoSMTP');
$routes->cli('cli/processjob', 'JobWorker::processJob');
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
$routes->cli('cli/sendMailWithAutoQuery','TicketController::sendMailWithAutoQuery');
$routes->get("processjob", "JobWorker::processJob");
$routes->cli('cli/new_gmail_token', 'MasterController::generateNewGmailAPIToken');
@ -519,6 +520,7 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->post('crud_mail_template/(:any)','TicketController::crudTemplate/$1');
$routes->post('note/(:any)','TicketController::crudNote/$1');
$routes->post('reply','TicketController::saveReply');
$routes->match( ['get', 'post'], 'ticket_reports','TicketController::ticketReports');
// $routes->post('ticket_messages','TicketController::getTicketMessage');
});

View File

@ -45,6 +45,7 @@ use App\Controllers\GoogleDriveController;
use App\Helpers\sendMailNotification;
use App\Models\RFQModel;
use App\Models\TicketMasterModel;
class ClientController extends AdminController
{
@ -4047,11 +4048,11 @@ class ClientController extends AdminController
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
$BDSReportController = new BDSReportController();
// $BDSReportController = new BDSReportController();
$data['data'] = $BDSReportController->getBAPInsurerData();
// $data['data'] = $BDSReportController->getBAPInsurerData();
return $this->loadLayout('irda_bap_insurer_report_list', $data);
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
// $data['data'] = $BDSReportController->getBAPClientData();
// return $this->loadLayout('irda_bap_client_report_list', $data);
@ -4080,6 +4081,15 @@ class ClientController extends AdminController
// $result = MailHelper::send_email($data[0]);
// echo json_encode($result);
// log_message('error',json_encode($result));
//--------------------------------------------------------------------------------------------------------
// $ticketModel = new TicketMasterModel();
// $reportData['data'] = $ticketModel->getTATReport(1);
// print_rr($reportData);
// $this->loadLayout('tat_report_band_wise_list', $reportData);
// $data = $ticketModel->getTATReport(1);
}
// -------------------------------------------------------------------------------------------------------

View File

@ -1496,7 +1496,9 @@ class EmpDataServiceController extends BaseController
}
} else {
$tpa_id_all[$current_tpa_id][] = $key;
if($current_tpa_id != "" && $current_tpa_id != null){
$tpa_id_all[$current_tpa_id][] = $key;
}
}
//--- TPA ID Duplicate check end ---

View File

@ -1914,6 +1914,7 @@ class EmployeeController extends AdminController
}
$excel_data = $empDataServiceController->readExcelFileToArray($file_name_with_path);
// dd($excel_data);
$excelErrorData['excel_header'] = $excel_data[0];
unset($excel_data[0]);
@ -1976,7 +1977,7 @@ class EmployeeController extends AdminController
$excelErrorData['excel_data'] = $finalArray;
$excelErrorData['file_id'] = $file_id;
// dd($finalArray);
// dd($excelErrorData);
echo view('export_import_error_list', $excelErrorData);
}

View File

@ -109,6 +109,7 @@ class TicketController extends BaseController
'((CLAIM_NO))' => 'claim_number',
'((RELATIONSHIP))' => 'relationship',
'((POLICY_TYPE))' => 'policy_type',
'((AUTO_QUERY_CONTENT))' => 'auto_query_content',
];
$this->ticketMasterModel = new TicketMasterModel();
@ -145,9 +146,9 @@ class TicketController extends BaseController
if ($action == 1) {
$data = $this->ticketMasterModel
->select('ticket_master.id, ticket_claim_status.claim_status as status,
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
insurers.name as insurer_name, clients.client_name,
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
insurers.name as insurer_name, clients.client_name,ticket_master.insured_name,clients.short_name,
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
@ -169,9 +170,9 @@ class TicketController extends BaseController
// print_rr($where);
$data = $this->ticketMasterModel
->select('ticket_master.id, ticket_claim_status.claim_status as status,
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
insurers.name as insurer_name, clients.client_name,
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
insurers.name as insurer_name, clients.client_name,ticket_master.insured_name,clients.short_name,
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
@ -250,7 +251,7 @@ class TicketController extends BaseController
$ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y');
// dd($ticket_data);
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
if(!empty($template_data)){
if (!empty($template_data)) {
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
}
@ -423,8 +424,10 @@ class TicketController extends BaseController
// action = 1 is read, action 2 is insert/update
if ($action == 1) {
$ticket_master_id = $this->request->getPost('id');
$is_auto_query = $this->request->getPost('is_auto_query');
// print_rr($is_auto_query);
if (isset($ticket_master_id) && $ticket_master_id != '') {
$data = $this->ticketNoteModel->where('is_active', 1)->where('ticket_id', $ticket_master_id)->first();
$data = $this->ticketNoteModel->where('is_active', 1)->where('ticket_id', $ticket_master_id)->where('is_auto_query', $is_auto_query)->first();
if ($data) {
return $this->respond(['status' => true, 'data' => $data], 200);
} else {
@ -434,10 +437,13 @@ class TicketController extends BaseController
} elseif ($action == 2) {
$data = $this->request->getPost();
// if (isset($data['id']) && $data['id'] != ''){
// print_rr($data);die();
$status = $this->ticketNoteModel->save($data);
$id = isset($data['id']) ? $data['id'] : $this->ticketNoteModel->insertID();
// }
if ($status) {
return $this->respond(['status' => true], 200);
return $this->respond(['status' => true, 'id' => $id], 200);
} else {
return $this->respond(['status' => false], 200);
}
@ -532,12 +538,12 @@ class TicketController extends BaseController
// Validate Essential Fields
if (empty($ticket_data['emp_mail'])) {
$this->myLogger->logme('error', "Employee email is missing for Ticket ID : '".$ticket_id ."'");
$this->myLogger->logme('error', "Employee email is missing for Ticket ID : '" . $ticket_id . "'");
return null;
}
if (empty($subject) || empty($message)) {
$this->myLogger->logme('error', "Generated email content is empty for Ticket ID: '".$ticket_id ."'");
$this->myLogger->logme('error', "Generated email content is empty for Ticket ID: '" . $ticket_id . "'");
return null;
}
@ -570,9 +576,9 @@ class TicketController extends BaseController
if ($value == "emp_code") {
$replaceData = $ticket_data[$value] ?? '';
}else if($value == "policy_type"){
} else if ($value == "policy_type") {
$replaceData = str_replace("Claim-", "", $this->ticketType[$ticket_data['ticket_type_id']] ?? "");
}else{
} else {
$replaceData = strtoupper($ticket_data[$value]) ?? '';
}
@ -589,9 +595,9 @@ class TicketController extends BaseController
public function sendTrigger($mail_content)
{
$this->myLogger->logme('error', "Sending email with content");
if(!empty($mail_content)){
if (!empty($mail_content)) {
$response = MailHelper::send_email($mail_content);
}else{
} else {
$response = ['status' => false, 'code' => 404, 'message' => "Mail not sent, mail data empty"];
$this->myLogger->logme('error', "Mail not sent, mail data empty");
}
@ -615,14 +621,14 @@ class TicketController extends BaseController
}
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($mail_data['ticket_id']);
// print_rr($ticket_data);die();
if (!$ticket_data) {
$this->myLogger->logme('error', "No ticket data found for Ticket ID : " .$mail_data['ticket_id']);
$this->myLogger->logme('error', "No ticket data found for Ticket ID : " . $mail_data['ticket_id']);
$this->myLogger->logme('error', "Reply mail not send");
return null;
}
if(!empty($mail_data)){
if (!empty($mail_data)) {
$mail_data['mail_content'] = $this->replacePlaceholders($mail_data['mail_content'], $ticket_data);
$mail_data['mail_subject'] = $this->replacePlaceholders($mail_data['mail_subject'], $ticket_data);
}
@ -653,10 +659,10 @@ class TicketController extends BaseController
$mail_content = $this->constructMailContent($ticket_id);
// print_r($mail_content); die;
$mail_responce = $this->sendTrigger($mail_content);
}elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0 ){
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Automail Not Enabled');
}else{
$this->myLogger->logme('error','Auto Mail Not Sent, Reason: Mail Template Not Created');
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
} else {
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Mail Template Not Created');
}
return $mail_responce;
@ -733,61 +739,292 @@ class TicketController extends BaseController
AND th.is_active = 1
ORDER BY
th.created_at DESC";
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
$priorityType = $this->priorityType;
$relationshipType = $this->relationshipType;
$modeOFIntimate = $this->modeOFIntimate;
$claim_type = $this->claimType;
foreach ($data as &$row) {
if ($row['field_name'] == 'claim_status_id') {
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
$new_new_value = $row['new_status_value'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'acm_id') {
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
$new_new_value = $row['new_account_manager'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'insured_emp_id') {
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
$new_new_value = $row['new_insured_id_name'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'priority') {
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
$new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'relationship') {
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
$new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'mode_of_intimation') {
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
$new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'claim_type') {
$new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-';
$new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']])?$claim_type[$row['ticket_type_id']][$row['new_value']]:'-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'claim_type') {
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
$new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} else {
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
$new_new_value = isset($row['new_value']) ? $row['new_value'] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
$data = $this->ticketHistoryModel->query($sql)->getResultArray();
$priorityType = $this->priorityType;
$relationshipType = $this->relationshipType;
$modeOFIntimate = $this->modeOFIntimate;
$claim_type = $this->claimType;
foreach ($data as &$row) {
if ($row['field_name'] == 'claim_status_id') {
$new_old_value = isset($row['old_status_value']) ? $row['old_status_value'] : '-';
$new_new_value = $row['new_status_value'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'acm_id') {
$new_old_value = isset($row['old_account_manager']) ? $row['old_account_manager'] : '-';
$new_new_value = $row['new_account_manager'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'insured_emp_id') {
$new_old_value = isset($row['old_insured_id_name']) ? $row['old_insured_id_name'] : '-';
$new_new_value = $row['new_insured_id_name'];
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'priority') {
$new_old_value = isset($priorityType[$row['old_value']]) ? $priorityType[$row['old_value']] : '-';
$new_new_value = isset($priorityType[$row['new_value']]) ? $priorityType[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'relationship') {
$new_old_value = isset($relationshipType[$row['old_value']]) ? $relationshipType[$row['old_value']] : '-';
$new_new_value = isset($relationshipType[$row['new_value']]) ? $relationshipType[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'mode_of_intimation') {
$new_old_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
$new_new_value = isset($modeOFIntimate[$row['old_value']]) ? $modeOFIntimate[$row['old_value']] : "-";
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'claim_type') {
$new_old_value = isset($claim_type[$row['ticket_type_id']][$row['old_value']]) ? $claim_type[$row['ticket_type_id']][$row['old_value']] : '-';
$new_new_value = isset($claim_type[$row['ticket_type_id']][$row['new_value']]) ? $claim_type[$row['ticket_type_id']][$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} elseif ($row['field_name'] == 'claim_type') {
$new_old_value = isset($claim_type[$row['old_value']]) ? $claim_type[$row['old_value']] : '-';
$new_new_value = isset($claim_type[$row['new_value']]) ? $claim_type[$row['new_value']] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
} else {
$new_old_value = isset($row['old_value']) ? $row['old_value'] : '-';
$new_new_value = isset($row['new_value']) ? $row['new_value'] : '-';
$row['old_value'] = $new_old_value;
$row['new_value'] = $new_new_value;
}
}
}
return ($data);
}
public function sendMailWithAutoQuery()
{
$ticket_ids = $this->ticketMessageModel
->select('ticket_master.id')
->join('ticket_master', 'ticket_master.id = ticket_messages.ticket_id AND ticket_master.is_active = 1 and ticket_master.claim_status_id in (4,17,27,37)')
->join('ticket_claim_status AS tcs', 'tcs.id = ticket_messages.claim_status AND (tcs.is_active = 1)')
->join('ticket_notes', 'ticket_notes.ticket_id = ticket_messages.ticket_id AND ticket_notes.is_auto_query = 1 AND ticket_notes.is_active = 1')
->where('ticket_messages.is_active', 1)
->where('ticket_messages.claim_status in (4,17,27,37)')
->groupBy('ticket_master.id')
->having('DATEDIFF(CURDATE(), MAX(ticket_messages.created_at)) =', 7)
->having('count(ticket_messages.id) < ', 6)
->findAll();
// var_dump($ticket_ids);die();
foreach ($ticket_ids as $ticket) {
$ticket_id = $ticket['id'];
$acm_mails = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
$ticket_data = $this->ticketMasterModel->getTicketDataByTicketID($ticket_id);
$template_data = $this->ticketMasterModel->getTemplateDataByTicketID($ticket_id);
if (!empty($template_data)) {
$template_data['mail_content'] = $this->replacePlaceholders($template_data['mail_content'], $ticket_data);
$template_data['subject'] = $this->replacePlaceholders($template_data['subject'], $ticket_data);
}
$emailData = [
'mail' => $template_data['emp_mail'],
'subject' => $template_data['subject'],
'message' => $template_data['mail_content'],
'common' => [],
'cc' => $acm_mails['common_mails'],
'attachments' => []
];
$this->myLogger->logme('error', "Final Reply Email Data");
// var_dump($emailData);
$this->sendTrigger($emailData);
}
return 'Ticket id\'s : '.json_encode($ticket_ids);
}
public function ticketReports(){
if ($this->request->is('get')){
$default_start = new \DateTime();
$data['default_end'] = $default_start->format('d-m-Y');
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
$data['policy_type'] = $this->ticketType;
$data['account_manager'] = $this->userModel->select('first_name')->where('is_active',1)->where('role',3)->findAll();
$data['report_type'] = [
'acc_manager_wise_status'=>'Account Manger Wise Status Report',
'tpa_wise_status' => 'TPA Wise Status Report',
'tat_band_wise' => 'TAT Wise Status Report'
];
//
$this->loadLayout('ticket_reports',$data);
}else{
$received_data = $this->request->getPost();
$from_Date = $received_data['fromDate'];
$to_Date = $received_data['toDate'];
$fromDate = \DateTime::createFromFormat('d-m-Y', $from_Date)->format('Y-m-d');
$toDate = \DateTime::createFromFormat('d-m-Y', $to_Date)->format('Y-m-d');
$policy_type = $received_data['policy_type'];
// print_rr($received_data);
if ($received_data['report_type'] == "acc_manager_wise_status"){
$viewData['account_manager_wise_data'] = $this->accountManagerWiseReport($policy_type,$fromDate,$toDate);
// print_rr($viewData);
if ($policy_type == 1){
$html = view('claims_report_acc_manager_gmc', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else{
$html = view('claims_report_acc_manager_gpa', $viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}
return ($data);
}elseif ($received_data['report_type'] == 'tpa_wise_status'){
$viewData['tpa_wise_data'] = $this->tpaWiseReport($policy_type,$fromDate,$toDate);
$html = view('claims_report_tpa_wise',$viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}else if ($received_data['report_type'] == 'tat_band_wise'){
$viewData['data'] = $this->ticketMasterModel->getTATReport($policy_type, $fromDate, $toDate);
$html = view('tat_report_band_wise_list',$viewData);
return $this->respond(['status' => true, 'html' => $html], 200);
}
}
}
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
if ($policy_type == 1) {
$sql = "SELECT
u.first_name AS acc_manager_name,
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
(
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
) AS total
FROM
ticket_master master
JOIN
user_profiles u ON master.acm_id = u.id and u.is_active = 1
JOIN
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
WHERE
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
GROUP BY
u.id;
";
$result = $this->ticketMasterModel->query($sql)->getResultArray();
// dd($result);
return $result;
}else{
$sql = "SELECT u.first_name AS acc_manager_name,
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
(
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
) AS total1,
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
(
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
) AS total2
FROM
ticket_master master
JOIN
user_profiles u ON master.acm_id = u.id and u.is_active = 1
JOIN
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
WHERE
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
GROUP BY
u.id;
";
$result = $this->ticketMasterModel->query($sql)->getResultArray();
return $result;
}
}
public function tpaWiseReport($policy_type = null ,$start_date = null,$end_date = null ){
// $policy_type = 1;
$sql = "SELECT
tpa.name AS tpa_name,
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
(
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
) AS total,
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
(
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
) AS total2
FROM
ticket_master master
JOIN
tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
JOIN
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
WHERE
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
GROUP BY
tpa.id;
";
$result = $this->ticketMasterModel->query($sql)->getResultArray();
return $result;
}
}

View File

@ -105,7 +105,7 @@ class TicketMasterModel extends Model
public function getTemplateDataByTicketID($ticket_id)
{
$template_data = $this
->select("ticket_mail_template.*, ticket_master.emp_mail")
->select("ticket_mail_template.*, ticket_master.emp_mail,ticket_master.claim_status_id")
->join('ticket_claim_status', 'ticket_master.claim_status_id = ticket_claim_status.id and ticket_claim_status.is_active = 1')
->join('ticket_mail_template', '
ticket_claim_status.trigger_type = ticket_mail_template.trigger_type
@ -131,11 +131,13 @@ class TicketMasterModel extends Model
clients.client_name,
insurers.name as insurer_name,
tpa.name as tpa_name
tpa.name as tpa_name,
ticket_notes.note as auto_query_content
")
->join('clients', 'ticket_master.client_id = clients.id', 'left')
->join('insurers', 'ticket_master.insurer_id = insurers.id', 'left')
->join('tpa', 'ticket_master.tpa_id = tpa.id', 'left')
->join('ticket_notes', 'ticket_master.id = ticket_notes.ticket_id and ticket_notes.is_active = 1 and ticket_notes.is_auto_query = 1','left')
->join('user_profiles', 'ticket_master.acm_id = user_profiles.id', 'left')
->where('ticket_master.id', $ticket_id)
->where('ticket_master.is_active', 1)
@ -144,5 +146,129 @@ class TicketMasterModel extends Model
return $ticket_data;
}
//get TAT report BAND wise Data
public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
{
//set default last 3 months data date
$fromDate = date('Y-m-d', strtotime('-90 days'));
$toDate = date('Y-m-d 23:59:59');
if (!empty($start_date) && !empty($end_date)) {
$fromDate = change_date_format($start_date);
$toDate = change_date_format($end_date);
}
$ticket_type_data_1 = "";
$ticket_type_data_2 = "";
if(!empty($ticket_type)){
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
$ticket_type_data_2 = "AND tm.ticket_type_id = $ticket_type";
}
// Fetch claim statuses from the `ticket_claim_status` table
$statusQuery = " SELECT
id, claim_status
FROM ticket_claim_status
Where is_active = 1
$ticket_type_data_1
";
$statusResult = $this->db->query($statusQuery)->getResultArray();
// dd($statusResult);
// Initialize dynamic query parts
$dynamicSelect = '';
// Loop through each claim status and generate the COALESCE and CASE statements for the SELECT
foreach ($statusResult as $status) {
// Dynamically add the COALESCE and CASE for each status in the SELECT part
$dynamicSelect .= "
COALESCE(
SUM(
CASE
WHEN subquery.status_id = {$status['id']} THEN 1
ELSE 0
END
),
0
) AS `{$status['claim_status']}`, ";
}
// Remove the trailing comma from the SELECT part
$dynamicSelect = rtrim($dynamicSelect, ', ');
// dd($dynamicSelect);
// Construct the full SQL query
$sql = "
SELECT
tc.TAT_Category,
$dynamicSelect
FROM
(
SELECT 'Above 20 Days' AS TAT_Category
UNION ALL
SELECT '13-20 Days'
UNION ALL
SELECT '7-12 Days'
UNION ALL
SELECT '0-6 Days'
) AS tc
LEFT JOIN (
SELECT
th.ticket_id,
tcs.claim_status,
tcs.id AS status_id,
CASE
WHEN DATEDIFF(
th.created_at,
COALESCE(tm.updated_at, th.created_at)
) BETWEEN 0 AND 6 THEN '0-6 Days'
WHEN DATEDIFF(
th.created_at,
COALESCE(tm.updated_at, th.created_at)
) BETWEEN 7 AND 12 THEN '7-12 Days'
WHEN DATEDIFF(
th.created_at,
COALESCE(tm.updated_at, th.created_at)
) BETWEEN 13 AND 20 THEN '13-20 Days'
ELSE 'Above 20 Days'
END AS TAT_Category
FROM
ticket_master tm
JOIN ticket_history th ON tm.id = th.ticket_id
JOIN ticket_claim_status tcs ON th.field_name = 'claim_status_id'
AND th.new_value = tcs.id
$ticket_type_data_2
AND tm.created_at >= '$fromDate'
AND tm.created_at <= '$toDate'
AND tm.is_active = 1
AND th.is_active = 1
AND tcs.is_active = 1
) AS subquery ON tc.TAT_Category = subquery.TAT_Category
GROUP BY
tc.TAT_Category
ORDER BY
FIELD(
tc.TAT_Category,
'Above 20 Days',
'13-20 Days',
'7-12 Days',
'0-6 Days'
);
";
// Execute the query and return the result
$data = $this->db->query($sql)->getResultArray();
// dd($this->db->getLastQuery(), $data);
// $tableData = [];
// if (!empty($data)) {
// // Extract table headers from the first row keys
// $headers = array_keys($data[0]);
// $tableData['headers'] = $headers;
// $tableData['body'] = $data;
// }
return $data;
}
}

View File

@ -12,7 +12,7 @@ class TicketMessageModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','sender','ticket_id','mail_subject','emp_mail','mail_content','created_at'];
protected $allowedFields = ['id','sender','ticket_id','claim_status','mail_subject','emp_mail','mail_content','created_at'];
// Callbacks

View File

@ -12,7 +12,7 @@ class TicketNoteModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','ticket_id','note','created_by','updated_by','is_active'];
protected $allowedFields = ['id','ticket_id','note','is_auto_query','created_by','updated_by','is_active'];
// Callbacks
protected $allowCallbacks = true;

View File

@ -0,0 +1,169 @@
<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="col-12">
<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;">Insurer List</h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>Account Manger</th>
<th>ID Not Generated</th>
<th>Non-ID</th>
<th>CDA</th>
<th>Information Required</th>
<th>Under Process</th>
<th>Approved</th>
<th>Payment Initiated</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php foreach($account_manager_wise_data as $data): ?>
<tr>
<td><?= $data['acc_manager_name'] ?></td>
<td><?= $data['id_not_generated'] ?></td>
<td><?= $data['non_id'] ?></td>
<td><?= $data['cda']?></td>
<td><?= $data['information_required'] ?></td>
<td><?= $data['under_process'] ?></td>
<td><?= $data['approved'] ?></td>
<td><?= $data['payment_initiated'] ?></td>
<td><?= $data['total'] ?></td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot>
<tr>
<th>Grand Total</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<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>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Insurer-Wise-Report-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Insurer-Wise-Report-List',
exportOptions: {
orthogonal: 'sort'
},
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false,
footerCallback: function(row, data, start, end, display) {
var api = this.api();
// Helper function to parse numbers
var parseNumber = function(value) {
return typeof value === 'string' ?
parseFloat(value.replace(/[\$,]/g, '')) :
typeof value === 'number' ? value : 0;
};
// Calculate total for each column
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_non_id = api.column(2).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_cda = api.column(3).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_information_required = api.column(4).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_under_process = api.column(5).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_approved = api.column(6).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_of_total = api.column(8).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
// Update the footer with totals
$(api.column(1).footer()).html(total_id_not_generated);
$(api.column(2).footer()).html(total_non_id);
$(api.column(3).footer()).html(total_cda);
$(api.column(4).footer()).html(total_information_required);
$(api.column(5).footer()).html(total_under_process);
$(api.column(6).footer()).html(total_approved);
$(api.column(7).footer()).html(total_payment_initiated);
$(api.column(8).footer()).html(total_of_total);
}
});
} else {
console.error("Table not found.");
}
});
</script>

View File

@ -0,0 +1,203 @@
<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="col-12">
<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;">Insurer List</h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th style="text-align: center;" colspan="8">OPEN</th>
<th style="text-align: center;" colspan="5">CLEARED</th>
</tr>
<tr>
<th>Account Manger</th>
<th>Claim Intimation</th>
<th>Intimation to Insurer</th>
<th>Client Pending</th>
<th>Insurer Pending</th>
<th>Investigation</th>
<th>Approved</th>
<th>On Hold</th>
<th>Total</th>
<th>Not Covered</th>
<th>Closed</th>
<th>Settled</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php foreach($account_manager_wise_data as $data): ?>
<tr>
<td><?= $data['acc_manager_name'] ?></td>
<td><?= $data['claim_intimation'] ?></td>
<td><?= $data['int_to_insurer'] ?></td>
<td><?=$data['client_pending']?></td>
<td><?=$data['information_required'] ?></td>
<td><?=$data['investigation'] ?></td>
<td><?=$data['approved'] ?></td>
<td><?=$data['on_hold'] ?></td>
<td><?=$data['total1'] ?></td>
<td><?=$data['not_covered'] ?></td>
<td><?=$data['closed'] ?></td>
<td><?=$data['settled'] ?></td>
<td><?=$data['total2'] ?></td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot>
<tr>
<th>Grand Total</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<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>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Insurer-Wise-Report-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Insurer-Wise-Report-List',
exportOptions: {
orthogonal: 'sort'
},
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false,
footerCallback: function(row, data, start, end, display) {
var api = this.api();
// Helper function to parse numbers
var parseNumber = function(value) {
return typeof value === 'string' ?
parseFloat(value.replace(/[\$,]/g, '')) :
typeof value === 'number' ? value : 0;
};
// Calculate total for each column
var total_claim_intimation = api.column(1).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_int_to_insurer = api.column(2).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_client_pending = api.column(3).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_information_required = api.column(4).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_investigation = api.column(5).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_approved = api.column(6).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_on_hold = api.column(7).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_of_total = api.column(8).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_not_covered = api.column(9).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_closed = api.column(10).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_settled = api.column(11).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_of_total2 = api.column(12).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
// Update the footer with totals
$(api.column(1).footer()).html(total_claim_intimation);
$(api.column(2).footer()).html(total_int_to_insurer);
$(api.column(3).footer()).html(total_client_pending);
$(api.column(4).footer()).html(total_information_required);
$(api.column(5).footer()).html(total_investigation);
$(api.column(6).footer()).html(total_approved);
$(api.column(7).footer()).html(total_on_hold);
$(api.column(8).footer()).html(total_of_total);
$(api.column(9).footer()).html(total_not_covered);
$(api.column(10).footer()).html(total_closed);
$(api.column(11).footer()).html(total_settled);
$(api.column(12).footer()).html(total_of_total2);
}
});
} else {
console.error("Table not found.");
}
});
</script>

View File

@ -0,0 +1,210 @@
<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="col-12">
<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;">Insurer List</h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th style="text-align: center;" colspan="8">OPEN</th>
<th style="text-align: center;" colspan="5">CLEARED</th>
</tr>
<tr>
<th>TPA</th>
<th>ID Not Generated</th>
<th>Non-ID</th>
<th>CDA</th>
<th>Information Required</th>
<th>Under Process</th>
<th>Approved</th>
<th>Payment Initiated</th>
<th>Total</th>
<th>Closed</th>
<th>Settled</th>
<th>Returned</th>
<th>Denied</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php foreach($tpa_wise_data as $data): ?>
<tr>
<td><?= $data['tpa_name'] ?></td>
<td><?= $data['id_not_generated'] ?></td>
<td><?= $data['non_id'] ?></td>
<td><?=$data['cda']?></td>
<td><?=$data['information_required'] ?></td>
<td><?=$data['under_process'] ?></td>
<td><?=$data['approved'] ?></td>
<td><?=$data['payment_initiated'] ?></td>
<td><?=$data['total'] ?></td>
<td><?=$data['closed'] ?></td>
<td><?=$data['settled'] ?></td>
<td><?=$data['returned'] ?></td>
<td><?=$data['denied'] ?></td>
<td><?=$data['total2'] ?></td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot>
<tr>
<th>Grand Total</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
<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>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Insurer-Wise-Report-List',
},
{
extend: 'excel',
text: 'Excel',
title: 'Insurer-Wise-Report-List',
exportOptions: {
orthogonal: 'sort'
},
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false,
footerCallback: function(row, data, start, end, display) {
var api = this.api();
// Helper function to parse numbers
var parseNumber = function(value) {
return typeof value === 'string' ?
parseFloat(value.replace(/[\$,]/g, '')) :
typeof value === 'number' ? value : 0;
};
// Calculate total for each column
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_non_id = api.column(2).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_cda = api.column(3).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_information_required = api.column(4).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_under_process = api.column(5).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_approved = api.column(6).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_of_total = api.column(8).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_closed = api.column(9).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_settled = api.column(10).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_returned = api.column(11).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_denied = api.column(12).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var total_of_total2 = api.column(13).data().reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
// Update the footer with totals
$(api.column(1).footer()).html(total_id_not_generated);
$(api.column(2).footer()).html(total_non_id);
$(api.column(3).footer()).html(total_cda);
$(api.column(4).footer()).html(total_information_required);
$(api.column(5).footer()).html(total_under_process);
$(api.column(6).footer()).html(total_approved);
$(api.column(7).footer()).html(total_payment_initiated);
$(api.column(8).footer()).html(total_of_total);
$(api.column(9).footer()).html(total_closed);
$(api.column(10).footer()).html(total_settled);
$(api.column(11).footer()).html(total_returned);
$(api.column(12).footer()).html(total_denied);
$(api.column(13).footer()).html(total_of_total2);
}
});
} else {
console.error("Table not found.");
}
});
</script>

View File

@ -82,8 +82,9 @@ table.dataTable tbody td {
<?php foreach ($excel_data[$i] as $data): ?>
<td <?php if (isset($data['error'])) echo 'class="error-cell"'; ?>>
<?php
if (isset($data['value'])) {
echo $data['value'];
if (isset($data['value']) && $data['value'] != "" ) {
// echo $data['value'];
echo is_array($data['value']) ? "" : $data['value'];
}
if (isset($data['error'])) {
echo '<span class="error-icon"> <i class="fas fa-exclamation-circle" style="color: red;"></i></span>';

View File

@ -658,6 +658,9 @@
<li>
<a href="<?= base_url('/ticket/mail_template') ?>">Mail Template</a>
</li>
<li>
<a href="<?= base_url('/ticket/ticket_reports') ?>">Claim Reports</a>
</li>
</ul>
</div>
</li>

View File

@ -0,0 +1,101 @@
<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="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;">TAT Band Wise Report </h4>
</div>
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead>
<tr>
<?php foreach (array_keys($data[0]) as $header): ?>
<th><?= esc($header) ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($data as $row): ?>
<tr>
<?php foreach ($row as $value): ?>
<td class="right-align-input"><?= esc($value) ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
</div>
</div>
</div><!-- end col -->
</div>
</div>
<!-------------------------------------------------------------------------------------------------->
<script>
// Datatable document ready
$(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>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'TAT BAND WISE DATA',
},
{
extend: 'excel',
text: 'Excel',
title: 'TAT BAND WISE DATA',
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 10, // Set default number of rows per page (optional)
ordering: false,
});
} else {
console.error("Table atet found.");
}
});
// ----------------------------------------------------------------------------------------------------
</script>

View File

@ -0,0 +1,98 @@
<div class="row">
<div class="col-12">
<div class="card-body">
<form role="form" class="parsley-examples" method="post" id="ticket_auto_query"
enctype="multipart/form-data">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-12">
<!-- <label for="ticket_auto_query_note">Add Notes</label> -->
<textarea class="form-control" id="ticket_auto_query_note" name="note" rows="3"
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
</div>
</div>
</div><input type="hidden" id="query_note_id"><input type="hidden"
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary" id="ticket_auto_query_submit">Submit</button>
</div>
</form>
</div>
</div> <!-- end col-->
</div>
<!-- end -->
<script>
$(document).ready(function() {
url = '<?= base_url('ticket/note/1')?>';
data = { id : $('#ticket_master_id').val() , is_auto_query : 1};
$.ajax({
url:url,
data:data,
type: 'POST',
success: function(res) {
if (res.status == true){
$('#ticket_auto_query_note').val(res.data.note);
$('#query_note_id').val(res.data.id);
}
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Went Wrong!', 'warning');
}, 1000);
}
})
$("#ticket_auto_query").submit(function(event) {
event.preventDefault();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var url = '<?= base_url("/ticket/note/2"); ?>';
var formData = $(this).serializeArray();
var ticket_id = $('#ticket_master_id').val();
if (ticket_id != null && ticket_id != ''){
formData.push({ name: 'ticket_id', value: ticket_id});
}
var primary_key = $('#query_note_id').val();
if (primary_key != null && primary_key != ''){
formData.push({ name: 'id', value: primary_key});
}
formData.push({name: 'is_auto_query',value:1})
console.log(formData);
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
if (response.status == true) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.success('Note Added Successfully','Success');
// console.log("Respone id is ")
// console.log(response.id);
$('#query_note_id').val(response.id);
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
});
});
</script>

View File

@ -49,6 +49,13 @@
<span class="d-none d-sm-inline-block">History</span>
</a>
</li>
<li class="nav-item">
<a href="#autoQuery-tab" data-toggle="tab" class="nav-link px-2 py-1" id="auto_query_tab"
aria-expanded="false">
<i class="mdi mdi-robot mr-1"></i>
<span class="d-none d-sm-inline-block">Auto Query Content</span>
</a>
</li>
</ul>
<!-- Tab Content -->
@ -72,6 +79,9 @@
<div class="tab-pane fade" id="history-tab">
<?php include('ticket_history.php'); ?>
</div>
<div class="tab-pane fade" id="autoQuery-tab">
<?php include('ticket_auto_query.php'); ?>
</div>
</div>
</div>
</div>

View File

@ -25,6 +25,20 @@ table.dataTable tbody td {
margin-left: 20px !important;
}
</style>
<style>
.table th:nth-child(1),
.table td:nth-child(1) {
max-width: 200px !important;
min-width: 100px !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
}
</style>
<div class="col-12">
<div class="card">
@ -52,12 +66,14 @@ table.dataTable tbody td {
<?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?>
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
<td><?php echo $row['status']; ?></td>
<td data-toggle="tooltip" data-placement="top" title="<?php echo $row['status']; ?>">
<span class="status-tooltip"><?php echo $row['status']; ?></span>
</td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['insured_name']; ?></td>
<td><?php echo $row['short_name']; ?></td>
<td><?php echo $row['tat']; ?></td>
</tr>
<?php } ?>
@ -77,6 +93,10 @@ table.dataTable tbody td {
<!-------------------------------------------------------------------------------------------------->
<script>
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
// Datatable document ready
$(document).ready(function() {

View File

@ -25,7 +25,7 @@
$(document).ready(function() {
url = '<?= base_url('ticket/note/1')?>';
data = { id : $('#ticket_master_id').val()};
data = { id : $('#ticket_master_id').val(), is_auto_query : 0};
$.ajax({
url:url,
data:data,
@ -69,6 +69,10 @@ $(document).ready(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.success('Note Added Successfully','Success');
// console.log("Respone id is ")
// console.log(response.id);
$('#note_id').val(response.id);
// console.log($('#'))
} else {

View File

@ -34,7 +34,7 @@
</div>
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
</div>
</div>
</div><input type="hidden" id="claim_status" name="claim_status" value="<?= isset($reply_data['claim_status_id'])??'' ?>">
</div>
<!-- Submit Button -->

View File

@ -0,0 +1,140 @@
<div class="row">
<div class="col-xl-12">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<!-- <div class="text-center"> -->
<div class="form-row">
<div class="form-group col-md-4" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>>
</div>
<div class="form-group col-md-4">
<label>Policy Type<span class="text-danger"> *</span></label> <br />
<select name="policy_type" class="form-control" id="policy_type" required>
<option value="">Select</option>
<?php foreach ($policy_type as $policy => $key) : ?>
<option value="<?= $policy ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div>
<div class="form-group col-md-4">
<label>Report Type<span class="text-danger"> *</span></label> <br />
<select class="form-control" id="report_type" required>
<option value="0">Select</option>
<?php foreach ($report_type as $reports => $key) : ?>
<option value="<?= $reports ?>"><?= $key ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="row justify-content-end">
<div class="col-auto">
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-report-page" onclick="fetchReportPage(event);">Submit</a>
</div>
</div>
<!-- </div> -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card mb-1">
<div id="report"></div>
</div>
<script>
$(function() {
var start = $('#startDate').val();
var end = $('#endDate').val();
var start = moment(start, 'DD/MM/YYYY');
var end = moment(end, 'DD/MM/YYYY');
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}
$('#reportrange').daterangepicker({
startDate: start,
endDate: end,
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')]
}
}, cb);
cb(start, end);
});
</script>
<script>
function fetchReportPage() {
var fromDate = $('#startDate').val();
var toDate = $('#endDate').val();
var policy_type = $('#policy_type').val();
var report_type = $('#report_type').val();
var requestData = {
fromDate: fromDate,
toDate: toDate,
policy_type: policy_type,
report_type: report_type
};
// console.log(requestData);
var url = '<?= base_url('/ticket/ticket_reports') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
if (response.status == true) {
$('#report').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}else{
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message,'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
</script>