diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index ae04f357..fa3d4378 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -157,7 +157,14 @@ class EmpDataServiceController extends BaseController return 5; } - $cash_balance = $this->clientDepositModel->where('cd_ac_no', $policy_details['cd_ac_no'])->orderBy('id', 'DESC')->first(); + $cash_balance = $this->clientDepositModel + ->where('cd_ac_pk', $policy_details['cd_ac_pk']) + // ->where('cd_ac_no', $policy_details['cd_ac_no']) + ->where('is_active', 1) + ->orderBy('id', 'DESC') + ->first(); + + // dd(db_connect()->getLastQuery(), $cash_balance); if ($cash_balance == null) { $balance = $this->CDMasterModel @@ -647,7 +654,12 @@ class EmpDataServiceController extends BaseController return 1; } - $cash_balance = $this->clientDepositModel->where('cd_ac_no', $policy_details['cd_ac_no'])->orderBy('id', 'DESC')->first(); + $cash_balance = $this->clientDepositModel + ->where('cd_ac_pk', $policy_details['cd_ac_pk']) + // ->where('cd_ac_no', $policy_details['cd_ac_no']) + ->where('is_active', 1) + ->orderBy('id', 'DESC') + ->first(); if ($cash_balance == null) { @@ -952,7 +964,12 @@ class EmpDataServiceController extends BaseController return 5; } - $cash_balance = $this->clientDepositModel->where('cd_ac_no', $policy_details['cd_ac_no'])->orderBy('id', 'DESC')->first(); + $cash_balance = $this->clientDepositModel + ->where('cd_ac_pk', $policy_details['cd_ac_pk']) + // ->where('cd_ac_no', $policy_details['cd_ac_no']) + ->where('is_active', 1) + ->orderBy('id', 'DESC') + ->first(); if ($cash_balance == null) { $balance = $this->CDMasterModel