Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
59861107f1
@ -29,6 +29,7 @@ $routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
|
|||||||
$routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
|
$routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
|
||||||
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
$routes->get("sendextraparam", "ClientController::sendextraparam");
|
||||||
|
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
|
|||||||
@ -44,8 +44,11 @@ use App\Controllers\EmpDataServiceController;
|
|||||||
use App\Controllers\GoogleDriveController;
|
use App\Controllers\GoogleDriveController;
|
||||||
|
|
||||||
use App\Helpers\sendMailNotification;
|
use App\Helpers\sendMailNotification;
|
||||||
|
use App\Models\PTCOShareDetailsModel;
|
||||||
use App\Models\RFQModel;
|
use App\Models\RFQModel;
|
||||||
use App\Models\TicketMasterModel;
|
use App\Models\TicketMasterModel;
|
||||||
|
use SebastianBergmann\Type\NullType;
|
||||||
|
use Kint\Kint;
|
||||||
|
|
||||||
class ClientController extends AdminController
|
class ClientController extends AdminController
|
||||||
{
|
{
|
||||||
@ -4321,4 +4324,307 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public function updateRenewalData()
|
||||||
|
{
|
||||||
|
$db = db_connect();
|
||||||
|
$renewalData = $db->table('old_renewal_data_copy')
|
||||||
|
->where('client_id IS NOT NULL')
|
||||||
|
->where('is_inserted != 1')
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$successData = [];
|
||||||
|
foreach ($renewalData as $key => $value) {
|
||||||
|
// Get branch_id properly
|
||||||
|
$branch = $this->clientBranchModel->where('client_id', $value['client_id'] ?? 0)->first();
|
||||||
|
$value['branch_id'] = $branch['branch_id'] ?? null;
|
||||||
|
|
||||||
|
// Fix vehicle_id key (previously "vehicel_id")
|
||||||
|
$value['vehicle_id'] = null;
|
||||||
|
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
|
||||||
|
$value['vehicle_id'] = $this->prepareVehicleData($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process client policy, policy transaction, and co-share details
|
||||||
|
$value['client_policy_id'] = $this->prepareClientPolicy($value);
|
||||||
|
$value['pt_id'] = $this->preparePolicyData($value);
|
||||||
|
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
|
||||||
|
|
||||||
|
// Update is_inserted field in DB
|
||||||
|
$db->table('old_renewal_data_copy')
|
||||||
|
->where('id', $value['id'])
|
||||||
|
->set(['is_inserted' => 1])
|
||||||
|
->update();
|
||||||
|
|
||||||
|
$successData[] = ['id' => $value['id'], 'client' => $value['insured']];
|
||||||
|
}
|
||||||
|
|
||||||
|
kint::dump($successData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// private function preparePolicyData($renewalData)
|
||||||
|
// {
|
||||||
|
// $data = [
|
||||||
|
// 'issuer' => $renewalData['issuer_type_id'],
|
||||||
|
// 'client_id' => $renewalData['client_id'],
|
||||||
|
// 'client_branch_id' => $renewalData['branch_id'] ?? null,
|
||||||
|
// 'vehicle_id' => $renewalData['vehicle_id'],
|
||||||
|
// 'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
// 'policy_type_id' => $renewalData['policy_type_id'],
|
||||||
|
// 'client_policy_id' => $renewalData['client_policy_id'] ?? null,
|
||||||
|
// 'policy_no' => $renewalData['policy_no'],
|
||||||
|
// 'policy_issue_date' => $renewalData['date_date_of_issue'],
|
||||||
|
// 'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||||
|
// 'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||||
|
// 'policy_holder_name' => $renewalData['insured'],
|
||||||
|
// 'status' => 'completed',
|
||||||
|
// 'is_active' => 1,
|
||||||
|
// 'tsi' => '500000',
|
||||||
|
// 'month' => '2025-02-01',
|
||||||
|
// 'ct_type' => 1,
|
||||||
|
// 'cd_ac_pk' => $renewalData['cd_ac_pk'] ?? null,
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $policyTransactionModel = new PolicyTransactionModel();
|
||||||
|
// return $policyTransactionModel->insert($data);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private function prepareVehicleData($renewalData)
|
||||||
|
// {
|
||||||
|
// $vehicleData = [
|
||||||
|
// 'vehicle_no' => $renewalData['veh_no'],
|
||||||
|
// 'owner' => $renewalData['client_id'],
|
||||||
|
// 'branch_id' => ($renewalData['client_type_id'] == 1) ? $renewalData['branch_id'] : null,
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $vehicleModel = new VehicleModel();
|
||||||
|
// return $vehicleModel->insert($vehicleData);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private function preparePtCoShareDetails($renewalData)
|
||||||
|
// {
|
||||||
|
// $ptCoShareDetails = [
|
||||||
|
// 'pt_id' => $renewalData['pt_id'],
|
||||||
|
// 'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
// 'co_share_type' => 0,
|
||||||
|
// 'co_share_per' => 0.00,
|
||||||
|
// 'bp_amt' => 0.00,
|
||||||
|
// 'tp_amt' => 0.00,
|
||||||
|
// 'tep_amt' => 0.00,
|
||||||
|
// 'follower_policy_no' => $renewalData['policy_no'],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $ptCoShareDetailsModel = new PTCOShareDetailsModel();
|
||||||
|
// return $ptCoShareDetailsModel->insert($ptCoShareDetails);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private function prepareClientPolicy($renewalData)
|
||||||
|
// {
|
||||||
|
// $clientPolicy = [
|
||||||
|
// 'client_id' => $renewalData['client_id'],
|
||||||
|
// 'client_branch_id' => $renewalData['branch_id'],
|
||||||
|
// 'policy_type_id' => $renewalData['policy_type_id'],
|
||||||
|
// 'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
// 'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
// 'policy_no' => $renewalData['policy_no'],
|
||||||
|
// 'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||||
|
// 'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||||
|
// 'policy_status' => 1,
|
||||||
|
// 'gst' => 18.00,
|
||||||
|
// 'cd_ac_pk' => $renewalData['cd_ac_pk'],
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $clientPolicyModel = new ClientPolicyModel();
|
||||||
|
// return $clientPolicyModel->insert($clientPolicy);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private function preparePolicyData($renewalData)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'issuer' => $renewalData['issuer_type_id'],
|
||||||
|
'client_id' => $renewalData['client_id'],
|
||||||
|
'client_branch_id' => $renewalData['branch_id'] ?? 0,
|
||||||
|
'vehicle_id' => $renewalData['vehicel_id'],
|
||||||
|
'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
'tpa_id' => null,
|
||||||
|
'tpa_branch_id' => null,
|
||||||
|
'policy_type_id' => $renewalData['policy_type_id'],
|
||||||
|
'client_policy_id' => $renewalData['client_policy_id'] ?? null,
|
||||||
|
'issue_type' => 1,
|
||||||
|
'source_client_policy_id' => null,
|
||||||
|
'policy_no' => $renewalData['policy_no'],
|
||||||
|
'cd_ac_no' => null,
|
||||||
|
'policy_issue_date' => $renewalData['date_date_of_issue'],
|
||||||
|
'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||||
|
'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||||
|
'action_type' => 'inception',
|
||||||
|
'endorsement_no' => null,
|
||||||
|
'data_received_date' => null,
|
||||||
|
'closure_date' => null,
|
||||||
|
'emp_count' => null,
|
||||||
|
'dependent_count' => null,
|
||||||
|
'revenue_type' => $renewalData['revenue_type'] ?? null,
|
||||||
|
'co_share' => 0,
|
||||||
|
'pre_payable_by' => 1,
|
||||||
|
'bro_payable_by' => 1,
|
||||||
|
'tsi' => '500000',
|
||||||
|
'status' => 'completed',
|
||||||
|
'ct_status' => 0,
|
||||||
|
'is_active' => 1,
|
||||||
|
'co_broking_status' => null,
|
||||||
|
'installment' => 0,
|
||||||
|
'installment_data' => null,
|
||||||
|
'location' => null,
|
||||||
|
'links' => null,
|
||||||
|
'stage' => null,
|
||||||
|
'etat' => null,
|
||||||
|
'etat_band' => null,
|
||||||
|
'edate' => null,
|
||||||
|
'renewal_date' => null,
|
||||||
|
'rollover_date' => null,
|
||||||
|
'policy_holder_name' => $renewalData['insured'],
|
||||||
|
'same_as_proposer' => 1, // 1 - Yes, 0 - No
|
||||||
|
'ref' => $renewalData['ref'],
|
||||||
|
'spl' => null,
|
||||||
|
'fund_received' => null,
|
||||||
|
'listed_insurers' => null,
|
||||||
|
'ppteam' => null,
|
||||||
|
'endorse_eff_date' => null,
|
||||||
|
'month' => '2025-02-01',
|
||||||
|
'sales_generated_by' => null,
|
||||||
|
'serviced_by' => null,
|
||||||
|
'ct_type' => 1,
|
||||||
|
'ct_tran_id' => null,
|
||||||
|
'remarks' => null,
|
||||||
|
'cd_ac_pk' =>$renewalData['cd_ac_pk'] ?? null,
|
||||||
|
'install_due_date' => null,
|
||||||
|
'policy_with_corr' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
// kint::dump($data);
|
||||||
|
$policyTransactionModel = new PolicyTransactionModel();
|
||||||
|
$id = $policyTransactionModel->insert($data);
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepareVehicleData($renewalData)
|
||||||
|
{
|
||||||
|
$vehicleData = [
|
||||||
|
'vehicle_no' => $renewalData['veh_no'],
|
||||||
|
'type' => null,
|
||||||
|
'description' => null,
|
||||||
|
'owner' => $renewalData['client_id'], // client_id
|
||||||
|
'branch_id' => $renewalData['client_type_id'] == 1 ? $renewalData['branch_id'] : null, // client_branch_id
|
||||||
|
'old_owner' => null,
|
||||||
|
'rc' => null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$VehicleModel = new VehicleModel();
|
||||||
|
$id = $VehicleModel->insert($vehicleData);
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function preparePtCoShareDetails($renewalData)
|
||||||
|
{
|
||||||
|
$pt_co_share_details = [
|
||||||
|
|
||||||
|
'pt_id' => $renewalData['pt_id'],
|
||||||
|
'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
'co_share_type' => 0,
|
||||||
|
'co_share_per' => 0.00,
|
||||||
|
'bp_amt' => 0.00,
|
||||||
|
'bp_gst_amt' => 0.00,
|
||||||
|
'bp_igst' => 0,
|
||||||
|
'bp_sgst' => 0,
|
||||||
|
'bp_cgst' => 0,
|
||||||
|
'tp_amt' => 0.00,
|
||||||
|
'tp_gst_amt' => 0.00,
|
||||||
|
'tp_igst' => 0.00,
|
||||||
|
'tp_sgst' => 0.00,
|
||||||
|
'tp_cgst' => 0.00,
|
||||||
|
'tep_amt' => 0.00,
|
||||||
|
'tep_gst_amt' => 0.00,
|
||||||
|
'tep_igst' => 0.00,
|
||||||
|
'tep_sgst' => 0.00,
|
||||||
|
'tep_cgst' => 0.00,
|
||||||
|
'agreed_amt' => 0.00,
|
||||||
|
'agreed_bp_per' => 0.00,
|
||||||
|
'agreed_tp_per' => 0.00,
|
||||||
|
'agreed_tep_per' => 0.00,
|
||||||
|
'standerd_bp_per' => 0.00,
|
||||||
|
'standerd_tp_per' => 0.00,
|
||||||
|
'standerd_tep_per' => 0.00,
|
||||||
|
'actual_bp_amt' => 0.00,
|
||||||
|
'actual_tp_amt' => 0.00,
|
||||||
|
'actual_tep_amt' => 0.00,
|
||||||
|
'actual_bp_per' => 0.00,
|
||||||
|
'actual_tp_per' => 0.00,
|
||||||
|
'actual_tep_per' => 0.00,
|
||||||
|
'actual_bp_brokerage_amt' => 0.00,
|
||||||
|
'actual_tp_brokerage_amt' => 0.00,
|
||||||
|
'actual_tep_brokerage_amt' => 0.00,
|
||||||
|
'reward' => 0.00,
|
||||||
|
'exp_amt' => 0.00,
|
||||||
|
'variance' => 0.00,
|
||||||
|
'remark' => null,
|
||||||
|
'cd_ac_no' => null,
|
||||||
|
'amount' => 0.00,
|
||||||
|
'stamp_duty' => 0.00,
|
||||||
|
'gst_type' => 0,
|
||||||
|
'cop_amt' => 0.00,
|
||||||
|
'statement_id' => 0,
|
||||||
|
'follower_policy_no' => $renewalData['policy_no'],
|
||||||
|
'non_comm_per_amt' => 0.00
|
||||||
|
];
|
||||||
|
|
||||||
|
$PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||||
|
$id = $PTCOShareDetailsModel->insert($pt_co_share_details);
|
||||||
|
return $id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function prepareClientPolicy($renewalData)
|
||||||
|
{
|
||||||
|
$client_policy = [
|
||||||
|
'client_id' => $renewalData['client_id'],
|
||||||
|
'client_branch_id' => $renewalData['branch_id'],
|
||||||
|
'policy_type_id' => $renewalData['policy_type_id'],
|
||||||
|
'insurer_id' => $renewalData['insurer_id'],
|
||||||
|
'insurer_branch_id' => $renewalData['insurer_branch_id'],
|
||||||
|
'tpa_id' => null,
|
||||||
|
'tpa_branch_id' => null,
|
||||||
|
'policy_start_date' => $renewalData['date_policy_start_date'],
|
||||||
|
'policy_end_date' => $renewalData['date_policy_end_date'],
|
||||||
|
'policy_no' => $renewalData['policy_no'],
|
||||||
|
'cd_ac_no' => null,
|
||||||
|
'policy_status' => 1,
|
||||||
|
'policy_terms' => null,
|
||||||
|
'is_addon' => 1,
|
||||||
|
'base_policy' => null,
|
||||||
|
'inception_type' => 1,
|
||||||
|
'open_for_enrollment' => 0,
|
||||||
|
'gst' => 18.00,
|
||||||
|
'enrolment_visibility' => 1,
|
||||||
|
'open_date' => null,
|
||||||
|
'close_date' => null,
|
||||||
|
'reminder_date' => null,
|
||||||
|
'disclaimer' => null,
|
||||||
|
'is_member_modify_allowed' => 0,
|
||||||
|
'cd_ac_pk' => $renewalData['cd_ac_pk'],
|
||||||
|
'is_lgbtq' => 0
|
||||||
|
];
|
||||||
|
|
||||||
|
$ClientPolicyModel = new ClientPolicyModel();
|
||||||
|
$id = $ClientPolicyModel->insert($client_policy);
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,7 +152,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||||
|
|
||||||
if ($policy_details['cd_ac_no'] == null) {
|
if ($policy_details['cd_ac_pk'] == null) {
|
||||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||||
|
|
||||||
if ($policy_details['cd_ac_no'] == null) {
|
if ($policy_details['cd_ac_pk'] == null) {
|
||||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -951,7 +951,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if(empty($additionData) && empty($deletionData) && empty($inceptionData) && empty($correctionData) && empty($enhancementData) && empty($dependentAdditionData)){
|
if(empty($additionData) && empty($deletionData) && empty($inceptionData) && empty($correctionData) && empty($enhancementData) && empty($dependentAdditionData)){
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//for cd tranction and cd master data is empty check
|
//for cd tranction and cd master data is empty check
|
||||||
@ -959,7 +959,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
$policy_details = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||||
|
|
||||||
if ($policy_details['cd_ac_no'] == null) {
|
if ($policy_details['cd_ac_pk'] == null) {
|
||||||
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
$this->myLogger->logme('error', 'The policy does not have a CD account number.');
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
@ -1829,7 +1829,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if(!empty($name) && !empty($emp_code)){
|
if(!empty($name) && !empty($emp_code)){
|
||||||
|
|
||||||
$totals = $totals + $amount;
|
$totals = $totals + floatval($amount);
|
||||||
|
|
||||||
$query = $db->table('employee_polices');
|
$query = $db->table('employee_polices');
|
||||||
$query->select('employee_polices.id');
|
$query->select('employee_polices.id');
|
||||||
|
|||||||
@ -590,7 +590,16 @@ class EmployeeController extends AdminController
|
|||||||
$batch_data['event_type'] = $array;
|
$batch_data['event_type'] = $array;
|
||||||
$return = $empDataServiceController->generateExcelForAllEventType($batch_data);
|
$return = $empDataServiceController->generateExcelForAllEventType($batch_data);
|
||||||
|
|
||||||
if($return === 6){
|
if ($return === 0) {
|
||||||
|
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
|
||||||
|
}else if($return === 5){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}
|
||||||
|
else if($return === 6){
|
||||||
|
|
||||||
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
@ -2225,6 +2234,7 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//UPDATE EMPLOYEE
|
||||||
public function update_emp_data()
|
public function update_emp_data()
|
||||||
{
|
{
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
|
|||||||
@ -179,7 +179,7 @@ class NotificationController extends AdminController
|
|||||||
// This function for sent a mail for testing
|
// This function for sent a mail for testing
|
||||||
public function sentTestMail($template_id, $test_mail)
|
public function sentTestMail($template_id, $test_mail)
|
||||||
{
|
{
|
||||||
$notification_data = $this->notificationModel->where('id', $template_id)->where('enabled', 1)->first();
|
$notification_data = $this->notificationModel->where('id', $template_id)->first();
|
||||||
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
||||||
|
|
||||||
if(!empty($notification_data)){
|
if(!empty($notification_data)){
|
||||||
|
|||||||
@ -141,23 +141,71 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function ticketSearch($action = null)
|
public function ticketSearch($action = null)
|
||||||
{
|
{
|
||||||
|
$db = db_connect();
|
||||||
|
|
||||||
|
$subquery = $db->table('ticket_history th')
|
||||||
|
->select([
|
||||||
|
'th.ticket_id',
|
||||||
|
"CASE
|
||||||
|
WHEN DATEDIFF(
|
||||||
|
th.created_at,
|
||||||
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
|
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||||
|
WHEN DATEDIFF(
|
||||||
|
th.created_at,
|
||||||
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
|
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||||
|
WHEN DATEDIFF(
|
||||||
|
th.created_at,
|
||||||
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
|
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||||
|
ELSE 'Above 20 Days'
|
||||||
|
END AS tat"
|
||||||
|
])
|
||||||
|
->join('ticket_master tm', 'tm.id = th.ticket_id', 'right')
|
||||||
|
->where('tm.is_active', 1)
|
||||||
|
->groupBy('th.ticket_id, tm.created_at');
|
||||||
|
|
||||||
//action 1 get last 100 rows, action 2 filter and get all rows related to that
|
//action 1 get last 100 rows, action 2 filter and get all rows related to that
|
||||||
if ($action == 1) {
|
if ($action == 1) {
|
||||||
$data = $this->ticketMasterModel
|
|
||||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
$query = $db->table('ticket_master tm')
|
||||||
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
->select([
|
||||||
insurers.name as insurer_name, clients.client_name,ticket_master.insured_name,clients.short_name,
|
'tm.id',
|
||||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
'tcs.claim_status AS status',
|
||||||
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
'tm.claim_number AS claim_no',
|
||||||
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
'tm.tpa_id',
|
||||||
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
'tm.emp_name',
|
||||||
->where('ticket_master.is_active', 1)
|
'i.name AS insurer_name',
|
||||||
->orderBy('ticket_master.id', 'DESC')
|
'c.client_name',
|
||||||
->limit(100)
|
'tm.insured_name',
|
||||||
->findAll();
|
'c.short_name',
|
||||||
|
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||||
|
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||||
|
])
|
||||||
|
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||||
|
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||||
|
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||||
|
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||||
|
->where('tm.is_active', 1)
|
||||||
|
->orderBy('tm.id', 'DESC');
|
||||||
|
|
||||||
|
$data = $query->get()->getResultArray();
|
||||||
|
|
||||||
|
// dd(db_connect()->getLastQuery());
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$search_data = $this->request->getPost();
|
$search_data = $this->request->getPost();
|
||||||
// print_r($search_data);
|
// print_r($search_data);
|
||||||
@ -168,20 +216,33 @@ class TicketController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print_rr($where);
|
// print_rr($where);
|
||||||
$data = $this->ticketMasterModel
|
$query = $db->table('ticket_master tm')
|
||||||
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
->select([
|
||||||
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
'tm.id',
|
||||||
insurers.name as insurer_name, clients.client_name,ticket_master.insured_name,clients.short_name,
|
'tcs.claim_status AS status',
|
||||||
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
'tm.claim_number AS claim_no',
|
||||||
->join('insurers', 'insurers.id = ticket_master.insurer_id and insurers.is_active = 1', 'left')
|
'tm.tpa_id',
|
||||||
->join('clients', 'clients.id = ticket_master.client_id and clients.is_active = 1', 'left')
|
'tm.emp_name',
|
||||||
->join('ticket_claim_status', 'ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1', 'left')
|
'i.name AS insurer_name',
|
||||||
->where('ticket_master.is_active', 1)
|
'c.client_name',
|
||||||
|
'tm.insured_name',
|
||||||
|
'c.short_name',
|
||||||
|
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||||
|
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||||
|
])
|
||||||
|
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||||
|
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||||
|
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||||
|
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||||
|
->where('tm.is_active', 1)
|
||||||
->where($where)
|
->where($where)
|
||||||
->findAll();
|
->orderBy('tm.id', 'DESC');
|
||||||
// print_rr($data);
|
|
||||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
$data = $query->get()->getResultArray();
|
||||||
|
// print_rr($data);
|
||||||
|
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||||
// print_rr($data);die();
|
// print_rr($data);die();
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -842,23 +903,24 @@ class TicketController extends BaseController
|
|||||||
return 'Ticket id\'s : '.json_encode($ticket_ids);
|
return 'Ticket id\'s : '.json_encode($ticket_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ticketReports(){
|
public function ticketReports()
|
||||||
|
{
|
||||||
|
|
||||||
if ($this->request->is('get')){
|
if ($this->request->is('get')) {
|
||||||
$default_start = new \DateTime();
|
$default_start = new \DateTime();
|
||||||
$data['default_end'] = $default_start->format('d-m-Y');
|
$data['default_end'] = $default_start->format('d-m-Y');
|
||||||
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
|
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
|
||||||
|
|
||||||
$data['policy_type'] = $this->ticketType;
|
$data['policy_type'] = $this->ticketType;
|
||||||
$data['account_manager'] = $this->userModel->select('first_name')->where('is_active',1)->where('role',3)->findAll();
|
$data['account_manager'] = $this->userModel->select('first_name')->where('is_active', 1)->where('role', 3)->findAll();
|
||||||
$data['report_type'] = [
|
$data['report_type'] = [
|
||||||
'acc_manager_wise_status'=>'Account Manger Wise Status Report',
|
'acc_manager_wise_status' => 'Account Manger Wise Status Report',
|
||||||
'tpa_wise_status' => 'TPA Wise Status Report',
|
'tpa_wise_status' => 'TPA Wise Status Report',
|
||||||
'tat_band_wise' => 'TAT Wise Status Report'
|
'tat_band_wise' => 'TAT Wise Status Report'
|
||||||
];
|
];
|
||||||
//
|
//
|
||||||
$this->loadLayout('ticket_reports',$data);
|
$this->loadLayout('ticket_reports', $data);
|
||||||
}else{
|
} else {
|
||||||
$received_data = $this->request->getPost();
|
$received_data = $this->request->getPost();
|
||||||
$from_Date = $received_data['fromDate'];
|
$from_Date = $received_data['fromDate'];
|
||||||
$to_Date = $received_data['toDate'];
|
$to_Date = $received_data['toDate'];
|
||||||
@ -867,164 +929,210 @@ class TicketController extends BaseController
|
|||||||
$policy_type = $received_data['policy_type'];
|
$policy_type = $received_data['policy_type'];
|
||||||
// print_rr($received_data);
|
// print_rr($received_data);
|
||||||
if ($received_data['report_type'] == "acc_manager_wise_status"){
|
if ($received_data['report_type'] == "acc_manager_wise_status"){
|
||||||
|
$viewData['policy_type'] = $received_data['policy_type'];
|
||||||
$viewData['account_manager_wise_data'] = $this->accountManagerWiseReport($policy_type,$fromDate,$toDate);
|
$viewData['account_manager_wise_data'] = $this->ticketMasterModel->accountManagerWiseReport($policy_type,$fromDate,$toDate);
|
||||||
// print_rr($viewData);
|
// print_rr($viewData);
|
||||||
if ($policy_type == 1){
|
if ($policy_type == 1){
|
||||||
$html = view('claims_report_acc_manager_gmc', $viewData);
|
$viewData['column_order'] = [
|
||||||
|
'ACM_NAME', 'ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED',
|
||||||
|
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||||
|
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||||
|
'TOTAL'
|
||||||
|
];
|
||||||
|
$ordered_data = [];
|
||||||
|
|
||||||
|
foreach ($viewData['account_manager_wise_data'] as $tpa_data) {
|
||||||
|
$temp = [];
|
||||||
|
foreach ($viewData['column_order'] as $key) {
|
||||||
|
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||||
|
}
|
||||||
|
$ordered_data[] = $temp;
|
||||||
|
}
|
||||||
|
$viewData['tpa_wise_data'] = $ordered_data;
|
||||||
|
$html = view('claims_report_acc_manager_wise', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
}else{
|
}else{
|
||||||
$html = view('claims_report_acc_manager_gpa', $viewData);
|
$viewData['column_order'] = [
|
||||||
|
'ACM_NAME', 'CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING',
|
||||||
|
'INSURER PENDING','INVESTIGATION','APPROVED','ON HOLD','TOTAL', 'NOT COVERED',
|
||||||
|
'CLOSED', 'SETTLED', 'CLEARED_TOTAL'
|
||||||
|
];
|
||||||
|
$ordered_data = [];
|
||||||
|
|
||||||
|
foreach ($viewData['account_manager_wise_data'] as $tpa_data) {
|
||||||
|
$temp = [];
|
||||||
|
foreach ($viewData['column_order'] as $key) {
|
||||||
|
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||||
|
}
|
||||||
|
$ordered_data[] = $temp;
|
||||||
|
}
|
||||||
|
$viewData['tpa_wise_data'] = $ordered_data;
|
||||||
|
$html = view('claims_report_acc_manager_wise', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
}
|
}
|
||||||
|
} elseif ($received_data['report_type'] == 'tpa_wise_status') {
|
||||||
|
|
||||||
}elseif ($received_data['report_type'] == 'tpa_wise_status'){
|
$viewData['tpa_wise_data'] = $this->ticketMasterModel->tpaWiseReport($policy_type, $fromDate, $toDate);
|
||||||
|
|
||||||
|
$viewData['column_order'] = [
|
||||||
|
'TPA_NAME', 'NON ID', 'ID NOT GENERATED', 'CDA', 'INFORMATION REQUIRED',
|
||||||
|
'UNDER PROCESS - CLAIM NO. UPDATION', 'UNDER PROCESS - INVESTIGATION STATUS',
|
||||||
|
'UNDER PROCESS - QUERY DOCUMENT RECEIVED', 'APPROVED', 'PAYMENT INITIATED',
|
||||||
|
'TOTAL', 'SETTLED', 'CLOSED', 'CANCELLED', 'RETURNED', 'CLEARED_TOTAL'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Reorder data based on column order
|
||||||
|
$ordered_data = [];
|
||||||
|
|
||||||
|
foreach ($viewData['tpa_wise_data'] as $tpa_data) {
|
||||||
|
$temp = [];
|
||||||
|
foreach ($viewData['column_order'] as $key) {
|
||||||
|
$temp[$key] = isset($tpa_data[$key]) ? $tpa_data[$key] : 0; // Default to 0 if key is missing
|
||||||
|
}
|
||||||
|
$ordered_data[] = $temp;
|
||||||
|
}
|
||||||
|
$viewData['tpa_wise_data'] = $ordered_data;
|
||||||
|
// $html = view('claims_report_tpa_wise', $viewData);
|
||||||
|
|
||||||
$viewData['tpa_wise_data'] = $this->tpaWiseReport($policy_type,$fromDate,$toDate);
|
|
||||||
$html = view('claims_report_tpa_wise',$viewData);
|
$html = view('claims_report_tpa_wise',$viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
} else if ($received_data['report_type'] == 'tat_band_wise') {
|
||||||
}else if ($received_data['report_type'] == 'tat_band_wise'){
|
|
||||||
|
|
||||||
$viewData['data'] = $this->ticketMasterModel->getTATReport($policy_type, $fromDate, $toDate);
|
$viewData['data'] = $this->ticketMasterModel->getTATReport($policy_type, $fromDate, $toDate);
|
||||||
$html = view('tat_report_band_wise_list',$viewData);
|
$html = view('tat_report_band_wise_list', $viewData);
|
||||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
// public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||||
|
|
||||||
if ($policy_type == 1) {
|
// if ($policy_type == 1) {
|
||||||
$sql = "SELECT
|
// $sql = "SELECT
|
||||||
u.first_name AS acc_manager_name,
|
// u.first_name AS acc_manager_name,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
|
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) AS id_not_generated,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
|
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) AS non_id,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
|
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) AS cda,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
|
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) AS information_required,
|
||||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
|
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) AS under_process,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) AS approved,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
|
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END) AS payment_initiated,
|
||||||
(
|
// (
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = 1 THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
|
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = 1 THEN master.id END)
|
||||||
) AS total
|
// ) AS total
|
||||||
FROM
|
// FROM
|
||||||
ticket_master master
|
// ticket_master master
|
||||||
JOIN
|
// JOIN
|
||||||
user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||||
JOIN
|
// JOIN
|
||||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||||
WHERE
|
// WHERE
|
||||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||||
GROUP BY
|
// GROUP BY
|
||||||
u.id;
|
// u.id;
|
||||||
";
|
// ";
|
||||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||||
// dd($result);
|
// // dd($result);
|
||||||
|
|
||||||
return $result;
|
// return $result;
|
||||||
|
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
$sql = "SELECT u.first_name AS acc_manager_name,
|
// $sql = "SELECT u.first_name AS acc_manager_name,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
|
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS claim_intimation,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
|
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS int_to_insurer,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
|
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS client_pending,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
|
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS investigation,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
|
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS on_hold,
|
||||||
|
|
||||||
(
|
// (
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
// COUNT(CASE WHEN tcs.claim_status = 'CLAIM INTIMATION' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
// COUNT(CASE WHEN tcs.claim_status = 'INTIMATION TO INSURER' AND master.ticket_type_id = '$policy_type' THEN master.id END)+
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'CLIENT PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'INSURER PENDING' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'INVESTIGATION' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
// COUNT(CASE WHEN tcs.claim_status = 'ON HOLD' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||||
) AS total1,
|
// ) AS total1,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
|
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS not_covered,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||||
(
|
// (
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'NOT COVERED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||||
) AS total2
|
// ) AS total2
|
||||||
FROM
|
// FROM
|
||||||
ticket_master master
|
// ticket_master master
|
||||||
JOIN
|
// JOIN
|
||||||
user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
// user_profiles u ON master.acm_id = u.id and u.is_active = 1
|
||||||
JOIN
|
// JOIN
|
||||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||||
WHERE
|
// WHERE
|
||||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
|
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1 and master.ticket_type_id = '$policy_type'
|
||||||
GROUP BY
|
// GROUP BY
|
||||||
u.id;
|
// u.id;
|
||||||
";
|
// ";
|
||||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||||
|
|
||||||
return $result;
|
// return $result;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public function tpaWiseReport($policy_type = null ,$start_date = null,$end_date = null ){
|
// public function tpaWiseReport($policy_type = null ,$start_date = null,$end_date = null ){
|
||||||
// $policy_type = 1;
|
// // $policy_type = 1;
|
||||||
$sql = "SELECT
|
// $sql = "SELECT
|
||||||
tpa.name AS tpa_name,
|
// tpa.name AS tpa_name,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
|
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS id_not_generated,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
|
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS non_id,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
|
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS cda,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS information_required,
|
||||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
|
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS under_process,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS approved,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
|
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS payment_initiated,
|
||||||
(
|
// (
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'ID NOT GENERATED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'NON ID' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'CDA' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'INFORMATION REQUIRED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status LIKE '%UNDER PROCESS%' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'APPROVED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
// COUNT(CASE WHEN tcs.claim_status = 'PAYMENT INITIATED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||||
) AS total,
|
// ) AS total,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS closed,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS settled,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
|
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS returned,
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
|
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END) AS denied,
|
||||||
(
|
// (
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'CLOSED' AND master.ticket_type_id = '$policy_type'THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'SETTLED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
// COUNT(CASE WHEN tcs.claim_status = 'RETURNED' AND master.ticket_type_id = '$policy_type' THEN master.id END) +
|
||||||
COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
// COUNT(CASE WHEN tcs.claim_status = 'REJECTED' AND master.ticket_type_id = '$policy_type' THEN master.id END)
|
||||||
) AS total2
|
// ) AS total2
|
||||||
FROM
|
// FROM
|
||||||
ticket_master master
|
// ticket_master master
|
||||||
JOIN
|
// JOIN
|
||||||
tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
|
// tpa ON master.tpa_id = tpa.id and tpa.is_active = 1
|
||||||
JOIN
|
// JOIN
|
||||||
ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
// ticket_claim_status tcs ON tcs.id = master.claim_status_id and tcs.is_active = 1
|
||||||
WHERE
|
// WHERE
|
||||||
master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
// master.created_at <= '$end_date' and master.created_at >= '$start_date' and master.is_active = 1
|
||||||
GROUP BY
|
// GROUP BY
|
||||||
tpa.id;
|
// tpa.id;
|
||||||
|
|
||||||
|
|
||||||
";
|
// ";
|
||||||
$result = $this->ticketMasterModel->query($sql)->getResultArray();
|
// $result = $this->ticketMasterModel->query($sql)->getResultArray();
|
||||||
|
|
||||||
return $result;
|
// return $result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -234,7 +234,7 @@ if(!function_exists('check_si'))
|
|||||||
$is_si_found = false;
|
$is_si_found = false;
|
||||||
$is_age_slab_found = false;
|
$is_age_slab_found = false;
|
||||||
|
|
||||||
if($policy_details['policy_type_id'] == 1 && $slab_details['slab_rates'][0]['policy_grid_id'] == 1 && $slab_details['slab_rates'][0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
if(($policy_details['policy_type_id'] == 1 || $policy_details['policy_type_id'] == 6 || $policy_details['policy_type_id'] == 7) && $slab_details['slab_rates'][0]['policy_grid_id'] == 1 && $slab_details['slab_rates'][0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||||
{
|
{
|
||||||
$is_si_found = true;
|
$is_si_found = true;
|
||||||
$is_age_slab_found = true;
|
$is_age_slab_found = true;
|
||||||
|
|||||||
@ -49,13 +49,13 @@ class sendMailNotification
|
|||||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments, 'common' => $common];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments, 'common' => $common];
|
||||||
}
|
}
|
||||||
@ -77,16 +77,16 @@ class sendMailNotification
|
|||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
|
||||||
$employee_name =$emp_data['name'];
|
$employee_name =$emp_data['name'];
|
||||||
$employee_mobile_no =$emp_data['mobile'];
|
$employee_mobile_no =$emp_data['mobile'];
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||||
$mail = $emp_data['email_corporate'];
|
$mail = $emp_data['email_corporate'];
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||||
@ -128,16 +128,17 @@ class sendMailNotification
|
|||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
// $client_logo = $nhance_logo;
|
// $client_logo = $nhance_logo;
|
||||||
|
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
$mail_content = str_replace(["[[ecard_download_link]]", "{{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);
|
$mail_content = str_replace(["[[client_name]]", "{{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'], 'common' => $common];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
@ -172,11 +173,11 @@ class sendMailNotification
|
|||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
// $client_logo = $nhance_logo;
|
// $client_logo = $nhance_logo;
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$mail = '';
|
$mail = '';
|
||||||
@ -518,9 +519,9 @@ class sendMailNotification
|
|||||||
// dd($payable_employee_array, $Addon_list);
|
// dd($payable_employee_array, $Addon_list);
|
||||||
// print_r($table_content); die;
|
// print_r($table_content); die;
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||||
|
|
||||||
// print_r($mail_content); die;
|
// print_r($mail_content); die;
|
||||||
|
|
||||||
@ -570,11 +571,11 @@ class sendMailNotification
|
|||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
// $client_logo = $nhance_logo;
|
// $client_logo = $nhance_logo;
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$mail = '';
|
$mail = '';
|
||||||
@ -816,13 +817,13 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||||
|
|
||||||
$account_manager_mail_list = [];
|
$account_manager_mail_list = [];
|
||||||
if(isset($user_list)){
|
if(isset($user_list)){
|
||||||
foreach ($user_list as $key => $value) {
|
foreach ($user_list as $key => $value) {
|
||||||
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
||||||
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $full_name , $mail_content);
|
||||||
|
|
||||||
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to'], 'common' => $common];
|
||||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
@ -868,11 +869,11 @@ class sendMailNotification
|
|||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
// $client_logo = $nhance_logo;
|
// $client_logo = $nhance_logo;
|
||||||
|
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$mail = '';
|
$mail = '';
|
||||||
@ -1115,7 +1116,7 @@ class sendMailNotification
|
|||||||
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||||
|
|
||||||
|
|
||||||
$hr_mails = $client_data['hr_mails'];
|
$hr_mails = $client_data['hr_mails'];
|
||||||
@ -1173,13 +1174,13 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
if ($mail != null || $mail != '') {
|
if ($mail != null || $mail != '') {
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'attachments' => $attachments];
|
||||||
@ -1204,11 +1205,12 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
|
||||||
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||||
|
|
||||||
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||||
|
|
||||||
@ -1256,15 +1258,15 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name, $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[post_enrollment_app_link]]", "{{post_enrollment_app_link}}"], "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
$mail_content = str_replace(["[[ecard_download_link]]", "{{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);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'],'attachments' => $attachments, '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']];
|
||||||
|
|
||||||
@ -1301,11 +1303,11 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$table_content = '';
|
$table_content = '';
|
||||||
@ -1413,9 +1415,9 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
$mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
|
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $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'], 'reply_to' => $client_data['reply_to']];
|
||||||
@ -1453,11 +1455,11 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$table_content = '';
|
$table_content = '';
|
||||||
@ -1563,8 +1565,8 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
@ -1600,11 +1602,11 @@ class sendMailNotification
|
|||||||
|
|
||||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
// Step 1: Replace the placeholder with an HTML table structure
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
$table_content = '';
|
$table_content = '';
|
||||||
@ -1712,8 +1714,8 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace(["[[member_summary]]", "{{member_summary}}"], $table_content , $mail_content);
|
||||||
|
|
||||||
|
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
|
|||||||
@ -147,6 +147,155 @@ class TicketMasterModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get TAT report BAND wise Data
|
//get TAT report BAND wise Data
|
||||||
|
// public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
|
||||||
|
// {
|
||||||
|
// //set default last 3 months data date
|
||||||
|
// $fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||||
|
// $toDate = date('Y-m-d 23:59:59');
|
||||||
|
|
||||||
|
// if (!empty($start_date) && !empty($end_date)) {
|
||||||
|
// $fromDate = change_date_format($start_date);
|
||||||
|
// $toDate = change_date_format($end_date);
|
||||||
|
// }
|
||||||
|
// $ticket_type_data_1 = "";
|
||||||
|
// $ticket_type_data_2 = "";
|
||||||
|
// if(!empty($ticket_type)){
|
||||||
|
// $ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
||||||
|
// $ticket_type_data_2 = "AND tm.ticket_type_id = $ticket_type";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Fetch claim statuses from the `ticket_claim_status` table
|
||||||
|
// $statusQuery = " SELECT
|
||||||
|
// id, claim_status, ticket_type
|
||||||
|
// FROM ticket_claim_status
|
||||||
|
// Where is_active = 1
|
||||||
|
// $ticket_type_data_1
|
||||||
|
// ";
|
||||||
|
// $statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||||
|
// // dd($statusResult);
|
||||||
|
|
||||||
|
// // Initialize dynamic query parts
|
||||||
|
// $dynamicSelect = '';
|
||||||
|
|
||||||
|
// // Loop through each claim status and generate the COALESCE and CASE statements for the SELECT
|
||||||
|
// foreach ($statusResult as $status) {
|
||||||
|
|
||||||
|
// $columnName = $status['claim_status']; // Default column name
|
||||||
|
|
||||||
|
// if (empty($ticket_type)) {
|
||||||
|
// // Append the insurance type prefix based on `ticket_type`
|
||||||
|
// switch ($status['ticket_type']) {
|
||||||
|
// case 1:
|
||||||
|
// $columnName = "GMC - {$status['claim_status']}";
|
||||||
|
// break;
|
||||||
|
// case 2:
|
||||||
|
// $columnName = "GPA - {$status['claim_status']}";
|
||||||
|
// break;
|
||||||
|
// case 3:
|
||||||
|
// $columnName = "EDLI - {$status['claim_status']}";
|
||||||
|
// break;
|
||||||
|
// case 4:
|
||||||
|
// $columnName = "GTLI - {$status['claim_status']}";
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $dynamicSelect .= "
|
||||||
|
// COALESCE(
|
||||||
|
// SUM(
|
||||||
|
// CASE
|
||||||
|
// WHEN subquery.status_id = {$status['id']} THEN 1
|
||||||
|
// ELSE 0
|
||||||
|
// END
|
||||||
|
// ),
|
||||||
|
// 0
|
||||||
|
// ) AS `$columnName`, ";
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Remove the trailing comma from the SELECT part
|
||||||
|
// $dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||||
|
// // dd($dynamicSelect);
|
||||||
|
|
||||||
|
|
||||||
|
// // Construct the full SQL query
|
||||||
|
// $sql = "
|
||||||
|
// SELECT
|
||||||
|
// tc.TAT_Category,
|
||||||
|
// $dynamicSelect
|
||||||
|
// FROM
|
||||||
|
// (
|
||||||
|
// SELECT 'Above 20 Days' AS TAT_Category
|
||||||
|
// UNION ALL
|
||||||
|
// SELECT '13-20 Days'
|
||||||
|
// UNION ALL
|
||||||
|
// SELECT '7-12 Days'
|
||||||
|
// UNION ALL
|
||||||
|
// SELECT '0-6 Days'
|
||||||
|
// ) AS tc
|
||||||
|
// LEFT JOIN (
|
||||||
|
// SELECT
|
||||||
|
// tm.id AS ticket_id,
|
||||||
|
// tcs.claim_status,
|
||||||
|
// tcs.id AS status_id,
|
||||||
|
// CASE
|
||||||
|
// WHEN DATEDIFF(
|
||||||
|
// COALESCE(th.created_at, tm.created_at),
|
||||||
|
// COALESCE(
|
||||||
|
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||||
|
// tm.created_at
|
||||||
|
// )
|
||||||
|
// ) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||||
|
// WHEN DATEDIFF(
|
||||||
|
// COALESCE(th.created_at, tm.created_at),
|
||||||
|
// COALESCE(
|
||||||
|
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||||
|
// tm.created_at
|
||||||
|
// )
|
||||||
|
// ) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||||
|
// WHEN DATEDIFF(
|
||||||
|
// COALESCE(th.created_at, tm.created_at),
|
||||||
|
// COALESCE(
|
||||||
|
// (SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = tm.id),
|
||||||
|
// tm.created_at
|
||||||
|
// )
|
||||||
|
// ) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||||
|
// ELSE 'Above 20 Days'
|
||||||
|
// END AS TAT_Category
|
||||||
|
// FROM
|
||||||
|
// ticket_master tm
|
||||||
|
// JOIN ticket_history th ON tm.id = th.ticket_id
|
||||||
|
// JOIN ticket_claim_status tcs ON th.field_name = 'claim_status_id'
|
||||||
|
// AND th.new_value = tcs.id
|
||||||
|
// WHERE
|
||||||
|
// tm.ticket_type_id = tcs.id
|
||||||
|
// $ticket_type_data_2
|
||||||
|
// AND tm.created_at >= '$fromDate'
|
||||||
|
// AND tm.created_at <= '$toDate'
|
||||||
|
// AND tm.is_active = 1
|
||||||
|
// AND th.is_active = 1
|
||||||
|
// AND tcs.is_active = 1
|
||||||
|
// ) AS subquery ON tc.TAT_Category = subquery.TAT_Category
|
||||||
|
// GROUP BY
|
||||||
|
// tc.TAT_Category
|
||||||
|
// ORDER BY
|
||||||
|
// FIELD(tc.TAT_Category, 'Above 20 Days', '13-20 Days', '7-12 Days', '0-6 Days');
|
||||||
|
// ";
|
||||||
|
|
||||||
|
// // Execute the query and return the result
|
||||||
|
// $data = $this->db->query($sql)->getResultArray();
|
||||||
|
// // print_rr($this->db->getLastQuery(), $data); die;
|
||||||
|
|
||||||
|
// // $tableData = [];
|
||||||
|
// // if (!empty($data)) {
|
||||||
|
// // // Extract table headers from the first row keys
|
||||||
|
// // $headers = array_keys($data[0]);
|
||||||
|
// // $tableData['headers'] = $headers;
|
||||||
|
// // $tableData['body'] = $data;
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// return $data;
|
||||||
|
// }
|
||||||
|
|
||||||
public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
|
public function getTATReport($ticket_type = null, $start_date = null, $end_date = null)
|
||||||
{
|
{
|
||||||
//set default last 3 months data date
|
//set default last 3 months data date
|
||||||
@ -161,12 +310,12 @@ class TicketMasterModel extends Model
|
|||||||
$ticket_type_data_2 = "";
|
$ticket_type_data_2 = "";
|
||||||
if(!empty($ticket_type)){
|
if(!empty($ticket_type)){
|
||||||
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
$ticket_type_data_1 = "AND ticket_type = $ticket_type";
|
||||||
$ticket_type_data_2 = "AND tm.ticket_type_id = $ticket_type";
|
$ticket_type_data_2 = "WHERE tm.ticket_type_id = $ticket_type";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch claim statuses from the `ticket_claim_status` table
|
// Fetch claim statuses from the `ticket_claim_status` table
|
||||||
$statusQuery = " SELECT
|
$statusQuery = " SELECT
|
||||||
id, claim_status
|
id, claim_status, ticket_type
|
||||||
FROM ticket_claim_status
|
FROM ticket_claim_status
|
||||||
Where is_active = 1
|
Where is_active = 1
|
||||||
$ticket_type_data_1
|
$ticket_type_data_1
|
||||||
@ -176,20 +325,40 @@ class TicketMasterModel extends Model
|
|||||||
|
|
||||||
// Initialize dynamic query parts
|
// Initialize dynamic query parts
|
||||||
$dynamicSelect = '';
|
$dynamicSelect = '';
|
||||||
|
|
||||||
// Loop through each claim status and generate the COALESCE and CASE statements for the SELECT
|
// Loop through each claim status and generate the COALESCE and CASE statements for the SELECT
|
||||||
foreach ($statusResult as $status) {
|
foreach ($statusResult as $status) {
|
||||||
// Dynamically add the COALESCE and CASE for each status in the SELECT part
|
|
||||||
|
$columnName = $status['claim_status']; // Default column name
|
||||||
|
|
||||||
|
if (empty($ticket_type)) {
|
||||||
|
// Append the insurance type prefix based on `ticket_type`
|
||||||
|
switch ($status['ticket_type']) {
|
||||||
|
case 1:
|
||||||
|
$columnName = "GMC - {$status['claim_status']}";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$columnName = "GPA - {$status['claim_status']}";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$columnName = "EDLI - {$status['claim_status']}";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$columnName = "GTLI - {$status['claim_status']}";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$dynamicSelect .= "
|
$dynamicSelect .= "
|
||||||
COALESCE(
|
COALESCE(
|
||||||
SUM(
|
SUM(
|
||||||
CASE
|
CASE
|
||||||
WHEN subquery.status_id = {$status['id']} THEN 1
|
WHEN subquery.status_id = {$status['id']} THEN 1
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END
|
END
|
||||||
),
|
),
|
||||||
0
|
0
|
||||||
) AS `{$status['claim_status']}`, ";
|
) AS `$columnName`, ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the trailing comma from the SELECT part
|
// Remove the trailing comma from the SELECT part
|
||||||
@ -213,36 +382,47 @@ class TicketMasterModel extends Model
|
|||||||
SELECT '0-6 Days'
|
SELECT '0-6 Days'
|
||||||
) AS tc
|
) AS tc
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
th.ticket_id,
|
th.ticket_id,
|
||||||
tcs.claim_status,
|
tcs.claim_status,
|
||||||
tcs.id AS status_id,
|
tcs.id AS status_id,
|
||||||
CASE
|
CASE
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
th.created_at,
|
||||||
COALESCE(tm.updated_at, th.created_at)
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
) BETWEEN 0 AND 6 THEN '0-6 Days'
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
th.created_at,
|
||||||
COALESCE(tm.updated_at, th.created_at)
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
) BETWEEN 7 AND 12 THEN '7-12 Days'
|
||||||
WHEN DATEDIFF(
|
WHEN DATEDIFF(
|
||||||
th.created_at,
|
th.created_at,
|
||||||
COALESCE(tm.updated_at, th.created_at)
|
COALESCE(
|
||||||
|
(SELECT MIN(created_at) FROM ticket_history th2 WHERE th2.ticket_id = th.ticket_id),
|
||||||
|
tm.created_at
|
||||||
|
)
|
||||||
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||||
ELSE 'Above 20 Days'
|
ELSE 'Above 20 Days'
|
||||||
END AS TAT_Category
|
END AS TAT_Category
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
ticket_master tm
|
ticket_master tm
|
||||||
JOIN ticket_history th ON tm.id = th.ticket_id
|
JOIN ticket_history th ON tm.id = th.ticket_id
|
||||||
JOIN ticket_claim_status tcs ON th.field_name = 'claim_status_id'
|
JOIN ticket_claim_status tcs ON th.field_name = 'claim_status_id' AND th.new_value = tcs.id
|
||||||
AND th.new_value = tcs.id
|
|
||||||
$ticket_type_data_2
|
$ticket_type_data_2
|
||||||
AND tm.created_at >= '$fromDate'
|
AND tm.created_at >= '$fromDate'
|
||||||
AND tm.created_at <= '$toDate'
|
AND tm.created_at <= '$toDate'
|
||||||
AND tm.is_active = 1
|
AND tm.is_active = 1
|
||||||
AND th.is_active = 1
|
AND th.is_active = 1
|
||||||
AND tcs.is_active = 1
|
AND tcs.is_active = 1
|
||||||
|
|
||||||
) AS subquery ON tc.TAT_Category = subquery.TAT_Category
|
) AS subquery ON tc.TAT_Category = subquery.TAT_Category
|
||||||
GROUP BY
|
GROUP BY
|
||||||
tc.TAT_Category
|
tc.TAT_Category
|
||||||
@ -258,7 +438,7 @@ class TicketMasterModel extends Model
|
|||||||
|
|
||||||
// Execute the query and return the result
|
// Execute the query and return the result
|
||||||
$data = $this->db->query($sql)->getResultArray();
|
$data = $this->db->query($sql)->getResultArray();
|
||||||
// dd($this->db->getLastQuery(), $data);
|
// print_rr($this->db->getLastQuery(), $data); die;
|
||||||
|
|
||||||
// $tableData = [];
|
// $tableData = [];
|
||||||
// if (!empty($data)) {
|
// if (!empty($data)) {
|
||||||
@ -270,5 +450,201 @@ class TicketMasterModel extends Model
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tpaWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||||
|
$ticket_type_data_1 = "";
|
||||||
|
$ticket_type_data_2 = "";
|
||||||
|
|
||||||
|
if (!empty($policy_type)) {
|
||||||
|
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||||
|
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch claim statuses dynamically
|
||||||
|
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||||
|
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||||
|
|
||||||
|
// Initialize dynamic query parts
|
||||||
|
$dynamicSelect = '';
|
||||||
|
$dynamicTotal = '';
|
||||||
|
$dynamicClosedTotal = '';
|
||||||
|
|
||||||
|
// Loop through each claim status and generate the CASE statements
|
||||||
|
foreach ($statusResult as $status) {
|
||||||
|
$dynamicSelect .= "
|
||||||
|
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||||
|
|
||||||
|
if (in_array($status['claim_status'], ['ID NOT GENERATED', 'NON ID', 'CDA', 'INFORMATION REQUIRED','UNDER PROCESS - CLAIM NO. UPDATION',
|
||||||
|
'UNDER PROCESS - INVESTIGATION STATUS','UNDER PROCESS - QUERY DOCUMENT RECEIVED','APPROVED','PAYMENT INITIATED'])) {
|
||||||
|
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
}
|
||||||
|
// Include in total count
|
||||||
|
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
|
||||||
|
// Include only closed-related statuses in total2 count
|
||||||
|
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'RETURNED', 'REJECTED'])) {
|
||||||
|
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the trailing commas and `+` signs
|
||||||
|
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||||
|
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||||
|
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||||
|
// print_rr($dynamicSelect);
|
||||||
|
// Construct the final SQL query
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
tpa.name AS TPA_NAME,
|
||||||
|
$dynamicSelect,
|
||||||
|
($dynamicTotal) AS TOTAL,
|
||||||
|
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||||
|
FROM
|
||||||
|
ticket_master master
|
||||||
|
JOIN
|
||||||
|
tpa ON master.tpa_id = tpa.id AND tpa.is_active = 1
|
||||||
|
WHERE
|
||||||
|
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||||
|
AND master.is_active = 1
|
||||||
|
$ticket_type_data_2
|
||||||
|
GROUP BY
|
||||||
|
tpa.id;
|
||||||
|
";
|
||||||
|
|
||||||
|
// Execute the query
|
||||||
|
$result = $this->db->query($sql)->getResultArray();
|
||||||
|
|
||||||
|
// print_rr($result);die();
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function accountManagerWiseReport($policy_type = null ,$start_date = null, $end_date = null){
|
||||||
|
|
||||||
|
if ($policy_type == 1) {
|
||||||
|
$ticket_type_data_1 = "";
|
||||||
|
$ticket_type_data_2 = "";
|
||||||
|
|
||||||
|
if (!empty($policy_type)) {
|
||||||
|
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||||
|
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch claim statuses dynamically
|
||||||
|
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||||
|
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||||
|
|
||||||
|
// Initialize dynamic query parts
|
||||||
|
$dynamicSelect = '';
|
||||||
|
$dynamicTotal = '';
|
||||||
|
|
||||||
|
// Loop through each claim status and generate the CASE statements
|
||||||
|
foreach ($statusResult as $status) {
|
||||||
|
$dynamicSelect .= "
|
||||||
|
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||||
|
|
||||||
|
|
||||||
|
// Include in total count
|
||||||
|
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
|
||||||
|
// Include only closed-related statuses in total2 count
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the trailing commas and `+` signs
|
||||||
|
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||||
|
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||||
|
// print_rr($dynamicSelect);
|
||||||
|
// Construct the final SQL query
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
user_profiles.first_name AS ACM_NAME,
|
||||||
|
$dynamicSelect,
|
||||||
|
($dynamicTotal) AS TOTAL
|
||||||
|
FROM
|
||||||
|
ticket_master master
|
||||||
|
JOIN
|
||||||
|
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||||
|
WHERE
|
||||||
|
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||||
|
AND master.is_active = 1
|
||||||
|
$ticket_type_data_2
|
||||||
|
GROUP BY
|
||||||
|
user_profiles.id;
|
||||||
|
";
|
||||||
|
|
||||||
|
$result = $this->db->query($sql)->getResultArray();
|
||||||
|
// dd($result);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$ticket_type_data_1 = "";
|
||||||
|
$ticket_type_data_2 = "";
|
||||||
|
|
||||||
|
if (!empty($policy_type)) {
|
||||||
|
$ticket_type_data_1 = "AND ticket_type = $policy_type";
|
||||||
|
$ticket_type_data_2 = "AND master.ticket_type_id = $policy_type";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch claim statuses dynamically
|
||||||
|
$statusQuery = "SELECT id, claim_status FROM ticket_claim_status WHERE is_active = 1 $ticket_type_data_1";
|
||||||
|
$statusResult = $this->db->query($statusQuery)->getResultArray();
|
||||||
|
|
||||||
|
// Initialize dynamic query parts
|
||||||
|
$dynamicSelect = '';
|
||||||
|
$dynamicTotal = '';
|
||||||
|
$dynamicClosedTotal = '';
|
||||||
|
|
||||||
|
// Loop through each claim status and generate the CASE statements
|
||||||
|
foreach ($statusResult as $status) {
|
||||||
|
$dynamicSelect .= "
|
||||||
|
COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) AS `{$status['claim_status']}`, ";
|
||||||
|
|
||||||
|
if (in_array($status['claim_status'], ['CLAIM INTIMATION', 'INTIMATION TO INSURER', 'CLIENT PENDING', 'INSURER PENDING','INVESTIGATION',
|
||||||
|
'APPROVED','ON HOLD'])) {
|
||||||
|
$dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
}
|
||||||
|
// Include in total count
|
||||||
|
// $dynamicTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
|
||||||
|
// Include only closed-related statuses in total2 count
|
||||||
|
if (in_array($status['claim_status'], ['CLOSED', 'SETTLED', 'NOT COVERED'])) {
|
||||||
|
$dynamicClosedTotal .= "COUNT(CASE WHEN master.claim_status_id = {$status['id']} THEN master.id END) + ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the trailing commas and `+` signs
|
||||||
|
$dynamicSelect = rtrim($dynamicSelect, ', ');
|
||||||
|
$dynamicTotal = rtrim($dynamicTotal, ' +');
|
||||||
|
$dynamicClosedTotal = rtrim($dynamicClosedTotal, ' +');
|
||||||
|
// print_rr($dynamicSelect);
|
||||||
|
// Construct the final SQL query
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
user_profiles.first_name AS ACM_NAME,
|
||||||
|
$dynamicSelect,
|
||||||
|
($dynamicTotal) AS TOTAL,
|
||||||
|
($dynamicClosedTotal) AS CLEARED_TOTAL
|
||||||
|
FROM
|
||||||
|
ticket_master master
|
||||||
|
JOIN
|
||||||
|
user_profiles ON master.acm_id = user_profiles.id AND user_profiles.is_active = 1
|
||||||
|
WHERE
|
||||||
|
master.created_at BETWEEN '$start_date' AND '$end_date'
|
||||||
|
AND master.is_active = 1
|
||||||
|
$ticket_type_data_2
|
||||||
|
GROUP BY
|
||||||
|
user_profiles.id;
|
||||||
|
";
|
||||||
|
|
||||||
|
// Execute the query
|
||||||
|
$result = $this->db->query($sql)->getResultArray();
|
||||||
|
|
||||||
|
// print_rr($result);die();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,169 +0,0 @@
|
|||||||
<style>
|
|
||||||
.table th,
|
|
||||||
.table td {
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable tbody td {
|
|
||||||
padding: 4px 4px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-12 {
|
|
||||||
max-width: 98% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTables_filter {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-align-input {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row" style="padding-bottom: 10px;">
|
|
||||||
<div class="col-6" style="align-self: center;">
|
|
||||||
<h4 style="position: relative;">Insurer List</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
|
||||||
<thead class="bg-light">
|
|
||||||
<tr>
|
|
||||||
<th>Account Manger</th>
|
|
||||||
<th>ID Not Generated</th>
|
|
||||||
<th>Non-ID</th>
|
|
||||||
<th>CDA</th>
|
|
||||||
<th>Information Required</th>
|
|
||||||
<th>Under Process</th>
|
|
||||||
<th>Approved</th>
|
|
||||||
<th>Payment Initiated</th>
|
|
||||||
<th>Total</th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach($account_manager_wise_data as $data): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= $data['acc_manager_name'] ?></td>
|
|
||||||
<td><?= $data['id_not_generated'] ?></td>
|
|
||||||
<td><?= $data['non_id'] ?></td>
|
|
||||||
<td><?= $data['cda']?></td>
|
|
||||||
<td><?= $data['information_required'] ?></td>
|
|
||||||
<td><?= $data['under_process'] ?></td>
|
|
||||||
<td><?= $data['approved'] ?></td>
|
|
||||||
<td><?= $data['payment_initiated'] ?></td>
|
|
||||||
<td><?= $data['total'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<th>Grand Total</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
|
||||||
|
|
||||||
if (ticketsTable.length) {
|
|
||||||
ticketsTable.DataTable({
|
|
||||||
scrollX: true,
|
|
||||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
extend: 'csv',
|
|
||||||
text: 'CSV',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
extend: 'excel',
|
|
||||||
text: 'Excel',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
exportOptions: {
|
|
||||||
orthogonal: 'sort'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
],
|
|
||||||
language: {
|
|
||||||
search: "_INPUT_",
|
|
||||||
searchPlaceholder: "Search..."
|
|
||||||
},
|
|
||||||
paging: true, // Enable pagination
|
|
||||||
pageLength: 10, // Set default number of rows per page (optional)
|
|
||||||
ordering: false,
|
|
||||||
footerCallback: function(row, data, start, end, display) {
|
|
||||||
var api = this.api();
|
|
||||||
|
|
||||||
// Helper function to parse numbers
|
|
||||||
var parseNumber = function(value) {
|
|
||||||
return typeof value === 'string' ?
|
|
||||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
|
||||||
typeof value === 'number' ? value : 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Calculate total for each column
|
|
||||||
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_non_id = api.column(2).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_cda = api.column(3).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_under_process = api.column(5).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
// Update the footer with totals
|
|
||||||
$(api.column(1).footer()).html(total_id_not_generated);
|
|
||||||
$(api.column(2).footer()).html(total_non_id);
|
|
||||||
$(api.column(3).footer()).html(total_cda);
|
|
||||||
$(api.column(4).footer()).html(total_information_required);
|
|
||||||
$(api.column(5).footer()).html(total_under_process);
|
|
||||||
$(api.column(6).footer()).html(total_approved);
|
|
||||||
$(api.column(7).footer()).html(total_payment_initiated);
|
|
||||||
$(api.column(8).footer()).html(total_of_total);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.error("Table not found.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@ -1,203 +0,0 @@
|
|||||||
<style>
|
|
||||||
.table th,
|
|
||||||
.table td {
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable tbody td {
|
|
||||||
padding: 4px 4px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.col-12 {
|
|
||||||
max-width: 98% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dataTables_filter {
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.right-align-input {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row" style="padding-bottom: 10px;">
|
|
||||||
<div class="col-6" style="align-self: center;">
|
|
||||||
<h4 style="position: relative;">Insurer List</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
|
||||||
<thead class="bg-light">
|
|
||||||
<tr>
|
|
||||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
|
||||||
<th style="text-align: center;" colspan="5">CLEARED</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Account Manger</th>
|
|
||||||
<th>Claim Intimation</th>
|
|
||||||
<th>Intimation to Insurer</th>
|
|
||||||
<th>Client Pending</th>
|
|
||||||
<th>Insurer Pending</th>
|
|
||||||
<th>Investigation</th>
|
|
||||||
<th>Approved</th>
|
|
||||||
<th>On Hold</th>
|
|
||||||
<th>Total</th>
|
|
||||||
<th>Not Covered</th>
|
|
||||||
<th>Closed</th>
|
|
||||||
<th>Settled</th>
|
|
||||||
<th>Total</th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach($account_manager_wise_data as $data): ?>
|
|
||||||
<tr>
|
|
||||||
<td><?= $data['acc_manager_name'] ?></td>
|
|
||||||
<td><?= $data['claim_intimation'] ?></td>
|
|
||||||
<td><?= $data['int_to_insurer'] ?></td>
|
|
||||||
<td><?=$data['client_pending']?></td>
|
|
||||||
<td><?=$data['information_required'] ?></td>
|
|
||||||
<td><?=$data['investigation'] ?></td>
|
|
||||||
<td><?=$data['approved'] ?></td>
|
|
||||||
<td><?=$data['on_hold'] ?></td>
|
|
||||||
<td><?=$data['total1'] ?></td>
|
|
||||||
<td><?=$data['not_covered'] ?></td>
|
|
||||||
<td><?=$data['closed'] ?></td>
|
|
||||||
<td><?=$data['settled'] ?></td>
|
|
||||||
<td><?=$data['total2'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<th>Grand Total</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
|
||||||
|
|
||||||
if (ticketsTable.length) {
|
|
||||||
ticketsTable.DataTable({
|
|
||||||
scrollX: true,
|
|
||||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
extend: 'csv',
|
|
||||||
text: 'CSV',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
extend: 'excel',
|
|
||||||
text: 'Excel',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
exportOptions: {
|
|
||||||
orthogonal: 'sort'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
],
|
|
||||||
language: {
|
|
||||||
search: "_INPUT_",
|
|
||||||
searchPlaceholder: "Search..."
|
|
||||||
},
|
|
||||||
paging: true, // Enable pagination
|
|
||||||
pageLength: 10, // Set default number of rows per page (optional)
|
|
||||||
ordering: false,
|
|
||||||
footerCallback: function(row, data, start, end, display) {
|
|
||||||
var api = this.api();
|
|
||||||
|
|
||||||
// Helper function to parse numbers
|
|
||||||
var parseNumber = function(value) {
|
|
||||||
return typeof value === 'string' ?
|
|
||||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
|
||||||
typeof value === 'number' ? value : 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Calculate total for each column
|
|
||||||
var total_claim_intimation = api.column(1).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_int_to_insurer = api.column(2).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_client_pending = api.column(3).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_investigation = api.column(5).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_on_hold = api.column(7).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_not_covered = api.column(9).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_closed = api.column(10).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_settled = api.column(11).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_of_total2 = api.column(12).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
// Update the footer with totals
|
|
||||||
$(api.column(1).footer()).html(total_claim_intimation);
|
|
||||||
$(api.column(2).footer()).html(total_int_to_insurer);
|
|
||||||
$(api.column(3).footer()).html(total_client_pending);
|
|
||||||
$(api.column(4).footer()).html(total_information_required);
|
|
||||||
$(api.column(5).footer()).html(total_investigation);
|
|
||||||
$(api.column(6).footer()).html(total_approved);
|
|
||||||
$(api.column(7).footer()).html(total_on_hold);
|
|
||||||
$(api.column(8).footer()).html(total_of_total);
|
|
||||||
$(api.column(9).footer()).html(total_not_covered);
|
|
||||||
$(api.column(10).footer()).html(total_closed);
|
|
||||||
$(api.column(11).footer()).html(total_settled);
|
|
||||||
$(api.column(12).footer()).html(total_of_total2);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.error("Table not found.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
103
app/Views/claims_report_acc_manager_wise.php
Normal file
103
app/Views/claims_report_acc_manager_wise.php
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<style>
|
||||||
|
.table th, .table td {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-12 {
|
||||||
|
max-width: 98% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dataTables_filter {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right-align-input {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row" style="padding-bottom: 10px;">
|
||||||
|
<div class="col-6" style="align-self: center;">
|
||||||
|
<h4 style="position: relative;">Account Manger Claim Status List</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<?php if ($policy_type != 1) {?>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||||
|
<th style="text-align: center;" colspan="5" >CLEARED</th>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($column_order as $col_name): ?>
|
||||||
|
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($account_manager_wise_data as $row): ?>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($column_order as $col_name): ?>
|
||||||
|
<td><?= $row[$col_name] ?></td>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<th>Grand Total</th>
|
||||||
|
<?php
|
||||||
|
$totals = array_fill_keys($column_order, 0);
|
||||||
|
foreach ($account_manager_wise_data as $row) {
|
||||||
|
foreach ($column_order as $col_name) {
|
||||||
|
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($column_order as $col_name) {
|
||||||
|
if ($col_name !== 'ACM_NAME') {
|
||||||
|
echo "<th>{$totals[$col_name]}</th>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||||
|
|
||||||
|
if (ticketsTable.length) {
|
||||||
|
ticketsTable.DataTable({
|
||||||
|
scrollX: true,
|
||||||
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||||
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
|
buttons: [
|
||||||
|
{ extend: 'csv', text: 'CSV', title: 'Insurer-Wise-Report-List' },
|
||||||
|
{ extend: 'excel', text: 'Excel', title: 'Insurer-Wise-Report-List', exportOptions: { orthogonal: 'sort' } }
|
||||||
|
],
|
||||||
|
language: { search: "_INPUT_", searchPlaceholder: "Search..." },
|
||||||
|
paging: true,
|
||||||
|
pageLength: 10,
|
||||||
|
ordering: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error("Table not found.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -1,24 +1,23 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th, .table td {
|
||||||
.table td {
|
padding: 8px;
|
||||||
padding: 8px;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-12 {
|
.col-12 {
|
||||||
max-width: 98% !important;
|
max-width: 98% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataTables_filter {
|
.dataTables_filter {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-align-input {
|
.right-align-input {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -26,7 +25,7 @@ table.dataTable tbody td {
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row" style="padding-bottom: 10px;">
|
<div class="row" style="padding-bottom: 10px;">
|
||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-6" style="align-self: center;">
|
||||||
<h4 style="position: relative;">Insurer List</h4>
|
<h4 style="position: relative;">TPA Claim Status List</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@ -34,63 +33,40 @@ table.dataTable tbody td {
|
|||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: center;" colspan="8">OPEN</th>
|
<th style="text-align: center;" colspan="8">OPEN</th>
|
||||||
<th style="text-align: center;" colspan="5">CLEARED</th>
|
<th style="text-align: center;" colspan="5" >CLEARED</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>TPA</th>
|
<?php foreach ($column_order as $col_name): ?>
|
||||||
<th>ID Not Generated</th>
|
<th><?= str_replace('_', ' ', $col_name) ?></th>
|
||||||
<th>Non-ID</th>
|
<?php endforeach; ?>
|
||||||
<th>CDA</th>
|
|
||||||
<th>Information Required</th>
|
|
||||||
<th>Under Process</th>
|
|
||||||
<th>Approved</th>
|
|
||||||
<th>Payment Initiated</th>
|
|
||||||
<th>Total</th>
|
|
||||||
<th>Closed</th>
|
|
||||||
<th>Settled</th>
|
|
||||||
<th>Returned</th>
|
|
||||||
<th>Denied</th>
|
|
||||||
<th>Total</th>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($tpa_wise_data as $data): ?>
|
<?php foreach ($tpa_wise_data as $row): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?= $data['tpa_name'] ?></td>
|
<?php foreach ($column_order as $col_name): ?>
|
||||||
<td><?= $data['id_not_generated'] ?></td>
|
<td><?= $row[$col_name] ?></td>
|
||||||
<td><?= $data['non_id'] ?></td>
|
<?php endforeach; ?>
|
||||||
<td><?=$data['cda']?></td>
|
|
||||||
<td><?=$data['information_required'] ?></td>
|
|
||||||
<td><?=$data['under_process'] ?></td>
|
|
||||||
<td><?=$data['approved'] ?></td>
|
|
||||||
<td><?=$data['payment_initiated'] ?></td>
|
|
||||||
<td><?=$data['total'] ?></td>
|
|
||||||
<td><?=$data['closed'] ?></td>
|
|
||||||
<td><?=$data['settled'] ?></td>
|
|
||||||
<td><?=$data['returned'] ?></td>
|
|
||||||
<td><?=$data['denied'] ?></td>
|
|
||||||
<td><?=$data['total2'] ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Grand Total</th>
|
<th>Grand Total</th>
|
||||||
<th></th>
|
<?php
|
||||||
<th></th>
|
$totals = array_fill_keys($column_order, 0);
|
||||||
<th></th>
|
foreach ($tpa_wise_data as $row) {
|
||||||
<th></th>
|
foreach ($column_order as $col_name) {
|
||||||
<th></th>
|
$totals[$col_name] += is_numeric($row[$col_name]) ? $row[$col_name] : 0;
|
||||||
<th></th>
|
}
|
||||||
<th></th>
|
}
|
||||||
<th></th>
|
|
||||||
<th></th>
|
foreach ($column_order as $col_name) {
|
||||||
<th></th>
|
if ($col_name !== 'TPA_NAME') {
|
||||||
<th></th>
|
echo "<th>{$totals[$col_name]}</th>";
|
||||||
<th></th>
|
}
|
||||||
<th></th>
|
}
|
||||||
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@ -106,102 +82,17 @@ table.dataTable tbody td {
|
|||||||
if (ticketsTable.length) {
|
if (ticketsTable.length) {
|
||||||
ticketsTable.DataTable({
|
ticketsTable.DataTable({
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{ extend: 'csv', text: 'CSV', title: 'Insurer-Wise-Report-List' },
|
||||||
extend: 'csv',
|
{ extend: 'excel', text: 'Excel', title: 'Insurer-Wise-Report-List', exportOptions: { orthogonal: 'sort' } }
|
||||||
text: 'CSV',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
extend: 'excel',
|
|
||||||
text: 'Excel',
|
|
||||||
title: 'Insurer-Wise-Report-List',
|
|
||||||
exportOptions: {
|
|
||||||
orthogonal: 'sort'
|
|
||||||
},
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
language: {
|
language: { search: "_INPUT_", searchPlaceholder: "Search..." },
|
||||||
search: "_INPUT_",
|
paging: true,
|
||||||
searchPlaceholder: "Search..."
|
pageLength: 10,
|
||||||
},
|
ordering: false
|
||||||
paging: true, // Enable pagination
|
|
||||||
pageLength: 10, // Set default number of rows per page (optional)
|
|
||||||
ordering: false,
|
|
||||||
footerCallback: function(row, data, start, end, display) {
|
|
||||||
var api = this.api();
|
|
||||||
|
|
||||||
// Helper function to parse numbers
|
|
||||||
var parseNumber = function(value) {
|
|
||||||
return typeof value === 'string' ?
|
|
||||||
parseFloat(value.replace(/[\$,]/g, '')) :
|
|
||||||
typeof value === 'number' ? value : 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Calculate total for each column
|
|
||||||
var total_id_not_generated = api.column(1).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_non_id = api.column(2).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
var total_cda = api.column(3).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_information_required = api.column(4).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_under_process = api.column(5).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_approved = api.column(6).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_payment_initiated = api.column(7).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_of_total = api.column(8).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_closed = api.column(9).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_settled = api.column(10).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_returned = api.column(11).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_denied = api.column(12).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
var total_of_total2 = api.column(13).data().reduce(function(a, b) {
|
|
||||||
return parseNumber(a) + parseNumber(b);
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
// Update the footer with totals
|
|
||||||
$(api.column(1).footer()).html(total_id_not_generated);
|
|
||||||
$(api.column(2).footer()).html(total_non_id);
|
|
||||||
$(api.column(3).footer()).html(total_cda);
|
|
||||||
$(api.column(4).footer()).html(total_information_required);
|
|
||||||
$(api.column(5).footer()).html(total_under_process);
|
|
||||||
$(api.column(6).footer()).html(total_approved);
|
|
||||||
$(api.column(7).footer()).html(total_payment_initiated);
|
|
||||||
$(api.column(8).footer()).html(total_of_total);
|
|
||||||
$(api.column(9).footer()).html(total_closed);
|
|
||||||
$(api.column(10).footer()).html(total_settled);
|
|
||||||
$(api.column(11).footer()).html(total_returned);
|
|
||||||
$(api.column(12).footer()).html(total_denied);
|
|
||||||
$(api.column(13).footer()).html(total_of_total2);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.error("Table not found.");
|
console.error("Table not found.");
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-12 {
|
.col-12 {
|
||||||
|
|
||||||
max-width: 98% !important;
|
max-width: 98% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dataTables_filter {
|
.dataTables_filter {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-align-input {
|
.right-align-input {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="col-12" id="second_page">
|
<div class="col-12" id="second_page">
|
||||||
@ -35,20 +35,51 @@ table.dataTable tbody td {
|
|||||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach (array_keys($data[0]) as $header): ?>
|
<?php
|
||||||
<th><?= esc($header) ?></th>
|
// Get headers dynamically
|
||||||
|
$headers = array_keys($data[0]);
|
||||||
|
?>
|
||||||
|
<?php foreach ($headers as $header): ?>
|
||||||
|
<th><?= esc($header) ?></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<th>TOTAL</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<?php
|
||||||
|
// Initialize column-wise totals
|
||||||
|
$columnTotals = array_fill_keys($headers, 0);
|
||||||
|
?>
|
||||||
<?php foreach ($data as $row): ?>
|
<?php foreach ($data as $row): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach ($row as $value): ?>
|
<?php
|
||||||
<td class="right-align-input"><?= esc($value) ?></td>
|
$rowTotal = 0; // Initialize row total
|
||||||
<?php endforeach; ?>
|
foreach ($row as $key => $value):
|
||||||
</tr>
|
// Convert numeric values to integer (ignore 'tat_category')
|
||||||
|
$numValue = is_numeric($value) ? (int) $value : 0;
|
||||||
|
|
||||||
|
if ($key != 'TAT_Category') {
|
||||||
|
$columnTotals[$key] += $numValue; // Add to column total
|
||||||
|
$rowTotal += $numValue; // Add to row total
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<td><?= esc($value) ?></td>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<td><strong><?= esc($rowTotal) ?></strong></td> <!-- Display row total -->
|
||||||
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($columnTotals as $key => $total): ?>
|
||||||
|
<th><?= ($key == "TAT_Category") ? "TOTAL" : esc($total) ?></th>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<th><strong><?= array_sum(array_filter($columnTotals, 'is_numeric')) ?></strong></th>
|
||||||
|
<!-- Grand Total -->
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
</table>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@ -61,41 +92,41 @@ table.dataTable tbody td {
|
|||||||
<!-------------------------------------------------------------------------------------------------->
|
<!-------------------------------------------------------------------------------------------------->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Datatable document ready
|
// Datatable document ready
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||||
|
|
||||||
if (ticketsTable.length) {
|
if (ticketsTable.length) {
|
||||||
ticketsTable.DataTable({
|
ticketsTable.DataTable({
|
||||||
scrollX: true,
|
scrollX: true,
|
||||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||||
buttons: [{
|
buttons: [{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'TAT BAND WISE DATA',
|
title: 'TAT BAND WISE DATA',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'excel',
|
||||||
|
text: 'Excel',
|
||||||
|
title: 'TAT BAND WISE DATA',
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
search: "_INPUT_",
|
||||||
|
searchPlaceholder: "Search..."
|
||||||
},
|
},
|
||||||
{
|
paging: true, // Enable pagination
|
||||||
extend: 'excel',
|
pageLength: 10, // Set default number of rows per page (optional)
|
||||||
text: 'Excel',
|
ordering: false,
|
||||||
title: 'TAT BAND WISE DATA',
|
});
|
||||||
}
|
} else {
|
||||||
|
console.error("Table atet found.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
],
|
// ----------------------------------------------------------------------------------------------------
|
||||||
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>
|
</script>
|
||||||
@ -219,6 +219,13 @@
|
|||||||
name="pod_no">
|
name="pod_no">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="claim_number">Claim Number<span class="text-danger"></span></label>
|
||||||
|
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
|
||||||
|
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
|
||||||
|
name="claim_number">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||||
|
|||||||
@ -195,6 +195,13 @@
|
|||||||
name="si_amt">
|
name="si_amt">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="claim_number">Claim Number<span class="text-danger"></span></label>
|
||||||
|
<input type="text" class="form-control" id="claim_number" placeholder="Enter Claim NO"
|
||||||
|
value="<?= isset($ticket_data['claim_number']) ? $ticket_data['claim_number'] : '' ?>"
|
||||||
|
name="claim_number">
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
<div class="form-group col-md-12 text-right m-b-0" style="margin-top: 29px;">
|
||||||
|
|||||||
@ -85,8 +85,8 @@ table.dataTable tbody td {
|
|||||||
<td><?php echo $row['owner_name']; ?></td>
|
<td><?php echo $row['owner_name']; ?></td>
|
||||||
<td><?php echo $row['rc']; ?></td>
|
<td><?php echo $row['rc']; ?></td>
|
||||||
<td><?php echo $row['vehicle_no']; ?></td>
|
<td><?php echo $row['vehicle_no']; ?></td>
|
||||||
<td><?php echo $vehicle_type[$row['type']]; ?></td>
|
<td><?php echo $vehicle_type[$row['type']] ?? ""; ?></td>
|
||||||
<td><?php echo $vehicle_des[$row['description']]; ?></td>
|
<td><?php echo $vehicle_des[$row['description']] ?? ""; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
<a href="javascript: void(0);"
|
<a href="javascript: void(0);"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user