diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 7917751a..041caaa3 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -114,6 +114,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) { $routes->group("terms", ["filter" => "authMVC"], function ($routes) { $routes->post("gpa_create", "ClientController::policyGPATerms"); $routes->post("edit", "ClientController::editClientPolicyPremium"); + $routes->post("other_terms", "ClientController::otherPolicyTermsFormSubmit"); }); }); @@ -206,6 +207,14 @@ $routes->group("/master", ["filter" => "authMVC"], function ($routes) { $routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1"); }); }); + + $routes->group("cash_deposite", ["filter" => "authMVC"], function ($routes) { + $routes->get("list", "MasterController::CDMasterList"); + $routes->post("create", "MasterController::createCDMasterData"); + $routes->post("edit", "MasterController::editCDMasterData"); + $routes->get("list/(:any)", "MasterController::getCDMasterDataByID/$1"); + // $routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1"); + }); }); @@ -234,6 +243,11 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1"); $routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1"); $routes->get("delete-additional-rack-rate/(:any)", "ClientController::deleteAdditionalRackRate/$1"); + $routes->get("check_cd_ac_no/(:any)", "MasterController::checkUniqueCDAccountNumber/$1"); + $routes->get("get_cd_ac/(:any)", "ClientController::get_cd_ac/$1"); + $routes->get("check_policy_type/(:any)", "ClientController::checkPolicyType/$1"); + $routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1"); + $routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 52b3dbca..13be8344 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -31,6 +31,10 @@ use App\Models\PolicyPremium2Model; use App\Models\EmployeeModel; use App\Models\EmployeePolicyModel; use App\Models\NotificationModel; +use App\Models\CDMasterModel; +use App\Models\PolicyTypeModel; + + @@ -62,12 +66,15 @@ class ClientController extends AdminController protected $employeeModel; protected $employeePolicyModel; protected $notificationModel; + protected $CDMasterModel; + protected $policyTypeModel; + public function __construct() { set_session_context('Client'); $this->myLogger = \Config\Services::mylogger(); - + $this->clientModel = new ClientModel(); $this->userModel = new UserModel(); $this->clientBranchModel = new ClientBranchModel(); @@ -89,7 +96,11 @@ class ClientController extends AdminController $this->policyPremium2Model = new PolicyPremium2Model(); $this->employeeModel = new EmployeeModel(); $this->employeePolicyModel = new EmployeePolicyModel(); - $this->notificationModel = new NotificationModel(); + $this->notificationModel = new NotificationModel(); + $this->CDMasterModel = new CDMasterModel(); + $this->policyTypeModel = new PolicyTypeModel(); + + @@ -200,13 +211,19 @@ 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', + 1 => 'Replenishment', 2 => 'Adjustment', - 3 => 'Refund', + 3 => 'Refund From Deletion', 4 => 'Debit', - // Add more options as needed ]; + $data['subTypeOptions'] = $subTypeOptions; $headerData['page_name'] = 'Client Deposit'; $data['insurerName']= $this->insurerModel->getInsurerName($insurerId); @@ -231,20 +248,33 @@ class ClientController extends AdminController // Retrieve form data from POST request $loggedInUserID = get_session_userid(); + $client_id = $this->request->getPost('client_id'); + $insurer_id = $this->request->getPost('insurer_id'); + + $CD_Account_Number = $this->CDMasterModel + ->where('client_id', $client_id) + ->where('insurer_id', $insurer_id) + ->first(); + // Prepare the array with data $data = [ 'amount' => $this->request->getPost('amount'), 'sub_type_id' => $this->request->getPost('sub_type_id'), 'client_id' => $this->request->getPost('client_id'), + 'client_policy_id' => null, + 'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null, + 'endorsement_no' => null, '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']]); } @@ -588,22 +618,13 @@ class ClientController extends AdminController $policy_type_id = $this->request->getPost('policy_type_id'); $client_branch_id = $this->request->getPost('client_branch_id'); - - $policyCount = $this->clientPolicyModel - ->where('policy_type_id', $policy_type_id) - ->where('client_branch_id', $client_branch_id) - ->countAllResults(); - - if($policyCount > 0 ){ - $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id')); - return $this->respond(['status' => 'policy_exist','code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200); - } - - $insurerValue = (string) $this->request->getPost('insurer'); - list($insurerBranchId, $insurerId) = explode('-', $insurerValue); $client_id = $this->request->getPost('client_id'); + $insurerValue = (string) $this->request->getPost('insurer'); + list($insurerBranchId, $insurerId) = explode('-', $insurerValue); + + $data['insurer_branch_id'] = $insurerBranchId; $data['insurer_id'] = $insurerId; @@ -638,7 +659,8 @@ class ClientController extends AdminController $data['base_policy'] = $this->request->getPost('base_policy'); $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['client_branch_id'] = $this->request->getPost('client_branch_id'); + $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); @@ -733,7 +755,8 @@ class ClientController extends AdminController $data['base_policy'] = $this->request->getPost('base_policy'); $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['client_branch_id'] = $this->request->getPost('client_branch_id'); + $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); @@ -884,6 +907,24 @@ class ClientController extends AdminController $policyPremium = $this->policyPremium1Model->insert($data); } + }else if ($si_or_bp == '2') { + + $premium = str_replace(',', '', $this->request->getPost('gpa_basic_premium[]')); + $sum_insure = str_replace(',', '', $this->request->getPost('gpa_basic_si[]')); + $basic_pay = str_replace(',', '', $this->request->getPost('basic_pay[]')); + + for ($i = 0; $i < count($premium); $i++) { + + $data['si_or_bp'] = $this->request->getPost('si_or_bp'); + $data['basic_multiplier'] = str_replace(',', '', $this->request->getPost('basic_multiplier')); + $data['multiplier'] = $this->request->getPost('premium_multiplier'); + $data['basic_pay'] = $basic_pay[$i]; + $data['si'] = $sum_insure[$i]; + $data['premium'] = $premium[$i]; + + $policyPremium = $this->policyPremium1Model->insert($data); + } + }else { $data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium')); @@ -1140,9 +1181,10 @@ class ClientController extends AdminController $client_id = $client_policy_data['client_id']; $polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll(); $client_policy_list = $this->clientPolicyModel->getpolicyWithPattern( $client_id ); + $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll(); - return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200); + return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, 'cd_data' => $cd_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200); }else{ return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200); } @@ -1177,19 +1219,11 @@ class ClientController extends AdminController $emp_count = $this->employeePolicyModel - ->join('client_policy cp', "cp.id = employee_polices.client_policy_id") - ->where("employee_polices.client_policy_id", $client_policy_id) - ->where("employee_polices.status", 'active') - ->where("employee_polices.is_active", 1) - ->countAllResults(); - - // $emp_count = count($data); - - // if($emp_count == 0){ - // $emp_count = true; - // }else{ - // $emp_count = false; - // } + ->join('client_policy cp', "cp.id = employee_polices.client_policy_id") + ->where("employee_polices.client_policy_id", $client_policy_id) + ->where("employee_polices.status", 'active') + ->where("employee_polices.is_active", 1) + ->countAllResults(); $data = $this->policesModel->getPolicyPremium($record['policy_id']); @@ -1197,9 +1231,11 @@ class ClientController extends AdminController $gmc_pattern = '/gmc/i'; $gpa_pattern = '/gpa/i'; $subject = $data[0]->policy_type; + $policy_type_id = $data[0]->id; + if (preg_match($gmc_pattern, $subject)) { $search_term = 'GMC'; - } else if (preg_match($gpa_pattern, $subject)) { + } else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) { $search_term = 'GPA'; } else { $search_term = ""; @@ -1207,7 +1243,7 @@ class ClientController extends AdminController $results = $this->policyGridModel->like('policy_type', $search_term)->findAll(); - if ($search_term === 'GPA') { + if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) { $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } else if ($search_term === 'GMC') { @@ -1218,9 +1254,6 @@ class ClientController extends AdminController $premiumData = ""; } - - - // echo '
';
         // print_r($premiumData); die;
@@ -1294,7 +1327,7 @@ class ClientController extends AdminController
 
             return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
 
-        } else if ($search_term === 'GPA') {
+        } else if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
 
             return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
         } else {
@@ -1315,7 +1348,7 @@ class ClientController extends AdminController
 
             $data['sum_insured']   =str_replace(',', '',$this->request->getPost("sum_insured"));
             $data['family_floater']   =$this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
-            $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
+            // $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
             $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];        
             
             $data['age_ratio']['self']['min'] =  $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") :0;
@@ -1427,7 +1460,7 @@ class ClientController extends AdminController
             $data['bioabsorbablestenttoriclensmultifocallens'] =$this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
             $data['roomrentlimit'] =str_replace(',', '',$this->request->getPost("roomrentlimit"));
             $data['proportionatedeductionclause'] =str_replace(',', '',$this->request->getPost("proportionatedeductionclause"));
-            $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
+            // $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
             $data['ailmentcapping'] =str_replace(',', '',$this->request->getPost("ailmentcapping"));
             $data['ambulancecharges'] =str_replace(',', '',$this->request->getPost("ambulancecharges"));
             $data['airambulance'] =str_replace(',', '',$this->request->getPost("airambulance"));
@@ -1435,6 +1468,12 @@ class ClientController extends AdminController
             $data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges"));
             $data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover"));
 
+            $data['congenitaldiseasesexternal'] =str_replace(',', '',$this->request->getPost("congenitaldiseasesexternal"));
+            $data['optionalparentalcopay'] =str_replace(',', '',$this->request->getPost("optionalparentalcopay"));
+            $data['posthospitalizationcover'] =str_replace(',', '',$this->request->getPost("posthospitalizationcover"));
+            $data['corporatebuffer'] =str_replace(',', '',$this->request->getPost("corporatebuffer"));
+            $data['sublimitofcorporatebuffer'] =str_replace(',', '',$this->request->getPost("sublimitofcorporatebuffer"));
+
             if ($data['ayudhtreatmentcover'] == 1) {
                 $data['ayushTreatmentCoverData']   = str_replace(',', '',$this->request->getPost("ayushTreatmentCoverData"));
             }else{
@@ -1455,6 +1494,7 @@ class ClientController extends AdminController
             $data['days_from_dod'] =str_replace(',', '',$this->request->getPost("days_from_dod"));
             $data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? [];
             $data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? [];
+            $data['multiple_sum_insured'] = str_replace(',', '',$this->request->getPost("multiple_sum_insured")) ?? [];
 
             $data['cataract'] =str_replace(',', '',$this->request->getPost("cataract"));
 
@@ -1509,16 +1549,22 @@ class ClientController extends AdminController
         //     ->where("employees.emp_status",'active')
         //     ->countAllResults();
 
-        $emp_count_by_policy = $this->employeePolicyModel->where('client_policy_id',$client_policy_id)->where('is_active',1)->countAllResults();
+        $emp_count_by_policy = $this->employeePolicyModel
+                        ->where('client_policy_id',$client_policy_id)
+                        ->where("status", 'active')
+                        ->where('is_active',1)
+                        ->countAllResults();
         
-        // if($emp_count == 0){
-        //     $emp_count = true;
-        // }else{
-        //     $emp_count = false;
-        // }
 
         if ($record) {
-            return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'],  'policy_name' => $policy_name,'policy_addon' => $record['is_addon'], 'emp_count_by_policy'=>$emp_count_by_policy], 200);
+            return $this->respond([
+                'Status' => true,
+                'code' => 200,        
+                'data' => $record['policy_terms'],  
+                'policy_name' => $policy_name,
+                'policy_addon' => $record['is_addon'], 
+                'emp_count_by_policy'=>$emp_count_by_policy],
+            200);
         } else {
             return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.',  'policy_name' => $policy_name], 200);
         }
@@ -1584,6 +1630,8 @@ class ClientController extends AdminController
             $data['worldwideCover']        = $this->request->getPost("worldwideCover");
             $data['gpa_special_condition_label'] = str_replace(',', '',$this->request->getPost("gpa_special_condition_label")) ?? [];
             $data['gpa_special_condition_input'] = str_replace(',', '',$this->request->getPost("gpa_special_condition_input")) ?? [];
+            $data['multiple_sum_insured'] = str_replace(',', '',$this->request->getPost("multiple_sum_insured")) ?? [];
+
 
 
             $jsonData = json_encode($data);
@@ -1942,10 +1990,6 @@ class ClientController extends AdminController
 
 
         $data['client_policy'] = $client_policy;
-        
-
-
-
         $data['client_branch'] = $this->clientModel
 
             ->select('
@@ -2120,5 +2164,83 @@ class ClientController extends AdminController
     
 
 
+    public function get_cd_ac($client_id, $insurer_id){
+
+        $cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
+
+        if($cd_data){
+            return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
+        }else{
+            return $this->respond(['status' => false, 'code' => 404, 'insurer_id' => $insurer_id, 'client_id' => $client_id], 200);
+        }
+
+    }
+
+
+    public function otherPolicyTermsFormSubmit()
+    {
+
+        $client_policy_id = $this->request->getPost("client_policy_id");
+        $policy_terms = $this->request->getPost("policy_terms");
+
+        $record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
+        if ($record) {
+
+            $update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms',  $policy_terms)->update();
+
+            if ($update) {
+                return $this->respond(['status' => true, 'code' => 200, 'message' => 'Data updated successfully', 'client_policy_id' => $client_policy_id], 200);
+            } else {
+                return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
+            }
+        } else {
+
+            return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
+        }
+    }
+
+
+    public function checkPolicyType($client_policy_id, $policy_type_id, $client_branch_id, $client_id){
+
+        $policyCount = $this->clientPolicyModel
+        ->where('policy_type_id', $policy_type_id) 
+        ->where('client_branch_id', $client_branch_id)
+        ->where('client_id', $client_id)
+        ->countAllResults(); 
+
+        if($policyCount > 0 ){
+            $clientPoliceData =  $this->clientPolicyModel->getClientPolicyByClientId($client_id);
+            return $this->respond(['status' => true,'code' => 200, 'count' =>  $policyCount, 'data' => $clientPoliceData, 'method' => 'CERATE' ,'client_id' => $client_id, 'client_branch_id' => $client_branch_id, 'policy_type_id' => $policy_type_id], 200);
+        }else{
+            return $this->respond(['status' => false,'code' => 200,'client_id' => $client_id, 'client_branch_id' => $client_branch_id, 'policy_type_id' => $policy_type_id], 200);
+        }
+
+    }
+
+
+    public function getPolicyTerms($client_policy_id){
+
+        $policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
+        if(isset($policy_terms['policy_terms']) && $policy_terms['policy_terms'] != null){
+
+            $JSON = json_decode($policy_terms['policy_terms']);
+            $si = $JSON->sum_insured ?? $JSON->sumInsured2;
+            $multi_si = $JSON->multiple_sum_insured;
+            $multi_si[] = $si;
+        }else{
+            $$multi_si = [];
+        }
+
+        return $this->respond(['status' => true, 'data'=>$multi_si], 200);
+    }
+
+
+    public function getPolicyTermsFormJson($policy_type_id){
+
+        $JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
+        return $this->respond(['status' => true, 'data' => $JSON], 200);
+    }
 
 }
\ No newline at end of file
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 1b3fa587..3cb36091 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -24,6 +24,7 @@ use App\Models\ClientDepositModel;
 use App\Models\NotificationModel;
 use App\Models\MessageModel;
 use App\Models\UserMessageModel;
+use App\Models\CDMasterModel;
 
 use App\Controllers\Jobs;
 use App\Controllers\JobWorker;
@@ -52,6 +53,8 @@ class EmpDataServiceController extends BaseController
     protected $notificationModel;
     protected $messageModel;
     protected $userMessageModel;
+    protected $CDMasterModel;
+
 
     public function __construct()
     {
@@ -70,6 +73,8 @@ class EmpDataServiceController extends BaseController
         $this->notificationModel    = new NotificationModel();
         $this->messageModel        = new MessageModel();
         $this->userMessageModel          = new UserMessageModel();
+        $this->CDMasterModel    = new CDMasterModel();
+
     }
 
     
@@ -138,6 +143,12 @@ class EmpDataServiceController extends BaseController
         $insurer_id = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
         $cash_balance = $this->clientDepositModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
 
+        if($cash_balance == null){
+
+            $balance = $this->CDMasterModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
+            $cash_balance['balance'] = $balance['opening_bal'];
+        }
+
 
         // Calculate the total amount from the objects
         $totals = array_reduce($objects, function ($carry, $item) {
@@ -188,7 +199,7 @@ class EmpDataServiceController extends BaseController
             'NAME OF EMP/DEP',
             'EMP ID',
             'EMP/DEP TYPE',
-            'RELATION',
+            'RELATIONSHIP CODE',
             'DOB',
             'GENDER',
             'PRE EXISTING AILMENTS',
@@ -673,7 +684,7 @@ class EmpDataServiceController extends BaseController
         unset($excel_data[0]);
         array_pop($excel_data);
 
-        $inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATION','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
+        $inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
 
         foreach ($inceptionHeader as $key => $value) {
             if($excel_header[$key] != $value){
@@ -1083,6 +1094,13 @@ class EmpDataServiceController extends BaseController
         $batch_code = $file['batch_code'];
         $user_id = $file['created_by'];
 
+        $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
+        $CD_Account_Number = $this->CDMasterModel
+                    ->where('client_id', $client_id)
+                    ->where('insurer_id', $insurer_id['insurer_id'])
+                    ->first();
+
 
         $get_policy_type = $this->clientPolicyModel
             ->select('policy_type.policy_type, policies.policy_type_id as policy_type_id')
@@ -1192,6 +1210,8 @@ class EmpDataServiceController extends BaseController
                 'employeeIds' => $emp_policy_ids,
                 'client_id' => $client_id,
                 'client_policy_id' => $client_policy_id,
+                'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
+                'endorsement_no' => null,
                 'client_branch_id' => $client_branch_id,
                 'count' => $emp_count,
                 'event' => $file['event_type'],
@@ -2095,6 +2115,13 @@ class EmpDataServiceController extends BaseController
         $batch_code = $file['batch_code'];
         $user_id = $file['created_by'];
 
+        $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
+        $CD_Account_Number = $this->CDMasterModel
+                    ->where('client_id', $client_id)
+                    ->where('insurer_id', $insurer_id['insurer_id'])
+                    ->first();
+
 
         $status_val = 'success';
         if ($status == 'in-progress-partially') {
@@ -2113,7 +2140,7 @@ class EmpDataServiceController extends BaseController
         $emp_policy_ids = [];
         $employeeIds = [];
         $emp_details = [];
-        $endorsement_id = [];
+        $endorsement_id = '';
         $endorsement_details = [];
         $totals = 0;
 
@@ -2121,7 +2148,7 @@ class EmpDataServiceController extends BaseController
 
             $emp_name = $value[1];
             $emp_code = $value[2];
-            $endorsement_id[] = $value[19];
+            $endorsement_id = $value[19];
             $totals += $value[18];
 
 
@@ -2229,6 +2256,8 @@ class EmpDataServiceController extends BaseController
             'client_id' => $client_id,
             'client_policy_id' => $client_policy_id,
             'client_branch_id' => $client_branch_id,
+            'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
+            'endorsement_no' => $endorsement_id ?? null,
             'count' => $emp_count,
             'event' => $file['event_type'],
             'policy_name' => $policy_name['policy_name'],
@@ -2633,6 +2662,13 @@ class EmpDataServiceController extends BaseController
         $batch_code = $file['batch_code'];
         $user_id = $file['created_by'];
 
+        $insurer_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
+        $CD_Account_Number = $this->CDMasterModel
+                    ->where('client_id', $client_id)
+                    ->where('insurer_id', $insurer_id['insurer_id'])
+                    ->first();
+
 
         $status_val = 'success';
         if ($status == 'in-progress-partially') {
@@ -2653,6 +2689,7 @@ class EmpDataServiceController extends BaseController
         $emp_endorsement_table_data = [];
         $employee_policy_table_data = [];
         $employee_policy_table_primaryKey = [];
+        $endorsement_id = '';
 
         $totals = 0;
 
@@ -2662,6 +2699,7 @@ class EmpDataServiceController extends BaseController
             $emp_name = $value[2]; //employee name
             $emp_code = $value[1]; //employee code
             $totals = $totals + $value[13];
+            $endorsement_id = $value[15];
 
 
             $fetch_data = [
@@ -2733,6 +2771,8 @@ class EmpDataServiceController extends BaseController
             'client_id' => $client_id,
             'client_policy_id' => $client_policy_id,
             'client_branch_id' => $client_branch_id,
+            'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
+            'endorsement_no' => $endorsement_id ?? null,
             'count' => $emp_count,
             'event' => $file['event_type'],
             'policy_name' => $policy_name['policy_name'],
@@ -3176,6 +3216,9 @@ class EmpDataServiceController extends BaseController
                 'amount' => $amount->total_sum ?? 0,
                 'sub_type_id' => 4,
                 'client_id' => $arrayData['client_id'],
+                'client_policy_id' => $arrayData['client_policy_id'],
+                'endorsement_no' => $arrayData['endorsement_no'] ?? null,
+                'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
                 'insurer_id' => $insurer_id['insurer_id'],
                 'description' => $description,
                 'transaction_type' => 'Debit',
@@ -3214,6 +3257,9 @@ class EmpDataServiceController extends BaseController
                 'amount' => $amount->total_sum,
                 'sub_type_id' => 4,
                 'client_id' => $arrayData['client_id'],
+                'client_policy_id' => $arrayData['client_policy_id'],
+                'endorsement_no' => $arrayData['endorsement_no'] ?? null,
+                'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
                 'insurer_id' => $insurer_id['insurer_id'],
                 'description' => $description,
                 'transaction_type' => 'Debit',
@@ -3254,6 +3300,9 @@ class EmpDataServiceController extends BaseController
                 'amount' => $amount->total_sum,
                 'sub_type_id' => 3,
                 'client_id' => $arrayData['client_id'],
+                'client_policy_id' => $arrayData['client_policy_id'],
+                'endorsement_no' => $arrayData['endorsement_no'] ?? null,
+                'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
                 'insurer_id' => $insurer_id['insurer_id'],
                 'description' => $description,
                 'transaction_type' => 'Credit',
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 61c66278..80571810 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -772,13 +772,9 @@ class EmployeeController extends AdminController
             ->findAll();
 
         $emp_count = count($data);
-
-        if ($data) {
-            return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
-        } else {
-
-            return $this->respond(['dataStatus' => false, 'code' => 404], 404);
-        }
+        $events = ['inception' => 'Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
+        return $this->respond(['dataStatus' => true, 'code' => 200,  'emp_count' => $emp_count, 'events' => $events, 'client_policy_id' => $id], 200);
+       
     }
 
 
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index a14aac42..cffff6ce 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -487,7 +487,7 @@ class EmployeeRestController extends AdminController
     {
         try {
             $empData =   $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
-           
+         
             if ($empData) {
                 return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
             } else {
diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index 8afffb88..04f1e336 100644
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -25,6 +25,7 @@ use App\Models\TPABranchModel;
 use App\Models\TPAModel;
 use App\Models\StateModel;
 use App\Models\PolicyTypeModel;
+use App\Models\CDMasterModel;
 
 class MasterController extends AdminController
 {   
@@ -45,6 +46,9 @@ class MasterController extends AdminController
     protected $tpaModel;
     protected $stateModel;
     protected $policyTypeModel;
+    protected $CDMasterModel;
+    protected $clientModel;
+
 
     
     public function __construct()
@@ -68,6 +72,9 @@ class MasterController extends AdminController
         $this->tpaModel           = new TPAModel();
         $this->stateModel         = new StateModel();
         $this->policyTypeModel    = new PolicyTypeModel();
+        $this->CDMasterModel    = new CDMasterModel();
+        $this->clientModel        = new ClientModel();
+
     }
 
     public function insurerList()
@@ -1111,4 +1118,103 @@ class MasterController extends AdminController
         }
     }
 
+
+
+    public function CDMasterList()
+    {
+
+        $data['CD_Master_Data'] = $this->CDMasterModel
+            ->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')
+            ->where('cd_master.is_active', 1)
+            ->findAll();
+        $data['insurers'] = $this->insurerModel->findAll();
+        $data['clients'] = $this->clientModel->findAll();
+        $this->loadLayout('cd_master_list', $data);
+    }
+
+
+    public function createCDMasterData()
+    {
+
+        $data = $this->request->getPost();
+        $date = (string) $this->request->getPost('opening_date');
+        $data['opening_date'] = date('Y-m-d', strtotime($date));
+
+
+        if ($data) {
+
+            $insert = $this->CDMasterModel->insert($data);
+
+            if ($insert) {
+
+                session()->setFlashdata('success', "Cash Deposite Master Added Successfully");
+                return redirect()->to(base_url('/master/cash_deposite/list'));
+            } else {
+
+                session()->setFlashdata('error', "Cash Deposite Master Added Failed");
+                return redirect()->to(base_url('/master/cash_deposite/list'));
+            }
+        } else {
+
+            session()->setFlashdata('error', "Cash Deposite Master Added Failed. Data Not Found");
+            return redirect()->to(base_url('/master/cash_deposite/list'));
+        }
+    }
+
+
+    public function editCDMasterData($id = null)
+    {
+
+        $id = $this->request->getPost('PrimaryKey');
+        $date = (string) $this->request->getPost('opening_date');
+        $data = $this->request->getPost();
+        $data['opening_date'] = date('Y-m-d', strtotime($date));
+
+        if ($data) {
+
+            $insert = $this->CDMasterModel->where('id', $id)->set($data)->update();
+
+            if ($insert) {
+
+                session()->setFlashdata('success', "Cash Deposite Master Updated Successfully");
+                return redirect()->to(base_url('/master/cash_deposite/list'));
+            } else {
+
+                session()->setFlashdata('error', "Cash Deposite Master Update Failed");
+                return redirect()->to(base_url('/master/cash_deposite/list'));
+            }
+        } else {
+
+            session()->setFlashdata('error', "Cash Deposite Master Update Failed. Data Not Found");
+            return redirect()->to(base_url('/master/cash_deposite/list'));
+        }
+    }
+
+    public function getCDMasterDataByID($id = null)
+    {
+
+        $cd_data = $this->CDMasterModel->where('id', $id)->first();
+        $cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
+
+        if ($cd_data) {
+            return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
+        } else {
+            return $this->respond(['status' => false, 'code' => 404], 200);
+        }
+    }
+
+    public function checkUniqueCDAccountNumber($AccountNumber)
+    {
+        $uniqueAC = $this->CDMasterModel->where('cd_ac_no', $AccountNumber)->findAll();
+
+        if($uniqueAC != null){
+            return $this->respond(['status' => true, 'message' => 'The CD Account Number is Already Exist', 'code' => 200], 200);
+        }else{
+            return $this->respond(['status' => false, 'code' => 404], 200);
+        }
+    }
+
 }
\ No newline at end of file
diff --git a/app/Helpers/DepositHelper.php b/app/Helpers/DepositHelper.php
index a25aff9e..7d3c713d 100644
--- a/app/Helpers/DepositHelper.php
+++ b/app/Helpers/DepositHelper.php
@@ -4,6 +4,7 @@
 namespace App\Helpers;
 
 use App\Models\ClientDepositModel;
+use App\Models\CDMasterModel;
 
 class DepositHelper
 {
@@ -49,6 +50,9 @@ class DepositHelper
             'amount' => $data['amount'],
             'sub_type' => $data['sub_type_id'],
             'client_id' => $data['client_id'],
+            'client_policy_id' => $data['client_policy_id'],
+            'cd_ac_no' => $data['cd_ac_no'],
+            'endorsement_no' => $data['endorsement_no'],
             'insurer_id' => $data['insurer_id'],
             'description' => $data['description'],
             'transaction_type' => $data['transaction_type'],
@@ -90,7 +94,18 @@ class DepositHelper
         $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
         $getLastBalanceParams = [$clientId, $insurerId];
 
-        $lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
+        $lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance;
+
+        if(!$lastBalance){
+
+            $cd_model = new ClientDepositModel();
+
+            $getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
+            $getLastBalanceParams = [$clientId, $insurerId];
+    
+            $lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
+    
+        }
 
         return $lastBalance;
     }
diff --git a/app/Models/CDMasterModel.php b/app/Models/CDMasterModel.php
new file mode 100644
index 00000000..491d1007
--- /dev/null
+++ b/app/Models/CDMasterModel.php
@@ -0,0 +1,64 @@
+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')
+            ->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('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/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index c21b8f5d..2dcac592 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -84,8 +84,8 @@ class EmployeePolicyModel extends Model
                         ->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
                         ->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
                         ->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
-                        ->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
-                        ->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
+                        ->join('tpa tpam', 'cp.tpa_id = tpam.id','left') //tpam - tpa master
+                        ->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id','left') //tpab - tpa brach
                         ->join('clients cm', 'cp.client_id = cm.id') //cm - client master
                         ->where('emp.client_id',$client_id)
                         ->where('emp.client_branch_id',$branch_id)
diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php
new file mode 100644
index 00000000..7a001b39
--- /dev/null
+++ b/app/Views/cd_master_list.php
@@ -0,0 +1,293 @@
+
+
+
+
+
+
+
+
+

CD Master List

+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Client NameInsurer NameOpening DateCD Account NoDeposite AmountDate/UserAction
( ) by + + +
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 34a1cd9e..e5626a3a 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -7,8 +7,8 @@
- - +
+ @@ -121,13 +121,22 @@
@@ -148,6 +157,7 @@ + \ No newline at end of file diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index 496ad3a0..16fad890 100644 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -869,7 +869,7 @@ $(document).ready(function() { $('#policy_id').change(function(){ var selectedpolicy = $(this).val(); - // console.log('selectedpolicy',selectedpolicy) + console.log('selectedpolicy',selectedpolicy) $('#upload-action-type').val('').change(); $('#file_upload').hide(); $('#excel_download').removeAttr('href'); @@ -885,27 +885,31 @@ $(document).ready(function() { }, success: function(response) { - // console.log('responce data emp_count', response); + console.log('responce data emp_count', response); if (response.code === 200 && response.dataStatus === true && response.data !== "") { try { - // console.log(response.emp_count.length) + console.log(response.emp_count.length) if(response.emp_count > 0){ var select = document.getElementById("upload-action-type"); for (var i = 0; i < select.options.length; i++) { + select.options[i].disabled = false; if (select.options[i].value === "inception") { select.options[i].disabled = true; - break; + // break; } } - }else{ + }else { var select = document.getElementById("upload-action-type"); for (var i = 0; i < select.options.length; i++) { + select.options[i].disabled = true; if (select.options[i].value === "inception") { select.options[i].disabled = false; - break; + } + if (select.options[i].value === "") { + select.options[i].disabled = false; } } } @@ -933,6 +937,16 @@ $(document).ready(function() { } }); + if($('#policy_id').val() == 0){ + + var select = document.getElementById("upload-action-type"); + console.log('select', select) + for (var i = 0; i < select.options.length; i++) { + select.options[i].disabled = false; + console.log(select.options[i]) + } + } + }) }) diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php index a4458cb1..11e7405f 100644 --- a/app/Views/layout/footer.php +++ b/app/Views/layout/footer.php @@ -159,7 +159,7 @@ method: 'GET', success: function(response) { - console.log('responce', response) + // console.log('responce', response) if(response.status == false){ $('#notification_count').html('0') diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 9c6a4795..7fe56a99 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -543,16 +543,17 @@ 2 - Employees + Members
diff --git a/app/Views/other_policy_terms.php b/app/Views/other_policy_terms.php new file mode 100644 index 00000000..6e1160c2 --- /dev/null +++ b/app/Views/other_policy_terms.php @@ -0,0 +1,619 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 2b710321..69a89773 100644 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -110,9 +110,12 @@
-
- +
+
+
+ +
@@ -120,6 +123,8 @@
+
+
@@ -136,14 +141,14 @@
- - + + - - + + @@ -155,8 +160,8 @@ - - + +
Insurer Policy
Self:
Min Age:
Max Age:
Min Age:
Max Age:
Spouse:
Min Age:
Max Age:
Min Age:
Max Age:
Children:
Min Age:
Max Age:
Min Age:
Max Age:
@@ -184,21 +189,19 @@ - - - + + + -
Elders Count:
Min Age:
Max Age:
Elders Count:
Min Age:
Max Age:
-

- +
+
+ +
+
+ +
+
+
@@ -315,6 +327,15 @@
+
+
+ +
+
+ +
+
+
@@ -323,6 +344,29 @@ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
@@ -615,7 +677,7 @@ // $('input[name="family_floater"]').change(function() { - // console.log($(this).val()); + // //console.log($(this).val()); // if ($(this).val() == '1') { // var element = $(this).parent().next()[0]; // $(element).css("display", "block"); @@ -631,7 +693,7 @@ $('input[name="ayudhtreatmentcover"]').change(function() { - console.log($(this).val()); + ////console.log($(this).val()); if ($(this).val() == '1') { var element = $(this).parent().parent().next()[0]; @@ -645,7 +707,7 @@ $('input[name="cataract"]').change(function() { - console.log($(this).val()); + //console.log($(this).val()); if ($(this).val() == '1') { var element = $(this).parent().parent().next()[0]; @@ -715,7 +777,7 @@ } if (!isValid) { - console.log('Form is Empty', 'Warning'); + //console.log('Form is Empty', 'Warning'); return; } @@ -751,7 +813,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); @@ -773,14 +835,15 @@ $('body').on('click', '.btnPolicyMaster', function() { var client_policy_id = $(this).data('id'); - console.log('gmc_client_policy_id :', client_policy_id); + //console.log('gmc_client_policy_id :', client_policy_id); $('#gmc_client_policy_id').val(client_policy_id) $('.removeDom').remove(); + $('#gmc_si_add_more').empty(); var gmc_policy_type_id = $(this).attr('id'); - // console.log(gmc_policy_type_id) + // //console.log(gmc_policy_type_id) if (gmc_policy_type_id == 'GMC') { @@ -798,10 +861,10 @@ client_policy_id: client_policy_id }, success: function(response) { - console.log('response', response); + //console.log('response', response); - // console.log('count', response.count); + // //console.log('count', response.count); setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -809,18 +872,18 @@ $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name); $('gmc_emp_count').val(response.count); - // console.log('count--1', response.count); + // //console.log('count--1', response.count); // $('emp_count').val(response.count) // if (response && response.hasOwnProperty('count')) { // if (response.count === false) { - // console.log('count -- 2', response.count); - // console.log(document.getElementById('btnGridSubmit1')) + // //console.log('count -- 2', response.count); + // //console.log(document.getElementById('btnGridSubmit1')) // $("#btnGridSubmit1").hide(); // $("#myButtonSpecialCondition").hide(); // } else { // $("#btnGridSubmit1").show(); // $("#myButtonSpecialCondition").show(); - // console.log('count -- ', response.count); + // //console.log('count -- ', response.count); // } // } else { // console.error('Response object does not have a "count" property or is invalid.'); @@ -849,13 +912,13 @@ } } - console.log('key', key) + //console.log('key', key) let elements = document.getElementsByName(`${key}[]`); - console.log(elements) + //console.log(elements) if (elements) { elements.forEach((element, index) => { - console.log() + //console.log() if(jsonObject[key][index] == undefined){ element.value = " "; }else{ @@ -865,12 +928,19 @@ } } + + if (key.includes("multiple_sum_insured")) { + jsonObject[key].forEach((value, index) => { + appendGMCSIAddMore(value); + }); + } + if (key.includes("family_floaters")) { let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`); if (jsonObject[key]) { - console.log(jsonObject[key]); - // console.log(jsonObject[key]); + //console.log(jsonObject[key]); + // //console.log(jsonObject[key]); if (jsonObject[key].childrens) { $('#children').val(jsonObject[key].childrens); } @@ -916,8 +986,11 @@ $('.waiverof1234thyearexclusions').prop('disabled', true); $('.waiverof30dayswaitingperiod').prop('disabled', true); $('#prehospitalizationcover').prop('disabled', true); + $('#posthospitalizationcover').prop('disabled', true); $('.congenitaldiseasesinternal').prop('disabled', true); + $('#congenitaldiseasesexternal').prop('disabled', true); $('#copayzonewisecopay').prop('disabled', true); + $('#optionalparentalcopay').prop('disabled', true); $('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true); $('#roomrentlimit').prop('disabled', true); $('#proportionatedeductionclause').prop('disabled', true); @@ -939,6 +1012,8 @@ $('#moderntreatmentsasperirdai').prop('disabled', true); $('#days_of_discharge').prop('disabled', true); $('#days_from_dod').prop('disabled', true); + $('#corporatebuffer').prop('disabled', true); + $('#sublimitofcorporatebuffer').prop('disabled', true); setTimeout(function() { var editor1 = new Jodit('#additionalsicknessbenefit'); @@ -998,7 +1073,7 @@ pTag.innerHTML = jsonObject[key]; // Add your new content inside the

tag } } - // console.log(jsonObject[key]); + // //console.log(jsonObject[key]); } else { if(jsonObject[key] == undefined){ @@ -1027,7 +1102,8 @@ }); } $("#sum_insured").trigger("keyup"); - + $(".multiple_sum_insured").trigger("keyup"); + $('.jodit-wysiwyg').each(function() { $(this).click(); }); @@ -1047,8 +1123,8 @@ $('.spouse-age').css('display','none'); } - console.log("child "); - console.log($('#children').val()); + //console.log("child "); + //console.log($('#children').val()); if($('#children').val() != 0){ $('.child-age').css('display',''); @@ -1087,7 +1163,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + //console.log('Something Wrong!', 'warning'); }, 1000); } }); @@ -1109,8 +1185,8 @@ $('.spouse-age').css('display','none'); } - console.log("child "); - console.log($('#children').val()); + //console.log("child "); + //console.log($('#children').val()); if($('#children').val() != 0){ $('.child-age').css('display',''); @@ -1145,8 +1221,11 @@ }); - $("#sum_insured").on("keyup", function() { - var inputNumber = $(this).val(); + function si_keup_num_to_word(input) { + + console.log('keyup sum insured'); + var inputNumber = $(input).val(); + console.log(inputNumber) if (inputNumber) { var result = convertCommaNumberToWords(inputNumber); @@ -1154,7 +1233,7 @@ } else { $("#numberToWordGMC").text(""); } - }); + }; @@ -1179,7 +1258,7 @@ \ No newline at end of file diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 99275624..b19fd8a6 100644 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -90,16 +90,21 @@

-
+
-
+
+
+
+
+
+
@@ -132,13 +137,13 @@
Min Age: - +
Max Age: - +
@@ -569,6 +574,12 @@ }); } } + + if (key.includes("multiple_sum_insured")) { + gpaJsonObjectForSpecialCondition[key].forEach((value, index) => { + appendGPASIAddMore(value); + }); + } }); let jsonObject = JSON.parse(res.data); @@ -634,6 +645,7 @@ } $("#sumInsured2").trigger("keyup"); + $('.multiple_sum_insured').trigger("keyup"); $("#totalSumInsured").trigger("keyup"); @@ -651,7 +663,7 @@ }); } else if (gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC') { - toastr.warning("This policy has no policy terms.", 'warning'); + // toastr.warning("This policy has no policy terms.", 'warning'); } }); @@ -723,6 +735,41 @@ } }); + $(".multiple_sum_insured").on("keyup", function() { + + console.log('multiple_sum_insured key up') + + var inputNumber = $(this).val(); + console.log('inputNumber', inputNumber); + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + console.log(result); + $(".numberToWordSumInsured").text(result); + } else { + $(".numberToWordSumInsured").text(""); + } + }); + + + function numtowordinkeyup(input){ + console.log('testing......') + console.log(input); + + var inputNumber = $(input).val(); + console.log('inputNumber', inputNumber); + + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + console.log(result); + var $parentRow = $(input).closest('.row'); + console.log('$parentRow', $parentRow) + var $targetDiv = $parentRow.find('.numberToWordSumInsured'); + $targetDiv.text(result) + console.log('$targetDiv', $targetDiv) + } + + } + $("#totalSumInsured").on("keyup", function() { var inputNumber = $(this).val(); @@ -735,16 +782,29 @@ }); + function appendGPASIAddMore(data = null){ + console.log('function called') - // function formatNumber(input) { - // Remove non-numeric characters - // let value = input.value.replace(/\D/g, ''); + var html = ` +
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
+
`; - // Add commas - // value = Number(value).toLocaleString('en-IN'); - - // Update the input value - // input.value = value; - // } + $('#gpa_si_add_more').append(html); + } \ No newline at end of file diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index f69a7648..927895d0 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -6,7 +6,7 @@