Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2025-12-03 12:09:50 +05:30
commit 4270a76582
8 changed files with 8818 additions and 2 deletions

View File

@ -432,6 +432,8 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
$routes->get("list/(:any)", "PolicyTransactionController::getInceptionDataForEdit/$1");
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
$routes->get("removePolicyTransaction/(:any)", "PolicyTransactionController::removePolicyTransaction/$1");
$routes->match(['get', 'post'], 'list2', 'PolicyTransactionController::viewInception2');
$routes->get("list2/(:any)", "PolicyTransactionController::getInceptionDataForEdit2/$1");
});
$routes->group("endorsement", ["filter" => "authMVC"], function ($routes) {

View File

@ -671,8 +671,9 @@
// Fetch Sales Team
$data['salse_team'] = $this->userModel
->select('user_profiles.*')
->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
@ -690,6 +691,7 @@
->where('is_active', 1)
->findAll();
// echo '<pre>';
// print_r($data['ppTeamsData']); die;
// dd($data);
@ -698,6 +700,160 @@
$this->loadLayout('policy_transaction_inception_list', $data);
}
public function viewInception2()
{
$bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
$data['tab_name'] = 'Policies';
$data['page_name'] = 'Policies';
// Static arrays for dropdowns
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
$data['issuing_type'] = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
$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',
'lost' => 'Lost',
];
$data['invoice_status_array'] = [
'yet_to_generate' => 'Pending',
'generated' => 'Generated',
'send' => 'Sent',
'recived' => 'Payment Received',
];
// $data['vehicle_type'] = [
// 'two_wheeler' => 'Two Wheeler',
// 'four_wheeler' => 'Four Wheeler',
// 'truck' => 'Truck',
// 'bus' => 'Bus',
// 'van' => 'Van',
// 'suv' => 'SUV',
// 'motorcycle' => 'Motorcycle',
// 'bicycle' => 'Bicycle'
// ];
$data['vehicle_type'] = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray();
$data['rto_details'] = db_connect()->table('rto_master')->where('is_active', 1)->get()->getResultArray();
$data['vehicle_des'] = [
'commercial' => 'Commercial',
'private' => 'Private',
];
$data['date_type'] = [
'policy_issue_date' => 'Policy Issue Date',
'policy_start_date' => 'Policy Start Date',
'policy_end_date' => 'Policy End Date',
];
// Filter data
$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');
// Handle null or empty values
$start_date = empty($start_date) ? 0 : $start_date;
$end_date = empty($end_date) ? 0 : $end_date;
$client_id = empty($client_id) ? 0 : $client_id;
$insurer_id = empty($insurer_id) ? 0 : $insurer_id;
$policy_type_id = empty($policy_type_id) ? 0 : $policy_type_id;
$date_type = empty($date_type) ? 0 : $date_type;
$issuer = empty($issuer) ? 0 : $issuer;
$status = empty($status) ? 0 : $status; // Corrected from `$issuer`
if(empty($bds_edit_pt_id)){
if ($this->request->is('get')) {
// Fetch inception data list
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
$start_date,
$end_date,
$client_id,
$insurer_id,
$policy_type_id,
$date_type,
$issuer,
$status
);
} else {
$ids = $this->request->getPost('ids');
$ids = array_filter(explode(',', $ids));
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
$start_date = 0,
$end_date = 0,
$client_id = 0,
$insurer_id = 0,
$policy_type_id = 0,
$date_type = 0,
$issuer = 0,
$status = 0,
$ids
);
}
}else{
$data['inception_data_list'] = [];
}
// Fetch additional data
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
$data['client_branch'] = $this->clientBranchModel->where('is_active', 1)->findAll();
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
// Fetch PP Teams Data
$data['ppTeamsData'] = $this->userModel
->where('is_active', 1)
->findAll();
// Fetch Sales Team
$data['salse_team'] = $this->userModel
->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
->join('user_teams', 'user_profiles.id = user_teams.user_id')
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
->where('user_teams.team_id', 5)
->where('user_teams.is_active', 1)
->where('user_profiles.is_active', 1)
->findAll();
// Fetch Partner Agent
$data['partner_agent'] = db_connect()->table('partner_agent')
->where('is_active', 1)
->get()
->getResultArray();
// Fetch ACM
$data['ACM'] = $this->userModel
->where('role', 3) // Assuming `role` is in `user_profiles`
->where('is_active', 1)
->findAll();
// echo '<pre>';
// print_r($data['ppTeamsData']); die;
// dd($data);
// Load view
$this->loadLayout('policy_transaction_inception_list_2', $data);
}
// policy Transaction Create function start
public function createInceptionPolicy()
{
@ -1483,6 +1639,276 @@
}
}
// Get the Single Inception Tranction data for edit
public function getInceptionDataForEdit2($id)
{
$data = $this->policyTransactionModel
->select('
policy_transaction.*,
clients.short_name as client_short_name,
clients.client_type,
clients.entity_type_id,
policy_type.policy_type,
client_policy.tpa_id as master_tpa_id,
client_policy.tpa_branch_id as master_tpa_branch_id,
client_policy.policy_type_id as master_policy_type_id,
client_policy.is_addon,
client_policy.base_policy,
(
select last_action_date
from policy_transaction_status
where policy_tran_id = policy_transaction.id
and status = policy_transaction.status
order by id desc
limit 1
) as last_action_date
')
->join('clients', 'clients.id = policy_transaction.client_id')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('policy_transaction.id', $id)
->where('policy_transaction.is_active', 1)
->first();
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
? date('d/m/Y h:i:s A', strtotime($data['created_at']))
: null;
$data['updated_at'] = (isset($data['updated_at']) && $data['updated_at'] !== null && $data['updated_at'] !== '')
? date('d/m/Y h:i:s A', strtotime($data['updated_at']))
: null;
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['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['renewal_date'])) {
$data['renewal_date'] = change_date_format($data['renewal_date'], 'Y-m-d', 'd/m/Y');
}
if (!empty($data['rollover_date'])) {
$data['rollover_date'] = change_date_format($data['rollover_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['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');
} else {
$data['month'] = null;
}
// print_r($data); die;
$data['renewal_policy'] = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.client_id', $data['client_id'])
->where('client_policy.client_branch_id', $data['client_branch_id'])
->where('client_policy.is_active', 1)
->findAll();
$data['base_policy_data'] = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.client_id', $data['client_id'])
->where('client_policy.client_branch_id', $data['client_branch_id'])
->whereIn('client_policy.policy_type_id', [2, 3])
->where('client_policy.is_active', 1)
->findAll();
$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;
$ptFileQuery = $this->PTFileModel
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
->where('pt_files.pt_id', $id)
->where('pt_files.is_active', 1);
if (!in_array(get_role_id(), [1, 5]) && empty(array_intersect(user_team(), [MANAGEMENT_TEAM_ID, FINANCE_TEAM_ID, BUSINESS_TEAM_ID]))) {
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
$ptFileQuery->where('pt_files.created_by', get_session_userid());
}
}
$data['pt_files'] = $ptFileQuery->findAll();
$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();
$data['emp_data'] = $this->employeeModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
->where('employees.client_id', $data['client_id'])
->where('employees.is_active', 1)->findAll();
// $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
$clientController = new ClientController();
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['vehicle_docs'] = $this->clientKYCDocsModel
->where('client_id', $data['client_id'])
->where('vehicle_id', $data['vehicle_id'])
->findAll();
// print_r( $data['pt_co_share_details']); die;
// return $data;
if ($data) {
return $this->respond(['status' => true, 'data' => $data], 200);
} else {
return $this->respond(['status' => false], 200);
}
}
public function removePolicyTransaction($id, $type = 0)
{
if ($id) {

View File

@ -1890,6 +1890,9 @@
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/inception/list2') ?>">Policy 2</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>

File diff suppressed because it is too large Load Diff

View File

@ -1768,4 +1768,17 @@ function removePolicyTransaction(input, pt_id, policy_type_id) {
});
}
function showForm(form) {
if (form == 1) {
$('#form1').show();
$('#form2').hide();
}
if (form == 2) {
$('#form1').hide();
$('#form2').show();
}
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
<button class="scroll-btn left-btn" type="button">&#9664;</button>
</li>
<li class="nav-item">
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active" id="general_tab">
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active-tab active" id="general_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Policy</span>
</a>

View File

@ -0,0 +1,90 @@
<div class="row" id="pt_onboarding" style="position: relative; bottom: 25px; display:none;">
<div class="col-xl-12">
<div class="card-body">
<div class="tab-wrapper position-relative">
<ul class="nav nav-pills navtab-bg" id="myTab">
<li class="nav-item d-flex justify-content-center align-items-center">
<button class="scroll-btn left-btn" type="button">&#9664;</button>
</li>
<li class="nav-item">
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active-tab active" id="general_tab">
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
<span class="d-none d-sm-inline-block">Policy</span>
</a>
</li>
<li class="nav-item">
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">KYC Docs</span>
</a>
</li>
<li class="nav-item" id="hide_file_upload" style="display: none;">
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">File Upload</span>
</a>
</li>
<li class="nav-item" id="hide_vehicle_tab" style="display: none;">
<a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab">
<span class="mr-1"><i class="mdi mdi-file"></i></span>
<span class="d-none d-sm-inline-block">Vehicle Docs</span>
</a>
</li>
<li class="nav-item d-flex justify-content-center align-items-center">
<!-- Right Arrow -->
<button class="scroll-btn right-btn" type="button">&#9654;</button>
</li>
</ul>
</div>
<div class="tab-content">
<?php include('policy_transaction_inception_form_2.php'); ?>
<?php include('drive_file_upload.php'); ?>
<?php include('client_kyc.php'); ?>
<?php include('vehicle_docs.php'); ?>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('#kyc_tab').on('click', function(e) {
var ptId = $('#policy_tranction_primarykey').val();
if (!ptId) { // Check if ptId is empty or null
e.preventDefault(); // Prevent the tab from opening
$('#g_drive_file_upload_sbt_btn').hide()
toastr.warning('Please create Policy before proceeding to File Upload.');
} else {
$('#g_drive_file_upload_sbt_btn').show()
}
});
$('#kyc_tab2').on('click', function(e) {
var ptId = $('#policy_tranction_primarykey').val();
if (!ptId) { // Check if ptId is empty or null
e.preventDefault(); // Prevent the tab from opening
$('#btn_other_docs').hide()
toastr.warning('Please create Policy before proceeding to File Upload.');
} else {
$('#btn_other_docs').show()
}
});
$('#vehicle_tab').on('click', function(e) {
var ptId = $('#policy_tranction_primarykey').val();
if (!ptId) { // Check if ptId is empty or null
e.preventDefault(); // Prevent the tab from opening
$('#vehicle_file_upload_sbt_btn').hide()
toastr.warning('Please create Policy before proceeding to File Upload.');
} else {
$('#vehicle_file_upload_sbt_btn').show()
}
});
});
</script>