MERGE_TEST_CLAIMS_MODULE
This commit is contained in:
commit
c5a4bbb451
@ -6,6 +6,9 @@ use CodeIgniter\Router\RouteCollection;
|
||||
/**
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
$routes->post('/chat', 'ChatbotControllerNew::index');
|
||||
$routes->get('/widget', 'ChatbotControllerNew::widget');
|
||||
$routes->get('/chatbot', 'ChatbotControllerNew::chatbot');
|
||||
|
||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
|
||||
@ -14,6 +17,7 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||
$routes->get("getClientData", "ClientController::getClientData");
|
||||
$routes->get("testing_for_review_mail/(:any)", "ClientController::testingForReviewMail/$1");
|
||||
$routes->get("sendMemberReviewConfirmationMail/(:any)", "ClientController::sendMemberReviewConfirmationMail/$1");
|
||||
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
|
||||
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
||||
@ -335,6 +339,9 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post('get_data_for_mapping', 'EmployeeController::getDataForMapping');
|
||||
$routes->post('unmap_employees/(:num)', 'EmployeeController::unmapEmployees/$1');
|
||||
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
||||
$routes->get('getCDAmount', 'ClientController::getCDAmount');
|
||||
$routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1');
|
||||
$routes->get('getTheEmpDataForClaimSearchByMobile/(:any)', 'ClientController::getTheEmpDataForClaimSearchByMobile/$1');
|
||||
});
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -372,6 +379,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("getFileErr/(:any)", "PolicyTransactionController::getFileErr/$1");
|
||||
$routes->get("getInsurerStatementMonth", "PolicyTransactionController::getInsurerStatementMonth");
|
||||
$routes->get("deleteStatement/(:any)", "PolicyTransactionController::deleteStatement/$1");
|
||||
//$routes->post('failedStatement',"PolicyTransactionController::failedStatementList");
|
||||
});
|
||||
|
||||
});
|
||||
@ -404,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');
|
||||
@ -413,6 +422,10 @@ $routes->cli('cli/check_bounce_mail_cli', 'MasterController::testCheckBounceMail
|
||||
$routes->cli('cli/app_check_list', 'MasterController::appCheckList');
|
||||
$routes->cli('cli/new_gdrive_token', 'GoogleDriveController::generateNewGoogleDriveAccessToken');
|
||||
|
||||
//crone job
|
||||
$routes->cli('cli/enrollOpendAndClose', 'DashboardController::updatePolicyEnrollmentStatus');
|
||||
$routes->cli("cli/sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
@ -424,11 +437,17 @@ $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationControll
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
|
||||
// Test initiate Claim
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
|
||||
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("logined", "RestAuthenticationController::logined");
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
|
||||
});
|
||||
// $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
@ -468,6 +487,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
// $routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
@ -478,3 +498,29 @@ $routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrol
|
||||
// Ticketing System
|
||||
|
||||
// Ticketing System End's
|
||||
|
||||
|
||||
//BDSReports
|
||||
$routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'irba_report','BDSReportController::irba_report');
|
||||
$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');
|
||||
|
||||
});
|
||||
|
||||
//New Tickets
|
||||
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
|
||||
$routes->get('new/(:any)','TicketController::ticket_form/$1');
|
||||
$routes->post('create','TicketController::createTicket');
|
||||
$routes->post('update','TicketController::updateTicket');
|
||||
$routes->get('view/(:any)','TicketController::view_ticket/$1');
|
||||
$routes->get('mail_template','TicketController::mailTemplate');
|
||||
$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');
|
||||
});
|
||||
|
||||
|
||||
930
app/Controllers/BDSReportController.php
Normal file
930
app/Controllers/BDSReportController.php
Normal file
@ -0,0 +1,930 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Kint\Kint;
|
||||
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\InsurerBranchModel;
|
||||
use App\Models\PolicyTransactionModel;
|
||||
use App\Models\PTCOShareDetailsModel;
|
||||
use App\Models\COShareStmtDetailsModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
|
||||
class BDSReportController extends AdminController
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
|
||||
protected $myLogger;
|
||||
protected $clientModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $insurerModel;
|
||||
protected $insurerBranchModel;
|
||||
protected $policyTransactionModel;
|
||||
protected $PTCOShareDetailsModel;
|
||||
protected $coShareStmtDetailsModel;
|
||||
protected $policyTypeModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->insurerBranchModel = new InsurerBranchModel();
|
||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||
$this->PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
}
|
||||
|
||||
// public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate)
|
||||
// {
|
||||
|
||||
// $fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d');
|
||||
// $toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d');
|
||||
// try {
|
||||
// $sql = "
|
||||
// select ins.id,ins.name as insurers,
|
||||
// COALESCE(SUM(CASE WHEN pt.action_type = 'inception' and pt.insurer_id = ins.id and ptp.policy_category = $insurerCategory THEN 1 ELSE 0 END), 0) AS Policies,
|
||||
// COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS Premium,
|
||||
// COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id and ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN stmt.reward + stmt.actual_bp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.actual_tp_brokerage_amt ELSE 0 END), 0) AS Revenue,
|
||||
// COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN pt_co.exp_amt ELSE 0 END), 0) AS Expected_amt
|
||||
// from insurers ins
|
||||
// left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
// left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
// left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate'
|
||||
// left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $insurerCategory and ptp.is_active = 1
|
||||
// where ins.is_active = 1 and (ptp.policy_category = $insurerCategory or ptp.policy_category is null)
|
||||
// group by ins.id
|
||||
// ";
|
||||
|
||||
// $data['insurer_wise_data'] = $this->insurerModel->query($sql)->getResultArray();
|
||||
// // log_message('error',$this->insurerModel->getLastQuery());
|
||||
// // log_message('error',json_encode($data));
|
||||
// } catch (\Exception $e) {
|
||||
// $data['message'] = 'No data Found';
|
||||
// $this->myLogger->logme('error', $e->getMessage());
|
||||
// return $data;
|
||||
// }
|
||||
// return ($data);
|
||||
// }
|
||||
|
||||
public function Insurer_wise_Data($insurerCategory, $fromDate, $toDate)
|
||||
{
|
||||
|
||||
$fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d');
|
||||
$toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d');
|
||||
try {
|
||||
$sql = "
|
||||
SELECT
|
||||
ins.id,
|
||||
ins.name AS insurers,
|
||||
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' AND pt.insurer_id = ins.id AND ptp.policy_category = $insurerCategory THEN 1 ELSE 0 END), 0) AS Policies,
|
||||
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS Premium,
|
||||
COALESCE(SUM(CASE WHEN stmt.co_share_id = pt_co.id AND ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN stmt.reward + stmt.actual_bp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.actual_tp_brokerage_amt ELSE 0 END), 0) AS Revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.policy_category = $insurerCategory AND pt_co.insurer_id = ins.id THEN pt_co.exp_amt ELSE 0 END), 0) AS Expected_amt
|
||||
FROM
|
||||
insurers ins
|
||||
LEFT JOIN
|
||||
pt_co_share_details pt_co ON ins.id = pt_co.insurer_id AND pt_co.is_active = 1
|
||||
LEFT JOIN
|
||||
co_share_stmt_details stmt ON pt_co.id = stmt.co_share_id AND stmt.is_active = 1
|
||||
LEFT JOIN
|
||||
policy_transaction pt ON pt_co.pt_id = pt.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
LEFT JOIN
|
||||
policy_type ptp ON pt.policy_type_id = ptp.id AND ptp.policy_category = $insurerCategory AND ptp.is_active = 1
|
||||
WHERE
|
||||
ins.is_active = 1 AND (ptp.policy_category = $insurerCategory OR ptp.policy_category IS NULL)
|
||||
GROUP BY
|
||||
ins.id;
|
||||
";
|
||||
|
||||
$data['insurer_wise_data'] = $this->insurerModel->query($sql)->getResultArray();
|
||||
// log_message('error',$this->insurerModel->getLastQuery());
|
||||
// log_message('error',json_encode($data));
|
||||
} catch (\Exception $e) {
|
||||
$data['message'] = 'No data Found';
|
||||
$this->myLogger->logme('error', $e->getMessage());
|
||||
return $data;
|
||||
}
|
||||
return ($data);
|
||||
}
|
||||
|
||||
public function Bap_Wise_Data($insurerCategory, $fromDate, $toDate)
|
||||
{
|
||||
$fromDate = \DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d');
|
||||
$toDate = \DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d');
|
||||
|
||||
try {
|
||||
$sql = "
|
||||
SELECT
|
||||
pot.bap AS bap,
|
||||
COALESCE(COUNT(DISTINCT pt.id), 0) AS Policies,
|
||||
COALESCE(SUM((pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt)), 0) AS Premium,
|
||||
COALESCE(SUM(co.reward + co.actual_bp_brokerage_amt + co.actual_tep_brokerage_amt + co.actual_tp_brokerage_amt), 0) AS Revenue,
|
||||
COALESCE(SUM(pt_co.exp_amt), 0) AS Expected_amt
|
||||
FROM policy_type AS pot
|
||||
LEFT JOIN policy_transaction AS pt ON pot.id = pt.policy_type_id AND pt.is_active = 1 AND pt.action_type = 'inception' and pt.policy_issue_date >= '$fromDate' and pt.policy_issue_date <= '$toDate'
|
||||
LEFT JOIN pt_co_share_details AS pt_co ON pt.id = pt_co.pt_id AND pt_co.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details AS co ON pt_co.id = co.co_share_id AND co.is_active = 1
|
||||
WHERE pot.is_active = 1
|
||||
AND pot.policy_category = $insurerCategory
|
||||
GROUP BY pot.bap;
|
||||
|
||||
";
|
||||
$data['bap_wise_data'] = $this->policyTypeModel->query($sql)->getResultArray();
|
||||
} catch (\Exception $e) {
|
||||
$data['message'] = 'No Data Found';
|
||||
$this->myLogger->logme('error', $e->getMessage());
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
return ($data);
|
||||
}
|
||||
|
||||
public function irba_report()
|
||||
{
|
||||
|
||||
if ($this->request->is('get')) {
|
||||
$default_start = new \DateTime();
|
||||
$data['default_end'] = $default_start->format('d-m-Y');
|
||||
$data['default_start'] = $default_start->modify('-90 days')->format('d-m-Y');
|
||||
$data['categories'] = [
|
||||
'Life' => 'life',
|
||||
'Non Life' => 'nonLife'
|
||||
];
|
||||
$data['report_type'] = [
|
||||
'Insurer' => 'insurer',
|
||||
'BAP' => 'bap',
|
||||
'BAP-Client' => 'bapClient',
|
||||
'BAP-Insurer' => 'bapInsurer',
|
||||
'Client' => 'client'
|
||||
];
|
||||
return $this->loadLayout('irba_report', $data);
|
||||
} else {
|
||||
|
||||
$fromDate = $this->request->getPost('fromDate');
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$category = $this->request->getPost('category');
|
||||
$report_type = $this->request->getPost('report_type');
|
||||
// log_message('error',json_encode($_POST));die();
|
||||
if ($report_type == 'insurer') {
|
||||
$life = $category == 'life' ? 1 : 0;
|
||||
$viewData = $this->Insurer_wise_Data($life, $fromDate, $toDate);
|
||||
if (isset($data['message'])) {
|
||||
return $this->respond(['status' => false, 'message' => $data['message']], 200);
|
||||
}
|
||||
// Ensure $viewData is an array
|
||||
if (!is_array($viewData)) {
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
|
||||
$html = view('bds_report_Insurer_wise_Data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
} else if ($report_type == 'bap') {
|
||||
|
||||
$life = $category == 'life' ? 1 : 0;
|
||||
$viewData = $this->Bap_wise_Data($life, $fromDate, $toDate);
|
||||
if (isset($data['message'])) {
|
||||
return $this->respond(['status' => false, 'message' => $data['message']], 200);
|
||||
}
|
||||
// Ensure $viewData is an array
|
||||
if (!is_array($viewData)) {
|
||||
$viewData = [];
|
||||
}
|
||||
|
||||
|
||||
$html = view('bds_report_bap_wise_data', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
} else if($report_type == 'bapInsurer'){
|
||||
|
||||
//Condition for BAP Insurer wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPInsurerData($category, $fromDate, $toDate);
|
||||
|
||||
$html = view('irda_bap_insurer_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
|
||||
}else if($report_type == 'bapClient'){
|
||||
|
||||
//Condition for BAP Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getBAPClientData($category, $fromDate, $toDate);
|
||||
|
||||
$html = view('irda_bap_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
|
||||
}else if($report_type == 'client'){
|
||||
|
||||
//Condition for Client wise date
|
||||
$category = $category == 'life' ? 1 : 0;
|
||||
$viewData['data'] = $this->getClientData($category, $fromDate, $toDate);
|
||||
|
||||
$html = view('irda_client_report_list', $viewData);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
//Function for get BAP INSURE wise data for premium , policy count , revenue only
|
||||
public function getBAPInsurerData($category = 0, $start_date = null, $end_date = null)
|
||||
{
|
||||
try {
|
||||
$this->myLogger->logme('error', 'getBAPInsurerData function called');
|
||||
$this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
$this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->query("
|
||||
select ins.id, ins.name as insurer_name,
|
||||
|
||||
-- Health Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS health_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN pt_co.exp_amt ELSE 0 END), 0) AS health_exp_amt,
|
||||
|
||||
-- Misc Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS misc_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN pt_co.exp_amt ELSE 0 END), 0) AS misc_exp_amt,
|
||||
|
||||
|
||||
-- Motor Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS motor_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN pt_co.exp_amt ELSE 0 END), 0) AS motor_exp_amt,
|
||||
|
||||
-- Engineering Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS engineering_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN pt_co.exp_amt ELSE 0 END), 0) AS engineering_exp_amt,
|
||||
|
||||
|
||||
|
||||
-- Fire Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS fire_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN pt_co.exp_amt ELSE 0 END), 0) AS fire_exp_amt,
|
||||
|
||||
|
||||
-- Liability Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS liability_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN pt_co.exp_amt ELSE 0 END), 0) AS liability_exp_amt,
|
||||
|
||||
|
||||
-- Life Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS life_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN pt_co.exp_amt ELSE 0 END), 0) AS life_exp_amt,
|
||||
|
||||
|
||||
-- Marine Cargo Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_cargoe_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_cargo_exp_amt,
|
||||
|
||||
|
||||
-- Marine Hull Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN pt_co.exp_amt ELSE 0 END), 0) AS marine_hull_exp_amt,
|
||||
|
||||
-- Grand Totals
|
||||
COALESCE(
|
||||
SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END),
|
||||
0
|
||||
) AS total_policy_count,
|
||||
|
||||
COALESCE(
|
||||
SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END),
|
||||
0
|
||||
) AS total_premium,
|
||||
|
||||
COALESCE(
|
||||
SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||
SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END),
|
||||
0
|
||||
) AS total_revenue
|
||||
|
||||
from insurers ins
|
||||
left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $category
|
||||
where ins.is_active = 1
|
||||
group by ins.id
|
||||
ORDER BY
|
||||
health_premium DESC,
|
||||
misc_premium DESC,
|
||||
motor_premium DESC,
|
||||
engineering_premium DESC,
|
||||
fire_premium DESC,
|
||||
liability_premium DESC,
|
||||
life_premium DESC,
|
||||
marine_cargo_premium DESC,
|
||||
marine_hull_premium DESC;
|
||||
|
||||
");
|
||||
|
||||
// Get the query
|
||||
$result = $builder->getResultArray();
|
||||
$this->myLogger->logme('error', 'Query executed successfully.');
|
||||
// dd(db_connect()->getLastQuery(),$result);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// Log the exception details for debugging
|
||||
$this->myLogger->logme('error', 'Error occurred in getBAPInsurerData: {message}', ['message' => $e->getMessage()]);
|
||||
$this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
//Function for get BAP CLIENT wise data for premium , policy count , revenue only
|
||||
public function getBAPClientData($category = 0, $start_date = null, $end_date = null)
|
||||
{
|
||||
|
||||
try {
|
||||
$this->myLogger->logme('error', 'getBAPClientData function called');
|
||||
$this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
$this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->query("
|
||||
|
||||
SELECT
|
||||
c.id AS client_id,
|
||||
c.client_name,
|
||||
|
||||
-- Health Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS health_premium,
|
||||
|
||||
-- Misc Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS misc_premium,
|
||||
|
||||
-- Motor Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS motor_premium,
|
||||
|
||||
-- Engineering Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS engineering_premium,
|
||||
|
||||
-- Fire Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS fire_premium,
|
||||
|
||||
-- Liability Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS liability_premium,
|
||||
|
||||
-- Life Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS life_premium,
|
||||
|
||||
-- Marine Cargo Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
|
||||
-- Marine Hull Policies
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||
COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN (pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) ELSE 0 END), 0) AS marine_hull_premium,
|
||||
|
||||
-- Grand Totals
|
||||
COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
||||
COALESCE(SUM(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt), 0) AS total_premium
|
||||
|
||||
FROM clients c
|
||||
LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
LEFT JOIN policy_type ptp ON pt.policy_type_id = ptp.id
|
||||
LEFT JOIN pt_co_share_details pt_co ON pt_co.pt_id = pt.id AND pt_co.is_active = 1
|
||||
LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = pt_co.id AND stmt.is_active = 1
|
||||
WHERE c.is_active = 1
|
||||
AND ptp.policy_category = $category
|
||||
GROUP BY c.id
|
||||
ORDER BY
|
||||
health_premium DESC,
|
||||
misc_premium DESC,
|
||||
motor_premium DESC,
|
||||
engineering_premium DESC,
|
||||
fire_premium DESC,
|
||||
liability_premium DESC,
|
||||
life_premium DESC,
|
||||
marine_cargo_premium DESC,
|
||||
marine_hull_premium DESC
|
||||
|
||||
");
|
||||
|
||||
// Get the query
|
||||
$result = $builder->getResultArray();
|
||||
// dd(db_connect()->getLastQuery(),$result);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// Log the exception details for debugging
|
||||
$this->myLogger->logme('error', 'Error occurred in getBAPClientData: {message}', ['message' => $e->getMessage()]);
|
||||
$this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
//Function for get CLIENT wise data for premium and policy count only
|
||||
public function getClientData($category = 0, $start_date = null, $end_date = null)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$this->myLogger->logme('error', 'getClientData function called');
|
||||
$this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
$this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->query("
|
||||
|
||||
select
|
||||
c.id as client_id,
|
||||
c.client_name,
|
||||
|
||||
(
|
||||
select
|
||||
count(policy_transaction.id)
|
||||
from policy_transaction
|
||||
left join policy_type on policy_transaction.policy_type_id = policy_type.id
|
||||
where policy_transaction.client_id = c.id
|
||||
and policy_transaction.action_type = 'inception'
|
||||
and policy_transaction.is_active = 1
|
||||
|
||||
) as policy_count,
|
||||
|
||||
COALESCE((
|
||||
select
|
||||
sum(pt_co.bp_amt + pt_co.tp_amt + pt_co.tep_amt + pt_co.non_comm_per_amt) as premium
|
||||
from co_share_stmt_details stmt
|
||||
left join pt_co_share_details pt_co on stmt.co_share_id = pt_co.id
|
||||
left join policy_transaction pt on pt_co.pt_id = pt.id
|
||||
where pt.client_id = c.id
|
||||
and stmt.is_active = 1
|
||||
and pt_co.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
|
||||
where c.is_active = 1
|
||||
group by client_name
|
||||
order by premium desc
|
||||
");
|
||||
|
||||
// Get the query
|
||||
$result = $builder->getResultArray();
|
||||
// dd(db_connect()->getLastQuery(),$result);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// Log the exception details for debugging
|
||||
$this->myLogger->logme('error', 'Error occurred in getClientData: {message}', ['message' => $e->getMessage()]);
|
||||
$this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// //Function for get BAP INSURE wise data for premium , policy count , revenue only
|
||||
// public function getBAPInsurerData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
// try {
|
||||
// $this->myLogger->logme('error', 'getBAPInsurerData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
|
||||
// //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);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// select ins.id, ins.name as insurer_name,
|
||||
|
||||
// -- Health Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS health_revenue,
|
||||
|
||||
// -- Misc Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS misc_revenue,
|
||||
|
||||
|
||||
// -- Motor Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS motor_revenue,
|
||||
|
||||
// -- Engineering Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS engineering_revenue,
|
||||
|
||||
|
||||
// -- Fire Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS fire_revenue,
|
||||
|
||||
// -- Liability Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS liability_revenue,
|
||||
|
||||
|
||||
// -- Life Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS life_revenue,
|
||||
|
||||
|
||||
// -- Marine Cargo Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_cargoe_revenue,
|
||||
|
||||
// -- Marine Hull Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END), 0) AS marine_hull_revenue,
|
||||
|
||||
// -- Grand Totals
|
||||
// COALESCE(
|
||||
// SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END),
|
||||
// 0
|
||||
// ) AS total_policy_count,
|
||||
|
||||
// COALESCE(
|
||||
// SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END),
|
||||
// 0
|
||||
// ) AS total_premium,
|
||||
|
||||
// COALESCE(
|
||||
// SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END) +
|
||||
// SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END)+
|
||||
// SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_brokerage_amt + stmt.actual_tp_brokerage_amt + stmt.actual_tep_brokerage_amt + stmt.reward ELSE 0 END),
|
||||
// 0
|
||||
// ) AS total_revenue
|
||||
|
||||
// from insurers ins
|
||||
// left join pt_co_share_details pt_co on ins.id = pt_co.insurer_id and pt_co.is_active = 1
|
||||
// left join co_share_stmt_details stmt on pt_co.id = stmt.co_share_id and stmt.is_active = 1
|
||||
// left join policy_transaction pt on pt_co.pt_id = pt.id and pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
// left join policy_type ptp on pt.policy_type_id = ptp.id and ptp.policy_category = $category
|
||||
// where ins.is_active = 1
|
||||
// group by ins.id
|
||||
// ORDER BY
|
||||
// health_premium DESC,
|
||||
// misc_premium DESC,
|
||||
// motor_premium DESC,
|
||||
// engineering_premium DESC,
|
||||
// fire_premium DESC,
|
||||
// liability_premium DESC,
|
||||
// life_premium DESC,
|
||||
// marine_cargo_premium DESC,
|
||||
// marine_hull_premium DESC;
|
||||
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// $this->myLogger->logme('error', 'Query executed successfully.');
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getBAPInsurerData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// //Function for get BAP CLIENT wise data for premium , policy count , revenue only
|
||||
// public function getBAPClientData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
|
||||
// try {
|
||||
// $this->myLogger->logme('error', 'getBAPClientData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
// //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);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// SELECT
|
||||
// c.id AS client_id,
|
||||
// c.client_name,
|
||||
|
||||
// -- Health Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Health' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS health_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Health' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS health_premium,
|
||||
|
||||
// -- Misc Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS misc_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Misc' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS misc_premium,
|
||||
|
||||
// -- Motor Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS motor_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Motor' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS motor_premium,
|
||||
|
||||
// -- Engineering Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS engineering_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Engineering' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS engineering_premium,
|
||||
|
||||
// -- Fire Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS fire_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Fire' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS fire_premium,
|
||||
|
||||
// -- Liability Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS liability_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Liability' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS liability_premium,
|
||||
|
||||
// -- Life Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Life' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS life_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Life' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS life_premium,
|
||||
|
||||
// -- Marine Cargo Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_cargo_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Cargo' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_cargo_premium,
|
||||
|
||||
// -- Marine Hull Policies
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' AND pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS marine_hull_policy_count,
|
||||
// COALESCE(SUM(CASE WHEN ptp.bap = 'Marine Hull' THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt ELSE 0 END), 0) AS marine_hull_premium,
|
||||
|
||||
// -- Grand Totals
|
||||
// COALESCE(SUM(CASE WHEN pt.action_type = 'inception' THEN 1 ELSE 0 END), 0) AS total_policy_count,
|
||||
// COALESCE(SUM(stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_amt), 0) AS total_premium
|
||||
|
||||
// FROM clients c
|
||||
// LEFT JOIN policy_transaction pt ON pt.client_id = c.id AND pt.is_active = 1 AND pt.policy_issue_date >= '$fromDate' AND pt.policy_issue_date <= '$toDate'
|
||||
// LEFT JOIN policy_type ptp ON pt.policy_type_id = ptp.id
|
||||
// LEFT JOIN pt_co_share_details ptco ON ptco.pt_id = pt.id AND ptco.is_active = 1
|
||||
// LEFT JOIN co_share_stmt_details stmt ON stmt.co_share_id = ptco.id AND stmt.is_active = 1
|
||||
// WHERE c.is_active = 1
|
||||
// AND ptp.policy_category = $category
|
||||
// GROUP BY c.id
|
||||
// ORDER BY
|
||||
// health_premium DESC,
|
||||
// misc_premium DESC,
|
||||
// motor_premium DESC,
|
||||
// engineering_premium DESC,
|
||||
// fire_premium DESC,
|
||||
// liability_premium DESC,
|
||||
// life_premium DESC,
|
||||
// marine_cargo_premium DESC,
|
||||
// marine_hull_premium DESC
|
||||
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getBAPClientData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// //Function for get CLIENT wise data for premium and policy count only
|
||||
// public function getClientData($category = 0, $start_date = null, $end_date = null)
|
||||
// {
|
||||
|
||||
// try {
|
||||
|
||||
// $this->myLogger->logme('error', 'getClientData function called');
|
||||
// $this->myLogger->logme('error', 'category : {data}', ['data' => $category]);
|
||||
// $this->myLogger->logme('error', 'start date : {start_date} - end date {end_date} ', ['start_date' => $start_date, 'end_date' => $end_date]);
|
||||
|
||||
// //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);
|
||||
// }
|
||||
|
||||
// $this->myLogger->logme('error', 'From date : {fromDate} - To date {toDate} ', ['fromDate' => $fromDate, 'toDate' => $toDate]);
|
||||
|
||||
// $db = db_connect();
|
||||
// $builder = $db->query("
|
||||
|
||||
// select
|
||||
// c.id as client_id,
|
||||
// c.client_name,
|
||||
|
||||
// (
|
||||
// select
|
||||
// count(policy_transaction.id)
|
||||
// from policy_transaction
|
||||
// left join policy_type on policy_transaction.policy_type_id = policy_type.id
|
||||
// where policy_transaction.client_id = c.id
|
||||
// and policy_transaction.action_type = 'inception'
|
||||
// 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
|
||||
// from co_share_stmt_details stmt
|
||||
// left join pt_co_share_details ptco on stmt.co_share_id = ptco.id
|
||||
// left join policy_transaction pt on ptco.pt_id = pt.id
|
||||
// where pt.client_id = c.id
|
||||
// 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
|
||||
// where c.is_active = 1
|
||||
// group by client_name
|
||||
// order by premium desc
|
||||
// ");
|
||||
|
||||
// // Get the query
|
||||
// $result = $builder->getResultArray();
|
||||
// // dd(db_connect()->getLastQuery(),$result);
|
||||
// return $result;
|
||||
// } catch (\Exception $e) {
|
||||
|
||||
// // Log the exception details for debugging
|
||||
// $this->myLogger->logme('error', 'Error occurred in getClientData: {message}', ['message' => $e->getMessage()]);
|
||||
// $this->myLogger->logme('error', 'Stack trace: {trace}', ['trace' => $e->getTraceAsString()]);
|
||||
// return [];
|
||||
// }
|
||||
// }
|
||||
|
||||
// ---------------RENEWAL REPORT-----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function renewalReport()
|
||||
{
|
||||
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['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['page_name'] = "Renewal Report";
|
||||
return $this->loadLayout('renewal_search', $data);
|
||||
|
||||
} else {
|
||||
|
||||
$fromDate = $this->request->getPost('fromDate');
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_type = $this->request->getPost('client_type');
|
||||
$issuer = $this->request->getPost('issuer');
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
// print_r($data); die;
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
110
app/Controllers/Chatbot/BotService.php
Normal file
110
app/Controllers/Chatbot/BotService.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
|
||||
class BotService
|
||||
{
|
||||
public static function sendMainOptions(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Welcome! Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Card Download'],
|
||||
['Network Hospital'],
|
||||
['Reimbursement Claim Process'],
|
||||
['Reimbursement Claim Status'],
|
||||
['New Policy'],
|
||||
['Renew Policy']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleCardDownload(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Download Card'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleNetworkHospital(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Find Hospital'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleReimbursementClaimProcess(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Submit Claim'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleReimbursementClaimStatus(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Check Status'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleNewPolicy(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Get Quote'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
public static function handleRenewPolicy(BotMan $bot)
|
||||
{
|
||||
$bot->reply('Please choose an option:', [
|
||||
'reply_markup' => json_encode([
|
||||
'keyboard' => [
|
||||
['Renew Now'],
|
||||
['Go Back']
|
||||
],
|
||||
'resize_keyboard' => true,
|
||||
'one_time_keyboard' => true
|
||||
])
|
||||
]);
|
||||
}
|
||||
}
|
||||
34
app/Controllers/Chatbot/ClaimHandler.php
Normal file
34
app/Controllers/Chatbot/ClaimHandler.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
||||
|
||||
class ClaimHandler
|
||||
{
|
||||
public static function handle(BotMan $bot, $option)
|
||||
{
|
||||
$responses = [
|
||||
'reimbursement_claim_process' => "Reimbursement Claim Process: Here is a dummy response.",
|
||||
'reimbursement_claim_status' => "Reimbursement Claim Status: Here is a dummy response."
|
||||
];
|
||||
|
||||
if (isset($responses[$option])) {
|
||||
$bot->reply($responses[$option]);
|
||||
} else {
|
||||
$bot->reply("Unknown claim option.");
|
||||
}
|
||||
|
||||
// Send Back Button
|
||||
self::sendBackButton($bot);
|
||||
}
|
||||
|
||||
private static function sendBackButton(BotMan $bot)
|
||||
{
|
||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
||||
);
|
||||
}
|
||||
}
|
||||
65
app/Controllers/Chatbot/EcardDownloadConversation.php
Normal file
65
app/Controllers/Chatbot/EcardDownloadConversation.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class EcardDownloadConversation extends Conversation
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->showEcardMenu();
|
||||
}
|
||||
|
||||
protected function showEcardMenu()
|
||||
{
|
||||
$policy_list = ChatbotHelper::getListOfPolicies();
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy to Download Ecard:';
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
{
|
||||
foreach($policy_list as $policy)
|
||||
{
|
||||
// $question = Question::create("Choose Policy to Download Ecard:")
|
||||
// ->addButtons([
|
||||
// Button::create("🔹 $policy['policy_name']")->value("$policy['emp_policy_id']"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
// ]);
|
||||
$buttons[] = Button::create("🔹 {$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$question = 'No policy found';
|
||||
}
|
||||
$buttons = array_merge($buttons,[Button::create("◀️ Go Back")->value("go_back")]);
|
||||
$question = Question::create($question)
|
||||
->addButtons($buttons);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
// print_r($answer->getValue());die();
|
||||
switch ($answer->getValue()) {
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||
|
||||
$link = base_url().'/download-e-card/' . explode('#',$answer->getValue())[1].'/1';
|
||||
$this->say('Click here to downlad: <a href="'.$link.'" target="_blank">Ecard</a>');
|
||||
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation()); // ✅ Restart the
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new EcardDownloadConversation()); // ✅ Restart the conversation
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
68
app/Controllers/Chatbot/MainMenuConversation.php
Normal file
68
app/Controllers/Chatbot/MainMenuConversation.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
class MainMenuConversation extends Conversation
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
$this->showMainMenu();
|
||||
}
|
||||
|
||||
protected function showMainMenu()
|
||||
{
|
||||
$question = Question::create("Please choose")
|
||||
->addButtons([
|
||||
Button::create("📄 Ecard Download")->value("ecard_download"),
|
||||
Button::create("🏥 Network Hospital")->value("network_hospital"),
|
||||
Button::create("💰 Reimbursement Claim Process")->value("reimbursement_claim"),
|
||||
Button::create("📑 Reimbursement Claim Status")->value("reimbursement_status"),
|
||||
Button::create("🆕 New Policy")->value("new_policy"),
|
||||
Button::create("🔄 Renew Policy")->value("renew_policy"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "ecard_download":
|
||||
|
||||
// $message = ChatbotHelper::get_payload_data();
|
||||
// $this->say($message);
|
||||
// $this->say("📄 Ecard Download Menu:");
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
break;
|
||||
case "network_hospital":
|
||||
$this->say("🏥 Network Hospital Menu:");log_message('error','Network Hospital clicked');
|
||||
$this->bot->startConversation(new NetworkHospitalConversation());
|
||||
break;
|
||||
case "reimbursement_claim":
|
||||
// $this->say("Reimbursement Claim Process selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimProcessConversation());
|
||||
break;
|
||||
case "reimbursement_status":
|
||||
$this->say("Reimbursement Claim Status selected. (Dummy Response)");
|
||||
$this->bot->startConversation(new ReimbursementClaimStatusConversation());
|
||||
|
||||
break;
|
||||
case "new_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
case "renew_policy":
|
||||
$this->bot->startConversation(new policyConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
82
app/Controllers/Chatbot/NetworkHospitalConversation.php
Normal file
82
app/Controllers/Chatbot/NetworkHospitalConversation.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class NetworkHospitalConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
$this->showHospitalMenu();
|
||||
}
|
||||
|
||||
protected function showHospitalMenu()
|
||||
{
|
||||
$policy_list = ChatbotHelper::getListOfPolicies();
|
||||
$buttons = [];
|
||||
$question = 'Choose Policy:';
|
||||
if(is_array($policy_list) && count($policy_list))
|
||||
{
|
||||
foreach($policy_list as $policy)
|
||||
{
|
||||
// $question = Question::create("Choose Policy to Download Ecard:")
|
||||
// ->addButtons([
|
||||
// Button::create("🔹 $policy['policy_name']")->value("$policy['emp_policy_id']"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
// ]);
|
||||
$buttons[] = Button::create("🔹 {$policy['policy_name']}")->value($policy['emp_policy_id'].'#'.$policy['rand_string']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$question = 'No policy found';
|
||||
}
|
||||
$buttons = array_merge($buttons,[Button::create("◀️ Go Back")->value("go_back")]);
|
||||
$question = Question::create($question)
|
||||
->addButtons($buttons);
|
||||
|
||||
// $this->bot->hears('.*', function ($bot) {
|
||||
// $this->bot->types(); // Typing indicator for the first message
|
||||
// sleep(0.5); // Delay
|
||||
// });
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case is_string($answer->getValue()) && is_array(explode('#',$answer->getValue())) && count((explode('#',$answer->getValue()))) == 2:
|
||||
|
||||
$client_poilicy_id = explode('#',$answer->getValue())[1];
|
||||
$hospital_link = ChatbotHelper::getHospitalLink($client_poilicy_id);
|
||||
|
||||
if($hospital_link)
|
||||
{
|
||||
$this->say('<a href="' . $hospital_link['network_hospitals'] . '" target="_blank">Click here for hospital details</a>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->say('No Data found, please contact support team');
|
||||
}
|
||||
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->bot->startConversation(new EcardDownloadConversation());
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
36
app/Controllers/Chatbot/PolicyHandler.php
Normal file
36
app/Controllers/Chatbot/PolicyHandler.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ButtonTemplate;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\ElementButton;
|
||||
|
||||
class PolicyHandler
|
||||
{
|
||||
public static function handle(BotMan $bot, $option)
|
||||
{
|
||||
$responses = [
|
||||
'ecard_download' => "Ecard Download: Here is a dummy response.",
|
||||
'network_hospital' => "Network Hospital: Here is a dummy response.",
|
||||
'new_policy' => "New Policy: Here is a dummy response.",
|
||||
'renew_policy' => "Renew Policy: Here is a dummy response."
|
||||
];
|
||||
|
||||
if (isset($responses[$option])) {
|
||||
$bot->reply($responses[$option]);
|
||||
} else {
|
||||
$bot->reply("Unknown policy option.");
|
||||
}
|
||||
|
||||
// Send Back Button
|
||||
self::sendBackButton($bot);
|
||||
}
|
||||
|
||||
private static function sendBackButton(BotMan $bot)
|
||||
{
|
||||
$bot->reply(ButtonTemplate::create("Would you like to return?")
|
||||
->addButton(ElementButton::create("Go Back")->type('postback')->payload("main_menu"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class ReimbursementClaimProcessConversation extends Conversation
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
$this->claimProcess();
|
||||
}
|
||||
|
||||
protected function claimProcess()
|
||||
{
|
||||
$res = ChatbotHelper::sendReimbursementProcessOverMail();
|
||||
if($res == true)
|
||||
{
|
||||
$this->say("Reimbursement process shared over your registered mail...!");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->say("No email found in your profile / Please contact support team");
|
||||
}
|
||||
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
|
||||
class ReimbursementClaimStatusConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->claimStatus();
|
||||
}
|
||||
|
||||
protected function claimStatus()
|
||||
{
|
||||
$question = Question::create("Do you Need Anything Else ?")
|
||||
->addButtons([
|
||||
Button::create("🔹 Yes I need some more Help")->value("yes"),
|
||||
Button::create("🔹 No, Thank You")->value("no"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
|
||||
$this->say("Sure, How can I help you ");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
case "no":
|
||||
$this->say("Thank you for your time! If you need anything else, feel free to reach out. Goodbye!");
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askQuestion();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
27
app/Controllers/Chatbot/TypingMiddleware.php
Normal file
27
app/Controllers/Chatbot/TypingMiddleware.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
|
||||
class TypingMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle the middleware logic.
|
||||
*
|
||||
* @param BotMan $bot
|
||||
* @param callable $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($bot, $next)
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->myLogger->logme('error', 'MIDDLEWARE');
|
||||
|
||||
// Simulate typing indicator
|
||||
$bot->types();
|
||||
sleep(0.1); // Cap delay at 5 seconds (convert to microseconds)
|
||||
// Proceed to the next middleware or response
|
||||
return $next($bot);
|
||||
}
|
||||
}
|
||||
50
app/Controllers/Chatbot/commonPolicyOptionConversations.php
Normal file
50
app/Controllers/Chatbot/commonPolicyOptionConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class commonPolicyOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->policyOptions();
|
||||
}
|
||||
|
||||
protected function policyOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Upload Vehicle Details")->value("upload_vehicle_details"),
|
||||
Button::create("🔹 Talk to our Service Executive")->value("service_executive"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "upload_vehicle_details":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new vehicleFormConversation());
|
||||
break;
|
||||
case "service_executive":
|
||||
$this->bot->startConversation(new serviceExecutiveConversation());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->policyOptions();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/doYouWantToContinueConversation.php
Normal file
50
app/Controllers/Chatbot/doYouWantToContinueConversation.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class doYouWantToContinueConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->bot->types(); // Typing indicator for the first message
|
||||
sleep(3); // Delay
|
||||
$this->askQuestion();
|
||||
}
|
||||
|
||||
protected function askQuestion()
|
||||
{
|
||||
$question = Question::create("Do you Need Anything Else ?")
|
||||
->addButtons([
|
||||
Button::create("🔹 Yes I need some more Help")->value("yes"),
|
||||
Button::create("🔹 No, Thank You")->value("no"),
|
||||
// Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
|
||||
// $this->say("Sure, How can I help you ");
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
case "no":
|
||||
$this->say("Thank you for your time! If you need anything else, feel free to reach out. Goodbye!");
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askQuestion();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/fourWheelerOptionsConversations.php
Normal file
50
app/Controllers/Chatbot/fourWheelerOptionsConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class fourWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->show4WOptions();
|
||||
}
|
||||
|
||||
protected function show4WOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Comprehensive")->value("comp"),
|
||||
Button::create("🔹 Third-Party Only")->value("3p"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "comp":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
49
app/Controllers/Chatbot/hospitalPolicyConversation.php
Normal file
49
app/Controllers/Chatbot/hospitalPolicyConversation.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class hospitalPolicyConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showMediclaimPolicyOptions();
|
||||
}
|
||||
|
||||
protected function showMediclaimPolicyOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Individual")->value("individual"),
|
||||
Button::create("🔹 Floater")->value("floater"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "individual":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/medicalClaimOptionConversations.php
Normal file
50
app/Controllers/Chatbot/medicalClaimOptionConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class medicalClaimOptionConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showMediclaimOptions();
|
||||
}
|
||||
|
||||
protected function showMediclaimOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Individual")->value("individual"),
|
||||
Button::create("🔹 Floater")->value("floater"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "individual":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "floater":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
55
app/Controllers/Chatbot/policyConversation.php
Normal file
55
app/Controllers/Chatbot/policyConversation.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class policyConversation extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->showNewPolicy();
|
||||
}
|
||||
|
||||
protected function showNewPolicy()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🏍️ 2 Wheeler")->value("2_wheeler"),
|
||||
Button::create("🚗 4 Wheeler")->value("4_wheeler"),
|
||||
Button::create("🩺 Medical Claim")->value("mediclaim"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "2_wheeler":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new twoWheelerOptionsConversations());
|
||||
break;
|
||||
case "4_wheeler":
|
||||
$this->bot->startConversation(new fourWheelerOptionsConversations());
|
||||
break;
|
||||
case "mediclaim":
|
||||
$this->bot->startConversation(new medicalClaimOptionConversations());
|
||||
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
60
app/Controllers/Chatbot/serviceExecutiveConversation.php
Normal file
60
app/Controllers/Chatbot/serviceExecutiveConversation.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
class serviceExecutiveConversation extends Conversation
|
||||
{
|
||||
protected $mobile_number;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askServiceExecutive();
|
||||
}
|
||||
|
||||
protected function askServiceExecutive()
|
||||
{
|
||||
$mobile = ChatbotHelper::getPhoneNumber(); // Assuming this fetches the user's phone number
|
||||
$question = Question::create("Is this Your Mobile Number: $mobile")
|
||||
->addButtons([
|
||||
Button::create("✅ Yes")->value("yes"),
|
||||
Button::create("❌ No")->value("no"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "yes":
|
||||
$this->say("Our executive will call you at the earliest.");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
break;
|
||||
|
||||
case "no":
|
||||
$this->ask('Enter Your Mobile Number?', function ($response) {
|
||||
$this->mobile_number = $response->getText();
|
||||
$this->bot->userStorage()->save([
|
||||
'mobile_number' => $this->mobile_number
|
||||
]);
|
||||
// Use 'use' to bring the class context into the closure
|
||||
$this->say("Our executive will call you at the earliest.");
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
});
|
||||
break;
|
||||
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->askServiceExecutive();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Controllers/Chatbot/twoWheelerOptionsConversations.php
Normal file
50
app/Controllers/Chatbot/twoWheelerOptionsConversations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Conversations;
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class twoWheelerOptionsConversations extends Conversation
|
||||
{
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->show2WOptions();
|
||||
}
|
||||
|
||||
protected function show2WOptions()
|
||||
{
|
||||
$question = Question::create("Choose Policy Type:")
|
||||
->addButtons([
|
||||
Button::create("🔹 Third-Party")->value("3p"),
|
||||
Button::create("🔹 Comprehensive")->value("comp"),
|
||||
Button::create("◀️ Go Back")->value("go_back"),
|
||||
]);
|
||||
|
||||
$this->bot->ask($question, function ($answer) {
|
||||
switch ($answer->getValue()) {
|
||||
case "3p":
|
||||
// $cityName = $response->getText();
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "comp":
|
||||
$this->bot->startConversation(new commonPolicyOptionConversations());
|
||||
break;
|
||||
case "go_back":
|
||||
$this->bot->startConversation(new MainMenuConversation());
|
||||
break;
|
||||
default:
|
||||
$this->say("Invalid selection. Please choose an option.");
|
||||
$this->showHospitalMenu();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
83
app/Controllers/Chatbot/vehicleFormConversation.php
Normal file
83
app/Controllers/Chatbot/vehicleFormConversation.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Chatbot;
|
||||
|
||||
use BotMan\BotMan\Messages\Conversations\Conversation;
|
||||
use BotMan\BotMan\Messages\Outgoing\Question;
|
||||
use BotMan\BotMan\Messages\Outgoing\Actions\Button;
|
||||
|
||||
class vehicleFormConversation extends Conversation
|
||||
{
|
||||
protected $vehicleName;
|
||||
protected $vehicleYOM;
|
||||
protected $vehicleEngineNo;
|
||||
protected $vehicleInvoiceNo;
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->askVehicleName();
|
||||
}
|
||||
|
||||
protected function askVehicleName()
|
||||
{
|
||||
$this->ask('Enter Vehicle Name ?', function ($response) {
|
||||
$this->vehicleName = $response->getText();
|
||||
if (empty($this->vehicleName)) {
|
||||
$this->say('Vehicle Name Cannot be Empty');
|
||||
return $this->askVehicleName(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleYOM(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleYOM()
|
||||
{
|
||||
$this->ask('Enter Vehicle Year of Manufacture ?', function ($response) {
|
||||
$this->vehicleYOM = $response->getText();
|
||||
if (empty($this->vehicleYOM)) {
|
||||
$this->say('Vehicle Year of Manufacture Cannot be Empty');
|
||||
return $this->askVehicleYOM(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleEngineNo(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleEngineNo()
|
||||
{
|
||||
$this->ask('Enter Vehicle Engine Number ?', function ($response) {
|
||||
$this->vehicleEngineNo = $response->getText();
|
||||
if (empty($this->vehicleEngineNo)) {
|
||||
$this->say('Vehicle Engine Number Cannot be Empty');
|
||||
return $this->askVehicleEngineNo(); // Re-ask if empty
|
||||
}
|
||||
$this->askVehicleInvoiceNo(); // Ask next question
|
||||
});
|
||||
}
|
||||
|
||||
protected function askVehicleInvoiceNo()
|
||||
{
|
||||
$this->ask('Enter Vehicle Invoice Number ?', function ($response) {
|
||||
$this->vehicleInvoiceNo = $response->getText();
|
||||
if (empty($this->vehicleInvoiceNo)) {
|
||||
$this->say('Vehicle Invoice Number Cannot be Empty');
|
||||
return $this->askVehicleInvoiceNo(); // Re-ask if empty
|
||||
}
|
||||
$this->storeVehicleData(); // Proceed to store the data
|
||||
});
|
||||
}
|
||||
|
||||
protected function storeVehicleData()
|
||||
{
|
||||
// Save all collected data to user storage
|
||||
$this->bot->userStorage()->save([
|
||||
'vehicle_name' => $this->vehicleName,
|
||||
'vehicle_yom' => $this->vehicleYOM,
|
||||
'vehicle_engine_no' => $this->vehicleEngineNo,
|
||||
'vehicle_invoice_no' => $this->vehicleInvoiceNo
|
||||
]);
|
||||
|
||||
$this->say('Vehicle Information Saved!');
|
||||
$this->bot->startConversation(new doYouWantToContinueConversation());
|
||||
|
||||
}
|
||||
}
|
||||
105
app/Controllers/ChatbotControllerNew.php
Normal file
105
app/Controllers/ChatbotControllerNew.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use BotMan\BotMan\BotMan;
|
||||
use BotMan\BotMan\BotManFactory;
|
||||
use BotMan\BotMan\Drivers\DriverManager;
|
||||
use BotMan\BotMan\Cache\SymfonyCache;
|
||||
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
|
||||
use BotMan\Drivers\Web\WebDriver;
|
||||
|
||||
use App\Controllers\Chatbot\MainMenuConversation;
|
||||
use App\Controllers\Chatbot\TypingMiddleware;
|
||||
|
||||
use App\Helpers\ChatbotHelper;
|
||||
|
||||
class ChatbotControllerNew extends BaseController
|
||||
{
|
||||
protected $myLogger;
|
||||
protected $session;
|
||||
protected $botman;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('CHATBOT CON');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->session = \Config\Services::session();
|
||||
|
||||
$this->myLogger->logme('error', 'CALLED');
|
||||
|
||||
// Load BotMan driver
|
||||
DriverManager::loadDriver(WebDriver::class);
|
||||
|
||||
// Setup BotMan with cache
|
||||
$cache = new SymfonyCache(new FilesystemAdapter());
|
||||
$this->botman = BotManFactory::create([], $cache);
|
||||
// Create a new instance of BotMan
|
||||
// $botman = resolve('botman');
|
||||
|
||||
// Attach the TypingMiddleware
|
||||
// $this->botman->middleware->received(new TypingMiddleware());
|
||||
|
||||
|
||||
// Retrieve user ID from session or request
|
||||
$extras = request()->getGet('conf');
|
||||
$extras = json_decode($extras);
|
||||
$router = service('router');
|
||||
$method = $router->methodName();
|
||||
$this->myLogger->logme('error', $method);
|
||||
|
||||
if (isset($extras) && $method == 'widget') {
|
||||
$extras = $extras->parameters;
|
||||
$this->session->set('CHATBOT_USER_ID', $extras->employee_id);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', $this->session->get('CHATBOT_USER_ID'));
|
||||
|
||||
// print_rr(ChatbotHelper::getListOfPolicies());die();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->botman->hears('.*', function ($bot) {
|
||||
$bot->types(); // Typing indicator for the first message
|
||||
sleep(0.5); // Delay
|
||||
});
|
||||
// Start the Main Menu when user says "hi" or "start"
|
||||
$this->botman->hears('start|hi|hello', function (BotMan $bot) {
|
||||
$bot->reply('Hi how can i assit?');
|
||||
$bot->startConversation(new MainMenuConversation());
|
||||
});
|
||||
|
||||
|
||||
|
||||
// $this->botman->hears('main_menu', function (BotMan $bot) {
|
||||
// BotService::sendMainOptions($bot);
|
||||
// });
|
||||
|
||||
// // Register Option Handlers
|
||||
// $this->registerHandlers();
|
||||
|
||||
// Listen for Messages
|
||||
$this->botman->listen();
|
||||
}
|
||||
|
||||
private function registerHandlers()
|
||||
{
|
||||
// Handling Policy and Claims
|
||||
$this->botman->hears('group:policy:{option}', [\App\Controllers\Chatbot\PolicyHandler::class, 'handle']);
|
||||
$this->botman->hears('group:claim:{option}', [\App\Libraries\Chatbot\ClaimHandler::class, 'handle']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function chatbot()
|
||||
{
|
||||
$this->loadLayout('chatbot.php');
|
||||
}
|
||||
|
||||
public function widget()
|
||||
{
|
||||
echo view('widget.php');
|
||||
}
|
||||
}
|
||||
@ -44,8 +44,8 @@ use App\Controllers\EmpDataServiceController;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
use App\Models\RFQModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
|
||||
class ClientController extends AdminController
|
||||
{
|
||||
@ -183,9 +183,12 @@ class ClientController extends AdminController
|
||||
print_rr($attachments);
|
||||
}
|
||||
|
||||
//Function for Testing Member Review and Summery Confirmation Mail
|
||||
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
|
||||
{
|
||||
|
||||
// dd($client_id, $emp_code, $mail_active);
|
||||
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
@ -213,7 +216,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
||||
|
||||
// dd($empData);
|
||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||
|
||||
// dd($filteredEmpData);
|
||||
@ -258,45 +261,45 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme("info", $mail_send_return);
|
||||
}
|
||||
|
||||
if (isset($wholeData[0])) {
|
||||
// if (isset($wholeData)) {
|
||||
|
||||
$params['common']['mail_type'] = 'account_maneger_summary_mail';
|
||||
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
||||
// print_r($account_manager_wholeData); die;
|
||||
// $params['common']['mail_type'] = 'account_maneger_summary_mail';
|
||||
// $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
||||
// // print_r($account_manager_wholeData); die;
|
||||
|
||||
if($account_manager_wholeData != null && $account_manager_wholeData != '' && count($account_manager_wholeData))
|
||||
{
|
||||
if($mail_active > 0){
|
||||
// if($account_manager_wholeData != null && $account_manager_wholeData != '' && count($account_manager_wholeData))
|
||||
// {
|
||||
// if($mail_active > 0){
|
||||
|
||||
foreach ($account_manager_wholeData as $key => $value) {
|
||||
$mail_send_return1 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return1);
|
||||
}
|
||||
// foreach ($account_manager_wholeData as $key => $value) {
|
||||
// // $mail_send_return1 = MailHelper::send_email($value);
|
||||
// $this->myLogger->logme("info", $mail_send_return1);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
|
||||
}
|
||||
// }else{
|
||||
// $this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
|
||||
// }
|
||||
|
||||
$params['common']['mail_type'] = 'client_hr_summary_mail';
|
||||
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
||||
// print_r($client_hr_wholeData); die;
|
||||
// $params['common']['mail_type'] = 'client_hr_summary_mail';
|
||||
// $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
||||
// // print_r($client_hr_wholeData); die;
|
||||
|
||||
if($client_hr_wholeData != null && $client_hr_wholeData != '' &&count($client_hr_wholeData))
|
||||
{
|
||||
if($mail_active > 0){
|
||||
// if($client_hr_wholeData != null && $client_hr_wholeData != '' &&count($client_hr_wholeData))
|
||||
// {
|
||||
// if($mail_active > 0){
|
||||
|
||||
foreach ($client_hr_wholeData as $key => $value) {
|
||||
$mail_send_return2 = MailHelper::send_email($value);
|
||||
$this->myLogger->logme("info", $mail_send_return2);
|
||||
}
|
||||
}
|
||||
// foreach ($client_hr_wholeData as $key => $value) {
|
||||
// // $mail_send_return2 = MailHelper::send_email($value);
|
||||
// $this->myLogger->logme("info", $mail_send_return2);
|
||||
// }
|
||||
// }
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
||||
}
|
||||
}
|
||||
// }else{
|
||||
// $this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
||||
// }
|
||||
// }
|
||||
|
||||
}else{
|
||||
$this->myLogger->logme("error", 'Member Review Mail Configuration not Enable for this client');
|
||||
@ -317,6 +320,123 @@ class ClientController extends AdminController
|
||||
// return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
//Function for Send Member Review and Summery Confirmation Mail
|
||||
public function sendMemberReviewConfirmationMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0)
|
||||
{
|
||||
$client_policy_ids = $this->employeeModel
|
||||
->select('employee_polices.client_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||
$client_policy_id = array_unique($client_policy_ids2);
|
||||
|
||||
if (!is_null($client_policy_id) && is_array($client_policy_id)) {
|
||||
|
||||
$empData = $this->employeeModel
|
||||
->where('emp_code', $emp_code)
|
||||
->where('client_id', $client_id)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||
|
||||
if (empty($filteredEmpData)) {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 404,
|
||||
'message' => 'No active employee data found for the given criteria.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$array_list = [];
|
||||
foreach ($client_policy_id as $value) {
|
||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(
|
||||
client_policy_id: $value,
|
||||
emp_code: $emp_code,
|
||||
client_id: $client_id,
|
||||
emp_status: ['draft', 'enrolled'],
|
||||
policy_status: ['draft', 'enrolled']
|
||||
);
|
||||
|
||||
if (count($find) > 0) {
|
||||
$array_list[] = $find;
|
||||
}
|
||||
}
|
||||
|
||||
$notification = $this->notificationModel
|
||||
->where('client_id', $client_id)
|
||||
->where('template_name', 'member_review_and_summary_mail')
|
||||
->first();
|
||||
|
||||
if ($notification && $notification['enabled'] == 1) {
|
||||
|
||||
$params = [
|
||||
'array_list' => $array_list,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'emp_code' => $emp_code,
|
||||
'client_id' => $client_id,
|
||||
'notification' => $notification,
|
||||
'common' => [
|
||||
'client_id' => $filteredEmpData[0]['client_id'],
|
||||
'client_branch_id' => $filteredEmpData[0]['client_branch_id'],
|
||||
'client_policy_id' => null,
|
||||
'employee_policy_id' => null,
|
||||
'employee_id' => $filteredEmpData[0]['id'],
|
||||
'mail_type' => 'member_review_and_summary_mail',
|
||||
],
|
||||
];
|
||||
|
||||
$wholeData = sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
|
||||
if ($mail_active > 0) {
|
||||
|
||||
$mail_send_result = MailHelper::send_email($wholeData[0]);
|
||||
|
||||
if ($mail_send_result['status'] === 'success') {
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email sent successfully.',
|
||||
'response' => $mail_send_result,
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 500,
|
||||
'message' => 'Failed to send email.',
|
||||
'details' => $mail_send_result,
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Notification prepared but email not sent as mail_active is 0.',
|
||||
'data' => $wholeData,
|
||||
], 200);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 400,
|
||||
'message' => 'Member Review Mail configuration is not enabled for this client.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'error',
|
||||
'code' => 404,
|
||||
'message' => 'No active client policy IDs found.',
|
||||
], 404);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
public function index()
|
||||
@ -1056,6 +1176,7 @@ class ClientController extends AdminController
|
||||
$data['disclaimer'] = $this->request->getPost('disclaimer');
|
||||
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
|
||||
$data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0;
|
||||
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
|
||||
|
||||
|
||||
|
||||
@ -1188,6 +1309,7 @@ class ClientController extends AdminController
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0;
|
||||
$data['is_lgbtq'] = $this->request->getPost('is_lgbtq') ? 1 : 0;
|
||||
if ($data['inception_type'] == 2) {
|
||||
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d');
|
||||
@ -3408,7 +3530,10 @@ class ClientController extends AdminController
|
||||
|
||||
public function getCDAccNoByClientAndInsurer($client, $insurer)
|
||||
{
|
||||
$cdmData = $this->CDMasterModel->where('client_id', $client)->where('insurer_id', $insurer)->findAll();
|
||||
$cdmData = $this->CDMasterModel
|
||||
->where('client_id', $client)
|
||||
->where('insurer_id', $insurer)
|
||||
->findAll();
|
||||
|
||||
if ($cdmData) {
|
||||
return $this->respond(['status' => true, 'data' => $cdmData], 200);
|
||||
@ -3831,24 +3956,27 @@ class ClientController extends AdminController
|
||||
|
||||
public function sendextraparam()
|
||||
{
|
||||
$batch_data = [
|
||||
'client_id' => 17,
|
||||
'client_policy_id' => 30,
|
||||
'client_branch_id' => 18,
|
||||
'event_type' => "inception",
|
||||
];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
$batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
// dd($this->request);
|
||||
// $employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 721]);
|
||||
|
||||
$employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 823]);
|
||||
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
|
||||
|
||||
|
||||
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------
|
||||
|
||||
// $batch_data = [
|
||||
// 'client_id' => 17,
|
||||
// 'client_policy_id' => 30,
|
||||
// 'client_branch_id' => 18,
|
||||
// 'event_type' => "inception",
|
||||
// ];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
// $batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
// $dashBoardController = new DashboardController();
|
||||
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
|
||||
// $dashBoardController->sendRemainderMail($client_policy_data);
|
||||
@ -3877,33 +4005,91 @@ class ClientController extends AdminController
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
||||
|
||||
$EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController = new EmpDataServiceController();
|
||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||
// $EmpDataServiceController->importCorrectionUpdateEndorsementID(['file_id' => 188]);
|
||||
$array = [
|
||||
"employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||
"client_id" => "159",
|
||||
"client_policy_id" => "336",
|
||||
"client_branch_id" => "126",
|
||||
"cd_ac_no" => "Apple_123",
|
||||
"endorsement_no" => "ENDORSEMENT_ID",
|
||||
"count" => 4,
|
||||
"event_name" => "deletion",
|
||||
"policy_name" => "GMC",
|
||||
"user_id" => "1"
|
||||
];
|
||||
|
||||
// $array = [
|
||||
// "employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||
// "client_id" => "159",
|
||||
// "client_policy_id" => "336",
|
||||
// "client_branch_id" => "126",
|
||||
// "cd_ac_no" => "Apple_123",
|
||||
// "endorsement_no" => "ENDORSEMENT_ID",
|
||||
// "count" => 4,
|
||||
// "event_name" => "deletion",
|
||||
// "policy_name" => "GMC",
|
||||
// "user_id" => "1"
|
||||
// ];
|
||||
|
||||
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
||||
|
||||
// $employeeRestController = new EmployeeServiceController();
|
||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 757]);
|
||||
|
||||
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
|
||||
// dd(db_connect()->getLastQuery());
|
||||
|
||||
// ------------- LEADS CONTROLLER ----------------------------------------------------------
|
||||
|
||||
// $LeadsController = new LeadsController();
|
||||
// $RFQModel = new RFQModel();
|
||||
|
||||
// $data = $RFQModel->where('is_active', 1)->where('lead_id', 40)->first();
|
||||
// // dd($data);
|
||||
// $policy_type = 2;
|
||||
// $proposel_name = "Proposal 2";
|
||||
// $insurer_name = "ICICI-P-ICICI002-V1";
|
||||
// $jsonArray = json_decode($data['json'], true);
|
||||
// // dd($jsonArray);
|
||||
|
||||
// $returndata = $LeadsController->convertQCRJsonToPolicyTerms($jsonArray, $policy_type, $proposel_name, $insurer_name);
|
||||
// dd($returndata);
|
||||
|
||||
// -----------BDS REPORT CONTROLLER---------------------------------------------------------------------------------
|
||||
|
||||
// $BDSReportController = new BDSReportController();
|
||||
|
||||
// $data['data'] = $BDSReportController->getBAPInsurerData();
|
||||
|
||||
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
|
||||
|
||||
// $data['data'] = $BDSReportController->getBAPClientData();
|
||||
// return $this->loadLayout('irda_bap_client_report_list', $data);
|
||||
|
||||
// $data['data'] = $BDSReportController->getClientData(1);
|
||||
// return $this->loadLayout('irda_client_report_list', $data);
|
||||
|
||||
// $BDSReportController->getBAPClientData();
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
// $email_id = 'venkateshraman786@gmail.com';
|
||||
// $common = ['mail_type'=>'test_mail_cli'];
|
||||
// $bcc = "vitvelz@gmail.com";
|
||||
|
||||
// $data = db_connect()
|
||||
// ->table('jobs')
|
||||
// ->where('id', 2264)
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
|
||||
// $data = json_decode($data[0]['payload'], true);
|
||||
|
||||
// // dd($data);
|
||||
// // Send email and get response
|
||||
// $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);
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
@ -3948,4 +4134,191 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getCDAmount()
|
||||
{
|
||||
$cd_ac_pk = $this->request->getGet('cd_ac_pk');
|
||||
|
||||
$cd_amount = $this->clientDepositModel
|
||||
->where('is_active', 1)
|
||||
->where('cd_ac_pk', $cd_ac_pk)
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
|
||||
if($cd_amount){
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_amount], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------Function for Claim Module--------------------------------------------------------------------------------------------
|
||||
|
||||
public function getTheEmpDataForClaim($param, $type = null)
|
||||
{
|
||||
// Construct the base query
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('client_policy.id', $param)
|
||||
->findAll();
|
||||
|
||||
$dataForClientAndInsurer = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->where('client_policy.id', $param)
|
||||
->first();
|
||||
|
||||
$memberData = [];
|
||||
|
||||
// Respond based on the query result
|
||||
if (!empty($data) || !empty($dataForClientAndInsurer)) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data found',
|
||||
'data' => $data,
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No data found',
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTheEmpDataForClaimSearchByMobile($param, $type = 'mobile')
|
||||
{
|
||||
$field_name = 'employees.' . $type;
|
||||
|
||||
// Construct the base query
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no,
|
||||
employee_polices.tpa_id AS tpa_no
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('insurers.is_active', 1)
|
||||
->where('tpa.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where($field_name, $param)
|
||||
->groupBy('employees.id')
|
||||
->orderBy('employees.id', 'DESC')
|
||||
->first();
|
||||
|
||||
$memberData = [];
|
||||
$dataForClientAndInsurer = [];
|
||||
|
||||
$acms = db_connect()->table('user_profiles')
|
||||
->select('user_profiles.id, user_profiles.first_name')
|
||||
->where('user_profiles.is_active', 1)
|
||||
->where('user_profiles.role', 3)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if(!empty($data) && count($data) > 0){
|
||||
|
||||
$memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code']);
|
||||
|
||||
$acms = $this->clientRMModel
|
||||
->select('user_profiles.id, user_profiles.first_name')
|
||||
->join('clients', 'client_rm.client_id = clients.id', 'left')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id', 'left')
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_rm.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->where('clients.id', $data['client_id'])
|
||||
->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Respond based on the query result
|
||||
if (!empty($data)) {
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'code' => 200,
|
||||
'message' => 'Data found',
|
||||
'data' => $data,
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms,
|
||||
], 200);
|
||||
} else {
|
||||
return $this->respond([
|
||||
'status' => false,
|
||||
'code' => 404,
|
||||
'message' => 'No data found',
|
||||
'param' => $param,
|
||||
'type' => $type,
|
||||
'dataForClientAndInsurer' => $dataForClientAndInsurer,
|
||||
'memberData' => $memberData,
|
||||
'acms' => $acms
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -286,9 +286,11 @@ class DashboardController extends AdminController
|
||||
}
|
||||
|
||||
$myLogger->logme('error', 'enrollment_status function completed');
|
||||
$myLogger->logme('error', 'updated Open Enrollment Policy count : "'.count($openEnrollment).'" and Close Enrollment Policy count : "'.count($closeEnrollment).'"');
|
||||
|
||||
return $this->respond([
|
||||
'status' => true,
|
||||
'message' => 'updated Policy Enrollment Status',
|
||||
'message' => 'updated Open and Close Enrollment successfully',
|
||||
'open_policy_count' => count($openEnrollment),
|
||||
'close_policy_count' => count($closeEnrollment),
|
||||
'open_policy_ids' => $openEnrollment,
|
||||
|
||||
@ -152,7 +152,7 @@ class EmpDataServiceController extends BaseController
|
||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
|
||||
if ($policy_details['cd_ac_no'] == null) {
|
||||
if ($policy_details['cd_ac_pk'] == null) {
|
||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||
return 5;
|
||||
}
|
||||
@ -649,7 +649,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
|
||||
if ($policy_details['cd_ac_no'] == null) {
|
||||
if ($policy_details['cd_ac_pk'] == null) {
|
||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||
return 1;
|
||||
}
|
||||
@ -959,7 +959,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
|
||||
if ($policy_details['cd_ac_no'] == null) {
|
||||
if ($policy_details['cd_ac_pk'] == null) {
|
||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||
return 5;
|
||||
}
|
||||
@ -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 ---
|
||||
@ -4416,7 +4418,7 @@ class EmpDataServiceController extends BaseController
|
||||
employees.email_corporate,
|
||||
employees.name,
|
||||
employees.mobile,
|
||||
employees.basic_cover_si,
|
||||
employee_polices.basic_cover_si,
|
||||
|
||||
cp.policy_type_id,
|
||||
cp.is_addon,
|
||||
@ -4438,7 +4440,7 @@ class EmpDataServiceController extends BaseController
|
||||
if ($emp_details) {
|
||||
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Processing employee_policy_id: {id}', ['id' => $id]);
|
||||
|
||||
if (!empty($emp_details['email_corporate'])) {
|
||||
if (!empty($emp_details['email_corporate']) && $emp_details['relationship'] === 'Self') {
|
||||
|
||||
$params = [
|
||||
'rand_string' => $emp_details['rand_string'],
|
||||
|
||||
@ -97,7 +97,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
// Convert the status field to an array if it exists in the request data
|
||||
if (isset($filterData['status']) && !empty($filterData['status'])) {
|
||||
$filterData['status'] = explode(",", $filterData['status']);
|
||||
// $filterData['status'] = explode(",", $filterData['status']);
|
||||
}else{
|
||||
$filterData['status'] = [];
|
||||
}
|
||||
@ -114,6 +114,11 @@ class EmployeeController extends AdminController
|
||||
// log_message('error',json_encode($data['employees']));
|
||||
// Set getData in $data array with the processed $filterData
|
||||
$data['getData'] = $filterData;
|
||||
|
||||
// return view('employee_list',$data);
|
||||
$html = view('employee_data_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
|
||||
}
|
||||
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
@ -1909,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]);
|
||||
|
||||
@ -1971,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);
|
||||
}
|
||||
@ -2171,6 +2177,9 @@ class EmployeeController extends AdminController
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
|
||||
$policy_terms = (array)$policy_details[0];
|
||||
$is_lgbtq = $policy_terms['is_lgbtq'];
|
||||
|
||||
|
||||
// dd($policy_terms);
|
||||
$policy_terms = json_decode($policy_terms['policy_terms']);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
@ -2178,7 +2187,7 @@ class EmployeeController extends AdminController
|
||||
//get file array or construnct dummy file array here
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $policy_id,'action' => 'inception','client_branch_id' => $branch_id,'created_by' => 1];
|
||||
//get familiy details in inception file format array from post method
|
||||
$result = check_dependent_conflict($family_details, $policy_terms, $file['action']);
|
||||
$result = check_dependent_conflict($family_details, $policy_terms, $file['action'],$is_lgbtq);
|
||||
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['policy_terms' => $policy_terms['family_floaters'],'result' => $result] ], 200);
|
||||
@ -2216,13 +2225,14 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
//UPDATE EMPLOYEE
|
||||
public function update_emp_data()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
// print_rr($data);die();
|
||||
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||
if(isset( $data['dob'])){
|
||||
$data['dob'] = change_date_format($data['dob'], 'd/m/Y', 'Y-m-d');
|
||||
$data['dob'] = change_date_format($data['dob'], null, 'Y-m-d');
|
||||
}
|
||||
// print_rr($data); die;
|
||||
|
||||
|
||||
@ -29,10 +29,15 @@ use App\Models\FEContentModel;
|
||||
use App\Models\AddImgModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\TicketClaimStatusModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
|
||||
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
use App\Controllers\TicketController;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
@ -73,6 +78,11 @@ class EmployeeRestController extends AdminController
|
||||
protected $addImgModel;
|
||||
protected $clientBranchModel;
|
||||
protected $auditHistoryModel;
|
||||
protected $claimStatusModel;
|
||||
protected $ticketMaster;
|
||||
protected $ticketMessage;
|
||||
|
||||
protected $ticketController;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -97,6 +107,11 @@ class EmployeeRestController extends AdminController
|
||||
$this->addImgModel = new AddImgModel();
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
$this->auditHistoryModel = new AuditHistoryModel();
|
||||
$this->claimStatusModel = new TicketClaimStatusModel();
|
||||
$this->ticketMaster = new TicketMasterModel();
|
||||
$this->ticketMessage = new TicketMessageModel();
|
||||
|
||||
$this->ticketController = new TicketController();
|
||||
|
||||
}
|
||||
|
||||
@ -722,7 +737,7 @@ class EmployeeRestController extends AdminController
|
||||
$jwt = $this->request->getHeaderLine('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
|
||||
$token = $jwtParts[2];
|
||||
$token = $jwtParts[1];
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
|
||||
@ -1085,7 +1100,7 @@ class EmployeeRestController extends AdminController
|
||||
$keysToRemove = ["removable_keys"];
|
||||
// Retrieve employee policy data by passing the employee primary key
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
// dd($empPolicy);
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||
->where('client_id',$client_id)
|
||||
@ -1123,11 +1138,18 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
|
||||
$si_gst_value = $si_gst_value + $employee_policy->gst;
|
||||
}
|
||||
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
@ -1142,6 +1164,8 @@ class EmployeeRestController extends AdminController
|
||||
$array->mapped_family_floaters = $self;
|
||||
$array->type = 'GPA';
|
||||
$array->si_value = $si_value;
|
||||
$array->si_premium_value = $si_premium_value;
|
||||
$array->si_gst_value = $si_gst_value;
|
||||
|
||||
|
||||
|
||||
@ -1201,8 +1225,11 @@ class EmployeeRestController extends AdminController
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
@ -1404,8 +1431,11 @@ class EmployeeRestController extends AdminController
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
@ -1504,16 +1534,25 @@ class EmployeeRestController extends AdminController
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$array->Policy_Terms = $decodedArray;
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
|
||||
$si_gst_value = $si_gst_value + $employee_policy->gst;
|
||||
}
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
|
||||
|
||||
$array->type = $policyTypeData->policy_type;
|
||||
$array->Policy_Name = $policyTypeData->long_name;
|
||||
$array->si_value = $si_value;
|
||||
$array->si_premium_value = $si_premium_value;
|
||||
$array->si_gst_value = $si_gst_value;
|
||||
|
||||
|
||||
if($employee_policy){
|
||||
@ -1672,6 +1711,7 @@ class EmployeeRestController extends AdminController
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('policy_status', 1)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
if(count($clientPolicy))
|
||||
@ -1808,8 +1848,11 @@ class EmployeeRestController extends AdminController
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
@ -1929,8 +1972,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
$temp3['data']['relationship'] = $value['relationship'];
|
||||
@ -1982,8 +2028,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
$temp3['data']['relationship'] = $value['relationship'];
|
||||
@ -3052,10 +3101,90 @@ class EmployeeRestController extends AdminController
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//Get Data from post for inserting ticket and message
|
||||
public function initiateClaim()
|
||||
{
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
$employee_id = $received_data['emp_id'];
|
||||
$client_policy_id = $received_data['client_policy_id'];
|
||||
$insured_emp_id = $received_data['insured_emp_id'];
|
||||
|
||||
$sql = "select cp.policy_type_id as ticket_type_id,
|
||||
cl_rm.user_id as acm_id,
|
||||
cp.insurer_id as insurer_id,
|
||||
cp.tpa_id as tpa_id,
|
||||
emp.client_id ,
|
||||
emp.id as emp_id,
|
||||
emp_pol.uhid as policy_no,
|
||||
emp.emp_code,
|
||||
emp_pol.tpa_id as tpa_no,
|
||||
emp.name as emp_name,
|
||||
emp.email_corporate as emp_mail,
|
||||
emp.mobile as emp_mobile,
|
||||
empl.id as insured_emp_id,
|
||||
empl.name as insured_name,
|
||||
empl.relationship
|
||||
|
||||
|
||||
|
||||
from employees emp
|
||||
|
||||
left join employees empl on empl.id = $insured_emp_id and empl.is_active = 1 and empl.emp_status = 'active'
|
||||
left join employee_polices emp_pol on empl.id = emp_pol.employee_id and emp_pol.client_policy_id = $client_policy_id and emp_pol.is_active = 1
|
||||
left join client_policy cp on cp.id = emp_pol.client_policy_id and cp.is_active = 1
|
||||
left join client_rm cl_rm on cl_rm.client_id = empl.client_id and cl_rm.is_active = 1 and cl_rm.level = 3
|
||||
|
||||
where emp.id = $employee_id and emp.is_active = 1 and emp.emp_status = 'active'
|
||||
limit 1 ";
|
||||
|
||||
$fetchData = $this->employeeModel->query($sql)->getResultArray()[0];
|
||||
$fetchData['claim_status_id'] = $this->claimStatusModel->select('id')->where('ticket_type', $fetchData['ticket_type_id'])->first()['id'];
|
||||
$fetchData['priority'] = 1;
|
||||
$fetchData['mode_of_intimation'] = 1;
|
||||
$fetchData['hospital_name'] = $received_data['hospital_name'];
|
||||
|
||||
$insert_status = $this->ticketMaster->insert($fetchData);
|
||||
$ticket_id = $this->ticketMaster->insertID();
|
||||
|
||||
if ($insert_status && !empty($ticket_id)) {
|
||||
$mail_sent_status = ($this->ticketController->sendAutoMailTrigger($ticket_id));
|
||||
if (gettype($mail_sent_status) == 'array') {
|
||||
$message = 'Claim Iniated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$mail_sent_status = 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;
|
||||
|
||||
$message_insert_status = $this->ticketMessage->insert($sent_message_data);
|
||||
|
||||
if ($message_insert_status) {
|
||||
$message = 'Claim Initiated Successfully';
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
} else {
|
||||
$message = 'Claim Initiated, Mail Sent Successfully';
|
||||
$this->myLogger->logme('error', "Claim initiated, Mail sent Successfully, Failed to store message:$ticket_id ");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -977,6 +977,9 @@ class EmployeeServiceController extends AdminController
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_details = (array)$policy_terms[0];
|
||||
$is_lgbtq = $policy_details['is_lgbtq'];
|
||||
|
||||
|
||||
// dd($this->clientPolicyModel->getLastQuery());
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
@ -1071,7 +1074,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment')
|
||||
{
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action'],$is_lgbtq);
|
||||
// dd($res);
|
||||
if(!$res['status'])
|
||||
{
|
||||
@ -1159,7 +1162,6 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
// calculate data points and premium
|
||||
public function employeesOnboardPreprocess($params)
|
||||
{
|
||||
@ -1240,8 +1242,9 @@ class EmployeeServiceController extends AdminController
|
||||
// dd($family);
|
||||
}
|
||||
|
||||
// Kint::dump($family);die();
|
||||
// Kint::dump($family);
|
||||
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
|
||||
// dd($data);
|
||||
$employee_data_group_by_family[$emp_id] = $data;
|
||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
}
|
||||
|
||||
@ -461,7 +461,8 @@ class LeadsController extends BaseController
|
||||
$this->loadLayout('view_rfq.php', $data);
|
||||
}
|
||||
|
||||
public function createRFQ(){
|
||||
public function createRFQ()
|
||||
{
|
||||
|
||||
// print_r($this->request->getPost('json')); die();
|
||||
|
||||
@ -1542,7 +1543,8 @@ class LeadsController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function transformProposelData($data, $proposel, $insurer){
|
||||
public function transformProposelData($data, $proposel, $insurer)
|
||||
{
|
||||
|
||||
// print_r($data['premium_data']['data']); die;
|
||||
|
||||
@ -1933,107 +1935,23 @@ class LeadsController extends BaseController
|
||||
return $this->convertQCRJsonToPolicyTerms($converted_json, $data['policy_type_id'], $proposel_data['proposel_name'], $proposel_data['insurer_name']);
|
||||
}
|
||||
|
||||
private function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
|
||||
{
|
||||
$GMC_Keys = [
|
||||
"sum_insured",
|
||||
"family_floater",
|
||||
"family_floaters",
|
||||
"age_ratio",
|
||||
"waiverofpreexistingdiseases",
|
||||
"maternitycoverage",
|
||||
"twindelivery",
|
||||
"preandpostnatal",
|
||||
"babyday1cover",
|
||||
"9monthwaitingperiodwaived",
|
||||
"coverfromthedateofjoining",
|
||||
"waiverof1,2,3&4thyearexclusions",
|
||||
"waiverof30dayswaitingperiod",
|
||||
"prehospitalizationcover",
|
||||
"congenitaldiseasesinternal",
|
||||
"copayzonewisecopay",
|
||||
"bioabsorbablestenttoriclensmultifocallens",
|
||||
"roomrentlimit",
|
||||
"proportionatedeductionclause",
|
||||
"ailmentcapping",
|
||||
"ambulancecharges",
|
||||
"airambulance",
|
||||
"familytransportationbenefit",
|
||||
"reasonableandcustomarycharges",
|
||||
"ayudhtreatmentcover",
|
||||
"congenitaldiseasesexternal",
|
||||
"optionalparentalcopay",
|
||||
"posthospitalizationcover",
|
||||
"corporatebuffer",
|
||||
"sublimitofcorporatebuffer",
|
||||
"ayushTreatmentCoverData",
|
||||
"armdcovered",
|
||||
"suminsuredenhancement",
|
||||
"automaticsuminsuredreinstatement",
|
||||
"additionalsicknessbenefit",
|
||||
"lasiksurgery",
|
||||
"midterminclusion",
|
||||
"capd",
|
||||
"organdonorexpenses",
|
||||
"moderntreatmentsasperirdai",
|
||||
"Wellness",
|
||||
"days_of_discharge",
|
||||
"days_from_dod",
|
||||
"special_condition_label",
|
||||
"special_condition_input",
|
||||
"multiple_sum_insured",
|
||||
"cataract",
|
||||
"cataractData"
|
||||
];
|
||||
|
||||
$GPA_Keys = [
|
||||
"sumInsured2",
|
||||
"totalSumInsured",
|
||||
"age_ratio",
|
||||
"accidentalDeathBenefit",
|
||||
"permanentTotalDisablement",
|
||||
"permanentPartialDisablement",
|
||||
"temporaryTotalDisablementBenefit",
|
||||
"accidentalHospitalizationExpenses",
|
||||
"childrenEducationWelfareFund",
|
||||
"compassionateVisitExpenses",
|
||||
"compassionateVisitExpensesData",
|
||||
"brokenBoneExpenses",
|
||||
"brokenBoneExpensesData",
|
||||
"ambulanceCharges",
|
||||
"ambulanceChargesData",
|
||||
"burnExpenses",
|
||||
"burnExpensesData",
|
||||
"carriageOfDeadBody",
|
||||
"carriageOfDeadBodyData",
|
||||
"animalSnakeInsectBite",
|
||||
"terrorism",
|
||||
"worldwideCover",
|
||||
"gpa_special_condition_label",
|
||||
"gpa_special_condition_input",
|
||||
"multiple_sum_insured"
|
||||
];
|
||||
|
||||
// Select keys based on policy type
|
||||
$termsKey = $policy_type == 1 ? $GPA_Keys : $GMC_Keys;
|
||||
|
||||
// Initialize terms_array with default empty values
|
||||
$terms_array = array_fill_keys($termsKey, "");
|
||||
$specialKeys = ['special_condition_label', 'special_condition_input', 'gpa_special_condition_label', 'gpa_special_condition_input', 'multiple_sum_insured'];
|
||||
foreach ($specialKeys as $key) {
|
||||
$terms_array[$key] = [];
|
||||
}
|
||||
//Function for convert the RFQ and QCR Json to Policy Terms Json
|
||||
public function convertQCRJsonToPolicyTerms($data, $policy_type, $proposel_name, $insurer_name)
|
||||
{
|
||||
//transform the data into the currernt proposel and insurere ( get single proposel )
|
||||
$data = $this->transformProposelData($data, $proposel_name, $insurer_name);
|
||||
|
||||
// Initialize age_ratio based on policy type
|
||||
$terms_array['age_ratio'] = $policy_type == 2 ? [
|
||||
"self" => ["min" => "18", "max" => "60"],
|
||||
"spouse" => ["min" => 0, "max" => 0],
|
||||
"child" => ["min" => 0, "max" => "25"],
|
||||
"elders" => ["min" => 0, "max" => 0],
|
||||
] : ["self" => ["min" => "18", "max" => "60"]];
|
||||
$age_ratio = $policy_type == 2 ? [
|
||||
'self' => ['min' => '18', 'max' => '60'],
|
||||
'spouse' => ['min' => 0, 'max' => 0],
|
||||
'child' => ['min' => 0, 'max' => '25'],
|
||||
'elders' => ['min' => 0, 'max' => 0],
|
||||
] : [
|
||||
'self' => ['min' => '18', 'max' => '60']
|
||||
];
|
||||
|
||||
foreach ($data['table_data']['data'] as $dataRow) {
|
||||
|
||||
$item = $dataRow['items'] ?? '';
|
||||
|
||||
foreach ($dataRow['data'] as $cellData) {
|
||||
@ -2043,45 +1961,52 @@ class LeadsController extends BaseController
|
||||
$value = $cellData['value'] ?? '';
|
||||
|
||||
// Skip unwanted keys
|
||||
if (
|
||||
in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) ||
|
||||
in_array($subth, ['Quote Asked'])
|
||||
) {
|
||||
if (in_array($parentth, ['Sno', 'Item Key', 'Particulars', 'Action']) || in_array($subth, ['Quote Asked'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle special conditions
|
||||
if (str_starts_with($item, "special_condition") && $parentth === $proposel_name && $subth === $insurer_name) {
|
||||
switch (true) {
|
||||
|
||||
$parts = explode("-", $input_value);
|
||||
$question = $parts[0] ?? '';
|
||||
$answer = $parts[1] ?? '';
|
||||
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
|
||||
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
|
||||
// CASE 1: Handle special conditions
|
||||
case str_starts_with($item, 'special_condition') && $parentth === $proposel_name && $subth === $insurer_name:
|
||||
$parts = explode('-', $input_value);
|
||||
$labelKey = $policy_type == 1 ? 'gpa_special_condition_label' : 'special_condition_label';
|
||||
$inputKey = $policy_type == 1 ? 'gpa_special_condition_input' : 'special_condition_input';
|
||||
|
||||
$terms_array[$labelKey][] = $question;
|
||||
$terms_array[$inputKey][] = $answer;
|
||||
continue;
|
||||
$terms_array[$labelKey][] = $parts[0] ?? '';
|
||||
$terms_array[$inputKey][] = $parts[1] ?? '';
|
||||
break;
|
||||
|
||||
// CASE 2: Handle sum insured
|
||||
case in_array($item, ['sum_insured', 'sumInsured2']):
|
||||
$si_amt = explode(',', $value);
|
||||
$terms_array[$item] = $si_amt[0] ?? '';
|
||||
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
|
||||
|
||||
// Add age_ratio after Sum insured
|
||||
if ($policy_type == 1) {
|
||||
$terms_array['age_ratio'] = $age_ratio;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// CASE 3: Handle family floaters
|
||||
case $item === 'family_composition':
|
||||
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
|
||||
|
||||
// Add age_ratio after family floaters
|
||||
if ($policy_type == 2) {
|
||||
$terms_array['age_ratio'] = $age_ratio;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// DEFAULT CASE :
|
||||
default:
|
||||
// $terms_array[$item] = isJsonString($input_value) ? (json_decode($input_value, true)['key'] ?? '') : $value;
|
||||
$terms_array[$item] = $value;
|
||||
break;
|
||||
}
|
||||
|
||||
// Handle sum insured
|
||||
if (in_array($item, ['sum_insured', 'sumInsured2'])) {
|
||||
$si_amt = explode(",", $value);
|
||||
$terms_array[$item] = $si_amt[0] ?? "";
|
||||
$terms_array['multiple_sum_insured'] = array_slice($si_amt, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle family floaters
|
||||
if ($item === 'family_composition') {
|
||||
$terms_array['family_floaters'] = isJsonString($input_value) ? json_decode($input_value, true) : $input_value;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Decode JSON if valid
|
||||
$terms_array[$item] = isJsonString($input_value) ?
|
||||
(json_decode($input_value, true)['key'] ?? '') :
|
||||
$input_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class LoginController extends BaseController
|
||||
// $isLoggedIn = check_session();
|
||||
$isLoggedIn = check_session();
|
||||
$hasCookie = check_cookie();
|
||||
if ($isLoggedIn || $hasCookie) {
|
||||
if ($isLoggedIn && $hasCookie) {
|
||||
return redirect()->to(base_url('/dashboard/view'));
|
||||
}
|
||||
return view('login');
|
||||
@ -91,7 +91,11 @@ class LoginController extends BaseController
|
||||
{
|
||||
$path = getenv('cookie.Path');
|
||||
session()->destroy();
|
||||
setcookie('session_data', '', time() - 3600, $path);
|
||||
// setcookie('session_data', '', time() - 3600, $path);
|
||||
$path = getenv('cookie.Path');
|
||||
$domain = getenv('cookie.Domain');
|
||||
$https = getenv('ccokie.secure');
|
||||
setcookie('session_data',null, time() -3600, $path, $domain, $https, true);
|
||||
return redirect()->to(base_url('login'));
|
||||
}
|
||||
|
||||
|
||||
@ -225,6 +225,7 @@ class MasterController extends AdminController
|
||||
'New Basic Cover SI' => 'new_basic_cover_si',
|
||||
'New SI Premium' => 'new_si_premium',
|
||||
'Date of Coverage' => 'date_of_coverage',
|
||||
'Age Band' => 'age_band',
|
||||
|
||||
];
|
||||
|
||||
@ -1669,9 +1670,11 @@ class MasterController extends AdminController
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$email_id = 'srinivas.saravanan@venbainfotech.com';
|
||||
$params = ['mail'=>$email_id];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
// $bcc = "vijayalakshmi@nhanceindia.in,vitvelz@gmail.com,velmurugan.s@venbainfotech.com,hariharan@nhanceindia.in,hariharan@jubiliant.in,srinivas.saravanan@venbainfotech.com";
|
||||
// Send email and get response
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
$result = MailHelper::send_email(['mail' => $email_id, 'params'=>$params,'subject' => 'Mail Via CLI','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
|
||||
|
||||
log_message('error',json_encode($result));
|
||||
|
||||
@ -52,6 +52,7 @@ class NotificationController extends AdminController
|
||||
$form_data['subject'] = $this->request->getPost('subject');
|
||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||
$form_data['client_id'] = $this->request->getPost('client_id');
|
||||
$form_data['mail_content_json'] = $this->request->getPost('mailJson');
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||
|
||||
@ -121,6 +121,7 @@ class PolicyTransactionController extends BaseController
|
||||
'cancelled' => 'Cancelled',
|
||||
'instalment_pending' => 'Instalment Pending',
|
||||
'completed' => 'Completed',
|
||||
'lost' => 'Lost',
|
||||
];
|
||||
$data['invoice_status_array'] = [
|
||||
'yet_to_generate' => 'Pending',
|
||||
@ -243,34 +244,6 @@ class PolicyTransactionController extends BaseController
|
||||
// print_r($data); die;
|
||||
// var_dump($data); die;
|
||||
|
||||
// Format dates
|
||||
// $data['policy_issue_date'] = change_date_format($this->request->getPost('policy_issue_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
// $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null;
|
||||
|
||||
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_issue_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_start_date']))
|
||||
// : null;
|
||||
|
||||
// $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['policy_end_date']))
|
||||
// : null;
|
||||
|
||||
// $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['renewal_date']))
|
||||
// : null;
|
||||
|
||||
// $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '')
|
||||
// ? date('d/m/Y', strtotime($data['rollover_date']))
|
||||
// : null;
|
||||
|
||||
|
||||
if(empty($data['policy_issue_date'])){
|
||||
$data['policy_issue_date'] = null;
|
||||
}
|
||||
@ -291,11 +264,17 @@ class PolicyTransactionController extends BaseController
|
||||
$data['rollover_date'] = null;
|
||||
}
|
||||
|
||||
if(empty($data['last_action_date'])){
|
||||
$data['last_action_date'] = null;
|
||||
}else{
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date']);
|
||||
}
|
||||
|
||||
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||
if ($data['tpa']) {
|
||||
if (isset($data['tpa'])) {
|
||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||
}
|
||||
}
|
||||
@ -321,6 +300,12 @@ class PolicyTransactionController extends BaseController
|
||||
$data['same_as_proposer'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['policy_with_corr'])) {
|
||||
$data['policy_with_corr'] = 0;
|
||||
} elseif ($data['policy_with_corr']) {
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
if($data['ct_type'] == ""){
|
||||
$data['ct_type'] = 1;
|
||||
}
|
||||
@ -343,7 +328,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
$insert = $this->policyTransactionModel->insert($data);
|
||||
if ($insert) {
|
||||
$this->insertTransactionStatus($insert, $data['status'], 1);
|
||||
$this->insertTransactionStatus($insert, $data, 1);
|
||||
$emp_data = $this->processInsertIndividualMemberInEmpTable($data);
|
||||
|
||||
if(isset($data['follow_insurer_id']) && !empty($data['follow_insurer_id'][0])){
|
||||
@ -379,7 +364,7 @@ class PolicyTransactionController extends BaseController
|
||||
{
|
||||
if ($this->policyTransactionModel->update($id, $data)) {
|
||||
|
||||
$this->insertTransactionStatus($id, $data['status'], 1);
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
$emp_data = $this->processInsertIndividualMemberInEmpTable($data);
|
||||
|
||||
if (isset($data['follow_insurer_id']) && !empty($data['follow_insurer_id'][0])) {
|
||||
@ -478,7 +463,8 @@ class PolicyTransactionController extends BaseController
|
||||
'created_by' => get_session_userid() ?? null,
|
||||
'updated_by' => get_session_userid() ?? null,
|
||||
'id' => $data['co_share_id'][$index] ?? null, // Assuming this is the ID to identify existing records
|
||||
'follower_policy_no' => $data['follower_policy_no'][$index] ?? null, // Assuming this is the ID to identify existing records
|
||||
'follower_policy_no' => $data['follower_policy_no'][$index] ?? null,
|
||||
'non_comm_per_amt' => $data['non_comm_per_amt'][$index] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
@ -540,11 +526,12 @@ class PolicyTransactionController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
private function insertTransactionStatus($policyTranId, $status, $statusType)
|
||||
private function insertTransactionStatus($policyTranId, $data, $statusType)
|
||||
{
|
||||
$statusData = [
|
||||
'policy_tran_id' => $policyTranId,
|
||||
'status' => $status,
|
||||
'status' => $data['status'],
|
||||
'last_action_date' => $data['last_action_date'],
|
||||
'status_type' => $statusType,
|
||||
'created_by' => get_session_userid(),
|
||||
];
|
||||
@ -691,6 +678,15 @@ class PolicyTransactionController extends BaseController
|
||||
client_policy.policy_type_id as master_policy_type_id,
|
||||
client_policy.is_addon,
|
||||
client_policy.base_policy,
|
||||
(
|
||||
select last_action_date
|
||||
from policy_transaction_status
|
||||
where policy_tran_id = policy_transaction.id
|
||||
and status = policy_transaction.status
|
||||
order by id desc
|
||||
limit 1
|
||||
|
||||
) as last_action_date
|
||||
')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
@ -756,6 +752,10 @@ class PolicyTransactionController extends BaseController
|
||||
if(!empty($data['endorse_eff_date'])){
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['last_action_date'])){
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['month'])){
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
@ -803,7 +803,110 @@ class PolicyTransactionController extends BaseController
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
) AS record_count
|
||||
) AS record_count,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_percentage,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_brokerage_amount
|
||||
|
||||
")
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
@ -965,18 +1068,37 @@ class PolicyTransactionController extends BaseController
|
||||
// $month = '01-'.$data['month'];
|
||||
// $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month));
|
||||
|
||||
if (!isset($data['policy_with_corr'])) {
|
||||
$data['policy_with_corr'] = 0;
|
||||
} elseif ($data['policy_with_corr']) {
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
|
||||
if(!empty($data['data_received_date'])){
|
||||
if(empty($data['data_received_date'])){
|
||||
$data['data_received_date'] = null;
|
||||
}else{
|
||||
$data['data_received_date'] = change_date_format($data['data_received_date'], 'd/m/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(!empty($data['closure_date'])){
|
||||
$data['closure_date'] = change_date_format($data['closure_date'], 'd/m/Y', 'Y-m-d');
|
||||
if(empty($data['policy_issue_date'])){
|
||||
$data['policy_issue_date'] = null;
|
||||
}else{
|
||||
$data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'd/m/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(!empty($data['endorse_eff_date'])){
|
||||
if(empty($data['endorse_eff_date'])){
|
||||
$data['endorse_eff_date'] = null;
|
||||
}else{
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'd/m/Y', 'Y-m-d');
|
||||
|
||||
}
|
||||
|
||||
if(empty($data['install_due_date'])){
|
||||
$data['install_due_date'] = null;
|
||||
}else{
|
||||
$data['install_due_date'] = change_date_format($data['install_due_date'], 'd/m/Y', 'Y-m-d');
|
||||
|
||||
}
|
||||
|
||||
if(!empty($data['month'])){
|
||||
@ -984,6 +1106,12 @@ class PolicyTransactionController extends BaseController
|
||||
$data['month'] = change_date_format($month, 'd/M/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(empty($data['last_action_date'])){
|
||||
$data['last_action_date'] = null;
|
||||
}else{
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date']);
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
@ -1014,11 +1142,11 @@ class PolicyTransactionController extends BaseController
|
||||
'issuer' => $issue_type['issuer'] ?? null,
|
||||
'client_type' => $data['client_type'] ?? $issue_type['client_type'] ?? null,
|
||||
'policy_type_id' => $issue_type['policy_type_id'] ?? null,
|
||||
'policy_type_id' => $issue_type['policy_type_id'] ?? null,
|
||||
'issue_type' => $issue_type['issue_type'] ?? null,
|
||||
'source_client_policy_id' => $issue_type['source_client_policy_id'] ?? null,
|
||||
'cd_ac_no' => $issue_type['issue_type'] ?? null,
|
||||
'policy_issue_date' => $issue_type['policy_issue_date'] ?? null,
|
||||
'cd_ac_no' => $issue_type['cd_ac_no'] ?? null,
|
||||
'cd_ac_pk' => $issue_type['cd_ac_pk'] ?? null,
|
||||
// 'policy_issue_date' => $issue_type['policy_issue_date'] ?? null,
|
||||
'policy_start_date' => $issue_type['policy_start_date'] ?? null,
|
||||
'policy_end_date' => $issue_type['policy_end_date'] ?? null,
|
||||
'revenue_type' => $issue_type['revenue_type'] ?? null,
|
||||
@ -1061,7 +1189,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
if ($insert) {
|
||||
|
||||
$this->insertTransactionStatus($insert, $data['status'], 1);
|
||||
$this->insertTransactionStatus($insert, $data, 1);
|
||||
$this->handleCompletedStatus($data, $insert);
|
||||
$this->insertOrUpdateCoShareDetails($data, $insert);
|
||||
|
||||
@ -1076,7 +1204,7 @@ class PolicyTransactionController extends BaseController
|
||||
$update = $this->policyTransactionModel->where('id', $id)->set($data)->update();
|
||||
|
||||
if ($update) {
|
||||
$this->insertTransactionStatus($id, $data['status'], 1);
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
$this->handleCompletedStatus($data, $id);
|
||||
$this->insertOrUpdateCoShareDetails($data, $id);
|
||||
|
||||
@ -1122,6 +1250,15 @@ class PolicyTransactionController extends BaseController
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_type,
|
||||
(
|
||||
select last_action_date
|
||||
from policy_transaction_status
|
||||
where policy_tran_id = policy_transaction.id
|
||||
and status = policy_transaction.status
|
||||
order by id desc
|
||||
limit 1
|
||||
|
||||
) as last_action_date
|
||||
')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
@ -1152,22 +1289,151 @@ class PolicyTransactionController extends BaseController
|
||||
$data['data_received_date'] = change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['closure_date'])){
|
||||
$data['closure_date'] = change_date_format($data['closure_date'], 'Y-m-d', 'd/m/Y');
|
||||
if(!empty($data['policy_issue_date'])){
|
||||
$data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['endorse_eff_date'])){
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['install_due_date'])){
|
||||
$data['install_due_date'] = change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['last_action_date'])){
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['month'])){
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
//get PT Co-Share Details
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
|
||||
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
|
||||
(
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
) AS record_count,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_percentage,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_brokerage_amount
|
||||
|
||||
")
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
|
||||
// print_r($data['endorse_eff_date']); die;
|
||||
|
||||
@ -1295,7 +1561,23 @@ class PolicyTransactionController extends BaseController
|
||||
public function getPTCOShareCount($client_id, $client_policy_id)
|
||||
{
|
||||
$totalCount = $this->PTCOShareDetailsModel
|
||||
->select('pt_co_share_details.*')
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
policy_transaction.bro_payable_by,
|
||||
(
|
||||
select cd_ac_no
|
||||
from cd_master
|
||||
where id = policy_transaction.cd_ac_pk
|
||||
) as cd_account_no,
|
||||
(
|
||||
select balance
|
||||
from cash_deposit
|
||||
where cd_ac_pk = policy_transaction.cd_ac_pk
|
||||
and is_active = 1
|
||||
order by id desc
|
||||
limit 1
|
||||
) as cd_amount,
|
||||
")
|
||||
->join('policy_transaction', 'policy_transaction.id = pt_co_share_details.pt_id')
|
||||
->where('policy_transaction.client_id', $client_id)
|
||||
->where('policy_transaction.client_policy_id', $client_policy_id)
|
||||
@ -1480,7 +1762,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
//Actual data for the list
|
||||
$data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id);
|
||||
// dd($data['report_list']);
|
||||
//!dd($data['report_list']);
|
||||
|
||||
$this->loadLayout('report_bds_filter', $data);
|
||||
}
|
||||
@ -1529,6 +1811,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
|
||||
$data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id);
|
||||
// !dd($data['varience_list']);
|
||||
$this->loadLayout('variance_report_list', $data);
|
||||
|
||||
}
|
||||
@ -1660,7 +1943,7 @@ class PolicyTransactionController extends BaseController
|
||||
// dd($this->validateInsurerStatement(['file_id' => 30]));
|
||||
// $data['insurers'] = $this->insurerModel->where('is_active',1)->findAll();
|
||||
$today = date('Y-m-d');
|
||||
$fromday = $from_date = date('Y-m-d', strtotime('-60 days', strtotime($today)));
|
||||
$fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
|
||||
// echo $fromday;die();
|
||||
$data['invoice_status_array'] = $this->invoiceStatus;
|
||||
$data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
@ -1687,6 +1970,7 @@ class PolicyTransactionController extends BaseController
|
||||
->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
|
||||
->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
|
||||
->where('insurer_statements.is_active', 1)
|
||||
// ->where('insurer_statements.file_status','success')
|
||||
->where('date(insurer_statements.created_at) >= ', $from_date)
|
||||
->where('date(insurer_statements.created_at) <= ', $today)
|
||||
->orderBy('insurer_statements.id', 'DESC')
|
||||
@ -1698,6 +1982,48 @@ class PolicyTransactionController extends BaseController
|
||||
$this->loadLayout('insurer_statement_list', $data);
|
||||
}
|
||||
|
||||
// public function failedStatementList(){
|
||||
// $today = date('Y-m-d');
|
||||
// $fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today)));
|
||||
// // echo $fromday;die();
|
||||
// $data['invoice_status_array'] = $this->invoiceStatus;
|
||||
// $data['insurers'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
|
||||
// // dd( $data['insurers']);
|
||||
// $data['insurer_statement_list'] = $this->insurerStatements
|
||||
// ->select('insurer_statements.*,
|
||||
// insurers.name AS insurer_name,
|
||||
// insurers.short_name,
|
||||
// user_profiles.first_name,
|
||||
// insurer_branch.branch_code,
|
||||
// (SELECT SUM(pt_co_share_details.exp_amt)
|
||||
// FROM pt_co_share_details
|
||||
// WHERE pt_co_share_details.is_active = 1
|
||||
// AND pt_co_share_details.statement_id = insurer_statements.id
|
||||
// ) AS exp_inv_amt,
|
||||
// (SELECT SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds) + SUM(inv_payment_details.gst)
|
||||
// FROM inv_payment_details
|
||||
// WHERE inv_payment_details.is_active = 1
|
||||
// AND inv_payment_details.statement_id = insurer_statements.id
|
||||
// ) AS received_inv_amt'
|
||||
// )
|
||||
// ->join('insurers', 'insurer_statements.insurer_id = insurers.id')
|
||||
// ->join('insurer_branch', 'insurer_statements.branch_id = insurer_branch.id')
|
||||
// ->join('user_profiles', 'insurer_statements.created_by = user_profiles.id')
|
||||
// ->where('insurer_statements.is_active', 1)
|
||||
// ->where('insurer_statements.file_status','failed')
|
||||
// ->where('date(insurer_statements.created_at) >= ', $from_date)
|
||||
// ->where('date(insurer_statements.created_at) <= ', $today)
|
||||
// ->orderBy('insurer_statements.id', 'DESC')
|
||||
// ->findAll();
|
||||
// if($data['insurer_statement_list']){
|
||||
// return $this->respond(['status' => true, 'code' => 200,'data'=>$data ], 200);
|
||||
// }else{
|
||||
// return $this->respond(['status'=>false,'message'=>'Data Not Fount'],404);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
public function uploadInsurerStatement()
|
||||
{
|
||||
|
||||
@ -1768,6 +2094,12 @@ class PolicyTransactionController extends BaseController
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file not uploaded', 'error_data' => $validation_result['error_data'],'error_code' => $validation_result['error_code']], 200);
|
||||
}
|
||||
|
||||
if (isset($file_id) || $validation_result['status']) {
|
||||
$this->insurerStatements->where('id', $file_id)->set(['invoice_status' => 'pending'])->update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
|
||||
}
|
||||
|
||||
@ -1855,16 +2187,19 @@ class PolicyTransactionController extends BaseController
|
||||
$is_row_empty = check_row_is_empty_or_null($excel_row);
|
||||
if(!$is_row_empty)
|
||||
{
|
||||
// $excel_row = ExcelSanitizeHelper::sanitizeArrayData($excel_row);
|
||||
$is_source_found = 0;
|
||||
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
|
||||
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
|
||||
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
|
||||
$policy_no = preg_replace('/[\x{200C}\x{200B}]/u', '', $excel_row[1]);//policy_end_date from excel
|
||||
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
|
||||
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
|
||||
|
||||
// Kint::dump($policy_no);
|
||||
foreach ($source_data as $source_key => $source_row)
|
||||
{
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : "";
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
// Kint::dump($source_endorsement_no);
|
||||
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
|
||||
{
|
||||
$is_source_found = 1;
|
||||
@ -1946,9 +2281,9 @@ class PolicyTransactionController extends BaseController
|
||||
$line_items = count($excel_data);
|
||||
// get uploaded month transactions data
|
||||
$source_data = $this->PTCOShareDetailsModel->getNonReconcileredPolicyTransactions(insurer_id:$file['insurer_id'],insurer_branch_id:$file['branch_id']);
|
||||
// Kint::dump($source_data);die;
|
||||
// Kint::dump($source_data);//die;
|
||||
// Kint::dump($excel_data);
|
||||
|
||||
// die;
|
||||
// check policy no,insurer and etc in DB for this month
|
||||
// if all good return true, otherwise return false with messssage
|
||||
$data_to_update = [];
|
||||
@ -1962,13 +2297,14 @@ class PolicyTransactionController extends BaseController
|
||||
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
|
||||
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
|
||||
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
|
||||
$policy_no = preg_replace('/[\x{200C}\x{200B}]/u', '', $excel_row[1]);//
|
||||
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
|
||||
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
|
||||
|
||||
foreach ($source_data as $source_key => $source_row)
|
||||
{
|
||||
// Kint::dump(change_date_format($excel_row[3],'d-m-Y','Y-m-d'));
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : "";
|
||||
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : null;
|
||||
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
|
||||
{
|
||||
$is_source_found = 1;
|
||||
|
||||
1138
app/Controllers/TicketController.php
Normal file
1138
app/Controllers/TicketController.php
Normal file
File diff suppressed because it is too large
Load Diff
209
app/Helpers/ChatbotHelper.php
Normal file
209
app/Helpers/ChatbotHelper.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
// File: App\Helpers\DepositHelper.php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\TPAModel;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
class ChatbotHelper
|
||||
{
|
||||
//get list of policies againest an employee_id
|
||||
public static function getListOfPolicies()
|
||||
{
|
||||
|
||||
$emp_id = 12288;
|
||||
$emp_code = 'HTL-007';
|
||||
$client_id = 159;
|
||||
$policy_id = 0;
|
||||
$client_branch_id = 126;
|
||||
$relationship ='Father';
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
return $EmployeeModel->getEmpFamilybyEmpCode(emp_code: $emp_code,client_id: $client_id,emp_status: ['draft'],policy_status:['draft'],client_branch_id:[ $client_branch_id ],relationship:[$relationship]);
|
||||
}
|
||||
|
||||
public static function getHospitalLink($client_policy_id){
|
||||
// $client_policy_id = 336;
|
||||
// $emp_id = 12288;
|
||||
$EmployeePolicyModel = new EmployeePolicyModel();
|
||||
$res = $EmployeePolicyModel->getHospitalLinkByPolicyandEmp($client_policy_id);
|
||||
|
||||
return is_array($res) && count($res) ? $res[0]['network_hospitals'] : null;
|
||||
}
|
||||
|
||||
public static function getPhoneNumber(){
|
||||
$emp_id = 12288;
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
return $EmployeeModel->select('mobile')->where('id',$emp_id)->first()['mobile'];
|
||||
}
|
||||
|
||||
public static function get_payload_data(string $key = null)
|
||||
{
|
||||
// Get the request object using the service helper
|
||||
$request = service('request');
|
||||
|
||||
// Get the raw input (JSON or other data)
|
||||
$rawInput = $request->getBody();
|
||||
|
||||
// Check if the raw input is valid JSON
|
||||
$payload = json_decode($rawInput, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
// JSON is valid, return the requested key or the entire payload
|
||||
return $key ? ($payload[$key] ?? null) : $payload;
|
||||
} else {
|
||||
// JSON is invalid, fallback to raw input or POST data
|
||||
$payload = $request->getRawInput() ?: $request->getPost();
|
||||
return $key ? ($payload[$key] ?? null) : $payload;
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendReimbursementProcessOverMail()
|
||||
{
|
||||
$emp_id = 12288;
|
||||
$emp_code = 'HTL-007';
|
||||
$client_id = 159;
|
||||
$policy_id = 0;
|
||||
$client_branch_id = 126;
|
||||
$relationship ='Father';
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
$data = $EmployeeModel->find($emp_id);
|
||||
if(isset($data) && isset($data['email_corporate']))
|
||||
{
|
||||
$message = SELF::ReimbursementProcessMailTemplate();
|
||||
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
];
|
||||
|
||||
|
||||
$common = ['mail_type'=>'reimbursement_mail_process_bot'];
|
||||
$email_id = $data['email_corporate'];
|
||||
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
|
||||
$res = json_decode($res);
|
||||
if($res->status == 'success')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static function ReimbursementProcessMailTemplate()
|
||||
{
|
||||
$template = '<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>How to Claim Your Insurance Reimbursement</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
background-color: #ffffff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
h2 {
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
}
|
||||
p {
|
||||
font-size: 16px;
|
||||
color: #555;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.steps {
|
||||
padding: 10px;
|
||||
background-color: #ecf0f1;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.steps ol {
|
||||
padding-left: 20px;
|
||||
}
|
||||
.btn {
|
||||
display: block;
|
||||
width: 200px;
|
||||
margin: 20px auto;
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
background-color: #3498db;
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
.footer {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2>How to Claim Your Insurance Reimbursement</h2>
|
||||
<p>Dear [Customer Name],</p>
|
||||
<p>We are here to assist you in claiming your insurance reimbursement smoothly. Please follow the steps below:</p>
|
||||
|
||||
<div class="steps">
|
||||
<ol>
|
||||
<li><strong>Gather Documents:</strong> Collect all required documents such as bills, invoices, and medical reports.</li>
|
||||
<li><strong>Complete the Claim Form:</strong> Fill out the insurance claim form accurately.</li>
|
||||
<li><strong>Attach Supporting Documents:</strong> Attach all necessary documents to support your claim.</li>
|
||||
<li><strong>Submit Your Claim:</strong> Send the completed form and documents via email or through our online portal.</li>
|
||||
<li><strong>Track Your Claim:</strong> Use our tracking system to monitor the status of your claim.</li>
|
||||
<li><strong>Receive Reimbursement:</strong> Once approved, the reimbursement will be processed to your registered account.</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<a href="[CLAIM_PORTAL_URL]" class="btn">Submit Your Claim</a>
|
||||
|
||||
<p>If you have any questions, feel free to contact our support team.</p>
|
||||
|
||||
<div class="footer">
|
||||
<p>Best Regards,<br><strong>Insurance Support Team</strong><br><a href="mailto:support@example.com">support@example.com</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||
@ -6,17 +7,11 @@ use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
|
||||
class ExcelSanitizeHelper
|
||||
{
|
||||
/**
|
||||
* Array of non-printable characters to be removed from strings.
|
||||
*
|
||||
* You can modify this array to include any characters you want to remove.
|
||||
* Regex pattern for non-printable characters to be removed from strings.
|
||||
*
|
||||
* This pattern includes control characters, zero-width characters, and Excel-specific codes
|
||||
*/
|
||||
private static $nonPrintableChars = [
|
||||
"\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09",
|
||||
"\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", "\x12", "\x13",
|
||||
"\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D",
|
||||
"\x1E", "\x1F", "\x7F", "_x000D_", "_x000A_", "_x0009_", "_x0008_", "_x0007_",
|
||||
"_x0006_", "_x0005_", "_x0004_", "_x0003_", "_x0002_", "_x0001_"
|
||||
];
|
||||
private static $nonPrintablePattern = '/[\x00-\x1F\x7F\x{200B}\x{200C}]|_x[0-9A-F]{4}_/u';
|
||||
|
||||
/**
|
||||
* Sanitizes array data by removing non-printable characters and trimming whitespace from strings.
|
||||
@ -24,22 +19,21 @@ class ExcelSanitizeHelper
|
||||
* @param array $data Input array containing data to sanitize
|
||||
* @return array Sanitized array with non-printable characters removed and leading/trailing whitespace trimmed
|
||||
*/
|
||||
public static function sanitizeArrayData(array $data): array
|
||||
public static function sanitizeArrayData(array $data): array
|
||||
{
|
||||
try {
|
||||
$cleanData = [];
|
||||
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$cleanData[$key] = self::sanitizeArrayData($value); // Recursive call for nested arrays
|
||||
} elseif (is_string($value)) {
|
||||
// Remove non-printable characters and trim whitespace from strings
|
||||
$cleanData[$key] = trim(str_replace(self::$nonPrintableChars, '', $value));
|
||||
$cleanData[$key] = trim(preg_replace(self::$nonPrintablePattern, '', $value));
|
||||
} else {
|
||||
$cleanData[$key] = $value; // Keep non-string/non-array data as is
|
||||
}
|
||||
}
|
||||
|
||||
return $cleanData;
|
||||
} catch (\Exception $e) {
|
||||
// Log the error and the problematic data for debugging
|
||||
|
||||
@ -56,11 +56,12 @@ class GmailResponseHandler{
|
||||
// 'employee_id' => isset($params['params']['common']['employee_id']) ? $params['params']['common']['employee_id'] : null,
|
||||
// 'mail_type' => isset($params['params']['common']['mail_type']) ? $params['params']['common']['mail_type'] : null,
|
||||
// 'gmail_api_status' => isset($params['gmail_api']['status']) ? $params['gmail_api']['status'] : null,
|
||||
// 'gmail_api_id' => isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null
|
||||
// 'gmail_api_id' => isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null,
|
||||
// 'received_message' => isset($params['gmail_api']['data']['labelIds'])?json_encode($params['gmail_api']['data']['labelIds']): null
|
||||
// ];
|
||||
// Initialize data array
|
||||
$data = [];
|
||||
// print_r($params['params']['common']);die();
|
||||
// // print_r($params['params']['common']);die();
|
||||
if (isset($params['params']['common'])) {
|
||||
foreach ($params['params']['common'] as $key => $value) {
|
||||
$data[$key] = isset($value) ? $value : null;
|
||||
|
||||
@ -194,6 +194,11 @@ class MailHelper
|
||||
} else {
|
||||
$bcc = '';
|
||||
}
|
||||
if(isset($params['cc'])){
|
||||
$cc = $params['cc'];
|
||||
}else{
|
||||
$cc = '';
|
||||
}
|
||||
$from_address = getenv('email.fromEmail');
|
||||
|
||||
|
||||
@ -255,7 +260,6 @@ class MailHelper
|
||||
}
|
||||
|
||||
$apiResponse = json_decode($response, true);
|
||||
|
||||
if ($httpCode === 200) {
|
||||
return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $emaill], 200);
|
||||
} else {
|
||||
@ -289,116 +293,152 @@ class MailHelper
|
||||
}
|
||||
|
||||
public static function send_email($params)
|
||||
{
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
{
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
||||
$common = isset($params['common']) ? $params['common'] : '';
|
||||
$bcc = isset($params['bcc']) ? $params['bcc'] : '';
|
||||
$cc = isset($params['cc']) ? $params['cc'] : '';
|
||||
|
||||
$from_address = getenv('email.fromEmail');
|
||||
try {
|
||||
$curl = curl_init();
|
||||
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
||||
$common = isset($params['common']) ? $params['common'] : '';
|
||||
|
||||
$from_address = getenv('email.fromEmail');
|
||||
try {
|
||||
$curl = curl_init();
|
||||
|
||||
$postData = [
|
||||
'from' => [
|
||||
'address' => $from_address
|
||||
],
|
||||
'to' => [
|
||||
[
|
||||
'email_address' => [
|
||||
'address' => $emaill
|
||||
]
|
||||
$postData = [
|
||||
'from' => [
|
||||
'address' => $from_address
|
||||
],
|
||||
'to' => [
|
||||
[
|
||||
'email_address' => [
|
||||
'address' => $emaill
|
||||
]
|
||||
],
|
||||
'subject' => $subject,
|
||||
'htmlbody' => $message
|
||||
];
|
||||
]
|
||||
],
|
||||
'subject' => $subject,
|
||||
'htmlbody' => $message
|
||||
];
|
||||
|
||||
// Handle attachments
|
||||
if (!empty($attachments)) {
|
||||
$postData['attachments'] = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
|
||||
// Determine MIME type dynamically
|
||||
$fileMimeType = mime_content_type($attachment['filePath']);
|
||||
|
||||
$postData['attachments'][] = [
|
||||
'content' => base64_encode(file_get_contents($attachment['filePath'])),
|
||||
'name' => $attachment['fileName'],
|
||||
'mime_type' => $fileMimeType, // Add mime_type field
|
||||
];
|
||||
}
|
||||
// Add CC recipients if provided
|
||||
if (!empty($cc)) {
|
||||
$ccList = explode(',', $cc);
|
||||
$ccList = array_map('trim', $ccList);
|
||||
$postData['cc'] = array_map(function($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $ccList);
|
||||
}
|
||||
// Add BCC if present
|
||||
if (!empty($bcc)) {
|
||||
$bccList = explode(',', $bcc);
|
||||
$bccList = array_map('trim', $bccList);
|
||||
$postData['bcc'] = array_map(function($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $bccList);
|
||||
}
|
||||
|
||||
// Add BCC recipients if provided
|
||||
// if (!empty($bcc)) {
|
||||
// $postData['bcc'] = [];
|
||||
// // Handle both string and array inputs for BCC
|
||||
// $bccEmails = is_array($bcc) ? $bcc : [$bcc];
|
||||
// foreach ($bccEmails as $bccEmail) {
|
||||
// $postData['bcc'][] = [
|
||||
// 'email_address' => [
|
||||
// 'address' => $bccEmail
|
||||
// ]
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
// Handle attachments
|
||||
if (!empty($attachments)) {
|
||||
$postData['attachments'] = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
|
||||
// Determine MIME type dynamically
|
||||
$fileMimeType = mime_content_type($attachment['filePath']);
|
||||
|
||||
$postData['attachments'][] = [
|
||||
'content' => base64_encode(file_get_contents($attachment['filePath'])),
|
||||
'name' => $attachment['fileName'],
|
||||
'mime_type' => $fileMimeType,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($postData),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"accept: application/json",
|
||||
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
|
||||
"cache-control: no-cache",
|
||||
"content-type: application/json",
|
||||
],
|
||||
]);
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($postData),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"accept: application/json",
|
||||
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
|
||||
"cache-control: no-cache",
|
||||
"content-type: application/json",
|
||||
],
|
||||
]);
|
||||
|
||||
$mail_result = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
// log_message('error','inside mail helper');
|
||||
// log_message('error', $response.' error->'.$err);die();
|
||||
$res['params'] = $params;
|
||||
$MailDataHelper = new GmailResponseHandler();
|
||||
$apiResponse = json_decode($mail_result, true);
|
||||
$res['zepto_api'] = $apiResponse;
|
||||
if (isset($apiResponse['error'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'message' => 'Email Sent Failed...' . $emaill,
|
||||
'data' => $res
|
||||
], 404);
|
||||
}
|
||||
$mail_result = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
|
||||
// $apiResponse = json_decode($response, true);
|
||||
|
||||
// Check if request_id exists in response (indicates success)
|
||||
if (isset($apiResponse['data'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email Sent Successfully...' . $emaill,
|
||||
'data' => $res
|
||||
], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$msg['error'] = $e->getMessage();
|
||||
$msg['params'] = $params;
|
||||
$res['params'] = $params;
|
||||
$MailDataHelper = new GmailResponseHandler();
|
||||
$apiResponse = json_decode($mail_result, true);
|
||||
$res['zepto_api'] = $apiResponse;
|
||||
|
||||
if (isset($apiResponse['error'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'data' => $msg
|
||||
], 500);
|
||||
'code' => 404,
|
||||
'message' => 'Email Sent Failed...' . $emaill,
|
||||
'data' => $res
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($apiResponse['data'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email Sent Successfully...' . $emaill,
|
||||
'data' => $res
|
||||
], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$msg['error'] = $e->getMessage();
|
||||
$msg['params'] = $params;
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'data' => $msg
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
public static function bulk_mail(array $mails = [])
|
||||
{
|
||||
$model = new JobModel();
|
||||
|
||||
@ -532,8 +532,10 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
|
||||
if (!function_exists('check_dependent_conflict'))
|
||||
{
|
||||
function check_dependent_conflict($family_data,$policy_terms,$actionArr)
|
||||
{
|
||||
function check_dependent_conflict($family_data,$policy_terms,$actionArr,$is_lgbtq)
|
||||
{
|
||||
// dd($family_data,$policy_terms,$actionArr,$is_lgbtq);
|
||||
|
||||
$result = ['status' => true];
|
||||
|
||||
$self_gender = null;
|
||||
@ -622,10 +624,14 @@ if (!function_exists('check_dependent_conflict'))
|
||||
// print_r(array_values(array_count_values($overall_famility_relationships)));
|
||||
// print_r(in_array(2,array_values(array_count_values($overall_famility_relationships))));
|
||||
|
||||
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
|
||||
//check if this policy is allowed LGBTQ
|
||||
if($is_lgbtq == 0)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
}
|
||||
}
|
||||
|
||||
if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) )
|
||||
@ -1072,7 +1078,9 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
||||
{
|
||||
{
|
||||
// dd($emp_data,$policy_terms,$slab_details,$default_si);
|
||||
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
@ -1238,6 +1246,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1246,12 +1255,12 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "5":
|
||||
//GMC - Employees Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
|
||||
|
||||
$temp_date = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'],to_date: $temp_date)->y;
|
||||
// kint::dump($age);
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
|
||||
// dd($slab_value);
|
||||
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3 ) ))
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
@ -1261,6 +1270,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1276,7 +1286,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
|
||||
{
|
||||
// echo $emp_data['name'];
|
||||
// echo $emp_data['name']; die;
|
||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
@ -1284,6 +1294,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1307,6 +1318,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -1378,6 +1390,8 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
@ -1459,6 +1473,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||
$emp_data['policy_details']['age_band'] = $slab_value['age_from'].'-'.$slab_value['age_to'];
|
||||
$is_match_found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ class sendMailNotification
|
||||
|
||||
$subject = $cleanedText;
|
||||
|
||||
$link = generate_download_link($rand_string);
|
||||
$link = generate_download_link($rand_string).'/1';
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
@ -189,7 +189,7 @@ class sendMailNotification
|
||||
$emp_code = '';
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($array_list); die;
|
||||
// dd($array_list); die;
|
||||
|
||||
|
||||
|
||||
@ -204,6 +204,7 @@ class sendMailNotification
|
||||
$policy_name = '';
|
||||
$is_addon = '';
|
||||
$rowspan = count($item) ?? 2;
|
||||
$is_si_set = 0;
|
||||
|
||||
foreach ($item as $inner_item) {
|
||||
|
||||
@ -262,7 +263,23 @@ class sendMailNotification
|
||||
if($policy_premium_data['premium_type'] == 2){
|
||||
$temp_data .= '<td>' . $si . '</td>';
|
||||
}else{
|
||||
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
|
||||
// $temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
|
||||
|
||||
if ($si != 0 && count($item) != 1 && $is_si_set == 0) {
|
||||
|
||||
$temp_data .= '<td rowspan=' . $rowspan . '>' . $si . '</td>';
|
||||
$is_si_set = 1;
|
||||
|
||||
} else {
|
||||
|
||||
if ($is_si_set == 1) {
|
||||
$temp_data .= '';
|
||||
} else {
|
||||
$temp_data .= '<td>' . $si . '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Only Display SI Topup and Dependent Addon
|
||||
@ -1209,6 +1226,20 @@ class sendMailNotification
|
||||
$notification = $params['notification_data'];
|
||||
$client_data = $params['client_data'];
|
||||
$mail = $params['test_mail'];
|
||||
$mailAttachmentModel = new MailAttachmentModel();
|
||||
$attachment_data = $mailAttachmentModel
|
||||
->select('file_path, file_name')
|
||||
->where('notification_id', $notification['id'])
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$attachments = [];
|
||||
foreach ($attachment_data as $data) {
|
||||
$attachments[] = [
|
||||
"filePath" => WRITEPATH . $data['file_path'],
|
||||
"fileName" => $data['file_name']
|
||||
];
|
||||
}
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$subject = $notification['subject'];
|
||||
@ -1235,7 +1266,7 @@ class sendMailNotification
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, 'reply_to' => $client_data['reply_to']];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
|
||||
@ -235,7 +235,7 @@ if (!function_exists('get_username')) {
|
||||
if (!function_exists('get_role_id')) {
|
||||
function get_role_id() {
|
||||
|
||||
$role_id = get_session_userdata()->role;
|
||||
$role_id = isset(get_session_userdata()->role) ? get_session_userdata()->role : null;
|
||||
return $role_id;
|
||||
}
|
||||
}
|
||||
@ -544,6 +544,10 @@ if (!function_exists('change_date_format')) {
|
||||
'Y/m/d', // 2024/12/01
|
||||
'Y.m.d', // 2024.12.01
|
||||
'Y,m,d', // 2024,12,01
|
||||
|
||||
'd/m/Y', // 01/01/2025
|
||||
'd-m-Y', // 01-01-2025
|
||||
|
||||
];
|
||||
|
||||
try {
|
||||
|
||||
@ -52,7 +52,8 @@ class ClientPolicyModel extends Model
|
||||
"disclaimer",
|
||||
"is_active",
|
||||
"is_member_modify_allowed",
|
||||
"cd_ac_pk"
|
||||
"cd_ac_pk",
|
||||
"is_lgbtq",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -106,7 +106,7 @@ class EmployeeModel extends Model
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employees.file_id','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.is_addon', 'employee_polices.payable_employee'])
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employees.file_id','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.is_addon', 'employee_polices.payable_employee','employee_polices.rand_string','employee_polices.claim_status'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id','left')
|
||||
@ -240,4 +240,25 @@ class EmployeeModel extends Model
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function getEmployeeByEmployeeCode($emp_code)
|
||||
{
|
||||
return $this->select("
|
||||
employees.id AS emp_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code,
|
||||
employees.mobile AS emp_mobile,
|
||||
employees.email_corporate AS emp_email,
|
||||
employees.relationship AS emp_relationship,
|
||||
employee_polices.uhid AS policy_no,
|
||||
employee_polices.tpa_id AS tpa_no
|
||||
")
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->groupBy('employees.id')
|
||||
->findAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,8 @@ class EmployeePolicyModel extends Model
|
||||
"claim_status",
|
||||
'ecard_sent_status',
|
||||
'payable_employee',
|
||||
'file_id'
|
||||
'file_id',
|
||||
"age_band",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -286,7 +287,10 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum as pro_rata_premium,
|
||||
employee_polices.gst,
|
||||
employee_polices.age_band,
|
||||
(employee_polices.rata_premimum + employee_polices.gst) AS total,
|
||||
|
||||
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
@ -486,10 +490,13 @@ class EmployeePolicyModel extends Model
|
||||
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,
|
||||
employee_polices.rata_premimum as old_si_premium,
|
||||
employee_polices.age_band,
|
||||
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
@ -818,6 +825,9 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.uhid as uhid,
|
||||
employee_polices.rata_premimum as premium,
|
||||
employee_polices.claim_status,
|
||||
employee_polices.age_band,
|
||||
employee_polices.tpa_id,
|
||||
|
||||
|
||||
batch_data.emp_policy_id AS emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
@ -1126,7 +1136,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
public function getEmployeePolicyForFileList($client_id, $policy_id)
|
||||
{
|
||||
$result = $this->select(['employee_polices.*','pt.policy_type','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
||||
$result = $this->select(['employee_polices.*','pt.policy_type','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile','cp.policy_type_id'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policy_type pt', 'cp.policy_type_id = pt.id') //pm - policy master
|
||||
@ -1722,7 +1732,7 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices ep
|
||||
WHERE
|
||||
ep.file_id = $file_id
|
||||
AND ep.uhid IS NOT NULL'
|
||||
AND ep.uhid IS NOT NULL
|
||||
AND ep.status != 'truncated'
|
||||
AND ep.status != 'truncated'
|
||||
AND ep.is_active = 1;
|
||||
@ -1735,4 +1745,17 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
public function getHospitalLinkByPolicyandEmp($client_policy_id){
|
||||
$data = $this->db->table('employee_polices')
|
||||
->select('tpa.network_hospitals')
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->join('tpa', 'tpa.id = employee_polices.tpa_id AND tpa.is_active = 1')
|
||||
// ->join('employees', 'employees.id = employee_polices.employee_id AND employees.id = ' . (int) $emp_id)
|
||||
->get()->getResultArray();
|
||||
|
||||
// var_dump($this->db->getLastQuery());
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -4,9 +4,9 @@ namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class NotificationModel extends Model
|
||||
class NotificationModel extends Model
|
||||
{
|
||||
protected $table = 'notifications';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",];
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",'mail_content_json'];
|
||||
}
|
||||
@ -65,6 +65,7 @@ class PTCOShareDetailsModel extends Model
|
||||
'cop_amt',
|
||||
'statement_id',
|
||||
'follower_policy_no',
|
||||
'non_comm_per_amt',
|
||||
];
|
||||
|
||||
public function getNonReconcileredPolicyTransactions(string $insurer_id,string $insurer_branch_id)
|
||||
|
||||
@ -76,7 +76,9 @@ class PolicyTransactionModel extends Model
|
||||
'ct_tran_id',
|
||||
'remarks',
|
||||
'month',
|
||||
'cd_ac_pk'
|
||||
'cd_ac_pk',
|
||||
'install_due_date',
|
||||
'policy_with_corr',
|
||||
];
|
||||
|
||||
|
||||
@ -363,7 +365,6 @@ class PolicyTransactionModel extends Model
|
||||
vehicle.vehicle_no,
|
||||
tpa.name as tpa_name,
|
||||
pt_co_share_details.remark as remarks,
|
||||
pt_co_share_details.reward,
|
||||
pt_co_share_details.bp_amt,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.id as pt_id,
|
||||
@ -383,7 +384,6 @@ class PolicyTransactionModel extends Model
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||
|
||||
pt_co_share_details.agreed_bp_per,
|
||||
|
||||
ROUND(
|
||||
(
|
||||
SELECT
|
||||
@ -405,6 +405,24 @@ class PolicyTransactionModel extends Model
|
||||
),
|
||||
2
|
||||
) AS total_irda_amt,
|
||||
ROUND(
|
||||
(
|
||||
SELECT
|
||||
(
|
||||
SUM(co_share_stmt_details.reward)
|
||||
|
||||
) AS reward
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
AND insurer_statements.is_active = 1
|
||||
$date_condition
|
||||
),
|
||||
2
|
||||
) AS reward,
|
||||
|
||||
ROUND(
|
||||
(
|
||||
@ -424,7 +442,7 @@ class PolicyTransactionModel extends Model
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
AND pt_table.is_active = 1
|
||||
AND insurer_statements.is_active = 1
|
||||
AND insurer_statements.invoice_no IS NOT NULL
|
||||
AND insurer_statements.invoice_status IS NOT NULL
|
||||
$date_condition
|
||||
|
||||
),
|
||||
@ -467,7 +485,7 @@ class PolicyTransactionModel extends Model
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
AND pt_table.is_active = 1
|
||||
AND insurer_statements.is_active = 1
|
||||
AND insurer_statements.invoice_no IS NULL
|
||||
AND insurer_statements.invoice_status IS NULL
|
||||
$date_condition
|
||||
)
|
||||
),
|
||||
@ -476,7 +494,7 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
// ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
@ -501,19 +519,27 @@ class PolicyTransactionModel extends Model
|
||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||
|
||||
}else{
|
||||
|
||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
// ->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0){
|
||||
// if($date_type == 'statement_month' && $start_date != 0 && $end_date != 0){
|
||||
|
||||
$builder->where('policy_transaction.month >=', $startDate)
|
||||
->where('policy_transaction.month <=', $endDate);
|
||||
// $startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
// $endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
// $builder->where('policy_transaction.month >=', $startDate)
|
||||
// ->where('policy_transaction.month <=', $endDate);
|
||||
// }
|
||||
|
||||
// Conditionally join insurer_statements if $date_type == 'statement_month'
|
||||
if ($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
|
||||
$startDate = date('Y-m-d', strtotime($start_date));
|
||||
$endDate = date('Y-m-d', strtotime($end_date));
|
||||
|
||||
$builder->join('co_share_stmt_details', 'pt_co_share_details.id = co_share_stmt_details.co_share_id', 'left')
|
||||
->join('insurer_statements', 'co_share_stmt_details.statement_id = insurer_statements.id','left')
|
||||
->where('insurer_statements.is_active', 1)
|
||||
->where('insurer_statements.month >=', $startDate)
|
||||
->where('insurer_statements.month <=', $endDate)
|
||||
->groupBy('co_share_stmt_details.co_share_id');
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
@ -735,16 +761,55 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance,
|
||||
ROUND ( (pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt),2) as original_premium,
|
||||
ROUND(
|
||||
(
|
||||
SELECT
|
||||
(
|
||||
SUM(co_share_stmt_details.actual_bp_amt) + SUM(co_share_stmt_details.actual_tp_amt) + SUM(co_share_stmt_details.actual_tep_amt)
|
||||
) AS total_stmt_amt
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
),
|
||||
2
|
||||
) AS statement_premium,
|
||||
|
||||
COALESCE(
|
||||
(pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 0
|
||||
) -
|
||||
COALESCE(
|
||||
(
|
||||
SELECT
|
||||
SUM(co_share_stmt_details.actual_bp_amt) +
|
||||
SUM(co_share_stmt_details.actual_tp_amt) +
|
||||
SUM(co_share_stmt_details.actual_tep_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
JOIN
|
||||
insurer_statements
|
||||
ON
|
||||
co_share_stmt_details.statement_id = insurer_statements.id
|
||||
AND insurer_statements.is_active = 1
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
), 0
|
||||
) AS premium_variance_amt,
|
||||
|
||||
|
||||
ROUND(
|
||||
(
|
||||
SELECT
|
||||
(
|
||||
SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt)
|
||||
SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward)
|
||||
) AS total_irda_amt
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||
JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
@ -759,11 +824,11 @@ class PolicyTransactionModel extends Model
|
||||
(
|
||||
SUM(co_share_stmt_details.actual_bp_brokerage_amt) +
|
||||
SUM(co_share_stmt_details.actual_tp_brokerage_amt) +
|
||||
SUM(co_share_stmt_details.actual_tep_brokerage_amt)
|
||||
SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward)
|
||||
)
|
||||
FROM co_share_stmt_details
|
||||
JOIN insurer_statements
|
||||
ON co_share_stmt_details.statement_id = insurer_statements.id
|
||||
ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
@ -783,7 +848,18 @@ class PolicyTransactionModel extends Model
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('pt_co_share_details.is_active', 1)
|
||||
->having('variance_amt IS NOT NULL');
|
||||
// ->where('insurer_statements.is_active',1);
|
||||
// ->having('variance_amt IS NOT NULL')
|
||||
// ->having('variance_amt !=',0)
|
||||
// ->having('premium_variance_amt IS NOT NULL')
|
||||
// ->having('premium_variance_amt !=',0);
|
||||
|
||||
// ->group_start()
|
||||
->having('variance_amt IS NOT NULL')
|
||||
->orHaving('variance_amt !=', 0)
|
||||
->having('premium_variance_amt IS NOT NULL')
|
||||
->orHaving('premium_variance_amt !=', 0);
|
||||
// ->group_end();
|
||||
// ->where('pt_co_share_details.actual_bp_brokerage_amt IS NOT NULL AND pt_co_share_details.actual_bp_brokerage_amt != 0');
|
||||
// ->where('pt_co_share_details.variance IS NOT NULL')
|
||||
// ->where('pt_co_share_details.variance !=', 0);
|
||||
@ -1125,5 +1201,62 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
//function for fetch renewal report data
|
||||
public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer = null)
|
||||
{
|
||||
$fromDate = date('Y-m-d', strtotime('-60 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);
|
||||
}
|
||||
|
||||
$query = $this->db->table('policy_transaction pt')
|
||||
->select('
|
||||
pt.*,
|
||||
c.client_name,
|
||||
c.short_name AS client_short_name,
|
||||
c.client_type,
|
||||
policy_type.policy_type,
|
||||
i.name as insurer_name,
|
||||
ib.branch_name as insurer_branch_name,
|
||||
vehicle.vehicle_no,
|
||||
leads.status as lead_status
|
||||
')
|
||||
->join('clients c', 'pt.client_id = c.id', 'left')
|
||||
->join('pt_co_share_details pt_co', 'pt.id = pt_co.pt_id and pt_co.co_share_type = 1', 'left')
|
||||
->join('insurers i', 'pt_co.insurer_id = i.id', 'left')
|
||||
->join('insurer_branch ib', 'pt_co.insurer_branch_id = ib.id', 'left')
|
||||
->join('policy_type', 'pt.policy_type_id = policy_type.id', 'left')
|
||||
->join('vehicle', 'pt.vehicle_id = vehicle.id and vehicle.is_active = 1', 'left')
|
||||
->join('leads', 'pt.client_policy_id = leads.source_policy_id and leads.source_policy_id != 0 and leads.is_active = 1', 'left')
|
||||
->where('pt.policy_end_date >=', $fromDate)
|
||||
->where('pt.policy_end_date <=', $toDate)
|
||||
->where('pt.is_active', 1)
|
||||
->where('pt_co.is_active', 1)
|
||||
->where('pt.action_type', "inception");
|
||||
|
||||
// Apply filters if parameters are provided
|
||||
if (!empty($client_type)) {
|
||||
$query->where('c.client_type', $client_type);
|
||||
}
|
||||
if (!empty($client)) {
|
||||
$query->where('pt.client_id', $client);
|
||||
}
|
||||
if (!empty($issuer)) { // Corrected condition to check $issuer
|
||||
$query->where('pt.issuer', $issuer);
|
||||
}
|
||||
|
||||
$query->groupBy('pt.id');
|
||||
$query->orderBy('pt.id', 'DESC');
|
||||
// Fetch and return results
|
||||
$results = $query->get()->getResultArray();
|
||||
// print($this->db->getLastQuery()); die;
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ class PolicyTransactionStatusModel extends Model
|
||||
'created_at',
|
||||
'created_by',
|
||||
'is_active',
|
||||
'last_action_date',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -22,6 +22,6 @@ class PolicyTypeModel extends Model
|
||||
"etp",
|
||||
"iep",
|
||||
"itp",
|
||||
"question_json",
|
||||
"question_json",'itep','etep', 'policy_category',
|
||||
];
|
||||
}
|
||||
|
||||
51
app/Models/TicketClaimStatusModel.php
Normal file
51
app/Models/TicketClaimStatusModel.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketClaimStatusModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_claim_status';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ["id", "ticket_type", "claim_status", "created_by", "updated_by", "is_active"];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
50
app/Models/TicketHistoryModel.php
Normal file
50
app/Models/TicketHistoryModel.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketHistoryModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_history';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','field_name','display_name','old_value',
|
||||
'new_value','created_by','created_at','updated_by','updated_at','is_active'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
49
app/Models/TicketMailTemplateModel.php
Normal file
49
app/Models/TicketMailTemplateModel.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketMailTemplateModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_mail_template';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','template_name','subject','ticket_type','is_auto_mail','trigger_type','mail_content'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
650
app/Models/TicketMasterModel.php
Normal file
650
app/Models/TicketMasterModel.php
Normal file
@ -0,0 +1,650 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketMasterModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_master';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'ticket_type_id',
|
||||
'claim_status_id',
|
||||
'acm_id',
|
||||
'insurer_id',
|
||||
'tpa_id',
|
||||
'client_id',
|
||||
'priority',
|
||||
'policy_no',
|
||||
'emp_code',
|
||||
'tpa_no',
|
||||
'emp_name',
|
||||
'insured_name',
|
||||
'relationship',
|
||||
'emp_mobile',
|
||||
'emp_mail',
|
||||
'mode_of_intimation',
|
||||
'claim_type',
|
||||
'hospital_name',
|
||||
'doa',
|
||||
'dod',
|
||||
'claim_amount',
|
||||
'pod_no',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'date_of_join',
|
||||
'date_of_incep',
|
||||
'dob',
|
||||
'date_of_accident',
|
||||
'date_of_death',
|
||||
'date_of_intimat',
|
||||
'si_amt',
|
||||
'is_active',
|
||||
'claim_number',
|
||||
'emp_id',
|
||||
'insured_emp_id',
|
||||
];
|
||||
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTemplateDataByStatusID($claim_status_id)
|
||||
{
|
||||
|
||||
$template_data = $this->table('ticket_claim_status')
|
||||
->select('ticket_mail_template.*')
|
||||
->join('ticket_mail_template', 'ticket_mail_template.trigger_type = ticket_claim_status.trigger_type')
|
||||
->where('ticket_mail_template.is_active', 1)
|
||||
->where('ticket_claim_status.is_active', 1)
|
||||
->where('ticket_claim_status.id', $claim_status_id)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
public function getTemplateDataByTicketID($ticket_id)
|
||||
{
|
||||
$template_data = $this
|
||||
->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
|
||||
and ticket_claim_status.ticket_type = ticket_mail_template.ticket_type
|
||||
and ticket_mail_template.is_active = 1')
|
||||
->where('ticket_master.id', $ticket_id)
|
||||
->where('ticket_master.is_active', 1)
|
||||
->first();
|
||||
|
||||
return $template_data;
|
||||
}
|
||||
|
||||
public function getTicketDataByTicketID($ticket_id)
|
||||
{
|
||||
$ticket_data = $this->select("
|
||||
ticket_master.*,
|
||||
|
||||
user_profiles.first_name as acm,
|
||||
user_profiles.mobile as acm_mobile,
|
||||
user_profiles.email as acm_email,
|
||||
|
||||
clients.common_mails,
|
||||
clients.client_name,
|
||||
|
||||
insurers.name as insurer_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)
|
||||
->first();
|
||||
|
||||
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, ticket_type
|
||||
// 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) {
|
||||
|
||||
// $columnName = $status['claim_status']; // Default column name
|
||||
|
||||
// if (empty($ticket_type)) {
|
||||
// // Append the insurance type prefix based on `ticket_type`
|
||||
// switch ($status['ticket_type']) {
|
||||
// case 1:
|
||||
// $columnName = "GMC - {$status['claim_status']}";
|
||||
// break;
|
||||
// case 2:
|
||||
// $columnName = "GPA - {$status['claim_status']}";
|
||||
// break;
|
||||
// case 3:
|
||||
// $columnName = "EDLI - {$status['claim_status']}";
|
||||
// break;
|
||||
// case 4:
|
||||
// $columnName = "GTLI - {$status['claim_status']}";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $dynamicSelect .= "
|
||||
// COALESCE(
|
||||
// SUM(
|
||||
// CASE
|
||||
// WHEN subquery.status_id = {$status['id']} THEN 1
|
||||
// ELSE 0
|
||||
// END
|
||||
// ),
|
||||
// 0
|
||||
// ) AS `$columnName`, ";
|
||||
// }
|
||||
|
||||
// // 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
|
||||
// tm.id AS ticket_id,
|
||||
// tcs.claim_status,
|
||||
// tcs.id AS status_id,
|
||||
// CASE
|
||||
// WHEN DATEDIFF(
|
||||
// COALESCE(th.created_at, tm.created_at),
|
||||
// COALESCE(
|
||||
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||
// tm.created_at
|
||||
// )
|
||||
// ) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||
// WHEN DATEDIFF(
|
||||
// COALESCE(th.created_at, tm.created_at),
|
||||
// COALESCE(
|
||||
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||
// tm.created_at
|
||||
// )
|
||||
// ) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||
// WHEN DATEDIFF(
|
||||
// COALESCE(th.created_at, tm.created_at),
|
||||
// COALESCE(
|
||||
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||
// tm.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
|
||||
// WHERE
|
||||
// tm.ticket_type_id = 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();
|
||||
// // print_rr($this->db->getLastQuery(), $data); die;
|
||||
|
||||
// // $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;
|
||||
// }
|
||||
|
||||
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 = "WHERE tm.ticket_type_id = $ticket_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses from the `ticket_claim_status` table
|
||||
$statusQuery = " SELECT
|
||||
id, claim_status, ticket_type
|
||||
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) {
|
||||
|
||||
$columnName = $status['claim_status']; // Default column name
|
||||
|
||||
if (empty($ticket_type)) {
|
||||
// Append the insurance type prefix based on `ticket_type`
|
||||
switch ($status['ticket_type']) {
|
||||
case 1:
|
||||
$columnName = "GMC - {$status['claim_status']}";
|
||||
break;
|
||||
case 2:
|
||||
$columnName = "GPA - {$status['claim_status']}";
|
||||
break;
|
||||
case 3:
|
||||
$columnName = "EDLI - {$status['claim_status']}";
|
||||
break;
|
||||
case 4:
|
||||
$columnName = "GTLI - {$status['claim_status']}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$dynamicSelect .= "
|
||||
COALESCE(
|
||||
SUM(
|
||||
CASE
|
||||
WHEN subquery.status_id = {$status['id']} THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
),
|
||||
0
|
||||
) AS `$columnName`, ";
|
||||
}
|
||||
|
||||
// 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(
|
||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||
tm.created_at
|
||||
)
|
||||
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||
WHEN DATEDIFF(
|
||||
th.created_at,
|
||||
COALESCE(
|
||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||
tm.created_at
|
||||
)
|
||||
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||
WHEN DATEDIFF(
|
||||
th.created_at,
|
||||
COALESCE(
|
||||
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||
tm.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();
|
||||
// print_rr($this->db->getLastQuery(), $data); die;
|
||||
|
||||
// $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;
|
||||
}
|
||||
|
||||
public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
$dynamicClosedTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED','UNDER PROCESS - CLAIM NO. UPDATION',
|
||||
'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'RETURNED', 'REJECTED'])) {
|
||||
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
tpa.name AS TPA_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL,
|
||||
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
tpa ON master.tpa_id = tpa.id AND tpa.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
tpa.id;
|
||||
";
|
||||
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||
|
||||
if ($policy_type == 1) {
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
|
||||
// Include in total count
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
user_profiles.first_name AS ACM_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
user_profiles.id;
|
||||
";
|
||||
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
// dd($result);
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
}else{
|
||||
$ticket_type_data_1 = "";
|
||||
$ticket_type_data_2 = "";
|
||||
|
||||
if (!empty($policy_type)) {
|
||||
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||
}
|
||||
|
||||
// Fetch claim statuses dynamically
|
||||
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||
|
||||
// Initialize dynamic query parts
|
||||
$dynamicSelect = '';
|
||||
$dynamicTotal = '';
|
||||
$dynamicClosedTotal = '';
|
||||
|
||||
// Loop through each claim status and generate the CASE statements
|
||||
foreach ($statusResult as $status) {
|
||||
$dynamicSelect .= "
|
||||
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||
|
||||
if (in_array($status['claim_status'], ['CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING', 'INSURER PENDING','INVESTIGATION',
|
||||
'APPROVED','ON HOLD'])) {
|
||||
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
// Include in total count
|
||||
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
|
||||
// Include only closed-related statuses in total2 count
|
||||
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'NOT COVERED'])) {
|
||||
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the trailing commas and `+` signs
|
||||
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||
// print_rr($dynamicSelect);
|
||||
// Construct the final SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
user_profiles.first_name AS ACM_NAME,
|
||||
$dynamicSelect,
|
||||
($dynamicTotal) AS TOTAL,
|
||||
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||
FROM
|
||||
ticket_master master
|
||||
JOIN
|
||||
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||
WHERE
|
||||
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||
AND master.is_active = 1
|
||||
$ticket_type_data_2
|
||||
GROUP BY
|
||||
user_profiles.id;
|
||||
";
|
||||
|
||||
// Execute the query
|
||||
$result = $this->db->query($sql)->getResultArray();
|
||||
|
||||
// print_rr($result);die();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Models/TicketMessageModel.php
Normal file
50
app/Models/TicketMessageModel.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketMessageModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_messages';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','sender','ticket_id','claim_status','mail_subject','emp_mail','mail_content','created_at'];
|
||||
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
49
app/Models/TicketNoteModel.php
Normal file
49
app/Models/TicketNoteModel.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class TicketNoteModel extends Model
|
||||
{
|
||||
protected $table = 'ticket_notes';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $returnType = 'array';
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = ['id','ticket_id','note','is_auto_query','created_by','updated_by','is_active'];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
145
app/Views/bds_renewal_report_list.php
Normal file
145
app/Views/bds_renewal_report_list.php
Normal file
@ -0,0 +1,145 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Renewal Policy List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="column-header">S.No.</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Renewal Month</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Issuer</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Name</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Branch</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insured</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Client Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Business Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Date of Issue </div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Start Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Expiry Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Vehicle No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Lead Status</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($renewal_data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td><?php echo $index+1; ?></td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? ' - ' : date('M-Y', strtotime($row['policy_end_date'])); ?>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_no'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_branch_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['client_name'] ?? ' - ' ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['revenue_type'] ?? ' - ' ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo $row['vehicle_no'] ?? ' - ' ?></td>
|
||||
<td><?php echo ucfirst($row['lead_status'] ?? ' - ') ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
dom: "<'row'<'col-sm-2'f><'col-sm-10 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: 'Renewal-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Renewal-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 20, // Set default number of rows per page (optional)
|
||||
ordering: true,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
131
app/Views/bds_report_Insurer_wise_Data.php
Normal file
131
app/Views/bds_report_Insurer_wise_Data.php
Normal file
@ -0,0 +1,131 @@
|
||||
<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>Insurer</th>
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($insurer_wise_data as $data): ?>
|
||||
<tr>
|
||||
<td><?= $data['insurers'] ?></td>
|
||||
<td><?= $data['Policies'] ?></td>
|
||||
<td><?= $data['Premium'] ?></td>
|
||||
<td><?= $data['Revenue'] == 0.00 ? $data['Expected_amt'] : $data['Revenue']?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</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 totalPolicies = api.column(1).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalPremium = api.column(2).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalRevenue = api.column(3).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer with totals
|
||||
$(api.column(1).footer()).html(totalPolicies.toLocaleString());
|
||||
$(api.column(2).footer()).html("₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 }));
|
||||
$(api.column(3).footer()).html("₹ " + totalRevenue.toLocaleString(undefined, { minimumFractionDigits: 2 }));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
131
app/Views/bds_report_bap_wise_data.php
Normal file
131
app/Views/bds_report_bap_wise_data.php
Normal file
@ -0,0 +1,131 @@
|
||||
<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;">BAP Report List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($bap_wise_data as $data): ?>
|
||||
<tr>
|
||||
<td><?= $data['bap'] ?></td>
|
||||
<td><?= $data['Policies'] ?></td>
|
||||
<td><?= $data['Premium'] ?></td>
|
||||
<td><?= $data['Revenue']== 0.00 ? $data['Expected_amt'] : $data['Revenue']?></td>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</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: 'Bap-Wise-Report-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Bap-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 totalPolicies = api.column(1).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalPremium = api.column(2).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalRevenue = api.column(3).data().reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer with totals
|
||||
$(api.column(1).footer()).html(totalPolicies.toLocaleString());
|
||||
$(api.column(2).footer()).html("₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 }));
|
||||
$(api.column(3).footer()).html("₹ " + totalRevenue.toLocaleString(undefined, { minimumFractionDigits: 2 }));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
83
app/Views/chatbot.php
Normal file
83
app/Views/chatbot.php
Normal file
@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Insurance ChatBot</title>
|
||||
|
||||
</head>
|
||||
<style type="text/css">
|
||||
|
||||
</style>
|
||||
<body>
|
||||
<h1>Welcome to Insurance ChatBot </h1>
|
||||
|
||||
<script>
|
||||
// var botmanWidget = {
|
||||
// frameEndpoint: 'https://localhost/PHP828APPS/ruc/nhance/chat', // This should match your CI4 route
|
||||
// introMessage: "Hi! I am your Insurance Bot. How can I assist you today?",
|
||||
// placeholderText: "Type your message here...",
|
||||
// title: "Insurance Bot",
|
||||
// mainColor: "#5C6BC0",
|
||||
// bubbleBackground: "#673AB7"
|
||||
// };
|
||||
var uid = Math.floor(100000 + Math.random() * 900000);
|
||||
console.log('CURRENT_USER' + uid);
|
||||
var botmanWidget = {
|
||||
chatServer: `<?=base_url('chat')?>`, // Make sure this URL is correct
|
||||
frameEndpoint: `<?=base_url('widget')?>`, // This should match your CI4
|
||||
title: "Ask ILA",
|
||||
introMessage: "",
|
||||
bubbleBackground: "#007bff",
|
||||
mainColor: "#007bff",
|
||||
placeholderText: "Type your message here...",
|
||||
aboutText: "Insurance Assistant ILA",
|
||||
enableAttachments: false,
|
||||
// Add extra parameters
|
||||
parameters: {
|
||||
employee_id: '1234655', //PK of emp
|
||||
session_id: "XYZ789", // token
|
||||
origin: "mobile", // origin
|
||||
emp_code:"EMP001",
|
||||
client_id:10,
|
||||
client_branch_id:12
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Send a first load request when the chat widget opens
|
||||
// window.addEventListener("load", function () {
|
||||
// setTimeout(function () {
|
||||
// fetch("https://localhost/PHP828APPS/ruc/nhance/chat", {
|
||||
// method: "POST",
|
||||
// headers: { "Content-Type": "application/json" },
|
||||
// body: JSON.stringify({ first_load: "true", user_id: "12345" })
|
||||
// });
|
||||
// }, 2000); // Slight delay to ensure the widget is ready
|
||||
// });
|
||||
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
setTimeout(function () {
|
||||
if (window.botmanWidget) {
|
||||
botmanChatWidget.open();
|
||||
setTimeout(function(){
|
||||
botmanChatWidget.sayAsBot('Hi user '+ uid +' ,This is ILA your Insurance AI Assistant, plz choose the following options')
|
||||
botmanChatWidget.whisper('hi');
|
||||
},2000);
|
||||
|
||||
}
|
||||
}, 3000); // Delay to ensure widget is initialized
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!-- <script src="https://cdn.jsdelivr.net/npm/botman-web-widget@latest"></script> -->
|
||||
<!-- <script id="botmanWidget" src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/chat.js'></script> -->
|
||||
|
||||
<!-- <script src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script> -->
|
||||
<script src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
103
app/Views/claims_report_acc_manager_wise.php
Normal file
103
app/Views/claims_report_acc_manager_wise.php
Normal file
@ -0,0 +1,103 @@
|
||||
<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;">Account Manger Claim Status List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<?php if ($policy_type != 1) {?>
|
||||
<tr>
|
||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||
<th style="text-align: center;" colspan="5" >CLEARED</th>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($account_manager_wise_data as $row): ?>
|
||||
<tr>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<td><?= $row[$col_name] ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<?php
|
||||
$totals = array_fill_keys($column_order, 0);
|
||||
foreach ($account_manager_wise_data as $row) {
|
||||
foreach ($column_order as $col_name) {
|
||||
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($column_order as $col_name) {
|
||||
if ($col_name !== 'ACM_NAME') {
|
||||
echo "<th>{$totals[$col_name]}</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>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
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,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
101
app/Views/claims_report_tpa_wise.php
Normal file
101
app/Views/claims_report_tpa_wise.php
Normal 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">
|
||||
<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;">TPA Claim Status 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>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($tpa_wise_data as $row): ?>
|
||||
<tr>
|
||||
<?php foreach ($column_order as $col_name): ?>
|
||||
<td><?= $row[$col_name] ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Grand Total</th>
|
||||
<?php
|
||||
$totals = array_fill_keys($column_order, 0);
|
||||
foreach ($tpa_wise_data as $row) {
|
||||
foreach ($column_order as $col_name) {
|
||||
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($column_order as $col_name) {
|
||||
if ($col_name !== 'TPA_NAME') {
|
||||
echo "<th>{$totals[$col_name]}</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>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
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,
|
||||
pageLength: 10,
|
||||
ordering: false
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -175,14 +175,14 @@
|
||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="is_member_modify_allowed" type="checkbox" name="is_member_modify_allowed" checked>
|
||||
<input id="is_lgbtq" type="checkbox" name="is_lgbtq">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="is_member_modify_allowed" style="position: relative;bottom: 5px;left: 85px;"> In Enrollment Member Data Modification Allowed</label>
|
||||
</div> -->
|
||||
<label for="is_lgbtq" style="position: relative;bottom: 5px;left: 85px;"> Is LGBTQ Enable</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
@ -755,7 +755,7 @@
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('client_policy_res', res);
|
||||
console.log('client_policy_res by btnPolicyEdit', res);
|
||||
|
||||
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
||||
|
||||
@ -825,6 +825,13 @@
|
||||
$('#policy_visibility').prop('checked', false);
|
||||
}
|
||||
|
||||
if (res.data.is_lgbtq == 1) {
|
||||
$('#is_lgbtq').prop('checked', true);
|
||||
} else {
|
||||
$('#is_lgbtq').prop('checked', false);
|
||||
}
|
||||
|
||||
|
||||
// Member Modify Data Enable or Disable
|
||||
// if (res.data.is_member_modify_allowed == 1) {
|
||||
// $('#is_member_modify_allowed').prop('checked', true);
|
||||
@ -937,7 +944,7 @@
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number
|
||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||
}, 2000)
|
||||
|
||||
@ -1653,7 +1660,7 @@
|
||||
text: item.cd_ac_no
|
||||
});
|
||||
|
||||
if (select === item.cd_ac_no) {
|
||||
if (select === item.id) {
|
||||
//console.log('selected');
|
||||
option.attr('selected', true);
|
||||
}
|
||||
@ -1886,6 +1893,19 @@
|
||||
$('#policy_visibility').prop('checked', false);
|
||||
}
|
||||
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||
|
||||
console.log(res.data.is_lgbtq)
|
||||
|
||||
if (res.data.is_lgbtq == 1) {
|
||||
$('#is_lgbtq').prop('checked', true);
|
||||
} else {
|
||||
$('#is_lgbtq').prop('checked', false);
|
||||
}
|
||||
|
||||
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
|
||||
|
||||
|
||||
|
||||
if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') {
|
||||
|
||||
@ -1970,7 +1990,7 @@
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number
|
||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||
}, 2000)
|
||||
|
||||
|
||||
@ -147,13 +147,12 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
|
||||
<?php
|
||||
if (
|
||||
(in_array($employee['emp_status'], ['draft', 'enrolled']) && in_array($employee['status'], ['draft', 'enrolled'])) ||
|
||||
($employee['status'] == 'active' && $employee['emp_status'] == 'active' && (empty($employee['email_corporate']) || empty($employee['mobile'])))
|
||||
) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
if
|
||||
(
|
||||
(in_array($employee['emp_status'], ['draft', 'enrolled', 'active']) && in_array($employee['status'], ['draft', 'enrolled', 'active']))
|
||||
) {
|
||||
?>
|
||||
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<?php } ?>
|
||||
|
||||
@ -161,7 +160,7 @@
|
||||
<a href="<?= base_url('download-e-card/'). $employee['rand_string'] ?>" class="dropdown-item" target="_blank"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View E-Card</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||
<?php if($employee['relationship'] == 'Self' && in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@ -135,8 +135,9 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
|
||||
<?php include('employee_data_list.php');?>
|
||||
<?php // include('employee_data_list.php');?>
|
||||
|
||||
<div id="employee_table_list"></div>
|
||||
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
@ -502,24 +503,29 @@ function fetchEmpolyeeList(event) {
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
// console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
// window.location.href = apiURL;
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
// console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// data: queryParams,
|
||||
// success: function(response) {
|
||||
// // Assuming response is a JSON array
|
||||
// // displayDataTables(response);
|
||||
// console.log(response);
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error('Error:', error);
|
||||
// }
|
||||
// });
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
data: queryParams,
|
||||
success: function(response) {
|
||||
if(response.status == true){
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('#employee_table_list').html(response.html);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', error);
|
||||
toastr.error('Failed to fetch Data','Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -1,70 +1,31 @@
|
||||
<style>
|
||||
custom-dropdown-menu {
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="row" id="insurer_list">
|
||||
<div class="col-12">
|
||||
|
||||
@ -108,75 +108,32 @@ table.dataTable tbody td {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
custom-dropdown-menu {
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
@ -184,13 +141,38 @@ custom-dropdown-menu {
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<div class="col-9" style="align-self: center;">
|
||||
<h4 style="position: relative;">Insurer Statement List</h4>
|
||||
<!-- <div id="statusSwitchWrapper" class="dt-switch-wrapper">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="statusSwitch">
|
||||
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="col-4">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="failedSwitch">
|
||||
<label class="custom-control-label" for="failedSwitch">Failed</label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
|
||||
<div class="col-3" style="text-align: right;">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-8">
|
||||
<div id="statusSwitchWrapper" class="dt-switch-wrapper">
|
||||
<div class="custom-control custom-switch" style="text-align: left;">
|
||||
<input type="checkbox" class="custom-control-input" id="statusSwitch">
|
||||
<label class="custom-control-label" for="statusSwitch">Failed Status</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><div class="dataTables_length d-flex align-items-center">
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
@ -399,7 +381,7 @@ custom-dropdown-menu {
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoice_value_modal">Invoice value<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="invoice_value_modal" name="invoice_value" placeholder="Enter Invoice Value" readonly>
|
||||
<input type="number" class="form-control" id="invoice_value_modal" name="invoice_value" placeholder="Enter Invoice Value" readonly step="0.01">
|
||||
</div>
|
||||
|
||||
|
||||
@ -431,7 +413,7 @@ custom-dropdown-menu {
|
||||
<div class="row" id="modal_received_amt_div">
|
||||
<div class="form-group col-md-4" >
|
||||
<label for="addon_policy">Total Received Amount</label>
|
||||
<input type="number" class="form-control" id="modal_received_amt" placeholder="" disabled>
|
||||
<input type="number" class="form-control" id="modal_received_amt" placeholder="" disabled step="0.01">
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
@ -458,7 +440,7 @@ custom-dropdown-menu {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required step="0.01" onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" required step="0.01" onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
@ -676,7 +658,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// alert($('#invoice_date_modal').val());
|
||||
if((!form.checkValidity()))
|
||||
{
|
||||
// console.log('error2');
|
||||
console.log('error2');
|
||||
console.log(form.checkValidity());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -710,7 +693,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
var jsonData = JSON.stringify(formDataJSON);
|
||||
console.log(jsonData);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
// Send the JSON data to the backend using AJAX
|
||||
$.ajax({
|
||||
url: 'saveInvoicePaymentDetails', // Replace with your backend URL
|
||||
@ -748,7 +731,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
newRow.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter GST" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
@ -891,7 +874,7 @@ function showInvoiceStatusModal(event)
|
||||
var row = paymentTableBody.insertRow();
|
||||
row.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="gst_amount[]" placeholder="Enter Amount" value="${payment.gst}" onchange="checkInvAmont(event)" required step="0.01"></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
|
||||
@ -1342,6 +1325,146 @@ function deleteStatement(id)
|
||||
});
|
||||
|
||||
}
|
||||
// $(document).ready(function() {
|
||||
// $('#failedSwitch').change(function() {
|
||||
// if ($(this).prop('checked')) {
|
||||
// getFailedStatementList();
|
||||
// } else {
|
||||
// console.log("Inside Reload Function");
|
||||
// fetch(window.location.href) // Fetch the current page's content
|
||||
// .then(response => response.text())
|
||||
// .then(html => {
|
||||
// const parser = new DOMParser();
|
||||
// const doc = parser.parseFromString(html, 'text/html');
|
||||
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(100).fadeOut('slow');
|
||||
// })
|
||||
// .catch(error => console.error('Error reloading body:', error));
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
// function checkSwitchStatus(){
|
||||
// $('#failedSwitch').change(function() {
|
||||
// if ($(this).prop('checked')) {
|
||||
// getFailedStatementList();
|
||||
// } else {
|
||||
// console.log("Inside Reload Function");
|
||||
// fetch(window.location.href) // Fetch the current page's content
|
||||
// .then(response => response.text())
|
||||
// .then(html => {
|
||||
// const parser = new DOMParser();
|
||||
// const doc = parser.parseFromString(html, 'text/html');
|
||||
// document.body.innerHTML = doc.body.innerHTML; // Replace the body content
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(250).fadeOut('slow');
|
||||
// })
|
||||
// .catch(error => console.error('Error reloading body:', error));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
// function getFailedStatementList(){
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
// $.ajax({
|
||||
// url:'<?= base_url("policy_tranction/statement/failedStatement")?>',
|
||||
// type:'POST',
|
||||
// success:function(response){
|
||||
// console.log(response);
|
||||
// var table = $('#tickets-table').DataTable();
|
||||
// table.clear();
|
||||
// $('#tickets-table').addClass('table-fixed');
|
||||
// var failedList = response.data.insurer_statement_list;
|
||||
// console.log('failed list'+failedList);
|
||||
// failedList.forEach(function(row) {
|
||||
// var newRow = [
|
||||
// '<input type="hidden" class="row-select" data-id="' + row.id + '">',
|
||||
// row.short_name + '-' + row.branch_code,
|
||||
// formatDate(row.month),
|
||||
// row.stmt_sno,
|
||||
// row.file_name,
|
||||
// row.line_items,
|
||||
// row.file_status +
|
||||
// (row.file_status == 'failed' ? ' <span class="col-xl-3 col-lg-4 col-sm-6"><i class="fe-alert-circle" data-toggle="modal" data-target="#file-err-modal" data-err="' + row.id + '"></i></span>' : ''),
|
||||
// (row.invoice_status ? row.invoice_status : ' - ') +
|
||||
// (row.file_status == 'success' ? ' <span class="col-xl-3 col-lg-4 col-sm-6"><i class="fe-alert-circle" data-toggle="tooltip" title="Invoice Amt: ' + (row.invoice_amount || '0.00') + ' Received Amt: ' + (row.received_inv_amt || '0.00') + '"></i></span>' : ''),
|
||||
// formatDate(row.created_at) + ' by <br>' + row.first_name,
|
||||
// (row.file_status != 'failed' ?
|
||||
// '<div class="btn-group dropdown">' +
|
||||
// '<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>' +
|
||||
// '<div class="dropdown-menu dropdown-menu-right">' +
|
||||
// '<a class="dropdown-item btnEdit" data-id="' + row.id + '" data-exp-amt="' + row.exp_inv_amt + '" data-received-amt="' + row.received_inv_amt + '" onclick="showInvoiceStatusModal(event)">' +
|
||||
// '<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Invoice status' +
|
||||
// '</a>' +
|
||||
// '<a class="dropdown-item btnEdit" data-id="' + row.id + '" onclick="deleteStatement(' + row.id + ')">' +
|
||||
// '<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete' +
|
||||
// '</a>' +
|
||||
// '</div>' +
|
||||
// '</div>' : '...')
|
||||
// ];
|
||||
|
||||
// // Append the new row to the table body
|
||||
// table.row.add(newRow);
|
||||
// });
|
||||
// table.draw();
|
||||
// table.columns.adjust().draw(); // Ensures correct alignment
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(250).fadeOut('slow');
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// let message = 'Failed to load Data ';
|
||||
// toastr.error(response.message, 'Failed');
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(250).fadeOut('slow');
|
||||
// }
|
||||
|
||||
// })
|
||||
// }
|
||||
// $(document).ready(function() {
|
||||
// var table = $('#tickets-table').DataTable({
|
||||
// // responsive: true, // Ensures table adjusts to smaller screens
|
||||
// stateSave: true, // Saves the table's state
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Add custom filter function to DataTables
|
||||
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
|
||||
const showFailedStatus = $('#statusSwitch').is(':checked');
|
||||
const status = data[6].toLowerCase().trim(); // Index 6 is the file_status column
|
||||
|
||||
if (showFailedStatus) {
|
||||
return status.includes('failed');
|
||||
} else {
|
||||
return status.includes('success');
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize DataTable
|
||||
const table = $('#tickets-table').DataTable({
|
||||
// Your existing DataTable options here
|
||||
"order": [], // Disable initial sorting if needed
|
||||
"pageLength": 10,
|
||||
// "dom": '<"top"lf>rt<"bottom"ip><"clear">', // This places length and filter controls at top
|
||||
"language": {
|
||||
"lengthMenu": "Show _MENU_ entries",
|
||||
"search": "Search:"
|
||||
}
|
||||
});
|
||||
|
||||
// Add event listener for switch changes
|
||||
$('#statusSwitch').on('change', function() {
|
||||
table.draw(); // Redraw the table to apply the filter
|
||||
});
|
||||
|
||||
// Trigger initial filter to show only success status
|
||||
table.draw();
|
||||
});
|
||||
</script>
|
||||
158
app/Views/irba_report.php
Normal file
158
app/Views/irba_report.php
Normal file
@ -0,0 +1,158 @@
|
||||
<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>
|
||||
<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>Category<span class="text-danger"> *</span></label> <br />
|
||||
<select name="category" class="form-control" id="category" required>
|
||||
<option value="">Select</option>
|
||||
<?php foreach ($categories as $category => $key) : ?>
|
||||
<option value="<?= $key ?>"><?= $category ?></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="<?= $key ?>"><?= $reports ?></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>
|
||||
$('#category').on('click', function(){
|
||||
|
||||
var choosed_option = $('#category').val();
|
||||
$("#report_type").val('0');
|
||||
if (choosed_option == 'life' ){
|
||||
$("#report_type option[value='insurer']").show();
|
||||
$("#report_type option[value='bap']").hide();
|
||||
$("#report_type option[value='bapClient']").hide();
|
||||
$("#report_type option[value='bapInsurer']").hide();
|
||||
$("#report_type option[value='client']").show();
|
||||
|
||||
} else if (choosed_option == 'nonLife') {
|
||||
$("#report_type option[value='insurer']").show();
|
||||
$("#report_type option[value='bap']").show();
|
||||
$("#report_type option[value='bapClient']").show();
|
||||
$("#report_type option[value='bapInsurer']").show();
|
||||
$("#report_type option[value='client']").hide();
|
||||
}
|
||||
})
|
||||
|
||||
function fetchReportPage() {
|
||||
|
||||
var fromDate = $('#startDate').val();
|
||||
var toDate = $('#endDate').val();
|
||||
var category = $('#category').val();
|
||||
var report_type = $('#report_type').val();
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
category: category,
|
||||
report_type: report_type
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
var url = '<?= base_url('/bdsReport/irba_report') ?>';
|
||||
$('.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>
|
||||
286
app/Views/irda_bap_client_report_list.php
Normal file
286
app/Views/irda_bap_client_report_list.php
Normal file
@ -0,0 +1,286 @@
|
||||
<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;
|
||||
}
|
||||
|
||||
.right-align-input:nth-child(4n+1),
|
||||
.right-align-input:nth-child(4n+2) {
|
||||
background-color: #f9f9f9; /* Light gray shade */
|
||||
}
|
||||
|
||||
.right-align-input:nth-child(4n+3),
|
||||
.right-align-input:nth-child(4n+4) {
|
||||
background-color: #ffffff; /* White shade */
|
||||
}
|
||||
|
||||
</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;">BAP Client Report </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
|
||||
<thead class="bg-light">
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th colspan="2" style="text-align: center;">Engineering</th>
|
||||
<th colspan="2" style="text-align: center;">Fire</th>
|
||||
<th colspan="2" style="text-align: center;">Health</th>
|
||||
<th colspan="2" style="text-align: center;">Liability</th>
|
||||
<th colspan="2" style="text-align: center;">Life</th>
|
||||
<th colspan="2" style="text-align: center;">Marine Cargo</th>
|
||||
<th colspan="2" style="text-align: center;">Misc</th>
|
||||
<th colspan="2" style="text-align: center;">Marine Hull</th>
|
||||
<th colspan="2" style="text-align: center;">Motor</th>
|
||||
<th colspan="2" style="text-align: center;">Grand Total</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>Insured</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if (isset($data) && !empty($data)) { ?>
|
||||
|
||||
<?php foreach($data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td class="right-align-input"><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['engineering_policy_count']; ?> </td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['fire_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['health_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['liability_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['life_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['misc_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['motor_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Grand Total</th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<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: 'IRDA-BAP-CLIENT-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'IRDA-BAP-CLIENT-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 20, // 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;
|
||||
};
|
||||
|
||||
// Define column groups for total calculations
|
||||
var columnGroups = [
|
||||
{ policy: 2, premium: 3 },
|
||||
{ policy: 4, premium: 5},
|
||||
{ policy: 6, premium: 7 },
|
||||
{ policy: 8, premium: 9 },
|
||||
{ policy: 10, premium: 11 },
|
||||
{ policy: 12, premium: 13 },
|
||||
{ policy: 14, premium: 15 },
|
||||
{ policy: 16, premium: 17 },
|
||||
{ policy: 18, premium: 19 },
|
||||
{ policy: 20, premium: 21 }
|
||||
];
|
||||
|
||||
// Loop through each column group to calculate totals and update the footer
|
||||
columnGroups.forEach(function(group) {
|
||||
var totalPolicies = api
|
||||
.column(group.policy)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalPremium = api
|
||||
.column(group.premium)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer
|
||||
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
|
||||
$(api.column(group.premium).footer()).html(
|
||||
"₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
368
app/Views/irda_bap_insurer_report_list.php
Normal file
368
app/Views/irda_bap_insurer_report_list.php
Normal file
@ -0,0 +1,368 @@
|
||||
<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;">BAP Insurer Report </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th colspan="3" style="text-align: center;">Engineering</th>
|
||||
<th colspan="3" style="text-align: center;">Fire</th>
|
||||
<th colspan="3" style="text-align: center;">Health</th>
|
||||
<th colspan="3" style="text-align: center;">Liability</th>
|
||||
<th colspan="3" style="text-align: center;">Life</th>
|
||||
<th colspan="3" style="text-align: center;">Marine Cargo</th>
|
||||
<th colspan="3" style="text-align: center;">Misc</th>
|
||||
<th colspan="3" style="text-align: center;">Marine Hull</th>
|
||||
<th colspan="3" style="text-align: center;">Motor</th>
|
||||
<th colspan="3" style="text-align: center;">Grand Total</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>Insurer</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
<th>Revenue</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if (isset($data) && !empty($data)) { ?>
|
||||
|
||||
<?php foreach($data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td class="right-align-input"><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['engineering_policy_count']; ?> </td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['engineering_revenue']== 0.00 ? $row['engineering_exp_amt'] : $row['engineering_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['fire_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['fire_revenue']== 0.00 ? $row['fire_exp_amt'] : $row['fire_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['health_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['health_revenue']== 0.00 ? $row['health_exp_amt'] : $row['health_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['liability_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['liability_revenue']== 0.00 ? $row['liability_exp_amt'] : $row['liability_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['life_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['life_revenue']== 0.00 ? $row['life_exp_amt'] : $row['life_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargo_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_cargoe_revenue']== 0.00 ? $row['marine_cargo_exp_amt'] : $row['marine_cargoe_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['marine_hull_revenue']== 0.00 ? $row['marine_hull_exp_amt'] : $row['marine_hull_revenue'];?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['misc_policy_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['misc_revenue']== 0.00 ? $row['misc_exp_amt'] : $row['misc_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['motor_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['motor_revenue']== 0.00 ? $row['motor_exp_amt'] : $row['motor_revenue']; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
|
||||
<?php
|
||||
$total_revenue = 0; // Initialize total revenue
|
||||
|
||||
// Calculate total revenue by summing all individual revenues
|
||||
$total_revenue += $row['engineering_revenue']== 0.00 ? $row['engineering_exp_amt'] : $row['engineering_revenue'];
|
||||
$total_revenue += $row['fire_revenue']== 0.00 ? $row['fire_exp_amt'] : $row['fire_revenue'];
|
||||
$total_revenue += $row['health_revenue']== 0.00 ? $row['health_exp_amt'] : $row['health_revenue'];
|
||||
$total_revenue += $row['liability_revenue']== 0.00 ? $row['liability_exp_amt'] : $row['liability_revenue'];
|
||||
$total_revenue += $row['life_revenue']== 0.00 ? $row['life_exp_amt'] : $row['life_revenue'];
|
||||
$total_revenue += $row['marine_cargoe_revenue']== 0.00 ? $row['marine_cargo_exp_amt'] : $row['marine_cargoe_revenue'];
|
||||
$total_revenue += $row['marine_hull_revenue']== 0.00 ? $row['marine_hull_exp_amt'] : $row['marine_hull_revenue'];
|
||||
$total_revenue += $row['misc_revenue']== 0.00 ? $row['misc_exp_amt'] : $row['misc_revenue'];
|
||||
$total_revenue += $row['motor_revenue']== 0.00 ? $row['motor_exp_amt'] : $row['motor_revenue'];
|
||||
?>
|
||||
|
||||
<td class="right-align-input"><?php echo round($total_revenue, 2); ?></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Grand Total</th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
<th class="right-align-input"></th>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
</table>
|
||||
|
||||
<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: 'IRDA-BAP-INSURER-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'IRDA-BAP-INSURER-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
},
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
customizeData: function(data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// Check if the column is the 9th index (10th column)
|
||||
if (j === 9) {
|
||||
data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 20, // 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;
|
||||
};
|
||||
|
||||
// Define column groups for total calculations
|
||||
var columnGroups = [
|
||||
{ policy: 2, premium: 3, revenue: 4 },
|
||||
{ policy: 5, premium: 6, revenue: 7 },
|
||||
{ policy: 8, premium: 9, revenue: 10 },
|
||||
{ policy: 11, premium: 12, revenue: 13 },
|
||||
{ policy: 14, premium: 15, revenue: 16 },
|
||||
{ policy: 17, premium: 18, revenue: 19 },
|
||||
{ policy: 20, premium: 21, revenue: 22 },
|
||||
{ policy: 23, premium: 24, revenue: 25 },
|
||||
{ policy: 26, premium: 27, revenue: 28 },
|
||||
{ policy: 29, premium: 30, revenue: 31 }
|
||||
];
|
||||
|
||||
// Loop through each column group to calculate totals and update the footer
|
||||
columnGroups.forEach(function(group) {
|
||||
var totalPolicies = api
|
||||
.column(group.policy)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalPremium = api
|
||||
.column(group.premium)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
var totalRevenue = api
|
||||
.column(group.revenue)
|
||||
.data()
|
||||
.reduce(function(a, b) {
|
||||
return parseNumber(a) + parseNumber(b);
|
||||
}, 0);
|
||||
|
||||
// Update the footer
|
||||
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
|
||||
$(api.column(group.premium).footer()).html(
|
||||
"₹ " + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||
);
|
||||
$(api.column(group.revenue).footer()).html(
|
||||
"₹ " + totalRevenue.toLocaleString(undefined, { minimumFractionDigits: 2 })
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
148
app/Views/irda_client_report_list.php
Normal file
148
app/Views/irda_client_report_list.php
Normal file
@ -0,0 +1,148 @@
|
||||
<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;">Client Report </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>Insured</th>
|
||||
<th>Policies</th>
|
||||
<th>Premium</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($data) && !empty($data)) { ?>
|
||||
|
||||
<?php foreach($data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td ><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td ><?php echo $row['policy_count']; ?> </td>
|
||||
<td ><?php echo $row['premium']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</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: 'IRDA-BAP-CLIENT-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'IRDA-BAP-CLIENT-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
},
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
customizeData: function(data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// Check if the column is the 9th index (10th column)
|
||||
if (j === 9) {
|
||||
data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
],
|
||||
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>
|
||||
@ -1,70 +1,31 @@
|
||||
<style>
|
||||
custom-dropdown-menu {
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="row" id="kyc_list">
|
||||
<div class="col-12">
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
|
||||
</div> <!-- content -->
|
||||
|
||||
<?php include(__DIR__ . '/../ticket_type_modal.php'); ?>
|
||||
|
||||
|
||||
<!-- Footer Start -->
|
||||
<footer class="footer">
|
||||
<div class="container-fluid">
|
||||
@ -927,4 +930,5 @@ function confirmActionSweertAlert(message = "Are you sure?", confirmText = "Yes,
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
||||
|
||||
<link rel="manifest" href="../manifest.json">
|
||||
|
||||
@ -75,14 +75,15 @@
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
<!-- srinivas -->
|
||||
<script src="https://editor.unlayer.com/embed.js"></script>
|
||||
<!-- <script src="<?= base_url('public/unlayer/js/embed.js') . '' ?>"></script> -->
|
||||
<!-- srinivas -->
|
||||
<style>
|
||||
|
||||
|
||||
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
|
||||
min-height: 0;
|
||||
}
|
||||
@ -588,7 +589,7 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
<?php if (get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
@ -624,7 +625,7 @@
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!--
|
||||
<li>
|
||||
<?php
|
||||
$sessionData = get_session_userdata();
|
||||
@ -632,12 +633,36 @@
|
||||
$parsedUrl = parse_url($currentUrl);
|
||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||
$hashedEmail = hash('sha256', $sessionData->email);
|
||||
$redirectUrl = getenv('helpdeskURL') .'/staff/login?' . http_build_query(['token' => $hashedEmail]);
|
||||
$redirectUrl = getenv('helpdeskURL') . '/staff/login?' . http_build_query(['token' => $hashedEmail]);
|
||||
?>
|
||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
<span> Tickets </span>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboardsTicket" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Claims </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboardsTicket">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#" onclick="openTicketTypeAskModal()">New claim</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/ticket/list') ?>">Claim List</a>
|
||||
</li>
|
||||
<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>
|
||||
|
||||
<li>
|
||||
@ -649,7 +674,7 @@
|
||||
<div class="collapse" id="sidebarDashboardsmenu">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/add_image_index') ?>"> Advertisement Images </a>
|
||||
<a href="<?= base_url('/add_image_index') ?>"> Advertisement Images </a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/frontend_content') ?>">Front-end Content</a>
|
||||
@ -666,82 +691,128 @@
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<?php if ((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Policy Transactions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
|
||||
</li>
|
||||
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-format-list-bulleted"></i>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
<span>Policy Transactions</span>
|
||||
</a>
|
||||
<div class="collapse" id="policyTransactions">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
<a href="#policyReports" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-file-chart-fill"></i>
|
||||
<span> Policy Reports </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="mdi mdi-timer-sand"></i>
|
||||
<span> Policy Pending Actions </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">Documents</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- End Sidebar -->
|
||||
|
||||
<li>
|
||||
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="policyReports">
|
||||
<ul class="nav-third-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Sidebar -left -->
|
||||
</li>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Left Sidebar End -->
|
||||
<!-- End Sidebar -->
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start Page Content here -->
|
||||
<!-- ============================================================== -->
|
||||
</div>
|
||||
<!-- Sidebar -left -->
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
</div>
|
||||
<!-- Left Sidebar End -->
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start Page Content here -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
@ -37,72 +37,33 @@ table.dataTable tbody td {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
custom-dropdown-menu {
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
2009
app/Views/notification old.php
Normal file
2009
app/Views/notification old.php
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -105,6 +105,68 @@ custom-dropdown-menu {
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="endorsement_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
@ -257,7 +319,7 @@ custom-dropdown-menu {
|
||||
<th>Data Recived Date</th>
|
||||
<th>No of Insured</th>
|
||||
<th>No of Dependence</th>
|
||||
<th>Closure Date</th>
|
||||
<th>Policy Issue Date</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -276,7 +338,7 @@ custom-dropdown-menu {
|
||||
<td><?php echo empty($row['data_received_date']) ? '' : date('d/m/Y', strtotime($row['data_received_date'])); ?></td>
|
||||
<td class="right-align-input"><?php echo $row['emp_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
|
||||
<td><?php echo empty($row['closure_date']) ? '' : date('d/m/Y', strtotime($row['closure_date'])); ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?></td>
|
||||
<td><?php echo $policy_status[$row['status']]; ?></td>
|
||||
|
||||
<td>
|
||||
@ -478,8 +540,20 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
}
|
||||
});
|
||||
|
||||
var last_action_date = flatpickr("#last_action_date", {
|
||||
dateFormat: "d/m/Y", // Display format in DD/MM/YYYY
|
||||
defaultDate: today, // Today's date as the default value
|
||||
allowInput: false,
|
||||
maxDate: today // Disallow future dates
|
||||
});
|
||||
|
||||
var closure_date = flatpickr("#closure_date", {
|
||||
|
||||
var closure_date = flatpickr("#policy_issue_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var install_due_date = flatpickr("#install_due_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -45,73 +45,32 @@ table.dataTable tbody td {
|
||||
.addbtnStyle{
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
custom-dropdown-menu {
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
@ -232,7 +191,7 @@ custom-dropdown-menu {
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer_for_search" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<option value="0">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
@ -320,7 +279,7 @@ custom-dropdown-menu {
|
||||
<tr>
|
||||
<th><div class="column-header">S.No.</div></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Issuing Type</div></th>
|
||||
<th><div class="column-header">Business Type</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
<th><div class="column-header">Client / Branch</div></th>
|
||||
<th><div class="column-header">Insurer</div></th>
|
||||
@ -1286,11 +1245,17 @@ $('#issue_type').change(function(){
|
||||
|
||||
if(value == 1){
|
||||
$('#revenue_type').val('NA');
|
||||
$('#revenue_type option[value="NA"]').show();
|
||||
$('#revenue_type option[value="EANR"]').show();
|
||||
$('#revenue_type option[value="EA"]').hide();
|
||||
}
|
||||
|
||||
if(value == 2){
|
||||
$('#revenue_type').val('EA')
|
||||
$('#renewal').show()
|
||||
$('#revenue_type option[value="EA"]').show();
|
||||
$('#revenue_type option[value="NA"]').hide();
|
||||
$('#revenue_type option[value="EANR"]').hide();
|
||||
// $('.sded_dates').show()
|
||||
// $('#source_client_policy_id').attr('required', true)
|
||||
}else{
|
||||
@ -1299,6 +1264,12 @@ $('#issue_type').change(function(){
|
||||
// $('#source_client_policy_id').attr('required', false)
|
||||
$('#policy_start_date').val('');
|
||||
$('#policy_end_date').val('');
|
||||
$('#revenue_type').val('');
|
||||
$('#revenue_type option[value="EA"]').hide();
|
||||
$('#revenue_type option[value="NA"]').show();
|
||||
$('#revenue_type option[value="EANR"]').show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(value == 3){
|
||||
|
||||
@ -15,10 +15,9 @@
|
||||
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_name">Policy Type Long Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="kyc_name">Policy Type Long Name</label>
|
||||
<input type="text" class="form-control" id="long_name"
|
||||
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name" required>
|
||||
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bap">BAP<span
|
||||
@ -38,6 +37,37 @@
|
||||
<input type="text" class="form-control" id="alloci"
|
||||
placeholder="Enter Alloci" value="<?= isset($policytype['alloci']) ? $policytype['alloci'] : '' ?>" name="alloci" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="ebp">Group Base Premium<span class="text-muted"> (STD %)</span></label>
|
||||
<input type="number" class="form-control" id="ebp"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['ebp']) ? $policytype['ebp'] : '' ?>" name="ebp">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="etp">Group Third Party Premium<span
|
||||
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etp"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etp']) ? $policytype['etp'] : '' ?>" name="etp">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="etep">Group Terrorism Premium<span
|
||||
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="etep"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['etep']) ? $policytype['etep'] : '' ?>" name="etep">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="iep">Individual Base Premium<span
|
||||
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="iep"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['iep']) ? $policytype['iep'] : '' ?>" name="iep">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="itp">Individual Third-Party Premium<span
|
||||
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itp"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itp']) ? $policytype['itp'] : '' ?>" name="itp">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="itep">Individual Terrorism Premium<span
|
||||
class="text-muted"> (STD %)</span></label> <input type="number" class="form-control" id="itep"
|
||||
placeholder="Enter Group Base Premium" value="<?= isset($policytype['itep']) ? $policytype['itep'] : '' ?>" name="itep">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -94,7 +124,7 @@ $(document).ready(function () {
|
||||
}, 1000);
|
||||
|
||||
$('#policy_type_id').val(res.data.id);
|
||||
$('#policytype_General_PrimaryKey').val(res.data.id);
|
||||
$('#policytype_General_PrimaryKey').val(res.data.PrimaryKey);
|
||||
$('#policy_id_type').click();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "Policy Type General Info";
|
||||
|
||||
236
app/Views/renewal_search.php
Normal file
236
app/Views/renewal_search.php
Normal file
@ -0,0 +1,236 @@
|
||||
<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-3" 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>
|
||||
<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-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="issuer" name="issuer">
|
||||
<option value="">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3 client_type_div">
|
||||
<label for="client_type">Client Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_type" name="client_type">
|
||||
<option value="">Select Client type</option>
|
||||
<option value="1">Group</option>
|
||||
<option value="2">Individual</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</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 id="report"></div>
|
||||
|
||||
<script>
|
||||
let client_list = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy();
|
||||
$('#client_id').select2();
|
||||
})
|
||||
|
||||
$(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()],
|
||||
'Next 7 Days': [moment(), moment().add(6, 'days')], // Next 7 Days
|
||||
'Next 30 Days': [moment(), moment().add(29, 'days')], // Next 30 Days
|
||||
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf(
|
||||
'month')], // Next Month
|
||||
'Next Year': [moment().add(1, 'year').startOf('year'), moment().add(1, 'year').endOf(
|
||||
'year')], // Next Year
|
||||
'Current Year': [moment().startOf('year'), moment().endOf('year')] // Current Year
|
||||
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
});
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
function fetchReportPage() {
|
||||
|
||||
var fromDate = $('#startDate').val();
|
||||
var toDate = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var client_type = $('#client_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
client_id: client_id,
|
||||
client_type: client_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
|
||||
$('.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');
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
//get client , branch, policy data
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
client_list = res.client_data;
|
||||
appendClients(res.client_data);
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients data
|
||||
function appendClients(data) {
|
||||
$('#client_id').empty();
|
||||
|
||||
$('#client_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-name': item.client_name,
|
||||
});
|
||||
|
||||
$('#client_id').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#client_type').on('change', function() {
|
||||
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
// console.log('selectedClientType', selectedClientType);
|
||||
|
||||
// Clear and add default options for client
|
||||
$('#client_id').empty().append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client'
|
||||
}))
|
||||
|
||||
// Populate client options based on selected client type
|
||||
if (selectedClientType) {
|
||||
|
||||
$.each(client_list, function(index, item) {
|
||||
if (item.client_type == selectedClientType) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
});
|
||||
$('#client_id').append(option);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Initialize or refresh Select2 for both dropdowns
|
||||
$('#client_id').select2();
|
||||
});
|
||||
</script>
|
||||
@ -32,6 +32,13 @@ table.dataTable tbody td {
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<div id="totals" style="margin-bottom: 10px;">
|
||||
<strong>Total Premium:</strong> <span id="total_premium">0.00</span> |
|
||||
<strong>Total Rewards:</strong> <span id="total_rewards">0.00</span> |
|
||||
<strong>Total IRDA Revenue INR:</strong> <span id="total_irda">0.00</span> |
|
||||
<strong>Total Billed Amount:</strong> <span id="total_billed">0.00</span> |
|
||||
<strong>Total Unbilled Amount:</strong> <span id="total_unbilled">0.00</span>
|
||||
</div>
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
@ -61,10 +68,11 @@ table.dataTable tbody td {
|
||||
<th>Total Premium</th>
|
||||
<th>Base <br> Revenue %</th>
|
||||
<th>TP / Terrorism <br> Revenue %</th>
|
||||
<th>Rewards</th>
|
||||
<th>Total IRDA <br> Revenue INR</th>
|
||||
<th>Billed Amount</th>
|
||||
<th>UnBilled Amount</th>
|
||||
<th>Rewards</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -97,11 +105,17 @@ table.dataTable tbody td {
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
|
||||
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> -->
|
||||
<td class="right-align-input"><?php echo number_format((float)$row['total_irda_amt'] - $row['billed_amt'],2, '.', '')?></td>
|
||||
<td class="right-align-input"><?php echo $row['reward']; ?></td>
|
||||
<?php
|
||||
$unbilled_amt = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
$unbilled_amt = $unbilled_amt == 0 && $row['billed_amt'] == 0 ? $total_irda_amt : $unbilled_amt ;
|
||||
?>
|
||||
<td class="right-align-input"><?php echo number_format((float)$unbilled_amt,2, '.', '')?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -191,7 +205,21 @@ $(document).ready(function() {
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
},
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
customizeData: function (data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
for (var j = 0; j < data.body[i].length; j++) {
|
||||
// Check if the column is the 9th index (10th column)
|
||||
if (j === 9) {
|
||||
data.body[i][j] = '\u200C' + data.body[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
],
|
||||
@ -201,7 +229,40 @@ $(document).ready(function() {
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
ordering: false,
|
||||
"footerCallback": function(row, data, start, end, display) {
|
||||
var api = this.api();
|
||||
|
||||
// Calculate column totals
|
||||
var totalPremium = api.column(23).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0);
|
||||
|
||||
var total_rewards = api.column(26).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0); // Add initial value 0 here
|
||||
|
||||
console.log('total_rewards - ' + total_rewards);
|
||||
|
||||
var totalIrda = api.column(27).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0);
|
||||
|
||||
var totalBilled = api.column(28).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0);
|
||||
|
||||
var totalUnbilled = api.column(29).data().reduce(function(a, b) {
|
||||
return parseFloat(a) + parseFloat(b) || 0;
|
||||
}, 0);
|
||||
|
||||
// Update the totals in the div above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(total_rewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
|
||||
132
app/Views/tat_report_band_wise_list.php
Normal file
132
app/Views/tat_report_band_wise_list.php
Normal file
@ -0,0 +1,132 @@
|
||||
<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
|
||||
// Get headers dynamically
|
||||
$headers = array_keys($data[0]);
|
||||
?>
|
||||
<?php 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);
|
||||
?>
|
||||
<?php foreach ($data as $row): ?>
|
||||
<tr>
|
||||
<?php
|
||||
$rowTotal = 0; // Initialize row total
|
||||
foreach ($row as $key => $value):
|
||||
// Convert numeric values to integer (ignore 'tat_category')
|
||||
$numValue = is_numeric($value) ? (int) $value : 0;
|
||||
|
||||
if ($key != 'TAT_Category') {
|
||||
$columnTotals[$key] += $numValue; // Add to column total
|
||||
$rowTotal += $numValue; // Add to row total
|
||||
}
|
||||
?>
|
||||
<td><?= esc($value) ?></td>
|
||||
<?php endforeach; ?>
|
||||
<td><strong><?= esc($rowTotal) ?></strong></td> <!-- Display 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>
|
||||
|
||||
</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>
|
||||
98
app/Views/ticket_auto_query.php
Normal file
98
app/Views/ticket_auto_query.php
Normal 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>
|
||||
79
app/Views/ticket_conversation.php
Normal file
79
app/Views/ticket_conversation.php
Normal file
@ -0,0 +1,79 @@
|
||||
<div id="ticket_messages_div">
|
||||
<?php $messages = $message_data['messages'];
|
||||
foreach ($messages as $message) :
|
||||
?>
|
||||
<?php if ($message['sender'] == 'user') { ?>
|
||||
<div class="card mb-3" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-2 col-lg-3">
|
||||
<div class="text-center">
|
||||
<div style="padding-left: 10px;" class="mb-3">
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/user.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['emp_name'] ?></div>
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-dark">User</span>
|
||||
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> <?php echo (new DateTime($message['created_at']))->format('j F Y h:i a');?></div>
|
||||
</div>
|
||||
<div id="msg_388" class="form-group">
|
||||
<p><?= $message['mail_content'] ?></p>
|
||||
</div>
|
||||
<!-- <div class="form-group mt-5">
|
||||
<button class="btn btn-dark btn-sm" type="button" onclick="quoteMessage(388);"><i
|
||||
class="fa fa-quote-left"></i> Quote</button>
|
||||
</div> -->
|
||||
<div class="border-top mt-3 pt-4 text-right">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="card mb-3 bg-staff" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-2 col-lg-3">
|
||||
<div class="text-center">
|
||||
<div style="padding-left: 10px;" class="mb-3">
|
||||
<div class="row">
|
||||
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
|
||||
class="user-avatar rounded-circle img-fluid col-mb-6" style="max-width: 70px">
|
||||
<div style="padding-left: 10px;padding-top: 15px;" class="col-mb-6"><?= $message_data['user_name'] ?></div>
|
||||
|
||||
</div>
|
||||
<span style="text-align: center; position: relative;text-align: center;bottom: 28px;left: 15px;" class="badge badge-primary">Staff</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<div class="text-muted"><i class="fa fa-calendar"></i> <?php echo (new DateTime($message['created_at']))->format('j F Y h:i a');?></div>
|
||||
</div>
|
||||
<div id="msg_394" class="form-group">
|
||||
<p><?= $message['mail_content'] ?></p>
|
||||
</div>
|
||||
<!-- <div class="form-group mt-5">
|
||||
<button class="btn btn-dark btn-sm" type="button" onclick="quoteMessage(394);"><i
|
||||
class="fa fa-quote-left"></i> Quote</button>
|
||||
</div> -->
|
||||
<!-- <div class="border-top mt-3 pt-4 text-right">
|
||||
<i class="fa fa-globe"></i> 115.97.253.189
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php } endforeach; ?>
|
||||
</div>
|
||||
212
app/Views/ticket_edit_onbording.php
Normal file
212
app/Views/ticket_edit_onbording.php
Normal file
@ -0,0 +1,212 @@
|
||||
<style>
|
||||
.bg-staff {
|
||||
background-color: #FFF5E5;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<h4 class="mb-0">Claims</h4>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Navigation Tabs -->
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-tab" data-toggle="tab" class="nav-link px-2 py-1 active" id="general_tab"
|
||||
aria-expanded="true">
|
||||
<i class="mdi mdi-contacts mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#reply-tab" data-toggle="tab" class="nav-link px-2 py-1" id="reply_tab"
|
||||
aria-expanded="false">
|
||||
<i class="fa fa-file mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Reply</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#note-tab" data-toggle="tab" class="nav-link px-2 py-1" id="note_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-account-switch mr-1"></i>
|
||||
<span class="d-none d-sm-inline-block">Note</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#history-tab" data-toggle="tab" class="nav-link px-2 py-1" id="history_tab"
|
||||
aria-expanded="false">
|
||||
<i class="mdi mdi-source-branch mr-1"></i>
|
||||
<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 -->
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="general-tab">
|
||||
<?php
|
||||
|
||||
if ($ticket_data['ticket_type_id'] == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="reply-tab">
|
||||
<?php include('ticket_reply.php'); ?>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="note-tab">
|
||||
<?php include('ticket_note.php'); ?>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="member_data_modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="acm_id">Insured Member<span class="text-danger"></span></label>
|
||||
<select class="form-control" onchange="setMemberData(this)">
|
||||
<option value="0">Select Insured Member</option>
|
||||
<?php if (!empty($member_data)) : ?>
|
||||
<?php foreach ($member_data as $value) : ?>
|
||||
<option value="<?= isset($value['emp_code']) ? $value['emp_code'] : '' ?>"
|
||||
data-empID="<?= isset($value['emp_id']) ? $value['emp_id'] : '' ?>"
|
||||
data-empName="<?= isset($value['emp_name']) ? htmlspecialchars($value['emp_name'], ENT_QUOTES, 'UTF-8') : '' ?>"
|
||||
data-policyNo="<?= isset($value['policy_no']) ? $value['policy_no'] : '' ?>"
|
||||
data-tpaNo="<?= isset($value['tpa_no']) ? $value['tpa_no'] : '' ?>"
|
||||
data-relationship="<?= isset($value['emp_relationship']) ? htmlspecialchars($value['emp_relationship'], ENT_QUOTES, 'UTF-8') : '' ?>">
|
||||
<?= isset($value['emp_name']) && isset($value['emp_relationship'])
|
||||
? htmlspecialchars($value['emp_name'] . ' - ' . $value['emp_relationship'], ENT_QUOTES, 'UTF-8')
|
||||
: 'Unknown Member' ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ticket_conversation_div">
|
||||
<?php include("ticket_conversation.php") ?>
|
||||
</div>
|
||||
|
||||
<?php //include("ticket_form_handler.php") ?>
|
||||
|
||||
<script>
|
||||
|
||||
function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formAction = '<?= base_url("ticket/update"); ?>';
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Collect IDs and form data
|
||||
const formData = new FormData(form);
|
||||
|
||||
// AJAX request
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: formAction,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
// Hide loader
|
||||
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
location.reload();
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.error(response.message, 'ERROR');
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openFetchEmpDataodal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('member_data_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function setMemberData(input) {
|
||||
|
||||
var selectedOption = $(input).find(':selected');
|
||||
|
||||
// Retrieve the data-* attributes
|
||||
var empId = selectedOption.data('empid');
|
||||
var empName = selectedOption.data('empname');
|
||||
var policyNo = selectedOption.data('policyno');
|
||||
var tpaNo = selectedOption.data('tpano');
|
||||
var relationship = selectedOption.data('relationship');
|
||||
|
||||
$('#tpa_no').val(tpaNo);
|
||||
$('#insured_emp_id').val(empId);
|
||||
$('#insured_name').val(empName);
|
||||
$('#policy_no').val(policyNo);
|
||||
|
||||
$('#relationship option').each(function() {
|
||||
if ($(this).text() === relationship) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
248
app/Views/ticket_form_gmc.php
Normal file
248
app/Views/ticket_form_gmc.php
Normal file
@ -0,0 +1,248 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<h4 class="mb-0">Claim GMC</h4>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="ticket_type_id" name="ticket_type_id" value="1">
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_status_id" name="claim_status_id">
|
||||
<!-- <option value="0">Select status</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="priority">Priority<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="priority" name="priority">
|
||||
<!-- <option value="0">Select Priority</option> -->
|
||||
<?php
|
||||
if (isset($priorityType) && count($priorityType)) {
|
||||
foreach ($priorityType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['priority'] == $key) ? 'selected' : '';
|
||||
echo "<option value=" . $key . " $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="acm_id" name="acm_id">
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected >" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_no">Policy No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="policy_no"
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no" placeholder="Policy Number" >
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
||||
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA<span class="text-danger"></span></label>
|
||||
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
|
||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
||||
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span
|
||||
class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
||||
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
||||
name="emp_code">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
|
||||
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
|
||||
name="tpa_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
||||
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
||||
name="emp_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
|
||||
<input type=hidden id="insured_emp_id" name="insured_emp_id" value="<?= isset($ticket_data['insured_emp_id']) ? $ticket_data['insured_emp_id'] : '' ?>">
|
||||
<input class="form-control" id="insured_name" name="insured_name" value="<?= isset($ticket_data['insured_name']) ? $ticket_data['insured_name'] : '' ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="relationship"> Relationship <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="relationship" name="relationship">
|
||||
<option value="0">Select Relationship</option>
|
||||
<?php
|
||||
if (isset($relationshipType) && count($relationshipType)) {
|
||||
foreach ($relationshipType as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['relationship'] == $key) ? 'selected' : '';
|
||||
echo "<option value='$key' $selected>$value</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
|
||||
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
||||
name="emp_mobile">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
||||
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
||||
name="emp_mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mode_of_intimation"> Mode of Intimation <span
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="mode_of_intimation" name="mode_of_intimation">
|
||||
<!-- <option value="0">Select Mode</option> -->
|
||||
<?php
|
||||
if (isset($modeOFIntimate) && count($modeOFIntimate)) {
|
||||
foreach ($modeOFIntimate as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['mode_of_intimation'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_type"> Claim Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_type" name="claim_type">
|
||||
<!-- <option value="0">Select claim Type</option> -->
|
||||
<?php
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="hospital_name">Hospital Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="hospital_name"
|
||||
placeholder="Enter Hospital Name"
|
||||
value="<?= isset($ticket_data['hospital_name']) ? $ticket_data['hospital_name'] : '' ?>"
|
||||
name="hospital_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="doa">DOA<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="doa" placeholder="Enter DOA"
|
||||
value="<?= isset($ticket_data['doa']) ? $ticket_data['doa'] : '' ?>"
|
||||
name="doa">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="dod">DOD<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="dod" placeholder="Enter DOD"
|
||||
value="<?= isset($ticket_data['dod']) ? $ticket_data['dod'] : '' ?>" name="dod">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_amount">Claim Amount<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="claim_amount"
|
||||
placeholder="Enter Claim Amount"
|
||||
value="<?= isset($ticket_data['claim_amount']) ? $ticket_data['claim_amount'] : '' ?>"
|
||||
name="claim_amount">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pod_no">POD No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pod_no" placeholder="Enter POD NO"
|
||||
value="<?= isset($ticket_data['pod_no']) ? $ticket_data['pod_no'] : '' ?>"
|
||||
name="pod_no">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit" >Submit</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
var doa = flatpickr("#doa", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var dod = flatpickr("#dod", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
243
app/Views/ticket_form_gpa.php
Normal file
243
app/Views/ticket_form_gpa.php
Normal file
@ -0,0 +1,243 @@
|
||||
<style>
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #e0e0e0;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="<?= !isset($ticket_data) ? "card" : "" ?>" style="margin-right: 23px;">
|
||||
<div class="card-body">
|
||||
<?php if(!isset($ticket_data)){ ?>
|
||||
<!-- Header Section -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<h4 class="mb-0">Claim <?= $ticket_form ?></h4>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="<?= base_url('ticket/list'); ?>" aria-label="Back to ticket list">
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc" onsubmit="submitClaimForm(event, this)"
|
||||
enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<input type="hidden" id="ticket_master_id" name="ticket_master_id" value="<?= isset($ticket_data['id']) ? $ticket_data['id'] : '' ?>">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_status_id" name="claim_status_id">
|
||||
<!-- <option value="0">Select status</option> -->
|
||||
<?php
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_status_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['claim_status'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="acm_id">Account Manager<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="acm_id" name="acm_id">
|
||||
<!-- <option value="0">Select Account Manager</option> -->
|
||||
<?php
|
||||
if (isset($acms) && count($acms)) {
|
||||
foreach ($acms as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['acm_id'] == $value['id']) ? 'selected' : '';
|
||||
echo "<option value=" . $value['id'] . " $selected>" . $value['first_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_name">Corporate Name<span class="text-danger"></span></label>
|
||||
<input type="hidden" id="client_id" name="client_id" value="<?= isset($ticket_data['client_id']) ? $ticket_data['client_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="client_name" placeholder="Client" value="<?= isset($ticket_data['client_name']) ? $ticket_data['client_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insurer_id">Insurer<span class="text-danger"></span></label>
|
||||
<input type=hidden id="insurer_id" name="insurer_id" value="<?= isset($ticket_data['insurer_id']) ? $ticket_data['insurer_id'] : '' ?>">
|
||||
<input type=text class="form-control" id="insurer_name" placeholder="Insurer" value="<?= isset($ticket_data['insurer_name']) ? $ticket_data['insurer_name'] : '' ?>" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_no">Policy No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="policy_no"
|
||||
value="<?= isset($ticket_data['policy_no']) ? $ticket_data['policy_no'] : '' ?>"
|
||||
name="policy_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="ticket_type_id"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control readonly-select" id="ticket_type_id" name="ticket_type_id" readonly>
|
||||
<?php
|
||||
if (isset($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
if($key != 1){
|
||||
$selected = (isset($ticket_data) && $ticket_data['ticket_type_id'] == $key) ? 'selected' : ((isset($selected_ticket_type) && $selected_ticket_type == $key) ? 'selected' : '');
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_type"> Claim Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_type" name="claim_type">
|
||||
<!-- <option value="0">Select claim Type</option> -->
|
||||
<?php
|
||||
if (isset($claim_type) && count($claim_type)) {
|
||||
foreach ($claim_type as $key => $value) {
|
||||
$selected = (isset($ticket_data) && $ticket_data['claim_type'] == $key) ? 'selected' : '';
|
||||
echo "<option value='" . $key . "' $selected>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID <i class="fa fa-search text-danger"
|
||||
aria-hidden="true" onclick="openFetchEmpDataodal(this)"></i> <span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
|
||||
value="<?= isset($ticket_data['emp_code']) ? $ticket_data['emp_code'] : '' ?>"
|
||||
name="emp_code">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_name">Employee Name<span class="text-danger"></span></label>
|
||||
<input type=hidden id="emp_id" name="emp_id" value="<?= isset($ticket_data['emp_id']) ? $ticket_data['emp_id'] : '' ?>">
|
||||
<input type="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
|
||||
value="<?= isset($ticket_data['emp_name']) ? $ticket_data['emp_name'] : '' ?>"
|
||||
name="emp_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mobile">Employee Mobile No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
|
||||
value="<?= isset($ticket_data['emp_mobile']) ? $ticket_data['emp_mobile'] : '' ?>"
|
||||
name="emp_mobile">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mail">Employee Mail ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mail" placeholder="Enter EMP Mail"
|
||||
value="<?= isset($ticket_data['emp_mail']) ? $ticket_data['emp_mail'] : '' ?>"
|
||||
name="emp_mail">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_join">Date of joining<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_join"
|
||||
placeholder="Enter Joining Date"
|
||||
value="<?= isset($ticket_data['date_of_join']) ? $ticket_data['date_of_join'] : '' ?>"
|
||||
name="date_of_join">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_incep">Date of Inception<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_incep"
|
||||
placeholder="Enter Inception Date"
|
||||
value="<?= isset($ticket_data['date_of_incep']) ? $ticket_data['date_of_incep'] : '' ?>"
|
||||
name="date_of_incep">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="dob">Date of Birth<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="dob" placeholder="Enter Birth Date"
|
||||
value="<?= isset($ticket_data['dob']) ? $ticket_data['dob'] : '' ?>" name="dob">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_accident">Date of Accident<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_accident"
|
||||
placeholder="Enter Accident Date"
|
||||
value="<?= isset($ticket_data['date_of_accident']) ? $ticket_data['date_of_accident'] : '' ?>"
|
||||
name="date_of_accident">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_death">Date of Death<span class="text-danger"></span></label>
|
||||
<input type="date_of_death" class="form-control" id="date_of_death"
|
||||
placeholder="Enter Death Date"
|
||||
value="<?= isset($ticket_data['date_of_death']) ? $ticket_data['date_of_death'] : '' ?>"
|
||||
name="date_of_death">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="date_of_intimat">Date of Intimation<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="date_of_intimat"
|
||||
placeholder="Enter Intimation Date"
|
||||
value="<?= isset($ticket_data['date_of_intimat']) ? $ticket_data['date_of_intimat'] : '' ?>"
|
||||
name="date_of_intimat">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="si_amt">Sum insured<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="si_amt" placeholder="Enter SI"
|
||||
value="<?= isset($ticket_data['si_amt']) ? $ticket_data['si_amt'] : '' ?>"
|
||||
name="si_amt">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
var date_of_join = flatpickr("#date_of_join", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_incep = flatpickr("#date_of_incep", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_accident = flatpickr("#date_of_accident", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_death = flatpickr("#date_of_death", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var date_of_intimat = flatpickr("#date_of_intimat", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
})
|
||||
</script>
|
||||
731
app/Views/ticket_form_handler.php
Normal file
731
app/Views/ticket_form_handler.php
Normal file
@ -0,0 +1,731 @@
|
||||
<style>
|
||||
.accordion {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.accordion h4 {
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #438e96;
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
font-size: 17px;
|
||||
padding-left: 13px;
|
||||
padding-top: 3px;
|
||||
padding-bottom: 3px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
.accordion-content {
|
||||
display: none;
|
||||
padding: 10px;
|
||||
background-color: #bfe0e2;
|
||||
margin-top: 5px;
|
||||
border-radius: 7px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.accordion-content.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.arrow.rotate {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<?php
|
||||
if(!isset($view_ticket_page)){
|
||||
if ($selected_ticket_type == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal fade" id="empDetailsModal" tabindex="-1" role="dialog" aria-labelledby="empDetailsModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="empDetailsModalLabel">Fetch Employee Data</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"
|
||||
onclick="toResetTheModelFields()">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="accordion">
|
||||
<!-- Search by Mobile Number -->
|
||||
<div>
|
||||
<h4 onclick="toggleAccordion('mobileAccordion')">
|
||||
Search by Mobile Number
|
||||
<span class="arrow" id="mobileArrow">➤</span>
|
||||
</h4>
|
||||
<div class="accordion-content" id="mobileAccordion">
|
||||
<div id="mobileSearch" class="search-method">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-5" style="display:true;">
|
||||
<div class="form-group">
|
||||
<label>Employee Data Points</label>
|
||||
<select name="employee_data_points" id="employee_data_points"
|
||||
class="form-control">
|
||||
<option value="mobile">Employee Mobile Number</option>
|
||||
<option value="emp_code">Employee ID</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label id="employee_data_points_label">Employee Mobile Number</label>
|
||||
<input class="form-control" type="text" id="emp_mobile_number_for_claim"
|
||||
name="mobile_numbers" onkeypress="return onlyNumbers(event)"
|
||||
maxlength="10">
|
||||
</div>
|
||||
<div class="text-danger" id="error_dis"></div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group" style="margin-top: 9px;">
|
||||
<br>
|
||||
<button class="btn btn-primary"
|
||||
onclick="getTheEmpDataForClaimSearchByMobile(this)">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="emp_member_policy_div" style="display:true;">
|
||||
<div class="row">
|
||||
<div class="col-md-5" style="display:none;">
|
||||
<div class="form-group">
|
||||
<label>Employee</label>
|
||||
<select name="employee_by_number" id="employee_by_number"
|
||||
class="form-control SelExample">
|
||||
<option value="0">Select Employee</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
<label>Insured List</label>
|
||||
<select name="employee_by_number" id="member_by_number"
|
||||
class="form-control SelExample" onchange="setMemberData(this)">
|
||||
<option value="0">Select Member</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search by Client, Branch, and Policy -->
|
||||
<div class="mt-4">
|
||||
<h4 onclick="toggleAccordion('clientBranchAccordion')">
|
||||
Search by Client, Branch, and Policy
|
||||
<span class="arrow" id="clientBranchArrow">➤</span>
|
||||
</h4>
|
||||
<div class="accordion-content" id="clientBranchAccordion">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Client</label>
|
||||
<select id="emp_client_data_list" name="client"
|
||||
class="form-control custom-select">
|
||||
<option value="0">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Branch</label>
|
||||
<select id="emp_client_branch_data_list" name="branch"
|
||||
class="form-control custom-select">
|
||||
<option value="0">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Policy</label>
|
||||
<select id="emp_client_policy_data_list" name="policy_client_branch"
|
||||
class="form-control custom-select" onchange="getEmpData(this)">
|
||||
<option value="0">Select Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Employee</label>
|
||||
<select name="search_by_client_employee" id="search_by_client_employee"
|
||||
class="form-control SelExample"
|
||||
onchange="getTheEmpDataForClaimSearchByMobile(this, 'client')">
|
||||
<option value="0">Select Employee</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Insured List</label>
|
||||
<select name="member" id="search_by_client_member"
|
||||
class="form-control SelExample" onchange="setMemberData(this)">
|
||||
<option value="0">Select Member</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close"
|
||||
onclick="toResetTheModelFields()">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var client_list = ''; // local variable for storing the client branch list
|
||||
var branch_list = ''; // local variable for storing the client branch list
|
||||
var policy_list = ''; // local variable for storing the client policy list
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy();
|
||||
$('#emp_client_data_list').select2();
|
||||
$('#emp_client_branch_data_list').select2();
|
||||
$('#emp_client_policy_data_list').select2();
|
||||
$('#search_by_client_member').select2();
|
||||
$('#search_by_client_employee').select2();
|
||||
$('#employee_by_number').select2();
|
||||
$('#member_by_number').select2();
|
||||
})
|
||||
|
||||
//on change functions
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#emp_client_data_list').change(function() {
|
||||
|
||||
let client_id = $(this).val();
|
||||
let client_name = $('#emp_client_data_list option:selected').data('name');
|
||||
|
||||
console.log('client_id', client_id);
|
||||
console.log('client_name', client_name);
|
||||
|
||||
if (branch_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = branch_list[client_id];
|
||||
appendBranch(data);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('#emp_client_branch_data_list').change(function() {
|
||||
|
||||
let branch_id = $(this).val();
|
||||
|
||||
console.log('branch_id', branch_id);
|
||||
|
||||
if (policy_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = policy_list[branch_id];
|
||||
appendPolicy(data);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function toggleAccordion(id) {
|
||||
const content = document.getElementById(id);
|
||||
const arrow = document.querySelector(`#${id === 'mobileAccordion' ? 'mobileArrow' : 'clientBranchArrow'}`);
|
||||
|
||||
// Define the other accordion to close
|
||||
const otherId = id === 'mobileAccordion' ? 'clientBranchAccordion' : 'mobileAccordion';
|
||||
const otherContent = document.getElementById(otherId);
|
||||
const otherArrow = document.querySelector(`#${id === 'mobileAccordion' ? 'clientBranchArrow' : 'mobileArrow'}`);
|
||||
|
||||
// Close the other accordion
|
||||
otherContent.classList.remove('show');
|
||||
otherArrow.classList.remove('rotate');
|
||||
|
||||
// Toggle the current accordion
|
||||
if (content.classList.contains('show')) {
|
||||
content.classList.remove('show');
|
||||
arrow.classList.remove('rotate');
|
||||
} else {
|
||||
content.classList.add('show');
|
||||
arrow.classList.add('rotate');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function openFetchEmpDataodal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('empDetailsModal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
//get client , branch, policy data
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
client_list = res.client_data;
|
||||
branch_list = res.branch_data;
|
||||
policy_list = res.policy_data;
|
||||
appendClients(res.client_data);
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients data to the modal
|
||||
function appendClients(data) {
|
||||
$('#emp_client_data_list').empty();
|
||||
|
||||
$('#emp_client_data_list').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-name': item.client_name,
|
||||
});
|
||||
|
||||
$('#emp_client_data_list').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//append the clients branch data to the modal
|
||||
function appendBranch(data) {
|
||||
$('#emp_client_branch_data_list').empty();
|
||||
|
||||
$('#emp_client_branch_data_list').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Branch'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name,
|
||||
'data-name': item.branch_name,
|
||||
});
|
||||
|
||||
$('#emp_client_branch_data_list').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//append the clients policy data to the modal
|
||||
function appendPolicy(data) {
|
||||
|
||||
let ticket_type = $('#ticket_type_id').val();
|
||||
$('#emp_client_policy_data_list').empty();
|
||||
|
||||
$('#emp_client_policy_data_list').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Policy'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
if(ticket_type == 1){
|
||||
|
||||
if(item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 ||item.policy_type_id == 5) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
|
||||
$('#emp_client_policy_data_list').append(option).select2();
|
||||
}
|
||||
|
||||
}else if(ticket_type == 2){
|
||||
|
||||
if(item.policy_type_id == 1) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
|
||||
$('#emp_client_policy_data_list').append(option).select2();
|
||||
}
|
||||
|
||||
}else if(ticket_type == 3){
|
||||
|
||||
if(item.policy_type_id == 6) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
|
||||
$('#emp_client_policy_data_list').append(option).select2();
|
||||
}
|
||||
|
||||
}else if(ticket_type == 4){
|
||||
|
||||
if(item.policy_type == 7) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.policy_type + '-' + item.policy_no,
|
||||
});
|
||||
|
||||
$('#emp_client_policy_data_list').append(option).select2();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function submitClaimForm(event, form) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Collect IDs and form data
|
||||
const formData = new FormData(form);
|
||||
|
||||
// AJAX request
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: formAction,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('Form submitted response:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
} else {
|
||||
toastr.error(response.message, 'ERROR');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getEmpData(input) {
|
||||
|
||||
console.log(input)
|
||||
let param = $(input).val();
|
||||
let url = '<?= base_url('util/getTheEmpDataForClaim/') ?>' + param;
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
param: param,
|
||||
};
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
console.log(response.message, 'SUCCESS');
|
||||
appendEmployee(response.data, 'search_by_client_employee');
|
||||
setClientAndInsurerData(response.dataForClientAndInsurer);
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetch data.', 'ERROR');
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
||||
|
||||
console.log(input)
|
||||
let type = $('#employee_data_points').val()
|
||||
let param = $('#emp_mobile_number_for_claim').val()
|
||||
|
||||
if (searchType == 'client') {
|
||||
type = 'emp_code';
|
||||
param = $(input).val();
|
||||
}
|
||||
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type;
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
param: param,
|
||||
type: type,
|
||||
};
|
||||
|
||||
// Show loader
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
// Send AJAX request
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status) {
|
||||
console.log(response.message, 'SUCCESS');
|
||||
if (searchType == 'client') {
|
||||
appendMember(response.memberData, 'search_by_client_member');
|
||||
} else {
|
||||
appendMember(response.memberData, 'member_by_number');
|
||||
}
|
||||
setClientAndInsurerData(response.data);
|
||||
appendACMS(response.acms)
|
||||
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
appendACMS(response.acms);
|
||||
unSetClientAndInsurerData()
|
||||
}
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
toastr.error('An error occurred while fetch data.', 'ERROR');
|
||||
|
||||
// Hide loader
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
function appendEmployee(data, attrId) {
|
||||
|
||||
console.log('data', data)
|
||||
|
||||
$('#' + attrId).empty();
|
||||
$('#' + attrId).append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Employee'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
console.log(item)
|
||||
var option = $('<option>', {
|
||||
value: item.emp_code,
|
||||
text: item.emp_name,
|
||||
});
|
||||
|
||||
$('#' + attrId).append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendMember(data, attrId) {
|
||||
|
||||
console.log('data', data);
|
||||
|
||||
// Clear the existing options
|
||||
$('#' + attrId).empty();
|
||||
|
||||
// Add the default 'Select Member' option
|
||||
$('#' + attrId).append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Member'
|
||||
}));
|
||||
|
||||
// Append options dynamically with data attributes
|
||||
$.each(data, function(index, item) {
|
||||
console.log('Item:', item); // Log each item to debug
|
||||
|
||||
// Ensure all properties exist, set fallback if necessary
|
||||
var empID = item.emp_id ?? '';
|
||||
var empName = item.emp_name ?? '';
|
||||
var policyNo = item.policy_no ?? '';
|
||||
var tpaNo = item.tpa_no ?? '';
|
||||
var relationship = item.emp_relationship ?? '';
|
||||
|
||||
// Create an option and set data attributes
|
||||
var option = $('<option>', {
|
||||
value: item.emp_code,
|
||||
text: empName + " - " + relationship
|
||||
}).attr({
|
||||
'data-empID': empID,
|
||||
'data-empName': empName,
|
||||
'data-policyNo': policyNo,
|
||||
'data-tpaNo': tpaNo,
|
||||
'data-relationship': relationship
|
||||
});
|
||||
|
||||
$('#' + attrId).append(option);
|
||||
});
|
||||
|
||||
// Reinitialize select2
|
||||
$('#' + attrId).select2();
|
||||
}
|
||||
|
||||
function appendACMS(data) {
|
||||
|
||||
console.log(data);
|
||||
|
||||
$('#acm_id').empty();
|
||||
|
||||
// $('#acm_id').append($('<option>', {
|
||||
// value: '0',
|
||||
// text: 'Select Account Manager'
|
||||
// }));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.first_name,
|
||||
});
|
||||
|
||||
$('#acm_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function setClientAndInsurerData(data) {
|
||||
|
||||
$('#insurer_id').val(data.insurer_id);
|
||||
$('#insurer_name').val(data.insurer_name);
|
||||
$('#tpa_id').val(data.tpa_id);
|
||||
$('#tpa_name').val(data.tpa_name);
|
||||
$('#client_id').val(data.client_id);
|
||||
$('#client_name').val(data.client_name);
|
||||
|
||||
$('#emp_code').val(data.emp_code);
|
||||
$('#emp_id').val(data.emp_id);
|
||||
$('#emp_name').val(data.emp_name);
|
||||
$('#emp_mobile').val(data.emp_mobile);
|
||||
$('#emp_mail').val(data.emp_email);
|
||||
}
|
||||
|
||||
function unSetClientAndInsurerData() {
|
||||
|
||||
$('#insurer_id').val("");
|
||||
$('#insurer_name').val("");
|
||||
$('#tpa_id').val("");
|
||||
$('#tpa_name').val("");
|
||||
$('#client_id').val("");
|
||||
$('#client_name').val("");
|
||||
|
||||
$('#emp_code').val("");
|
||||
$('#emp_id').val("");
|
||||
$('#emp_name').val("");
|
||||
$('#emp_mobile').val("");
|
||||
$('#emp_mail').val("");
|
||||
}
|
||||
|
||||
function setMemberData(input) {
|
||||
|
||||
var selectedOption = $(input).find(':selected');
|
||||
|
||||
// Retrieve the data-* attributes
|
||||
var empId = selectedOption.data('empid');
|
||||
var empName = selectedOption.data('empname');
|
||||
var policyNo = selectedOption.data('policyno');
|
||||
var tpaNo = selectedOption.data('tpano');
|
||||
var relationship = selectedOption.data('relationship');
|
||||
|
||||
$('#tpa_no').val(tpaNo);
|
||||
$('#insured_emp_id').val(empId);
|
||||
$('#insured_name').val(empName);
|
||||
$('#policy_no').val(policyNo);
|
||||
|
||||
$('#relationship option').each(function() {
|
||||
if ($(this).text() === relationship) {
|
||||
$(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#employee_data_points').on('change', function() {
|
||||
|
||||
let value = $(this).val()
|
||||
if (value == "mobile") {
|
||||
$('#employee_data_points_label').text('Employee Mobile Number')
|
||||
} else {
|
||||
$('#employee_data_points_label').text('Employee ID')
|
||||
}
|
||||
})
|
||||
|
||||
function toResetTheModelFields() {
|
||||
|
||||
$('#emp_mobile_number_for_claim').val('');
|
||||
$('#employee_data_points').val();
|
||||
$('#employee_by_number').val('');
|
||||
$('#member_by_number').val('0').select2();
|
||||
$('#emp_client_data_list').val('0').select2();
|
||||
$('#emp_client_branch_data_list').val('0').select2();
|
||||
$('#emp_client_policy_data_list').val('0').select2();
|
||||
$('#search_by_client_employee').val('0').select2();
|
||||
$('#search_by_client_member').val('0').select2();
|
||||
}
|
||||
</script>
|
||||
73
app/Views/ticket_history.php
Normal file
73
app/Views/ticket_history.php
Normal file
@ -0,0 +1,73 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<!-- <th>Old Value</th>
|
||||
<th>New Value</th> -->
|
||||
<th>Change</th>
|
||||
<th>User</th>
|
||||
<th>Date/Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($ticket_history)) { ?>
|
||||
<?php foreach($ticket_history as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['display_name']; ?></td>
|
||||
<td><?php echo $row['old_value'].' => '.$row['new_value']; ?></td>
|
||||
<!-- <td><?php //echo $row['new_value']; ?></td> -->
|
||||
<td><?php echo $row['modified_by']; ?></td>
|
||||
<td><?php echo $row['created_at']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
|
||||
<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'>>" + // 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: 'Ticket_History',
|
||||
// },
|
||||
// {
|
||||
// extend: 'excel',
|
||||
// text: 'Excel',
|
||||
// title: 'Ticket_History',
|
||||
// exportOptions: {
|
||||
// orthogonal: 'sort'
|
||||
// },
|
||||
// }
|
||||
|
||||
// ],
|
||||
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>
|
||||
152
app/Views/ticket_list.php
Normal file
152
app/Views/ticket_list.php
Normal file
@ -0,0 +1,152 @@
|
||||
<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;
|
||||
}
|
||||
|
||||
.addbtnStyle {
|
||||
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">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Claim List </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<th>Claim number</th>
|
||||
<th>TPA ID</th>
|
||||
<th>Emp name</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Corporate name</th>
|
||||
<th>TAT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr onclick="viewTicket(<?php echo $row['id']; ?>)">
|
||||
<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['insured_name']; ?></td>
|
||||
<td><?php echo $row['short_name']; ?></td>
|
||||
<td><?php echo $row['tat']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
// 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: 'Claim-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'claim-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
},
|
||||
{
|
||||
text: 'New Claim',
|
||||
className: 'buttons-html5 addbtnStyle',
|
||||
action: function(e, dt, node, config) {
|
||||
openTicketTypeAskModal()
|
||||
}
|
||||
}
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
|
||||
function viewTicket(ticket_id){
|
||||
|
||||
let url = '<?= base_url('ticket/view/'); ?>' + ticket_id
|
||||
window.location.href = url
|
||||
}
|
||||
|
||||
</script>
|
||||
607
app/Views/ticket_mail_template.php
Normal file
607
app/Views/ticket_mail_template.php
Normal file
@ -0,0 +1,607 @@
|
||||
<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;
|
||||
}
|
||||
|
||||
.addbtnStyle {
|
||||
margin-left: 20px !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</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;">Mail Template List </h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Template Name</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Trigger Type</th>
|
||||
<th>Mail Send Type</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($ticket_data)) { ?>
|
||||
<?php foreach($ticket_data as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['template_name']; ?></td>
|
||||
<td><?php echo $ticket_type[$row['ticket_type']]; ?></td>
|
||||
<td><?php echo $trigger_type[$row['trigger_type']]; ?></td>
|
||||
<td><?=$row['is_auto_mail'] == 1?'Auto':"Manual" ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"
|
||||
onclick="getMailTemplateData(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" onclick="deleteTemplate(<?=$row['id']?>)"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="new_mail_template" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Add New Template<span id="nameOfThePolicy"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center" id="no_data"></div>
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_mail_editor_modal"
|
||||
enctype="multipart/form-data" novalidate>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Template Name</label>
|
||||
<input type="text" id="template_name" name="template_name" class="form-control"
|
||||
placeholder="Template Name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Policy Type</label>
|
||||
<select class="form-control" id="policy_type" name="ticket_type" required>
|
||||
<option value="">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_type) && count($policy_type)) {
|
||||
foreach ($policy_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="trigger_type">Trigger Type</label>
|
||||
<select class="form-control" id="trigger_type" name="trigger_type" required>
|
||||
<option value="">Select status</option>
|
||||
<?php
|
||||
if (isset($trigger_type) && count($trigger_type)) {
|
||||
foreach ($trigger_type as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select> <input id="primaryKey" type="hidden">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<div>
|
||||
<div id="statusSwitchWrapper" class="dt-switch-wrapper"
|
||||
style="padding-top: 40px;padding-left: 10px;">
|
||||
<div class="custom-control custom-switch" style="text-align: left;">
|
||||
<input type="checkbox" class="custom-control-input" id="statusSwitch">
|
||||
<label class="custom-control-label" for="statusSwitch">Auto Mail</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="template_subject">Subject</label>
|
||||
<input type="text" id="template_subject" name="subject" class="form-control"
|
||||
placeholder="Subject" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control"
|
||||
style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $key => $value): ?>
|
||||
<?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
</option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnGridSubmit_2">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-------------------------------------------------------------------------------------------------->
|
||||
|
||||
<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: [{
|
||||
text: 'Add Template',
|
||||
className: 'buttons-html5 addbtnStyle',
|
||||
action: function(e, dt, node, config) {
|
||||
openModal()
|
||||
}
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function(editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
}, ],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#template_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "template_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos,
|
||||
input.value.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('.close').click(function() {
|
||||
$('#template_subject').val('');
|
||||
$('#template_name').val('');
|
||||
$('#primaryKey').val('');
|
||||
$('#policy_type').val('').change();
|
||||
$('#trigger_type').val('').change();
|
||||
editor.setEditorValue('');
|
||||
$('#primaryKey').val(null);
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
|
||||
})
|
||||
$('#ticket_mail_editor_modal').submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
let isValid = true;
|
||||
$('#ticket_mail_editor_modal [required]').each(function() {
|
||||
if (!this.value.trim()) {
|
||||
isValid = false;
|
||||
$(this).addClass('is-invalid'); // Add a red border for visibility
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
toastr.error('Please fill all required fields.', 'Validation Error');
|
||||
return; // Prevent submission
|
||||
}
|
||||
var joditEditor = editor;
|
||||
if (joditEditor) {
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({
|
||||
name: 'mail_content',
|
||||
value: mailContent
|
||||
});
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
formData.push({
|
||||
name: 'is_auto_mail',
|
||||
value: isAutoMailEnabled
|
||||
});
|
||||
var primary_key = $('#primaryKey').val();
|
||||
if (primary_key != null && primary_key != '') {
|
||||
formData.push({
|
||||
name: 'id',
|
||||
value: primary_key
|
||||
});
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/1") ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.status == true) {
|
||||
$('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template saved successfully!', 'Success');
|
||||
location.reload();
|
||||
} else if (res.status == false) {
|
||||
toastr.error('Failed to Save Data', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function openModal() {
|
||||
var myModal = new bootstrap.Modal(document.getElementById('new_mail_template'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function deleteTemplate(id) {
|
||||
const url = '<?= base_url("ticket/crud_mail_template/3") ?>';
|
||||
const data = {
|
||||
id: id
|
||||
}; // Ensure data is passed as an object
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this template.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
if (res.status === true) {
|
||||
location.reload();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Template Deleted successfully!', 'Success');
|
||||
} else if (res.status === false) {
|
||||
toastr.error('Failed to Delete Template', 'Error');
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something went wrong!', 'Warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMailTemplateData(id) {
|
||||
const template_name = 'new_mail_template';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("ticket/crud_mail_template/2") ?>';
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(res) {
|
||||
console.log('get Mail Template Data', res);
|
||||
if (res) {
|
||||
if (res.status == true) {
|
||||
// Open the modal
|
||||
openModal();
|
||||
|
||||
// Populate the form fields
|
||||
$('#template_subject').val(res.data.subject);
|
||||
$('#template_name').val(res.data.template_name);
|
||||
$('#primaryKey').val(res.data.id);
|
||||
$('#policy_type').val(res.data.ticket_type).change();
|
||||
$('#trigger_type').val(res.data.trigger_type).change();
|
||||
$('.jodit-wysiwyg').html(res.data.mail_content);
|
||||
|
||||
// Set the auto mail switch
|
||||
if (res.data.is_auto_mail == 1) {
|
||||
$('#statusSwitch').prop('checked', true);
|
||||
} else {
|
||||
$('#statusSwitch').prop('checked', false);
|
||||
}
|
||||
|
||||
// Populate any additional fields if necessary, like placeholders
|
||||
// Assuming `placeholders` is an array in the response
|
||||
if (res.placeholders) {
|
||||
res.placeholders.forEach(function(placeholder) {
|
||||
// You can populate any dropdown or field as required
|
||||
$('#ticket_mail_customButton').val(placeholder);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
toastr.error('Data Not Found', 'error');
|
||||
}
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("scroll-horizontal-datatable");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
98
app/Views/ticket_note.php
Normal file
98
app/Views/ticket_note.php
Normal 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_note_form"
|
||||
enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="ticket_note">Add Notes</label>
|
||||
<textarea class="form-control" id="ticket_note" name="note" rows="3"
|
||||
placeholder="Enter Text"><?= isset($ticket_note['note']) ? $ticket_note['note'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div><input type="hidden" id="note_id">
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_note_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 : 0};
|
||||
$.ajax({
|
||||
url:url,
|
||||
data:data,
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
if (res.status == true){
|
||||
$('#ticket_note').val(res.data.note);
|
||||
$('#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_note_form").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 = $('#note_id').val();
|
||||
if (primary_key != null && primary_key != ''){
|
||||
formData.push({ name: 'id', value: primary_key});
|
||||
}
|
||||
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);
|
||||
$('#note_id').val(response.id);
|
||||
// console.log($('#'))
|
||||
|
||||
|
||||
} 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>
|
||||
185
app/Views/ticket_reply.php
Normal file
185
app/Views/ticket_reply.php
Normal file
@ -0,0 +1,185 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="ticket_reply_form" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<!-- Email To Field -->
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_mail_for_to">To</label>
|
||||
<input type="text" value="<?= isset($ticket_data['emp_mail'])?$ticket_data['emp_mail']:'' ?>" class="form-control" id="emp_mail_for_to" name="emp_mail" placeholder="Recipient email" readonly>
|
||||
</div>
|
||||
|
||||
<!-- Subject Field -->
|
||||
<div class="form-group col-md-8">
|
||||
<label for="mail_subject">Subject</label>
|
||||
<input type="text" class="form-control" value="<?= isset($reply_data['subject'])?$reply_data['subject']:'' ?>" id="mail_subject" name="mail_subject" placeholder="Mail subject">
|
||||
</div>
|
||||
|
||||
<!-- Mail Content Field -->
|
||||
<div class="form-group col-md-12">
|
||||
<!-- <textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea> -->
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
<div class="form-group col-md-12">
|
||||
<select id="ticket_mail_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $key => $value): ?>
|
||||
<!-- <?php // if($value == 'member_name' || $value == 'member_mobile' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name'){ ?>member_mobile -->
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="<?php echo $key; ?>"><?php echo $valueChange; ?></option>
|
||||
<?php //} ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ticket_mail_editor" name="content" style="height: 300px;"></div>
|
||||
</div>
|
||||
</div><input type="hidden" id="claim_status" name="claim_status" value="<?= isset($reply_data['claim_status_id'])??'' ?>">
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-primary" id="ticket_reply_submit">Send Mail</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||
const editorConfig = {
|
||||
buttons: toolbar.concat(['fontsize']),
|
||||
fontsize: [8, 10, 12, 14, 16, 18, 20, 22, 24], // Customize font sizes
|
||||
showPlaceholder: false,
|
||||
toolbarButtonSize: 'small',
|
||||
toolbarAdaptive: false,
|
||||
saveHeightInStorage: true,
|
||||
minHeight: 400,
|
||||
extraButtons: [
|
||||
{
|
||||
name: 'info',
|
||||
iconURL: '<?= base_url()."public"; ?>/assets/images/image-solid.svg', // Replace with the actual icon URL
|
||||
exec: function (editor) {
|
||||
const fileInput = document.getElementById("Question_title_fileInput");
|
||||
fileInput.click();
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const editor = Jodit.make("#ticket_mail_editor", editorConfig);
|
||||
var mail_content = `<?=isset($reply_data['mail_content'])?$reply_data['mail_content']:'' ?>`;
|
||||
$('.jodit-wysiwyg').html(mail_content);
|
||||
|
||||
let lastActiveField = null;
|
||||
|
||||
// Track last active input field
|
||||
$("#mail_subject").on("focus", function() {
|
||||
lastActiveField = this;
|
||||
});
|
||||
|
||||
// Track Jodit editor focus separately
|
||||
editor.events.on("focus", function() {
|
||||
lastActiveField = editor;
|
||||
});
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
var target = event.target;
|
||||
if (target.matches('#ticket_mail_customButton')) {
|
||||
let placeholderValue = $(target).val();
|
||||
if (!placeholderValue) return;
|
||||
|
||||
if (lastActiveField) {
|
||||
if (lastActiveField.id === "mail_subject") {
|
||||
insertAtCursor(lastActiveField, placeholderValue);
|
||||
} else {
|
||||
editor.selection.insertHTML(placeholderValue);
|
||||
}
|
||||
}
|
||||
|
||||
$(target).val('');
|
||||
}
|
||||
});
|
||||
|
||||
function insertAtCursor(input, textToInsert) {
|
||||
if (document.selection) {
|
||||
input.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = textToInsert;
|
||||
} else if (input.selectionStart || input.selectionStart === 0) {
|
||||
let startPos = input.selectionStart;
|
||||
let endPos = input.selectionEnd;
|
||||
input.value = input.value.substring(0, startPos) + textToInsert + input.value.substring(endPos, input.value.length);
|
||||
input.selectionStart = input.selectionEnd = startPos + textToInsert.length;
|
||||
} else {
|
||||
input.value += textToInsert;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#ticket_reply_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
var joditEditor = editor;
|
||||
if (joditEditor)
|
||||
{
|
||||
var mailContent = $(joditEditor.currentPlace.container).find('.jodit-wysiwyg').html();
|
||||
var formData = $(this).serializeArray();
|
||||
formData.push({ name: 'mail_content', value: mailContent });
|
||||
// formData.push({ name: 'client_id', value: $('#general_PrimaryKey').val() });
|
||||
// var isAutoMailEnabled = $('#statusSwitch').is(':checked') ? 1 : 0;
|
||||
// formData.push({ name: 'is_auto_mail', value: isAutoMailEnabled });
|
||||
var ticket_id = $('#ticket_master_id').val();
|
||||
if (ticket_id != null && ticket_id != ''){
|
||||
formData.push({ name: 'ticket_id', value: ticket_id});
|
||||
}
|
||||
// console.log(formData);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form_action = '<?= base_url("/ticket/reply"); ?>';
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res)
|
||||
{
|
||||
if(res.status == true){
|
||||
// $('#new_mail_template').find('.close').click();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('Message Sent successfully!', 'Success');
|
||||
reloadTicket_conversation();
|
||||
}else if (res.status == false){
|
||||
toastr.error('Failed to Send Message', 'error');
|
||||
}
|
||||
|
||||
},
|
||||
error: function (xhr, status, error)
|
||||
{
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function()
|
||||
{
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.error('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error("Jodit editor instance is not defined.");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function reloadTicket_conversation() {
|
||||
$("#ticket_messages_div").load(location.href + " #ticket_messages_div");
|
||||
}
|
||||
|
||||
</script>
|
||||
140
app/Views/ticket_reports.php
Normal file
140
app/Views/ticket_reports.php
Normal 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>
|
||||
<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>
|
||||
204
app/Views/ticket_search.php
Normal file
204
app/Views/ticket_search.php
Normal file
@ -0,0 +1,204 @@
|
||||
<style>
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4 style="text-align: left;">Claim Filter</h4>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<a style="text-align: right;" 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></div>
|
||||
</div>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="ticket_type"> Claim Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="ticket_type" name="ticket_type">
|
||||
<option value="0">Select claim Type</option>
|
||||
<?php
|
||||
if (isset($ticket_type) && count($ticket_type)) {
|
||||
foreach ($ticket_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="pod_no">POD No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="pod_no" name="pod_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_no">Claim No<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="claim_no" name="claim_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_id"> Corporate Name <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Corporate</option>
|
||||
<?php
|
||||
if (isset($client_list) && count($client_list)) {
|
||||
foreach ($client_list as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_code">Employee ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_code" name="emp_code">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="tpa_id">TPA ID<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="tpa_id" name="tpa_id">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="emp_mobile_no">Employee Mobile No<span
|
||||
class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="emp_mobile_no" name="emp_mobile_no">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claim_status">Status<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="claim_status" name="claim_status">
|
||||
<option value="0">Select status</option>
|
||||
<?php /*
|
||||
if (isset($claim_status) && count($claim_status)) {
|
||||
foreach ($claim_status as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['status'] . "</option>";
|
||||
}
|
||||
}
|
||||
*/ ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
|
||||
<a href="<?= base_url("/ticket/list"); ?>" class="btn btn-secondary"id="clear-filters">Clear</a>
|
||||
<a class="btn btn-primary" id="get-emp-list" onclick="fetchTicketListData();">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="row" id="ticket_list_div">
|
||||
<?php include('ticket_list.php'); ?>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$('#client_id').select2();
|
||||
$('#claim_status').select2();
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#ticket_type').on('change',function(){
|
||||
var ticket_type = $('#ticket_type').val();
|
||||
var claim_status = <?= json_encode($claim_status) ?>;
|
||||
$('#claim_status').empty();
|
||||
$('#claim_status').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Claim Status'
|
||||
}));
|
||||
|
||||
// console.log('Claim Status:', claim_status);
|
||||
for (var i = 0;i<claim_status.length;i++){
|
||||
if(claim_status[i]['ticket_type'] == ticket_type){
|
||||
$('#claim_status').append($('<option>', {
|
||||
value: claim_status[i]['id'], // Use 'id' as the value
|
||||
text: claim_status[i]['claim_status'] // Use 'claim_status' as the text
|
||||
}));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function fetchTicketListData() {
|
||||
|
||||
var ticket_type = $('#ticket_type').val();
|
||||
var pod_no = $('#pod_no').val();
|
||||
var claim_no = $('#claim_no').val();
|
||||
var emp_code = $('#emp_code').val();
|
||||
var claim_status = $('#claim_status').val();
|
||||
var emp_mobile_no = $('#emp_mobile_no').val();
|
||||
var tpa_id = $('#tpa_id').val();
|
||||
var client_id = $('#client_id').val();
|
||||
|
||||
var requestData = {
|
||||
ticket_type_id: ticket_type,
|
||||
pod_no: pod_no,
|
||||
claim_number: claim_no,
|
||||
emp_code: emp_code,
|
||||
claim_status_id: claim_status,
|
||||
emp_mobile: emp_mobile_no,
|
||||
tpa_id: tpa_id,
|
||||
client_id: client_id,
|
||||
};
|
||||
|
||||
console.log("requestData", requestData);
|
||||
|
||||
var url = '<?= base_url('/ticket/list') ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
|
||||
|
||||
console.log('Filter Responce', response);
|
||||
|
||||
if (response.status == true) {
|
||||
$('#ticket_list_div').empty();
|
||||
$('#ticket_list_div').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 data.', 'ERROR');
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
47
app/Views/ticket_type_modal.php
Normal file
47
app/Views/ticket_type_modal.php
Normal file
@ -0,0 +1,47 @@
|
||||
<div class="modal fade" id="New_Ticket_modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel"></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="ticket_type"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="openTicketTypeAskModal">
|
||||
<option value="1">Claim-GMC</option>
|
||||
<option value="2">Claim-GPA</option>
|
||||
<option value="3">EDLI</option>
|
||||
<option value="4">GTLI</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" onclick="submitToRedirectTicketNewUrl(this)">submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function openTicketTypeAskModal(){
|
||||
var myModal = new bootstrap.Modal(document.getElementById('New_Ticket_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function submitToRedirectTicketNewUrl(){
|
||||
|
||||
console.log('function called')
|
||||
|
||||
let ticket_type = $('#openTicketTypeAskModal').val()
|
||||
console.log('ticket_type ', ticket_type)
|
||||
let url = '<?=base_url('/ticket/new/')?>' + ticket_type
|
||||
console.log('url ', url)
|
||||
window.location.href = url;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1,71 +1,31 @@
|
||||
<style>
|
||||
custom-dropdown-menu {
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0,0,0,.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
clear: both !important;
|
||||
font-weight: 400 !important;
|
||||
color: #212529 !important;
|
||||
text-align: inherit !important;
|
||||
white-space: nowrap !important;
|
||||
background-color: transparent !important;
|
||||
border: 0 !important;
|
||||
text-decoration: none !important;
|
||||
position: relative !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item i {
|
||||
margin-right: 8px !important;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Ensure the dropdown menu has a solid background */
|
||||
.custom-dropdown-menu::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Add a subtle backdrop effect */
|
||||
.custom-dropdown-menu::after {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.05);
|
||||
z-index: -2;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
} </style>
|
||||
<div class="row" id="tpa_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
|
||||
@ -170,6 +170,9 @@ table.dataTable tbody td {
|
||||
<th>Insurer Branch</th>
|
||||
<th>Policy</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Premium</th>
|
||||
<th>Statement Premium</th>
|
||||
<th>Premium Variance</th>
|
||||
<th>Expected Amount</th>
|
||||
<th>Statement Amount</th>
|
||||
<th>Variance</th>
|
||||
@ -186,9 +189,12 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['insurer_branch_name']; ?></td>
|
||||
<td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['original_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['statement_premium']) ? $row['statement_premium'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['premium_variance_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['exp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['statement_amount']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['variance_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['statement_amount']) ? $row['statement_amount'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['variance_amt']) ? $row['variance_amt'] : '0.00'; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user