diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 5ee0296c..2dbe4d60 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -206,16 +206,16 @@ class ClientController extends AdminController public function view_Deposit($insurerId) { // Load your model to fetch data based on $clientId and $insurerId - $subTypeOptions = [ - 1 => 'Deposit', - 2 => 'Adjustment', - 3 => 'Refund', - 4 => 'Debit', - ]; + // $subTypeOptions = [ + // 1 => 'Deposit', + // 2 => 'Adjustment', + // 3 => 'Refund', + // 4 => 'Debit', + // ]; $subTypeOptions = [ 1 => 'Replenishment', 2 => 'Adjustment', - 3 => 'RefundFromDeletion', + 3 => 'Refund From Deletion', 4 => 'Debit', ]; @@ -248,7 +248,7 @@ class ClientController extends AdminController $CD_Account_Number = $this->CDMasterModel ->where('client_id', $client_id) - ->where('insurer_id', $insurer_id['insurer_id']) + ->where('insurer_id', $insurer_id) ->first(); // Prepare the array with data @@ -262,12 +262,14 @@ class ClientController extends AdminController 'insurer_id' => $this->request->getPost('insurer_id'), 'description' => $this->request->getPost('description'), 'transaction_type' => $this->request->getPost('transaction_type') ?: 'Credit', - 'updated_by' => 1, // You need to set the correct value for updated_by + 'updated_by' => 1, ]; + // Call the saveDeposit function from DepositHelper $response = DepositHelper::saveDeposit($data, $loggedInUserID); + // Return a boolean value based on success return $this->response->setJSON(['success' => $response['success']]); } diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index f24f52a3..04f1e336 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -1124,7 +1124,7 @@ class MasterController extends AdminController { $data['CD_Master_Data'] = $this->CDMasterModel - ->select('cd_master.*, clients.client_name, insurers.name as insurer_name, user_profiles.first_name as user_name') + ->select('cd_master.*, clients.client_name, clients.short_name, insurers.name as insurer_name, user_profiles.first_name as user_name') ->join('clients', 'clients.id = cd_master.client_id') ->join('insurers', 'insurers.id = cd_master.insurer_id') ->join('user_profiles', 'user_profiles.id = cd_master.created_by') diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index ab0f8b74..a339b142 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -185,19 +185,19 @@ class ClientPolicyModel extends Model ->select('clients.client_name as clientname, clients.short_name as clientshort') ->select('policies.name as policy_name') ->select('user_profiles.first_name as username') - ->join('user_profiles','user_profiles.id=cash_deposit.created_by') - ->join('insurers', 'insurers.id = cash_deposit.insurer_id') - ->join('clients', 'clients.id = cash_deposit.client_id') - ->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id') - ->join('policies', 'policies.id = client_policy.policy_id') - + ->join('user_profiles', 'user_profiles.id = cash_deposit.created_by', 'left') + ->join('insurers', 'insurers.id = cash_deposit.insurer_id', 'left') + ->join('clients', 'clients.id = cash_deposit.client_id', 'left') + ->join('client_policy', 'client_policy.id = cash_deposit.client_policy_id', 'left') + ->join('policies', 'policies.id = client_policy.policy_id', 'left') ->where('cash_deposit.client_id', $clientId) - ->where('cash_deposit.insurer_id', $insurerId) // Add this line to filter by insurer_id + ->where('cash_deposit.insurer_id', $insurerId) ->orderBy('cash_deposit.id', 'DESC') ->get() ->getResult(); } + public function getDepositSummary($clientId, $insurerId) { // Fetch the sum of credit and debit transactions and calculate the balance diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index fde9f69a..7a001b39 100644 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -49,7 +49,7 @@ table.dataTable thead th { - + ( ) @@ -81,11 +81,11 @@ table.dataTable thead th {