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

This commit is contained in:
Srinivas-Saravanan 2025-06-05 10:24:20 +05:30
commit 35a2930439
7 changed files with 41 additions and 24 deletions

View File

@ -661,8 +661,9 @@ class ClientController extends AdminController
$loggedInUserID = get_session_userid(); $loggedInUserID = get_session_userid();
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId); // $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
$clientId = $this->request->getGet('client_id'); $clientId = $this->request->getGet('client_id');
$cd_ac_pk = $this->request->getGet('cd_ac_pk');
$data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId); $data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId);
$data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId); $data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId, $cd_ac_pk);
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId); $data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId); $data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);

View File

@ -185,7 +185,7 @@ class EmpDataServiceController extends BaseController
$balance = $this->CDMasterModel $balance = $this->CDMasterModel
->where('client_id', $export_data['client_id']) ->where('client_id', $export_data['client_id'])
->where('insurer_id', $policy_details['insurer_id']) ->where('insurer_id', $policy_details['insurer_id'])
->where('cd_ac_no', $policy_details['cd_ac_no']) ->where('id', $policy_details['cd_ac_pk'])
->first(); ->first();
$cash_balance['balance'] = $balance['opening_bal']; $cash_balance['balance'] = $balance['opening_bal'];
@ -683,7 +683,7 @@ class EmpDataServiceController extends BaseController
$balance = $this->CDMasterModel $balance = $this->CDMasterModel
->where('client_id', $export_data['client_id']) ->where('client_id', $export_data['client_id'])
->where('insurer_id', $policy_details['insurer_id']) ->where('insurer_id', $policy_details['insurer_id'])
->where('cd_ac_no', $policy_details['cd_ac_no']) ->where('id', $policy_details['cd_ac_pk'])
->first(); ->first();
$cash_balance['balance'] = $balance['opening_bal']; $cash_balance['balance'] = $balance['opening_bal'];

View File

@ -2501,7 +2501,7 @@ class EmployeeRestController extends AdminController
function getEmployeeActiveOrInactivePolicy() function getEmployeeActiveOrInactivePolicy()
{ {
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; } if($this->request->getGet('type') == 'Active'){ $policy_status = 1; $policy_status_key = "Active"; }else{ $policy_status = 0; $policy_status_key = "InActive";}
$dayInterval = 10; $dayInterval = 10;
$ClientPolicyData = $this->clientPolicyModel->select("client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name, DATE_ADD(client_policy.policy_end_date, INTERVAL {$dayInterval} DAY) as claims_grace_date") $ClientPolicyData = $this->clientPolicyModel->select("client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url, policy_type.long_name as policy_long_name, DATE_ADD(client_policy.policy_end_date, INTERVAL {$dayInterval} DAY) as claims_grace_date")
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
@ -2527,12 +2527,16 @@ class EmployeeRestController extends AdminController
->get()->getRow()->name; ->get()->getRow()->name;
$whereArrayForId = []; $whereArrayForId = [];
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); } foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
if(count($ClientPolicyData) > 0 && count($employeeData) > 0) if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
{ {
$result = []; $result = [];
foreach ($ClientPolicyData as $key => $ClientPolicyValue) { foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
if (strtotime(date('Y-m-d') > strtotime($ClientPolicyValue['claims_grace_date']))) {
continue;
}
if($ClientPolicyValue['policy_type_id'] == 1) if($ClientPolicyValue['policy_type_id'] == 1)
{ {
$policyGroup = 'gpa'; $policyGroup = 'gpa';
@ -2566,7 +2570,8 @@ class EmployeeRestController extends AdminController
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']); $data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']); $data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
$data['heading'] = $ClientPolicyValue['policy_long_name']; $data['heading'] = $ClientPolicyValue['policy_long_name'];
$data['claims_grace_date'] = $ClientPolicyValue['claims_grace_date']; $data['claims_grace_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['claims_grace_date']);
$data['policy_status'] = $policy_status_key;
// $data['policy_terms'] = $terms; // $data['policy_terms'] = $terms;
// if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else // if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else

View File

@ -1649,6 +1649,7 @@ class PolicyTransactionController extends BaseController
->where('policy_transaction.client_id', $client_id) ->where('policy_transaction.client_id', $client_id)
->where('policy_transaction.client_policy_id', $client_policy_id) ->where('policy_transaction.client_policy_id', $client_policy_id)
->where('policy_transaction.action_type', 'inception') ->where('policy_transaction.action_type', 'inception')
->where('policy_transaction.is_active', 1)
->findAll(); ->findAll();
$is_copay_yes = $this->policyTransactionModel $is_copay_yes = $this->policyTransactionModel

View File

@ -181,8 +181,9 @@ class ClientPolicyModel extends Model
->where('client_policy.client_id', $id) ->where('client_policy.client_id', $id)
->where('cd_master.id = client_policy.cd_ac_pk') ->where('cd_master.id = client_policy.cd_ac_pk')
->where('cd_master.is_active', 1) ->where('cd_master.is_active', 1)
->groupBy('client_policy.insurer_id')
->groupBy('client_policy.client_id', $id) // Group by insurer_id ->groupBy('client_policy.client_id', $id) // Group by insurer_id
->groupBy('client_policy.insurer_id')
->groupBy('client_policy.cd_ac_pk')
->get() ->get()
->getResult(); ->getResult();
@ -225,10 +226,10 @@ class ClientPolicyModel extends Model
} }
public function getDepositData($clientId, $insurerId) public function getDepositData($clientId, $insurerId, $cd_ac_pk = null)
{ {
// Fetch the deposit data based on client and insurer IDs // Fetch the deposit data based on client and insurer IDs
return $this->db->table('cash_deposit') $query = $this->db->table('cash_deposit')
->select('cash_deposit.*') ->select('cash_deposit.*')
->select('insurers.name as insurer_name, insurers.short_name as insurer_short') ->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
->select('clients.client_name as clientname, clients.short_name as clientshort, client_policy.policy_no') ->select('clients.client_name as clientname, clients.short_name as clientshort, client_policy.policy_no')
@ -245,11 +246,14 @@ class ClientPolicyModel extends Model
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
->where('cash_deposit.client_id', $clientId) ->where('cash_deposit.client_id', $clientId)
->where('cash_deposit.insurer_id', $insurerId) ->where('cash_deposit.insurer_id', $insurerId)
->where('cash_deposit.is_active', 1) ->where('cash_deposit.is_active', 1);
// ->where('cash_deposit.cd_ac_pk = cd_master.id') // ->where('cash_deposit.cd_ac_pk = cd_master.id')
->orderBy('cash_deposit.id', 'DESC') if(!empty($cd_ac_pk)){
->get() $query->where('cash_deposit.cd_ac_pk', $cd_ac_pk);
->getResult(); }
$query->orderBy('cash_deposit.id', 'DESC');
return $query->get()->getResult();
} }
@ -319,6 +323,7 @@ class ClientPolicyModel extends Model
->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance') ->select('SUM(CASE WHEN transaction_type = "Credit" THEN amount ELSE -amount END) AS balance')
->where('client_id', $id) ->where('client_id', $id)
->groupBy('insurer_id') ->groupBy('insurer_id')
->groupBy('cd_ac_pk')
->get() ->get()
->getResult(); ->getResult();
} }

View File

@ -416,7 +416,7 @@ class EmployeePolicyModel extends Model
employees.designation AS emp_designation, employees.designation AS emp_designation,
employees.basic_pay AS emp_basic_pay, employees.basic_pay AS emp_basic_pay,
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age, TIMESTAMPDIFF(YEAR, employees.dob, employee_polices.date_coverage) AS emp_age,
employees.emp_type as emp_type, employees.emp_type as emp_type,
@ -641,21 +641,22 @@ class EmployeePolicyModel extends Model
sidata.new_basic_cover_si, sidata.new_basic_cover_si,
sidata.new_si_premium, sidata.new_si_premium,
sidata.old_si_premium,
sidata.date_of_coverage, sidata.date_of_coverage,
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days, DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium, ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premium, ROUND((sidata.new_si_premium - sidata.old_si_premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premium,
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst, ROUND(((sidata.new_si_premium - sidata.old_si_premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
ROUND( ROUND(
((sidata.new_si_premium - employee_polices.rata_premimum) * ((sidata.new_si_premium - sidata.old_si_premium) *
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) +
ROUND( ROUND(
((sidata.new_si_premium - employee_polices.rata_premimum) * ((sidata.new_si_premium - sidata.old_si_premium) *
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2 (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2
), 2 ), 2
) AS total ) AS total
@ -671,12 +672,14 @@ class EmployeePolicyModel extends Model
aa.emp_code, aa.emp_code,
aa.new_value as 'new_basic_cover_si', aa.new_value as 'new_basic_cover_si',
bb.new_value as 'new_si_premium', bb.new_value as 'new_si_premium',
bb.old_value as 'old_si_premium',
cc.new_value as 'date_of_coverage' cc.new_value as 'date_of_coverage'
FROM ( FROM (
SELECT SELECT
a1.emp_code, a1.emp_code,
a1.field_name, a1.field_name,
a1.new_value a1.new_value,
a1.old_value
FROM FROM
emp_endorsement as a1 emp_endorsement as a1
WHERE WHERE
@ -686,7 +689,8 @@ class EmployeePolicyModel extends Model
SELECT SELECT
b1.emp_code, b1.emp_code,
b1.field_name, b1.field_name,
b1.new_value b1.new_value,
b1.old_value
FROM FROM
emp_endorsement as b1 emp_endorsement as b1
WHERE WHERE
@ -696,7 +700,8 @@ class EmployeePolicyModel extends Model
SELECT SELECT
c1.emp_code, c1.emp_code,
c1.field_name, c1.field_name,
c1.new_value c1.new_value,
c1.old_value
FROM FROM
emp_endorsement as c1 emp_endorsement as c1
WHERE WHERE

View File

@ -49,7 +49,7 @@
</td> </td>
<td> <td>
<a class="dropdown-item" <a class="dropdown-item"
href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}"); ?>"> href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}&cd_ac_pk={$value->cd_ac_pk}"); ?>">
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit <i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit
</a> </a>
</td> </td>