diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index bdc61c70..0b15d139 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2549,12 +2549,14 @@ class ClientController extends AdminController } } + //for this function policy binding dropdown list use ( client policy ) public function getClientBranch($client_id) { $branchs = $this->clientBranchModel ->select('*') ->where('client_id', $client_id) + ->where('is_active', 1) ->findAll(); return $this->respond(['status' => true, 'code' => 200, 'data' => $branchs], 200); diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 62a4be3b..32d9738d 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -3854,7 +3854,7 @@ class EmpDataServiceController extends BaseController //end not in use /** - * The below functions are Calculates and records cash deposits for employee policies at inception. + * The below functions are Calculates and records cash deposits for employee policies at Deletion. * * @param array $arrayData An array containing necessary data including : * - employee IDs, @@ -4059,7 +4059,7 @@ class EmpDataServiceController extends BaseController AND emp_endorsement.field_name = 'date_of_exit' ")->getRow(); - dd(db_connect()->getLastQuery(), $amount); + // dd(db_connect()->getLastQuery(), $amount); if($amount){ diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 6079b293..813238f3 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -1086,6 +1086,7 @@ class EmployeeController extends AdminController return $response; } + //E-CARD DOWNLOAD FUNCTION public function generateIDCardForEmployee($rand_string, $people = 0) { // dd($rand_string, $people); @@ -1186,6 +1187,8 @@ class EmployeeController extends AdminController '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png', '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png', ]; + + $placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id); foreach ($placeholders as $placeholder => $replaceValue) { $htmlContent = str_replace($placeholder, $replaceValue, $htmlContent); @@ -1225,8 +1228,278 @@ class EmployeeController extends AdminController } - //truncateFileDataIn DB (de activate rows) + //truncateFileDataIn DB (de activate rows) NEW FUNCTION public function truncateFileData($file_id, $role_id = null) + { + $this->myLogger->logme('error', '---- truncateFileData Function called ----'); + $file_id = $this->request->uri->getSegment(3); + // $file_id = 747; + + $this->myLogger->logme('error', 'File id for truncate : -- FILE ID : {data} --', ['data' => $file_id]); + + //get the files data + $file = $this->fileModel->find($file_id); + + $client_id = $file['client_id']; + $client_policy_id = $file['policy_id']; + $loggedInUserID = get_session_userid(); + + //get the client policy data + $policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first(); + + //get the cd transaction data based on the insurer and client + $cd_tranction = $this->cashDepositModel + ->where('client_id', $client_id) //client + ->where('insurer_id', $policy_data['insurer_id']) //insurer + ->where('event_name',$file['action']) //event + ->where('client_policy_id', $client_policy_id)//policy + ->orderBy('id', 'desc') + ->first(); + + // print_r($file); die; + if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'enrollment' || $file['action'] == 'missed_inception') { + + + if($file['action'] == 'enrollment'){ + $result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['draft','enrolled'], policy_status: ['draft','enrolled']); + }else{ + $result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['active'], policy_status: ['active']); + } + + // print_r($result); die; + if (count($result) && $role_id == null) { + + if(get_role_id() == 1 || get_role_id() == 5){ + return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200); + }else{ + return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200); + } + + } else { + + $this->myLogger->logme('error', '---- TRUNCATED STARTED WITH ADMIN OR HEAD PERMISSION ----'); + $this->myLogger->logme('error', '---- Event Type : -- {data} ----', ['data' => $file['action']]); + + if($file['action'] != 'enrollment') + { + $employee_policy_data_with_file_id = $this->employeePolicyModel->where('file_id', $file_id)->findAll(); + + if(!empty($employee_policy_data_with_file_id) && count($employee_policy_data_with_file_id) > 0){ + + // GET THE CD TRANSACTION AMOUNT + $cd_amount_total = $this->employeePolicyModel->calculateCdTranctionAmount($file_id); + $cd_amount = $cd_amount_total['total'] ?? 0; + $this->myLogger->logme('error', '---- CD Amount : {data} ----', ['data' => $cd_amount]); + + //STEP: 1 - Update employee policy table + $db = db_connect(); + $query = " + UPDATE employee_polices + SET employee_polices.status = 'truncated', employee_polices.is_active = 0 + WHERE employee_polices.file_id = $file_id + "; + $db->query($query); + $affectedRows = $db->affectedRows(); + $this->myLogger->logme('error', '---- employee_polices table update query : {data} ----', ['data' => $query]); + $this->myLogger->logme('error', '---- employee_polices table updated - Affected Rows : {data} ----', ['data' => $affectedRows]); + // print_r($db->getLastQuery()); die; + + //STEP:2 - Update emp_endorsement Table + if(in_array($file['action'], ['addition', 'dependent_addition'])){ + $this->empEndorsementModel->where('file_id', $file_id)->set(['status' => 'truncated','is_active' => 0])->update(); + $this->myLogger->logme('error', '---- emp_endorsement table updated ----'); + } + + //STEP:3 - Update files table status + $this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update(); + $this->myLogger->logme('error', '---- files table updated ----'); + + //FINAL STEP - Update reverse entry in cash_deposite table + if(!empty($cd_amount)){ + + $cd_data = [ + 'amount' => $cd_amount, + 'sub_type_id' => 8, + 'endorsement_no' => null, + 'insurer_id' =>$policy_data['insurer_id'], + 'description' => 'The policy Truncated by Admin or Head', + 'transaction_type' => 'Credit', + 'updated_by' => 1, + 'client_id' => $client_id, + 'client_policy_id' => $client_policy_id, + 'cd_ac_no' => $policy_data['cd_ac_no'] ?? null, + 'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null, + 'event_name' => $file['action'], + ]; + + $response = DepositHelper::saveDeposit($cd_data, $loggedInUserID); + $this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction'); + } + + }else{ + + $this->myLogger->logme('error', '---- There is no data to truncate ----'); + return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'There is no data to truncate'], 200); + } + + } + else + { + // echo 'came here...1'; + //check all dependents added by self and other dependent policies + $emp_codes = $this->employeeModel->select('emp_code') + ->where('file_id', $file_id) + ->findAll(); + $emp_codes = array_column($emp_codes,'emp_code'); + // Kint::dump($emp_codes);//die; + + $dependent_policies = $this->clientPolicyModel->select('id') + ->where('base_policy', $client_policy_id) + ->findAll(); + // $dependent_policies = [ [10],[25],[35] ]; + // Kint::dump($dependent_policies); + // Kint::dump(array_column($dependent_policies,'id')); + if(count($dependent_policies)) + { + $dependent_policies = array_column($dependent_policies,'id'); + // Kint::dump($dependent_policies); + $second_level_dependent_policies = $this->clientPolicyModel->select('id') + ->whereIn('base_policy', $dependent_policies) + ->findAll(); + // dd($second_level_dependent_policies); + if(count($second_level_dependent_policies)) + { + $second_level_dependent_policies = array_column($second_level_dependent_policies,'id'); + } + + $dependent_policies = array_merge($dependent_policies,$second_level_dependent_policies); + } + $dependent_policies = array_merge($dependent_policies,[$client_policy_id]); + // Kint::dump($dependent_policies); + + //update emp and emp plocies + $db = db_connect(); + $emp_codes = '(' . implode(',', array_map(fn($code) => "'$code'", $emp_codes)) . ')'; + $dependent_policies = '(' . implode(',', $dependent_policies) . ')'; + $query = " + UPDATE employee_polices + JOIN employees ON employees.id = employee_polices.employee_id and employees.emp_code in $emp_codes + SET employee_polices.status = 'truncated', employee_polices.is_active = 0 + WHERE employee_polices.client_policy_id in $dependent_policies + "; + // print_r($query); die; + $db->query($query); + $affectedRows = $db->affectedRows(); + + // dd($affectedRows); + $affectedRows = $affectedRows * 2; + $this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update(); + + } + + $this->myLogger->logme('error', 'SUCCESSFULLY TRUNCATED'); + + return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => round($affectedRows / 2)], 200); + } + + } else if ($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion') { + + $res = $this->empEndorsementModel->select(['count(id) as count']) + ->where('emp_endorsement.file_id', $file_id) + ->groupStart() + ->where('emp_endorsement.endorsement_id is not null') + ->orwhereIn('emp_endorsement.status', ['complete']) + ->groupEnd() + ->get() + ->getResult(); + + // print_r($this->empEndorsementModel->getLastQuery()); + // echo $res[0]->count;die(); + + if ($res[0]->count == 0 || $role_id == 5 || $role_id == 1) { + + $this->myLogger->logme('error', 'TRUNCATED STARTED WITH ADMIN OR HEAD PERMISSION'); + $this->myLogger->logme('error', 'Event Type : -- {data} --', ['data' => $file['action']]); + + $transaction_type = 'Credit'; + $cd_amount = $cd_tranction['amount']; + + if($file['action'] == 'deletion'){ + $transaction_type = 'Debit'; + //get cd amount for the particular file id to reverse entry to the cash deposite for only deletion + $cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']); + $totalSum = array_sum(array_column($cd_amount_total, 'total')); + $cd_amount = $totalSum; + + $this->myLogger->logme('error', 'Deletion CD Amount : {data}', ['data' => $cd_amount]); + } + + $this->myLogger->logme('error', 'Endorsemnt CD Amount : {data}', ['data' => $cd_amount]); + + + //STEP 1: + //update truncated status to the Emp_endorsement table + $this->empEndorsementModel->where('file_id', $file_id) + ->set(['status' => 'truncated','is_active' => 0]) + ->update(); + + $this->myLogger->logme('error', 'emp_endorsement table updated'); + + //STEP 2: + if($file['action'] == 'deletion') { + //update the employee policy table reverse the data + $this->employeePolicyModel->updateEmployeePolicyTruncateReverse($file_id); + $this->myLogger->logme('error', 'employee_polices table updated for deletion'); + } + + if($file['action'] == 'correction'){ + + } + + // STEP 3: + //update files table status to "truncated" + $this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update(); + $this->myLogger->logme('error', 'files table updated'); + + + if($cd_tranction && $file['action'] != 'correction'){ + + $cd_data = [ + 'amount' => $cd_amount, + 'sub_type_id' => 8, + 'endorsement_no' => null, + 'insurer_id' =>$policy_data['insurer_id'], + 'description' => 'The policy Truncated by Admin or Head', + 'transaction_type' => $transaction_type, + 'updated_by' => 1, + 'client_id' => $client_id, + 'client_policy_id' => $client_policy_id, + 'cd_ac_no' => $policy_data['cd_ac_no'] ?? null, + 'cd_ac_pk' => $policy_data['cd_ac_pk'] ?? null, + 'event_name' => $file['action'], + ]; + + $response = DepositHelper::saveDeposit($cd_data, $loggedInUserID); + $this->myLogger->logme('error', 'cash_deposite table updated -- cd transaction'); + + } + + $this->myLogger->logme('error', 'SUCCESSFULLY TRUNCATED'); + + return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'success'], 200); + + } else { + if(get_role_id() == 1 || get_role_id() == 5){ + return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200); + }else{ + return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200); + } + } + } + } + + //truncateFileData OLD FUNCTION + public function truncateFileDataOld($file_id, $role_id = null) { $file_id = $this->request->uri->getSegment(3); // $file_id = 747; @@ -1288,7 +1561,7 @@ class EmployeeController extends AdminController if($file['action'] != 'enrollment') { - //STEP: 1 - Update employee policy table + //STEP: 1 - Update employee policy table //update emp and emp plocies $db = db_connect(); $query = " @@ -1331,13 +1604,13 @@ class EmployeeController extends AdminController // Kint::dump($emp_codes);//die; $dependent_policies = $this->clientPolicyModel->select('id') - ->where('base_policy', $client_policy_id) - ->findAll(); + ->where('base_policy', $client_policy_id) + ->findAll(); // $dependent_policies = [ [10],[25],[35] ]; - // Kint::dump($dependent_policies); - // Kint::dump(array_column($dependent_policies,'id')); - if(count($dependent_policies)) - { + // Kint::dump($dependent_policies); + // Kint::dump(array_column($dependent_policies,'id')); + if(count($dependent_policies)) + { $dependent_policies = array_column($dependent_policies,'id'); // Kint::dump($dependent_policies); $second_level_dependent_policies = $this->clientPolicyModel->select('id') @@ -1350,11 +1623,11 @@ class EmployeeController extends AdminController } $dependent_policies = array_merge($dependent_policies,$second_level_dependent_policies); - } - $dependent_policies = array_merge($dependent_policies,[$client_policy_id]); - // Kint::dump($dependent_policies); + } + $dependent_policies = array_merge($dependent_policies,[$client_policy_id]); + // Kint::dump($dependent_policies); - //update emp and emp plocies + //update emp and emp plocies $db = db_connect(); $emp_codes = '(' . implode(',', array_map(fn($code) => "'$code'", $emp_codes)) . ')'; $dependent_policies = '(' . implode(',', $dependent_policies) . ')'; @@ -1402,7 +1675,7 @@ class EmployeeController extends AdminController } } else if ($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion') { - + $res = $this->empEndorsementModel->select(['count(id) as count']) ->where('emp_endorsement.file_id', $file_id) ->groupStart() @@ -1425,7 +1698,7 @@ class EmployeeController extends AdminController if($file['action'] == 'deletion'){ $transaction_type = 'Debit'; - //get cd amount for the particular file id to reverse entry to the cash deposite for only deletion + //get cd amount for the particular file id to reverse entry to the cash deposite for only deletion $cd_amount_total = $this->employeePolicyModel->getDeletionDataForTruncated($file['id']); $totalSum = array_sum(array_column($cd_amount_total, 'total')); $cd_amount = $totalSum; @@ -2173,27 +2446,30 @@ class EmployeeController extends AdminController exit; } + //------------------------------------------------------------------------------------------------------ + + public function test_members_list(){ - // $model = new EmployeeModel(); - // $list = [ - // ['relationship' => 'spouse','emp_code' => 'TEST002', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], - // ['relationship' => 'Daughter','emp_code' => 'TEST002', 'name' => 'Jayalakshmi','email_personal' => 'jayalakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'2018-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], - // ['relationship' => 'Son','emp_code' => 'TEST002', 'name' => 'Jayam Ravi','email_personal' => 'jayamravi@gmail.com','mobile'=>'6382156701','gender'=>'male','dob'=>'1994-05-19','doj'=>'2019-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], - // // ['relationship' => 'self','emp_code' => 'TEST003', 'name' => 'Ravi Shankar','email_personal' => 'srinivassaravanan2002@gmail.com','email_corporate'=>'srinivas.saravanan@venbainfotech.com','mobile'=>'6382156701','gender'=>'male','dob'=>'1994-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'] - // ['relationship' => 'spouse','emp_code' => 'TEST001', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], + // $model = new EmployeeModel(); + // $list = [ + // ['relationship' => 'spouse','emp_code' => 'TEST002', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], + // ['relationship' => 'Daughter','emp_code' => 'TEST002', 'name' => 'Jayalakshmi','email_personal' => 'jayalakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'2018-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], + // ['relationship' => 'Son','emp_code' => 'TEST002', 'name' => 'Jayam Ravi','email_personal' => 'jayamravi@gmail.com','mobile'=>'6382156701','gender'=>'male','dob'=>'1994-05-19','doj'=>'2019-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], + // // ['relationship' => 'self','emp_code' => 'TEST003', 'name' => 'Ravi Shankar','email_personal' => 'srinivassaravanan2002@gmail.com','email_corporate'=>'srinivas.saravanan@venbainfotech.com','mobile'=>'6382156701','gender'=>'male','dob'=>'1994-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'] + // ['relationship' => 'spouse','emp_code' => 'TEST001', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], - // ]; - // foreach($list as $listitem){ + // ]; + // foreach($list as $listitem){ - - // $model->insert($listitem); - // } - // die(); - $employee_data = $this->employeeModel->getTestEmployeeData(); - $data['employees'] = $employee_data; - $data['clients'] = $this->clientModel->findAll(); - // dd($data); - return $this->loadLayout('test_members_list',$data); + + // $model->insert($listitem); + // } + // die(); + $employee_data = $this->employeeModel->getTestEmployeeData(); + $data['employees'] = $employee_data; + $data['clients'] = $this->clientModel->findAll(); + // dd($data); + return $this->loadLayout('test_members_list',$data); } public function mapEmployees(){ @@ -2276,8 +2552,6 @@ class EmployeeController extends AdminController } - - public function cloneWorksheet() { // Define file paths @@ -2332,4 +2606,45 @@ class EmployeeController extends AdminController } } + //------------------------------------------------------------------------------------------------------ + + + public function generateAcmAndMForEcard($client_id) + { + $db = db_connect(); + $builder = $db->table('client_rm'); + $builder->select('user_profiles.first_name, user_profiles.mobile, user_profiles.email, client_rm.level'); + $builder->join('user_profiles', 'client_rm.user_id = user_profiles.id'); + $builder->where('client_rm.client_id', $client_id); + $builder->whereIn('client_rm.level', [2, 3]); + $builder->where('client_rm.is_active', 1); + $builder->orderBy('client_rm.level', 'desc'); + $query = $builder->get(); + $result = $query->getResultArray(); + + $levels = [ + 3 => [], + 2 => [] + ]; + + foreach ($result as $value) { + $levels[$value['level']][] = $value; + } + + // Generate the HTML content + $html = ''; + + foreach ($levels as $level => $contacts) { + $displayLevel = $level == 3 ? 1 : 2; // Switch levels for display + $html .= '
Level ' . $displayLevel . '
'; + foreach ($contacts as $index => $contact) { + $html .= ($index + 1) . '. ' . $contact['first_name'] . ' / ' . $contact['mobile'] . ' / ' . $contact['email'] . '
'; + } + } + + $html .= '


'; + + return $html; + } + } diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index 10c42716..b3ca2187 100755 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -19,17 +19,16 @@ class LoginController extends BaseController // set_session_data($session_data); // $isLoggedIn = check_session(); $isLoggedIn = check_session(); - - if ($isLoggedIn) { + $hasCookie = check_cookie(); + if ($isLoggedIn || $hasCookie) { return redirect()->to(base_url('/dashboard/view')); } return view('login'); } - + public function receiveGoogleOAuthResponse() { - $UserModel = new UserModel(); //echo 'DONE';die(); if ($this->request->getGet('code')) { @@ -52,7 +51,10 @@ class LoginController extends BaseController 'userProfile' => $value->picture, 'user_team' => $user_team, ]; - + $path = getenv('cookie.Path'); + $domain = getenv('cookie.Domain'); + $https = getenv('ccokie.secure'); + setcookie('session_data', json_encode($session_data), time() + 12 * 60 * 60, $path, $domain, $https, true); set_session_data($session_data); log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); @@ -82,12 +84,14 @@ class LoginController extends BaseController public function initiateGoogleOAuth() { - return googleOAuthLogin(false); + return googleOAuthLogin(false); } public function logout() { + $path = getenv('cookie.Path'); session()->destroy(); + setcookie('session_data', '', time() - 3600, $path); return redirect()->to(base_url('login')); } diff --git a/app/Filters/AuthMVC.php b/app/Filters/AuthMVC.php index aa406108..1e0be969 100755 --- a/app/Filters/AuthMVC.php +++ b/app/Filters/AuthMVC.php @@ -9,7 +9,7 @@ class AuthMVC implements FilterInterface { public function before(RequestInterface $request, $arguments = null) { - if (!check_session()) { + if (!check_session() && !check_cookie()) { return redirect()->to(base_url('/login')); } diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php index 4a13df4d..f5c6e513 100755 --- a/app/Helpers/session_helper.php +++ b/app/Helpers/session_helper.php @@ -1,5 +1,39 @@ getUserByEmail($value['userData']->email); + if($user){ + if($user->is_active !== '0'){ + $user_team = $UserModel->getUserTeamsByUserID($user->id); + // dd($user_team); + + $session_data = [ + 'isLoggedIn' => True , + 'userid' => $user->id, + 'userData' => $user, + 'userProfile' => $value['userProfile'], + 'user_team' => $user_team, + ]; + set_session_data($session_data); + // $this->getUserDeviceInfo($user->id, 'NhanceUser'); + // return redirect()->to(base_url('/dashboard/view')); + return true; + + } + // $session_data = (array)json_decode($_COOKIE['session_data']); + // set_session_data($session_data); + } + }else{ + return false; + } +} if (!function_exists('check_session')) { function check_session() @@ -150,7 +184,7 @@ if (!function_exists('user_team')) { } - +} diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index f536cb37..ec1f48a3 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -1683,4 +1683,29 @@ class EmployeePolicyModel extends Model $query = "UPDATE emp_endorsement SET status = $caseStatus, endorsement_id = $caseEndorsementId WHERE id IN ($ids);"; // Execute the query $this->db->query($query); } + + //calculate the CD Transaction sum of the amount for the inception, addition, dependent addition, missed inception + public function calculateCdTranctionAmount($file_id) + { + $query = $this->db->query(" + + SELECT + ROUND(SUM(ep.rata_premimum + ep.gst), 2) AS total + FROM + employee_polices ep + WHERE + ep.file_id = $file_id + AND ep.uhid IS NOT NULL' + AND ep.status != 'truncated' + AND ep.status != 'truncated' + AND ep.is_active = 1; + "); + + + $result = $query->getResultArray(); + // dd($this->db->getLastQuery(), $result); + // dd($result); + + return $result[0]; + } } \ No newline at end of file diff --git a/app/Views/test_members_list.php b/app/Views/test_members_list.php index 385aeb37..aaaf425e 100644 --- a/app/Views/test_members_list.php +++ b/app/Views/test_members_list.php @@ -87,6 +87,27 @@ color: #16181b !important; cursor: pointer !important; } +th, td { + text-align: center; /* Or left/right depending on your preference */ + vertical-align: middle; /* Ensures content is vertically centered */ +} +input[type="checkbox"] { + width: 16px; /* Standard checkbox size */ + height: 16px; + margin: 0; /* Remove default margin */ + vertical-align: middle; /* Align with text or other elements */ +} +th:first-child, td:first-child { + width: 50px; /* Adjust width as needed */ +} +.table-responsive { + overflow-x: auto; +} + +.table { + table-layout: fixed; /* Prevent columns from resizing dynamically */ +} + @@ -156,12 +177,13 @@ + - - + } --> + */ + ?> @@ -392,7 +415,7 @@ -