diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 42ba6641..0b15d139 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -484,7 +484,7 @@ class ClientController extends AdminController // Fetch associated insurer names and balances $balances = $this->clientPolicyModel->getBalances($id); $data['balances'] = $balances; - + // dd($data); echo view('layout/header', $headerData); echo view('client_deposit_list', $data); echo view('layout/footer'); @@ -521,7 +521,7 @@ class ClientController extends AdminController $data['clientData'] = $this->clientPolicyModel->getClientById($clientId); $data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId); - // dd($data['depositdata']); + // dd($data['insurerName']); // print_r($data['depositdata'] );die; // Load the view for the new list page; @@ -1051,7 +1051,7 @@ class ClientController extends AdminController $data['policy_status'] = 1; $data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1; $data['client_branch_id'] = $this->request->getPost('client_branch_id'); - $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); + $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); $data['gst'] = $this->request->getPost('gst'); $data['disclaimer'] = $this->request->getPost('disclaimer'); $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; @@ -1102,7 +1102,7 @@ class ClientController extends AdminController 'insurer_branch_id' => $insurerBranchId, 'issue_type' => 1, 'policy_no' => $this->request->getPost('policy_no'), - 'cd_ac_no' => $this->request->getPost('cd_ac_no'), + 'cd_ac_pk' => $this->request->getPost('cd_ac_no'), 'policy_issue_date' => date('Y-m-d'), 'policy_start_date' => change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'), 'policy_end_date' => change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'), @@ -1112,7 +1112,6 @@ class ClientController extends AdminController ]; - $insert = $this->clientPolicyModel->insert($data); if ($insert) { @@ -1139,6 +1138,7 @@ class ClientController extends AdminController public function editClientPolicy() { + // print_r('test'); die; $this->myLogger->logme('error', 'Client policy function called'); @@ -1182,13 +1182,12 @@ class ClientController extends AdminController $data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1; $data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0; $data['client_branch_id'] = $this->request->getPost('client_branch_id'); - $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); + $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); $data['gst'] = $this->request->getPost('gst'); $data['disclaimer'] = $this->request->getPost('disclaimer'); $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; - if ($data['inception_type'] == 2) { $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 20b3e549..32d9738d 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -3880,7 +3880,8 @@ class EmpDataServiceController extends BaseController foreach($units as $unit) { - + $client_policy_id = $arrayData['client_policy_id']; + $cd_ac_pk = $this->clientPolicyModel->select('cd_ac_pk')->where('id',$client_policy_id)->first(); $amount = $this->employeePolicyModel->query(" SELECT SUM(rata_premimum + gst) AS total_sum FROM employee_polices @@ -3908,6 +3909,7 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, + 'cd_ac_pk' => $cd_ac_pk['cd_ac_pk'] ]; $response = DepositHelper::saveDeposit($data, $arrayData['user_id']); @@ -3964,6 +3966,7 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, + 'cd_ac_pk' => $insurer_id['cd_ac_pk'] ]; $response = DepositHelper::saveDeposit($data, $arrayData['user_id']); @@ -3999,7 +4002,7 @@ class EmpDataServiceController extends BaseController // dd($client_branch_data, $units); $get_insurer_id_from_client_policy = db_connect()->table('client_policy') - ->select('insurer_id') + ->select('insurer_id,cd_ac_pk') ->where('id', $arrayData['client_policy_id']) ->get() ->getRowArray(); @@ -4077,6 +4080,7 @@ class EmpDataServiceController extends BaseController 'updated_by' => $arrayData['user_id'], 'event_name' => $arrayData['event_name'], 'is_active' => 1, + 'cd_ac_pk' => $insurer_id['cd_ac_pk'] ]; $response = DepositHelper::saveDeposit($data, $arrayData['user_id']); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 095e9327..4b5c9032 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -1224,7 +1224,7 @@ class MasterController extends AdminController $data = $this->request->getPost(); $date = (string) $this->request->getPost('opening_date'); $data['opening_date'] = date('Y-m-d', strtotime($date)); - + // print_rr($data);die(); // Prepare the array with data $cd_tranction_data = [ 'amount' => $data['opening_bal'], @@ -1247,7 +1247,7 @@ class MasterController extends AdminController $insert = $this->CDMasterModel->insert($data); if ($insert) { - + $cd_tranction_data['cd_ac_pk'] = $this->CDMasterModel->insertID(); $response = DepositHelper::saveDeposit($cd_tranction_data, $loggedInUserID); session()->setFlashdata('success', "Cash Deposite Master Added Successfully"); diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index d7d2748b..6784c0fd 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -225,6 +225,7 @@ class PolicyTransactionController extends BaseController // print_r($this->request->getPost()); die; $id = $this->request->getPost('id'); $data = $this->preparePolicyData(); + $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); // print_r($this->request->getPost()); die; @@ -434,7 +435,7 @@ class PolicyTransactionController extends BaseController if(isset($data['follow_insurer_id'])){ foreach ($data['follow_insurer_id'] as $index => $insurer) { - + // Separate the insurer and insurer branch list($insurer_branch_id, $insurer_id) = explode('-', $insurer); @@ -534,7 +535,7 @@ class PolicyTransactionController extends BaseController 'created_by' => get_session_userid(), 'policy_no' => $data['policy_no'] ?? null, 'client_branch_id' => $data['client_branch_id'] ?? 0, - 'cd_ac_no' => $data['cd_ac_no'] ?? null, + 'cd_ac_pk' => $data['cd_ac_no'] ?? null, 'gst' => 18, ]; } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index ce177302..b9f5c34e 100755 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -40,7 +40,7 @@ class UserController extends AdminController $data['UserList'] = $this->userModel->getUserList(); // echo '
';
// print_r($data); die;
- $data['roleData'] = $this->roleModel->select('id, role')->findAll();
+ $data['roleData'] = $this->roleModel->select('id, role')->findAll();
$data['teamData'] = $this->teamModel->select('id, name')->findAll();
$this->loadLayout('UserList', $data);
}
diff --git a/app/Helpers/DepositHelper.php b/app/Helpers/DepositHelper.php
index aa5950f0..0ee54530 100755
--- a/app/Helpers/DepositHelper.php
+++ b/app/Helpers/DepositHelper.php
@@ -62,6 +62,7 @@ class DepositHelper
'created_by' => $loggedInUserID,
'updated_by' => $data['updated_by'],
'balance' => $newBalance, // Include the new balance in the data array
+ 'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null,
];
// Insert data and get the insert ID
diff --git a/app/Models/ClientDepositModel.php b/app/Models/ClientDepositModel.php
index 00530dec..91bdf1c4 100755
--- a/app/Models/ClientDepositModel.php
+++ b/app/Models/ClientDepositModel.php
@@ -27,6 +27,7 @@ class ClientDepositModel extends Model
"endorsement_no",
"event_name",
"unit",
+ "cd_ac_pk"
];
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index cd68444d..6e9cc897 100755
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -52,6 +52,7 @@ class ClientPolicyModel extends Model
"disclaimer",
"is_active",
"is_member_modify_allowed",
+ "cd_ac_pk"
];
// Callbacks
@@ -169,13 +170,14 @@ class ClientPolicyModel extends Model
public function getinsurerswithclientid($id){
return $this->db->table('client_policy')
- ->select('client_policy.*, cd_master.cd_ac_no')
+ ->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
->select('clients.client_name as client_name')
->join('clients','clients.id=client_policy.client_id')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
->where('client_policy.client_id', $id)
+ ->where('cd_master.id = client_policy.cd_ac_pk')
->groupBy('client_policy.insurer_id')
->groupBy('client_policy.client_id', $id) // Group by insurer_id
->get()
@@ -225,6 +227,7 @@ class ClientPolicyModel extends Model
->select('cash_deposit.*')
->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('cd_master.cd_ac_no as cd_master_account_no')
// ->select('policies.name as policy_name')
->select('policy_type.policy_type')
->select('user_profiles.first_name as username')
@@ -232,11 +235,13 @@ class ClientPolicyModel extends Model
->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('cd_master', 'cd_master.id = cash_deposit.cd_ac_pk', 'left')
// ->join('policies', 'policies.id = client_policy.policy_id', 'left')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
->where('cash_deposit.client_id', $clientId)
->where('cash_deposit.insurer_id', $insurerId)
->where('cash_deposit.is_active', 1)
+ // ->where('cash_deposit.cd_ac_pk = cd_master.id')
->orderBy('cash_deposit.id', 'DESC')
->get()
->getResult();
diff --git a/app/Models/InsurerModel.php b/app/Models/InsurerModel.php
index 61572263..e24dd00a 100755
--- a/app/Models/InsurerModel.php
+++ b/app/Models/InsurerModel.php
@@ -41,11 +41,12 @@ class InsurerModel extends Model
{
// Fetch the insurer name based on the insurer ID
$query = $this->db->table('client_policy')
- ->select('insurers.id, insurers.name, cd_master.cd_ac_no')
+ ->select('insurers.id, insurers.name, cd_master.cd_ac_no as cd_master_account_no')
->join('insurers', 'insurers.id = client_policy.insurer_id')
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
->where('client_policy.insurer_id', $insurerId)
->where('client_policy.client_id', $client_id)
+ ->where('cd_master.id = client_policy.cd_ac_pk')
->get();
if ($query->resultID->num_rows > 0) {
diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php
index 8ab22397..0364fd17 100644
--- a/app/Models/PolicyTransactionModel.php
+++ b/app/Models/PolicyTransactionModel.php
@@ -76,6 +76,7 @@ class PolicyTransactionModel extends Model
'ct_tran_id',
'remarks',
'month',
+ 'cd_ac_pk'
];
diff --git a/app/Views/UserList.php b/app/Views/UserList.php
index 37ce4dd5..be654b8d 100755
--- a/app/Views/UserList.php
+++ b/app/Views/UserList.php
@@ -182,7 +182,9 @@ $(document).ready(function () {
$('#tickets-table').DataTable({
- dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
+ dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" + // Keep your original alignment for the search and buttons
+ "<'row'<'col-sm-12'tr>>" + // Table rows
+ "<'row'<'col-sm-6'i><'col-sm-6'p>>",
buttons: [
{
extend: 'csv',
diff --git a/app/Views/business_team_list.php b/app/Views/business_team_list.php
index 33c99426..57a1db4a 100644
--- a/app/Views/business_team_list.php
+++ b/app/Views/business_team_list.php
@@ -209,6 +209,28 @@ table.dataTable tbody td {
+
+
+
+
+