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

This commit is contained in:
velz 2025-01-27 17:31:51 +05:30
commit 96ff58062d
38 changed files with 3787 additions and 162 deletions

View File

@ -482,3 +482,23 @@ $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');
});
//New Tickets
$routes->group("/ticket", ["filter" => "authMVC"], function ($routes) {
$routes->match( ['get', 'post'], 'list','TicketController::ticketList');
$routes->get('new','TicketController::ticket_form');
$routes->post('create','TicketController::createTicket');
$routes->get('update','TicketController::updateTicket');
$routes->get('view/(:any)','TicketController::view_ticket/$1');
$routes->get('mail_template','TicketController::createMailTemplate');
});

View File

@ -0,0 +1,521 @@
<?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 stmt.co_share_id = pt_co.id and ptp.policy_category = $insurerCategory and pt_co.insurer_id = ins.id THEN stmt.actual_bp_amt + stmt.actual_tp_amt + stmt.actual_tep_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
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(co.actual_bp_amt + co.actual_tep_amt + co.actual_tp_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
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 ptco ON pt.id = ptco.pt_id AND ptco.is_active = 1
LEFT JOIN co_share_stmt_details AS co ON ptco.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 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 [];
}
}
}

View File

@ -4045,6 +4045,20 @@ class ClientController extends AdminController
// $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();
}
// -------------------------------------------------------------------------------------------------------

View File

@ -1696,6 +1696,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))

View File

@ -1103,20 +1103,30 @@ class PolicyTransactionController extends BaseController
}
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['policy_issue_date'])){
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'])){
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'])){
@ -1162,7 +1172,8 @@ class PolicyTransactionController extends BaseController
'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,
'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,

View File

@ -0,0 +1,132 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use Kint\Kint;
use CodeIgniter\API\ResponseTrait;
class TicketController extends BaseController
{
use ResponseTrait;
protected $myLogger;
protected $ticketType;
protected $priorityType;
protected $relationshipType;
public function __construct()
{
$this->myLogger = \Config\Services::mylogger();
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"];
$this->priorityType = [
1 => "Low",
2 => "Medium",
3 => "High",
4 => "Urgent",
5 => "Emergency",
6 => "Critical"
];
$this->relationshipType = [
"self" => "Self",
"spouse" => "Spouse",
"son" => "Son",
"daughter" => "Daughter",
"father" => "Father",
"mother" => "Mother",
"father-in-law" => "Father-in-Law",
"mother-in-law" => "Mother-in-Law"
];
}
public function ticketList()
{
if ($this->request->is('get')) {
$data['page_name'] = "Claims";
$data['ticket_type'] = $this->ticketType;
$data['claim_status'] = [];
$data['client_list'] = [];
return $this->loadLayout('ticket_search', $data);
} else{
$data['ticket_data'] = $this->ticketSearch();
$html = view('ticket_list', $data);
return $this->respond(['status' => true, 'html' => $html], 200);
}
}
public function ticketSearch()
{
$search_data = $this->request->getPost();
// print_r($search_data); die;
$data = [
[
'id' => 1,
'status' => 'Approved',
'claim_no' => 'CL12345',
'tpa_id' => 'TPA001',
'emp_name' => 'John Doe',
'insurer_name' => 'ABC Insurance',
'client_name' => 'XYZ Corp',
'tat' => '5 Days',
],
[
'id' => 2,
'status' => 'Pending',
'claim_no' => 'CL12346',
'tpa_id' => 'TPA002',
'emp_name' => 'Jane Smith',
'insurer_name' => 'DEF Insurance',
'client_name' => 'LMN Ltd',
'tat' => '3 Days',
],
[
'id' => 3,
'status' => 'Rejected',
'claim_no' => 'CL12347',
'tpa_id' => 'TPA003',
'emp_name' => 'Alice Johnson',
'insurer_name' => 'GHI Insurance',
'client_name' => 'PQR Co',
'tat' => '7 Days',
],
];
return $data;
}
public function ticket_form()
{
$data['ticket_form'] = 1;
return $this->loadLayout('ticket_form_gmc', $data);
}
public function view_ticket($ticket_id)
{
$data = [];
return $this->loadLayout('ticket_edit_onbording', $data);
}
public function createTicket()
{
}
public function updateTicket()
{
}
public function createMailTemplate()
{
$data = [];
return $this->loadLayout('ticket_mail_template', $data);
}
}

View File

@ -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_","\u200C"
];
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

View File

@ -1226,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'];
@ -1252,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;

View File

@ -546,6 +546,7 @@ if (!function_exists('change_date_format')) {
'Y,m,d', // 2024,12,01
'd/m/Y', // 01/01/2025
'd-m-Y', // 01-01-2025
];

View File

@ -22,6 +22,6 @@ class PolicyTypeModel extends Model
"etp",
"iep",
"itp",
"question_json",'itep','etep'
"question_json",'itep','etep', 'policy_category',
];
}

View File

@ -0,0 +1,49 @@
<?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 = [];
// 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;
}
}

View File

@ -0,0 +1,49 @@
<?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 = [];
// 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;
}
}

View 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 = [];
// 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;
}
}

View File

@ -0,0 +1,49 @@
<?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 = [];
// 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;
}
}

View 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 = [];
// 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;
}
}

View 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 = [];
// 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;
}
}

View 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'] ?></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>

View 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'] ?></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>

157
app/Views/irba_report.php Normal file
View File

@ -0,0 +1,157 @@
<div class="row">
<div class="col-xl-12">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<!-- <div class="text-center"> -->
<div class="form-row">
<div class="form-group col-md-4" id="date_div">
<label>Date<span class="text-danger"></span></label>
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="fa fa-calendar"></i>&nbsp;
<span></span> <i class="fa fa-caret-down"></i>
</div>
<input type="hidden" id="startDate" value=<?= $default_start ?>>
<input type="hidden" id="endDate" value=<?= $default_end ?>>
</div>
<div class="form-group col-md-4">
<label>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')]
}
}, 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>

View File

@ -0,0 +1,276 @@
<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 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;">Motor</th>
<th colspan="2" style="text-align: center;">Marine Hull</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>

View File

@ -0,0 +1,353 @@
<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;">Motor</th>
<th colspan="3" style="text-align: center;">Marine Hull</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']; ?></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']; ?></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']; ?></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']; ?></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'];?></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'];?></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'];?></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']; ?></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']; ?></td>
<td class="right-align-input"><?php echo $row['total_policy_count'] ?></td>
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
<td class="right-align-input"><?php echo $row['total_revenue']; ?></td>
</tr>
<?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>

View 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>

View File

@ -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,17 +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>
<!-- srinivas -->
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- <script src="<?= base_url('public/unlayer/js/embed.js').''?>"></script> -->
<!-- srinivas -->
<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;
}
@ -591,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">
@ -627,7 +625,7 @@
</li>
<?php } ?>
<!--
<li>
<?php
$sessionData = get_session_userdata();
@ -635,12 +633,33 @@
$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="<?= base_url('/ticket/new') ?>">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>
</ul>
</div>
</li>
<li>
@ -652,7 +671,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>
@ -669,77 +688,82 @@
</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()))) { ?>
<?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="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<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="#policyTransactions" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<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>
<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>
<?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="#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>
<?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>
</li>
</ul>
</div>
</li>
<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>
<?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>
</li></ul></div>
<li>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
@ -747,41 +771,42 @@
</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>
<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>
</li>
<?php } ?>
</ul>
</div>
<!-- End Sidebar -->
</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">

View File

@ -175,7 +175,7 @@
<span class="slider round" style="height: 27px;"></span>
</label>
&nbsp; &nbsp;
<a href="" data-toggle="modal" id="account_maneger_summary_mail" onclick="getMailTemplateData(this)" data-target="#account_maneger_summary_mail_modal">Edit</a>
<a href="" data-toggle="modal" id="account_maneger_summary_mail" onclick="getMailTemplateData2(this)" data-target="#account_maneger_summary_mail_modal">Edit</a>
</div>
<div class="form-group col-md-5">
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
@ -446,6 +446,16 @@
<input type="file" id="Question_title_fileInput" style="display: none;">
<table id="attachment_table_ecard" class="table table-sm mb-0" style="margin-top: 30px;">
<thead>
<tr>
<th>Attachments</th>
<th>Action</th>
</tr>
</thead>
<tbody id="attachment_tbody_ecard">
</tbody>
</table>
</div>
@ -664,7 +674,24 @@
<div class="form-group col-md-2 testmail" style="display: none;">
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
</div>
</div><hr>
</div>
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
<select id="account_maneger_summary_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
<option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?>
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary'){ ?>
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>
<?php } ?>
<?php endforeach; ?>
</select>
<span id="copy-feedback" style="display: none; position: absolute; top: 50px; right: 10px; color: green; font-size: 12px;">
Copied to clipboard!
</span>
</div>
</div>
<hr>
<!-- Unlayer editor -->
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-12">
@ -897,7 +924,7 @@
}
else if (target.matches('#account_maneger_summary_mail_modal_customButton'))
{
editor4.selection.insertHTML($(target).val());
// editor4.selection.insertHTML($(target).val());
$(target).val('');
}
else if (target.matches('#client_hr_summary_mail_modal_customButton'))
@ -913,7 +940,7 @@
editor.setEditorValue('');
editor2.setEditorValue('');
editor3.setEditorValue('');
editor4.setEditorValue('');
// editor4.setEditorValue('');
editor5.setEditorValue('');
editor6.setEditorValue('');
@ -1275,10 +1302,10 @@
return word.charAt(0).toUpperCase() + word.slice(1);
}).join(' ');
}
template_name = '';
function getMailTemplateData(element)
{
var template_name = $(element).attr('id');
template_name = $(element).attr('id');
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "client_hr_summary_mail")
{
@ -1311,16 +1338,19 @@
if(res.id){
$('.testmail').show();
$('#attachment_table').show();
$('#attachment_table_ecard')
$('.setid').attr('data-id', res.id);
}else{
$('.testmail').hide();
$('#attachment_table').hide();
$('#attachment_table_ecard').hide();
$('.setid').attr('data-id', '');
}
}else{
$('.testmail').hide();
$('#attachment_table').hide();
$('#attachment_table_ecard').hide();
$('.setid').attr('data-id', '');
}
@ -1448,8 +1478,13 @@
function addHTMLInput(data = null) {
console.log('addHTMLInput function called');
const container = document.getElementById('attachment_tbody');
console.log(template_name);
var container = '';
if (template_name == 'member_welcome_mail'){
container = document.getElementById('attachment_tbody');
}else{
container = document.getElementById('attachment_tbody_ecard');
}
if (data) {
@ -1512,7 +1547,11 @@
}
function removeHTMLInput(element) {
const container = document.getElementById('attachment_tbody');
if (template_name == 'member_welcome_mail'){
const container = document.getElementById('attachment_tbody');
}else{
const container = document.getElementById('attachment_tbody_ecard');
}
const rows = container.querySelectorAll('.dynamic-form-row');
if (rows.length > 1) {
@ -1525,13 +1564,14 @@
event.preventDefault(); // Prevent the default form submission
var template_name = $('#member_welcome_mail_template_name').val();
// var template_name = template_name;
var client_id = $('#general_PrimaryKey').val();
// console.log(client_id);
const formData = new FormData(form);
formData.append('template_name', template_name);
formData.append('client_id', client_id);
console.log(formData.template_name);
const fileInput = form.querySelector('input[type="file"]');
// Check if a file is selected
@ -1597,7 +1637,7 @@
function removeAttachment(id){
var template_name = $('#member_welcome_mail_template_name').val();
// var template_name = template_name
var client_id = $('#general_PrimaryKey').val();
$('.loader').fadeIn();
@ -1751,10 +1791,10 @@ function initializeEditor(callback) {
}
// Modified template data function with better error handling
function getMailTemplateData(element) {
function getMailTemplateData2(element) {
const template_name = element.id;
const validTemplates = [
"account_maneger_summary_mail",
"account_maneger_summary_mail","member_reminder_mail","member_ecard_mail"
];
if (!validTemplates.includes(template_name)) {
@ -1824,6 +1864,7 @@ function getMailTemplateData(element) {
// Update UI elements
$('.testmail').toggle(!!res.id);
$('#attachment_table').toggle(!!res.id);
$('#attachment_table_ecard').toggle(!!res.id);
$('.setid').attr('data-id', res.id || '');
}else{
console.log("Inside else");
@ -1949,5 +1990,76 @@ function hideBranding(){
console.log('Overlay added to hide branding.');
});
}
function copyToClipboard(selectElement) {
const value = selectElement.value; // Get the selected value
if (value) {
// Use the Clipboard API to copy the value
navigator.clipboard.writeText(value)
.then(() => {
const feedback = document.getElementById('copy-feedback');
feedback.style.display = 'inline'; // Show the feedback message
setTimeout(() => {
feedback.style.display = 'none'; // Hide the feedback message after 2 seconds
}, 2000);
})
.catch(err => {
console.error('Failed to copy text: ', err);
});
}
}
</script>
<!-- <script src="https://editor.unlayer.com/embed.js"></script> -->
<!-- <script>
// Initialize Unlayer editor
unlayer.init({
id: 'editor-container', // Make sure to target your correct editor container ID
projectId: 1234, // Replace with your actual Unlayer project ID
tools: {
text: {
label: 'Text',
icon: 'fa fa-font'
}
},
paste: { // Enable the paste tool
label: 'Paste',
icon: 'fa fa-clipboard', // You can customize the icon here
action: function() {
// You can handle any custom behavior for paste here
console.log('Paste icon clicked!');
}
}
})
// Function to handle pasting clipboard content into a text block
async function pasteFromClipboard() {
try {
// Use the Clipboard API to get the clipboard text
const text = await navigator.clipboard.readText();
if (text) {
// Get the current selected block or create one if none exists
const editor = unlayer.getEditor();
const currentBlock = editor.getSelectedElement();
if (currentBlock && currentBlock.type === 'text') {
// If the selected block is a text block, insert the text there
editor.insertText(text);
} else {
// If there's no text block, create one and insert the text
editor.addTextBlock({
"type": "text",
"text": text
});
}
}
} catch (err) {
console.error('Failed to read clipboard contents: ', err);
}
}
// Listen for the click event inside the editor container
document.getElementById('editor-container').addEventListener('click', function() {
pasteFromClipboard(); // Paste clipboard content when clicked inside editor
});
</script> -->

View File

@ -1159,17 +1159,20 @@ function amountCalculation(input) {
console.log('gst_per_amt', gst_per_amt);
// $('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
if(gst_amount != 0){
if (event.target.id.startsWith('non_comm_per_amt')) {
if (event.target.id.startsWith('non_comm_per_amt')) {
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}else if (event.target.id.startsWith('gst_amount')) {
$('#gst_amount_' + input).val(!isNaN(gst_amount) && isFinite(gst_amount) ? gst_amount.toFixed(2) : '0.00');
}else{
if(ncpa != 0 && ncpa != ""){
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}else{
$('#gst_amount_' + input).val(!isNaN(gst_amount) && isFinite(gst_amount) ? gst_amount.toFixed(2) : '0.00');
$('#gst_amount_' + input).val(!isNaN(gst_per_amt) && isFinite(gst_per_amt) ? gst_per_amt.toFixed(2) : '0.00');
}
}else{
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}
let finalTotal = tpTotal + gst_per_amt + stamp_duty_amt;
console.log('Summed Amount:', finalTotal);
@ -1186,11 +1189,15 @@ function amountCalculation(input) {
expectedAmount = agreed_amount;
// console.log('Formula 1 AGREED AMOUNT');
}else if(sum_of_agreed_premium > 0){
expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
//expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
let sumOfTheAggreedPer = agreed_bp_per + agreed_tp_per + agreed_tep_per;
expectedAmount = (tpTotal * sumOfTheAggreedPer);
expectedAmount = expectedAmount / 100;
// console.log('Formula 2 AGREED BP TP/TEP %');
}else{
expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
// expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
let sumOfTheStandardPer = standard_bp_per + standard_tp_per + standard_tep_per;
expectedAmount = (tpTotal * sumOfTheStandardPer);
console.log(expectedAmount)
expectedAmount = expectedAmount / 100;
// console.log('Formula 3 STANDARD BP TP/TEP %');

View File

@ -548,10 +548,10 @@ document.addEventListener("DOMContentLoaded", function () {
});
// var closure_date = flatpickr("#policy_issue_date", {
// dateFormat: "d/m/Y",
// allowInput: false
// });
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",

View File

@ -1842,17 +1842,20 @@ function amountCalculation(input) {
console.log('gst_per_amt', gst_per_amt);
// $('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
if(gst_amount != 0){
if (event.target.id.startsWith('non_comm_per_amt')) {
if (event.target.id.startsWith('non_comm_per_amt')) {
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}else if (event.target.id.startsWith('gst_amount')) {
$('#gst_amount_' + input).val(!isNaN(gst_amount) && isFinite(gst_amount) ? gst_amount.toFixed(2) : '0.00');
}else{
if(ncpa != 0 && ncpa != ""){
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}else{
$('#gst_amount_' + input).val(!isNaN(gst_amount) && isFinite(gst_amount) ? gst_amount.toFixed(2) : '0.00');
$('#gst_amount_' + input).val(!isNaN(gst_per_amt) && isFinite(gst_per_amt) ? gst_per_amt.toFixed(2) : '0.00');
}
}else{
$('#gst_amount_' + input).val(!isNaN(ncpa_gst_per_amt) && isFinite(ncpa_gst_per_amt) ? ncpa_gst_per_amt.toFixed(2) : '0.00');
}
let finalTotal = tpTotal + gst_per_amt + stamp_duty_amt;
console.log('Summed Amount:', finalTotal);
@ -1869,11 +1872,15 @@ function amountCalculation(input) {
expectedAmount = agreed_amount;
// console.log('Formula 1 AGREED AMOUNT');
}else if(sum_of_agreed_premium > 0){
expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
//expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
let sumOfTheAggreedPer = agreed_bp_per + agreed_tp_per + agreed_tep_per;
expectedAmount = (tpTotal * sumOfTheAggreedPer);
expectedAmount = expectedAmount / 100;
// console.log('Formula 2 AGREED BP TP/TEP %');
}else{
expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
// expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
let sumOfTheStandardPer = standard_bp_per + standard_tp_per + standard_tep_per;
expectedAmount = (tpTotal * sumOfTheStandardPer);
console.log(expectedAmount)
expectedAmount = expectedAmount / 100;
// console.log('Formula 3 STANDARD BP TP/TEP %');
@ -3890,9 +3897,11 @@ function populateTable(dataArray, cd_ac_pk) {
case 2: // CD Account Number
cell.find('select').val(cd_ac_pk);
var selectElement = cell.find('select');
console.log('selectElement', selectElement);
selectElement.val(cd_ac_pk).prop('selected', true);
selectElement.toggleClass('readonly-select', !!disable_td)
setTimeout(function(){
console.log('selectElement', selectElement);
selectElement.find('option[value="' + cd_ac_pk + '"]').prop('selected', true);
selectElement.toggleClass('readonly-select', !!disable_td)
}, 2000)
@ -4240,8 +4249,14 @@ function getCdAmount(cd_ac_pk, increment){
console.log('Data fetched successfully:', response);
if (response.status == true) {
$('#cd_current_balance_'+increment).val(response.data.balance);
}
if(!response.data.balance){
$('#cd_current_balance_'+increment).val(0.00);
}else{
$('#cd_current_balance_'+increment).val(response.data.balance);
}
} else{
$('#cd_current_balance_'+increment).val(0.00);
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);

View File

@ -0,0 +1,67 @@
<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 class="mb-3">
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/user.jpg"
class="user-avatar rounded-circle img-fluid" style="max-width: 100px">
</div>
<div class="mb-3">
<div>RUPESH</div>
<span class="badge badge-dark">User</span>
</div>
</div>
</div>
<div class="col">
<div class="mb-3">
<div class="text-muted"><i class="fa fa-calendar"></i> 16 December 2024 04:15 pm</div>
</div>
<div id="msg_388" class="form-group">
Body </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>
<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 class="mb-3">
<img src="https://venbait.in/nhance/helpdesk/dev/assets/helpdeskz/images/agent.jpg"
class="user-avatar rounded-circle img-fluid" style="max-width: 100px">
</div>
<div class="mb-3">
<div>Venkatesh HelpDesk Admin</div>
<span 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> 24 January 2025 03:41 pm</div>
</div>
<div id="msg_394" class="form-group">
<p>hi how are you i am fine</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>

View File

@ -0,0 +1,72 @@
<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">Ticket</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>
</ul>
<!-- Tab Content -->
<div class="tab-content">
<div class="tab-pane fade show active" id="general-tab">
<?php 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>
</div>
</div>
</div>
</div>
<div id="ticket_conversation_div">
<?php include("ticket_conversation.php") ?>
</div>

View File

@ -0,0 +1,246 @@
<div class="row">
<div class="col-12">
<div class="<?= isset($ticket_form) ? "card" : "" ?>">
<div class="card-body">
<?php if(isset($ticket_form)){ ?>
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Claim GMC </h4>
</div>
</div>
<?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc"enctype="multipart/form-data">
<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) {
echo "<option value=" . $value['id'] . ">" . $value['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($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-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($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-3">
<label for="policy_no">Policy No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
name="policy_no">
</div>
<div class="form-group col-md-3">
<label for="acm_id">Insurer<span class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0">Select insurer</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-3">
<label for="acm_id">TPA<span class="text-danger"></span></label>
<select class="form-control" id="tpa_id" name="tpa_id">
<option value="0">Select TPA</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-3">
<label for="client_name">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($claim_status) && count($claim_status)) {
foreach ($claim_status 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" placeholder="Enter Employee ID"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
name="emp_name">
</div>
<div class="form-group col-md-3">
<label for="insured_name"> Insured Name <span class="text-danger"></span></label>
<select class="form-control" id="insured_name" name="insured_name">
<option value="0">Select Insured Name</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="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($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="client_name">Employee Mobile No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_mobile" placeholder="Enter EMP Mobile"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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($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="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($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="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($client['short_name']) ? $client['short_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($client['client_name']) ? $client['client_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>" 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($client['short_name']) ? $client['short_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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>

View File

@ -0,0 +1,173 @@
<div class="row">
<div class="col-12">
<div class="<?= isset($ticket_form) ? "card" : "" ?>">
<div class="card-body">
<?php if(isset($ticket_form)){ ?>
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 id="page_title" style="position: relative;">Claim GPA </h4>
</div>
</div>
<?php } ?>
<form role="form" class="parsley-examples" method="post" id="ticket_form_gmc"
enctype="multipart/form-data">
<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" 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-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($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-3">
<label for="client_name">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($claim_status) && count($claim_status)) {
foreach ($claim_status as $key => $value) {
echo "<option value=" . $value['id'] . ">" . $value['client_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="acm_id">Insurer<span class="text-danger"></span></label>
<select class="form-control" id="insurer_id" name="insurer_id">
<option value="0">Select insurer</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-3">
<label for="policy_no">Policy No<span class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
name="policy_no">
</div>
<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="emp_code">Employee ID<span class="text-danger"></span></label>
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee ID"
value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
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="text" class="form-control" id="emp_name" placeholder="Enter Employee Name"
value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
name="emp_name">
</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($client['client_name']) ? $client['client_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>" 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($client['client_name']) ? $client['client_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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($client['short_name']) ? $client['short_name'] : '' ?>"
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>

View File

@ -0,0 +1,33 @@
<div class="row">
<div class="col-12">
<div class="card-body">
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
<th>Field</th>
<th>Old Value</th>
<th>New Value</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['status']; ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['client_name']; ?></td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div> <!-- end col-->

136
app/Views/ticket_list.php Normal file
View File

@ -0,0 +1,136 @@
<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>
<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><?php echo $row['status']; ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></td>
<td><?php echo $row['emp_name']; ?></td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['client_name']; ?></td>
<td><?php echo $row['tat']; ?></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: '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) {
newClaim()
}
}
],
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
}
function newClaim(){
let url = '<?= base_url('ticket/new'); ?>'
window.location.href = url
}
</script>

View File

@ -0,0 +1,174 @@
<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>
<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>Status</th>
<th>Policy Type</th>
</tr>
</thead>
<tbody>
<?php if (isset($ticket_data)) { ?>
<?php foreach($ticket_data as $index => $row){ ?>
<tr>
<td><?php echo $row['status']; ?></td>
<td><?php echo $row['claim_no']; ?></td>
<td><?php echo $row['tpa_id']; ?></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="account_maneger_summary_mail_form"
enctype="multipart/form-data">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-6">
<label for="emp_code">Template Name</label>
<input type="text" id="template_name" name="template_name" value="Trigger 1" class="form-control" placeholder="Template Name">
</div>
<div class="form-group col-md-3">
<label for="emp_code">Policy Type</label>
<select class="form-control" id="policy_type" name="policy_type">
<option value="0">Select Policy Type</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-3">
<label for="emp_code">Claim Status</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>
<hr>
<!-- Unlayer editor -->
<div class="form-row">
<div class="form-group col-md-12">
<textarea class="form-control" rows="5" placeholder="Enter Mail Content"></textarea>
</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.");
}
});
function openModal() {
var myModal = new bootstrap.Modal(document.getElementById('new_mail_template'));
myModal.show();
}
</script>

62
app/Views/ticket_note.php Normal file
View File

@ -0,0 +1,62 @@
<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="ticket_note" rows="3"
placeholder="Enter Text"><?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?></textarea>
</div>
</div>
</div>
<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() {
$("#ticket_note_form").submit(function(event) {
event.preventDefault();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var url = '<?= base_url("/ticket/note"); ?>';
var formData = new FormData($('#ticket_note_form')[0]);
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
if (response.status == true) {
$('.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>

View File

@ -0,0 +1,67 @@
<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" class="form-control" id="emp_mail_for_to" name="emp_mail_for_to" placeholder="Recipient email">
</div>
<!-- Subject Field -->
<div class="form-group col-md-4">
<label for="mail_subject">Subject</label>
<input type="text" class="form-control" id="mail_subject" name="mail_subject" placeholder="Mail subject">
</div>
<!-- Mail Content Field -->
<div class="form-group col-md-12">
<label for="mail_content">Mail Content</label>
<textarea class="form-control" id="mail_content" name="mail_content" rows="3" placeholder="Enter mail content">
<?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?>
</textarea>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="form-group text-right">
<button type="submit" class="btn btn-primary" id="ticket_reply_submit">Submit</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$("#ticket_reply_form").submit(function(event) {
event.preventDefault();
// Show loaders
$('.loader, .loader-mask').fadeIn();
var url = '<?= base_url("/ticket/reply"); ?>';
var formData = new FormData(this);
// Send AJAX request
sendAjaxRequestForGlobal(url, 'POST', formData, function(response) {
$('.loader, .loader-mask').fadeOut();
if (response.status) {
toastr.success('Mail sent successfully.', 'Success');
} else {
toastr.error(response.message || 'Failed to send mail.', 'Error');
}
}, function(xhr, status, error) {
console.error('Error:', error);
console.error('Response:', xhr.responseText);
$('.loader, .loader-mask').fadeOut();
toastr.error('An error occurred while processing the request.', 'Error');
});
});
});
</script>

170
app/Views/ticket_search.php Normal file
View File

@ -0,0 +1,170 @@
<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">
<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 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 ($ticket_type 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>
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: ticket_type,
pod_no: pod_no,
claim_no: claim_no,
emp_code: emp_code,
claim_status: claim_status,
emp_mobile_no: 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>

View File

@ -0,0 +1,67 @@
<?php
namespace Tests\Unit\Helpers;
use PHPUnit\Framework\TestCase;
use App\Helpers\ExcelSanitizeHelper;
class ExcelSanitizeHelperTest extends TestCase
{
/**
* Test sanitizeArrayData with various input scenarios.
*/
public function testSanitizeArrayData()
{
// Test with a flat array
$input = [
"validString" => "HelloWorld",
"withNonPrintable" => "71030034240400000016",
"withWhitespace" => " Trim me ",
"nonStringValue" => 'Hello
World',
];
$expected = [
"validString" => "HelloWorld",
"withNonPrintable" => "71030034240400000016",
"withWhitespace" => "Trim me",
"nonStringValue" => 'HelloWorld',
];
$result = ExcelSanitizeHelper::sanitizeArrayData($input);
// var_dump($input);
// var_dump($result);
$this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input));
// Test with nested arrays
$input = [
"nested" => [
"validString" => "71030034240400000016",
"withNonPrintable" => "Nested\x01\x02String_x000A_",
],
"withWhitespace" => " Outer whitespace ",
];var_dump($input);
$expected = [
"nested" => [
"validString" => "71030034240400000016",
"withNonPrintable" => "NestedString",
],
"withWhitespace" => "Outer whitespace",
];
$this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input));
// Test with empty array
$this->assertSame([], ExcelSanitizeHelper::sanitizeArrayData([]));
// Test with an array containing only non-string values
$input = [
"integer" => 42,
"float" => 3.14,
"boolean" => true,
"null" => null,
];
$this->assertSame($input, ExcelSanitizeHelper::sanitizeArrayData($input));
// Test with invalid input to ensure graceful handling (edge case)
$input = ["invalid" => "\x00\x01\x7F_x000D_", "normal" => "Text"];
$expected = ["invalid" => "", "normal" => "Text"];
$this->assertSame($expected, ExcelSanitizeHelper::sanitizeArrayData($input));
}
}