FIX_LIVE_ISSUE

This commit is contained in:
VENKATESHWARAN 2025-06-03 17:51:55 +05:30
parent cf8849fa71
commit 481bddb2c1
5 changed files with 26 additions and 15 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

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

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