diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a3a3f7ec..bd9feb09 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -448,6 +448,8 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { $routes->post("create", "PolicyTransactionController::createEndorsementPolicy"); $routes->get("list/(:any)", "PolicyTransactionController::getEndorsementDataForEdit/$1"); $routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1"); + $routes->get("list2", "PolicyTransactionController::viewEndorsement2"); + $routes->get("list2/(:any)", "PolicyTransactionController::getEndorsementDataForEdit2/$1"); }); $routes->group("report", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 2708abc4..7e154d64 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -2078,6 +2078,100 @@ $this->loadLayout('policy_transaction_endorsement_list', $data); } + public function viewEndorsement2() + { + // echo '
';
+ // !dd($this->getEndorsementDataForEdit(17));
+ $bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
+ $data['tab_name'] = 'Endorsements';
+ $data['page_name'] = 'Endorsements';
+ $data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
+ $data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
+ $data['client_type'] = [1 => 'Group', 2 => 'Individual'];
+
+ $data['policy_status'] = [
+ 'under_process' => 'Under Process',
+ 'client_pending' => 'Client Pending',
+ 'insurer_pending' => 'Insurer Pending',
+ 'co_insurer_pending' => 'Co-Insurer Pending',
+ 'tpa_pending' => 'TPA Pending',
+ 'validated' => 'Validated',
+ 'cancelled' => 'Cancelled',
+ 'instalment_pending' => 'Instalment Pending',
+ 'completed' => 'Completed',
+ ];
+
+ $data['invoice_status'] = [
+ 'yet_to_generate' => 'Pending',
+ 'generated' => 'Generated',
+ 'send' => 'Sent',
+ 'recived' => 'Payment Received',
+ ];
+
+ $data['action_type'] = [
+ 'addition' => 'Addition',
+ 'deletion' => 'Deletion',
+ 'addition_deletion' => 'Addition & Deletion',
+ 'si_enhancement' => 'SI Enhancement',
+ 'combo_a_d_si' => 'Combo A, D & SI',
+ 'correction' => 'Correction',
+ 'baby_addition' => 'Baby Addition',
+ 'policy_instalment' => 'Policy Instalment',
+ 'addition_inception' => 'Addition-Inception',
+ 'bds_correction' => 'BDS Correction',
+ 'policy_correction' => 'Policy Correction',
+ 'policy_cancellation' => 'Policy Cancellation',
+ ];
+
+ $data['date_type'] = [
+ 'policy_issue_date' => 'Policy Issue Date',
+ 'policy_start_date' => 'Policy Start Date',
+ 'policy_end_date' => 'Policy End Date',
+ ];
+
+ //filter datas
+ $start_date = $this->request->getGet('start_date');
+ $end_date = $this->request->getGet('end_date');
+ $client_id = $this->request->getGet('client_id');
+ $insurer_id = $this->request->getGet('insurer_id');
+ $policy_type_id = $this->request->getGet('policy_type_id');
+ $date_type = $this->request->getGet('date_type');
+ $issuer = $this->request->getGet('issuer');
+ $status = $this->request->getGet('status');
+
+ $start_date = (!isset($start_date) || $start_date === '' || $start_date === null) ? 0 : $start_date;
+ $end_date = (!isset($end_date) || $end_date === '' || $end_date === null) ? 0 : $end_date;
+
+ $client_id = (!isset($client_id) || $client_id === '' || $client_id === null) ? 0 : $client_id;
+ $insurer_id = (!isset($insurer_id) || $insurer_id === '' || $insurer_id === null) ? 0 : $insurer_id;
+ $policy_type_id = (!isset($policy_type_id) || $policy_type_id === '' || $policy_type_id === null) ? 0 : $policy_type_id;
+ $date_type = (!isset($date_type) || $date_type === '' || $date_type === null) ? 0 : $date_type;
+ $issuer = (!isset($issuer) || $issuer === '' || $issuer === null) ? 0 : $issuer;
+ $status = (!isset($issuer) || $status === '' || $status === null) ? 0 : $status;
+
+ if($bds_edit_pt_id == null){
+ $data['endorsement_data_list'] = $this->policyTransactionModel->getEndorsementTranctionListData($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
+ }else{
+ $data['endorsement_data_list'] = [];
+ }
+ $data['client'] = $this->clientModel->where('is_active', 1)->findAll();
+ $data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
+
+ $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
+ // $data['tpa'] = $this->tpaModel->where('is_active', 1)->findAll();
+ $data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
+ $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
+ list($policyList, $policyListByClient) = $this->getPolicyForEndorsment();
+
+ $data['endorsementPolicies'] = $policyList;
+ $data['endorsementPolicyListByClient'] = $policyListByClient;
+
+ // dd($data);
+ // print_r($data['endorsementPolicies']);die();
+
+ $this->loadLayout('policy_transaction_endorsement_list_2', $data);
+ }
+
public function createEndorsementPolicy()
{
$id = $this->request->getPost('id');
@@ -2515,6 +2609,220 @@
}
}
+ public function getEndorsementDataForEdit2($id)
+ {
+ $data = $this->policyTransactionModel
+ ->select('
+ policy_transaction.*,
+ clients.short_name as client_short_name,
+ clients.client_type,
+ (
+ select last_action_date
+ from policy_transaction_status
+ where policy_tran_id = policy_transaction.id
+ and status = policy_transaction.status
+ order by id desc
+ limit 1
+
+ ) as last_action_date
+ ')
+ ->join('clients', 'clients.id = policy_transaction.client_id')
+ ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
+ ->where('policy_transaction.id', $id)
+ ->where('policy_transaction.is_active', 1)
+ ->orderBy('id', 'asc')
+ ->first();
+
+ $pt_id = null;
+
+ if(!empty($data)){
+ $inception_data = $this->policyTransactionModel
+ ->where('policy_no', $data['policy_no'])
+ ->where('client_id', $data['client_id'])
+ ->where('action_type', 'inception')
+ ->first();
+ $pt_id = $inception_data['id'];
+ }
+
+ if (!empty($data['policy_start_date'])) {
+ $data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['policy_end_date'])) {
+ $data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['data_received_date'])) {
+ $data['data_received_date'] = change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['policy_issue_date'])) {
+ $data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['endorse_eff_date'])) {
+ $data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['install_due_date'])) {
+ $data['install_due_date'] = change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['last_action_date'])) {
+ $data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
+ }
+
+ if (!empty($data['month'])) {
+ $data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
+ }
+
+ // print_r($data); die;
+
+ //get PT Co-Share Details
+ $data['pt_co_share_details'] = $this->PTCOShareDetailsModel
+
+ ->select("
+ pt_co_share_details.*,
+
+ (
+ SELECT
+ COUNT(*)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_stmt_details.co_share_id = pt_co_share_details.id
+ AND co_share_stmt_details.is_active = 1
+ ) AS record_count,
+
+ (
+ SELECT
+ SUM(actual_bp_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_bp_amount,
+
+ (
+ SELECT
+ SUM(actual_tp_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tp_amount,
+
+ (
+ SELECT
+ SUM(actual_tep_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tep_amount,
+
+ (
+ SELECT
+ SUM(actual_bp_per)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_bp_percentage,
+
+ (
+ SELECT
+ SUM(actual_tp_per)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tp_percentage,
+
+ (
+ SELECT
+ SUM(actual_tep_per)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tep_percentage,
+
+
+ (
+ SELECT
+ SUM(actual_bp_brokerage_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_bp_brokerage_amount,
+
+
+ (
+ SELECT
+ SUM(actual_tp_brokerage_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tp_brokerage_amount,
+
+
+ (
+ SELECT
+ SUM(actual_tep_brokerage_amt)
+ FROM
+ co_share_stmt_details
+ WHERE
+ co_share_id = pt_co_share_details.id
+ AND is_active = 1
+
+ ) AS actual_tep_brokerage_amount,
+
+ DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date
+
+ ")
+ ->where('pt_id', $id)
+ ->where('is_active', 1)
+ ->orderBy('id', 'asc')
+ ->findAll();
+
+ // print_r($data['endorse_eff_date']); die;
+
+ $pt_bp_amt = $this->PTCOShareDetailsModel
+ ->select('bp_amt, amount')
+ ->where('pt_id', $id)
+ ->where('co_share_type', 1)
+ ->where('is_active', 1)
+ ->first();
+
+ // dd(db_connect()->getLastQuery() ,$pt_bp_amt);
+ $data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
+
+ if ($data) {
+ return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200);
+ } else {
+ return $this->respond(['status' => false], 200);
+ }
+ }
+
//------------------------------------------------------------------------------------------------
//file upload function
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 68950c44..eb8bfea0 100755
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -2047,6 +2047,12 @@
Policy 2
+