From 574ae9f84b7568e70a2a7f9bf3000d4b636266d3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 26 Nov 2024 13:49:05 +0530 Subject: [PATCH 1/3] CHANGE_POLICY_TREMS_ENDORSEMENT_QUERY_CHANGE_AND_OTHER_CHANGE : RV --- app/Controllers/ClientController.php | 8 +- app/Controllers/EmployeeController.php | 14 ++- app/Models/EmployeePolicyModel.php | 14 ++- app/Views/insurer_export_templete.php | 17 +++- app/Views/leads_list.php | 124 +++++++++++++------------ app/Views/policy_gmc_terms.php | 80 +++++++++------- 6 files changed, 158 insertions(+), 99 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 1e169b88..7da74a72 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2138,11 +2138,15 @@ class ClientController extends AdminController $data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal")); // $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal"); $data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay"); + $data['co_pay_details'] = str_replace(',', '', $this->request->getPost("co_pay_details")); + $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['ailmentcapping'] = str_replace(',', '', $this->request->getPost("ailmentcapping")); + $data['ailmentcapping'] = $this->request->getPost("ailmentcapping"); + $data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details")); + $data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges")); $data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance")); $data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit")); @@ -2151,7 +2155,7 @@ class ClientController extends AdminController $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['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")); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index af508898..c308d65f 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -1795,9 +1795,21 @@ class EmployeeController extends AdminController // 'client_id' => 77, // 'client_policy_id' => 203, // 'client_branch_id' => 53, - // 'insurer_or_tpa' => 'tpa', // ]; + // $batch_data['insurer_or_tpa'] = 'insurer'; + // $batch_data['insurer_or_tpa'] = 'tpa'; + + //INCEPTION + // $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data); + + // CORRECTION + // $result = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($batch_data); + + //SI-ENHANCEMENT + // $result = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data); + + //DELETION // $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data); // print_rr($result); die; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 75f8cd53..abbba1e4 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -331,6 +331,8 @@ class EmployeePolicyModel extends Model $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; + $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (emp_endorsement.endorsement_id IS NOT NULL OR emp_endorsement.endorsement_id != '')" : "AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')"; + $sql = " SELECT DISTINCT emp_endorsement.id, @@ -389,13 +391,14 @@ class EmployeePolicyModel extends Model AND employee_polices.client_policy_id = '{$client_policy_id}' AND employees.client_branch_id = '{$client_branch_id}' AND emp_endorsement.actions = 'c' + AND emp_endorsement.status != 'truncated' AND employee_polices.is_active = 1 AND employee_polices.status = 'active' AND employees.is_active = 1 AND employees.emp_status = 'active' AND (employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id != '') AND (employee_polices.uhid IS NOT NULL AND employee_polices.uhid != '') - AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')"; + $endorsement_condition"; // Execute the raw query $query = $this->db->query($sql); @@ -403,6 +406,8 @@ class EmployeePolicyModel extends Model // Get the result set $result = $query->getResult(); + // dd($this->db->getLastQuery(), $result); + return $result; } @@ -416,6 +421,9 @@ class EmployeePolicyModel extends Model $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; + $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')"; + + $query = $this->db->query(" SELECT a.id as endorsement_primarykey, @@ -528,8 +536,9 @@ class EmployeePolicyModel extends Model WHERE employee_polices.client_policy_id = '{$client_policy_id}' AND employees.client_branch_id = '{$client_branch_id}' - AND (a.endorsement_id IS NULL OR a.endorsement_id = '') + $endorsement_condition AND a.actions = 'si' + AND a.status != 'truncated' AND employee_polices.is_active = 1 AND employee_polices.status = 'active' AND employees.is_active = 1 @@ -539,6 +548,7 @@ class EmployeePolicyModel extends Model // Get the result set $results = $query->getResult(); + // dd($this->db->getLastQuery(), $results); return $results; } diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php index 935b669d..6934ab5e 100755 --- a/app/Views/insurer_export_templete.php +++ b/app/Views/insurer_export_templete.php @@ -137,6 +137,7 @@ +
+ + + $event) { ?> + + + +
+
diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 6da050d1..a67b3b49 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -53,72 +53,74 @@ table.dataTable tbody td {
- +
+
- - - - - - - - - - - - - - - - - - - - - $row){ ?> + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + $row){ ?> + + + + + + + + + + + + + + - + + + + + + + - - - - - - - -
S.No.
Lead Type
Issuer
Client Type
Client / Branch
Entity Type
Branch Name
Branch Code
Contact Person Name
Contact Person Mobile
Policy Type
Status
Action
-
S.No.
Lead Type
Issuer
Client Type
Client / Branch
Entity Type
Branch Name
Branch Code
Contact Person Name
Contact Person Mobile
Policy Type
Status
Action
+ - -
No data available
No data available
+ + + +
@@ -174,7 +176,7 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ - scrollX: true, + // scrollX: true, dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 70a10fdd..b7e6c9a8 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -341,43 +341,18 @@
- + Yes + No
-
-
- +
@@ -430,6 +405,15 @@
+ +
@@ -705,6 +689,34 @@ } }); + $('input[name="ailmentcapping"]').change(function() { + + ////console.log($(this).val()); + + if ($(this).val() == '1') { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", ""); + + } else { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", "none"); + } + }); + + $('input[name="copayzonewisecopay"]').change(function() { + + ////console.log($(this).val()); + + if ($(this).val() == '1') { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", ""); + + } else { + var element = $(this).parent().parent().next()[0]; + $(element).css("display", "none"); + } + }); + $('input[name="cataract"]').change(function() { //console.log($(this).val()); @@ -1067,6 +1079,10 @@ }else if(element.name === "ayudhtreatmentcover"){ element.parentElement.parentElement.nextElementSibling.style.display = ''; + }else if(element.name === "ailmentcapping"){ + element.parentElement.parentElement.nextElementSibling.style.display = ''; + }else if(element.name === "copayzonewisecopay"){ + element.parentElement.parentElement.nextElementSibling.style.display = ''; }else if(element.name === "cataract"){ element.parentElement.parentElement.nextElementSibling.style.display = ''; } From dc290df50a60c22cd459f7b5e7933caa4ae07e97 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 27 Nov 2024 12:01:13 +0530 Subject: [PATCH 2/3] FIX_EMPTY_ROWS_ELIMINATED_IN_INS_STMT --- app/Controllers/PolicyTransactionController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 0f735bdc..1c5526c6 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1676,6 +1676,7 @@ class PolicyTransactionController extends BaseController public function validateInsurerStatement($params) { + helper('excel_util_helper'); //get file info $file_id = $params['file_id']; $file = $this->insurerStatements->find($file_id); @@ -1728,6 +1729,12 @@ class PolicyTransactionController extends BaseController // if all good return true, otherwise return false with messssage foreach ($excel_data as $excel_key => $excel_row) { + $is_row_empty = check_row_is_empty_or_null($excel_row); + if($is_row_empty) + { + continue; + } + $is_source_found = 0; $policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel $policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel From c33d723a7ca5623e57aaae166dd2ec2dda3706d6 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 27 Nov 2024 13:44:19 +0530 Subject: [PATCH 3/3] CHANGE_BDS_DUBLICAT_CHECK_TRANSACTION_DELETE_CALC_STAMP_DUTY_ADD_CLIENT_VEHICLE_AND_OTHERS : RV --- app/Config/Routes.php | 3 + app/Controllers/ClientController.php | 114 ++++++++ .../PolicyTransactionController.php | 20 ++ app/Models/PolicyTransactionModel.php | 6 +- app/Views/layout/footer.php | 63 ++++ .../policy_transaction_inception_form.php | 274 +++++++++++++++--- .../policy_transaction_inception_list.php | 38 ++- 7 files changed, 477 insertions(+), 41 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f7426af0..a6472417 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -21,6 +21,7 @@ $routes->get("view", "EmployeeController::viewECard/$1"); // $routes->get("exportQCRandRFQ", "LeadsController::exportQCRandRFQ"); $routes->get("smapletest", "ClientController::smapletest"); $routes->get("testMailAttachments", "ClientController::testMailAttachments"); +$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey"); $routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image"); $routes->get("add_image_index", "AppContentManagementController::add_image_index"); @@ -314,6 +315,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get('log_list', 'EmployeeController::listLogs'); $routes->get('view_log/(:any)', 'EmployeeController::viewLog/$1'); $routes->get('download_log/(:any)', 'EmployeeController::downloadLog/$1'); + $routes->post('checkDuplicateTableFieldValue', 'ClientController::checkDuplicateTableFieldValue'); }); $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { @@ -323,6 +325,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { $routes->post("create", "PolicyTransactionController::createInceptionPolicy"); $routes->get("list/(:any)", "PolicyTransactionController::getInceptionDataForEdit/$1"); $routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1"); + $routes->get("removePolicyTransaction/(:any)", "PolicyTransactionController::removePolicyTransaction/$1"); }); $routes->group("endorsement", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 7da74a72..06f29c30 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -118,6 +118,23 @@ class ClientController extends AdminController $this->leadsModel = new LeadsModel(); } + public function checkDuplicateTableFieldValue() + { + $table = $this->request->getPost('table'); + $field = $this->request->getPost('field'); + $value = $this->request->getPost('value'); + + // Load the database if not already loaded + $db = db_connect(); + + // Perform the query + $builder = $db->table($table); + $isDuplicate = $builder->where($field, $value)->countAllResults() > 0; + + // Return the result + return $this->response->setJSON(['isDuplicate' => $isDuplicate]); + } + public function smapletest() { $headers = [ @@ -3562,4 +3579,101 @@ class ClientController extends AdminController dd($result); } + public function updatePolicyTermsKey() + { + + $data = $this->clientPolicyModel + ->where("policy_terms IS NOT NULL AND policy_terms <> ''") + ->where('policy_type_id', 2) + ->where('is_active', 1) + ->findAll(); + + for ($i = 0; $i < count($data); $i++) { + + if (isset($data[$i]['policy_terms']) && !empty($data[$i]['policy_terms'])) { + $policyTerms = json_decode($data[$i]['policy_terms'], true); + } else { + continue; + } + + // Set default value of copayzonewisecopay to "empty" + $ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty'; + + + // Initialize an empty array for the ordered policy terms + $orderedPolicyTerms = []; + + // Add copayzonewisecopay and copayzonewisecopaydata if they exist_ + if (isset($policyTerms['copayzonewisecopay'])) { + + $orderedPolicyTerms['copayzonewisecopay'] = $policyTerms['copayzonewisecopay']; + $orderedPolicyTerms['co_pay_details'] = isset($policyTerms['co_pay_details']) ? $policyTerms['co_pay_details'] : ''; + } + + + // Add ailmentcapping and ailmentcappingdata if they exist_ + if (isset($policyTerms['ailmentcapping'])) { + $orderedPolicyTerms['ailmentcapping'] = $policyTerms['ailmentcapping']; + $orderedPolicyTerms['ailment_capping_details'] = isset($policyTerms['ailment_capping_details']) ? $policyTerms['ailment_capping_details'] : ''; + } + + + // Now add the rest of the policy terms that are not copayzonewisecopay, copayzonewisecopaydata, ailmentcapping, or ailmentcapping_data_ + foreach ($policyTerms as $key => $value) { + if (!in_array($key, ['copayzonewisecopay', 'co_pay_details', 'ailmentcapping', 'ailment_capping_details'])) { + $orderedPolicyTerms[$key] = $value; + } + } + + + // Re-encode the ordered policy terms + $updatedPolicyTerms = json_encode($orderedPolicyTerms); + + + // Update the policyterms in the database_ + $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]); + + + // Handle different conditions for copayzonewisecopay + if (strtolower($ans) == "nil" || $ans == 0) { + // If copayzonewisecopay is "nil" or 0, reset it to 0 and add copayzonewisecopaydata as empty_ + if (isset($orderedPolicyTerms['copayzonewisecopay'])) { + $orderedPolicyTerms['copayzonewisecopay'] = 0; + $orderedPolicyTerms['co_pay_details'] = ""; + } + + + // Rebuild the array after modification + foreach ($policyTerms as $key => $value) { + if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) { + $orderedPolicyTerms[$key] = $value; + } + } + + + $updatedPolicyTerms = json_encode($orderedPolicyTerms); + $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]); + continue; + } elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) { + // If copayzonewisecopay has a valid value, update it + if (isset($orderedPolicyTerms['copayzonewisecopay'])) { + $orderedPolicyTerms['copayzonewisecopay'] = 1; + $orderedPolicyTerms['co_pay_details'] = $ans; + } + + + // Rebuild the array after modification + foreach ($policyTerms as $key => $value) { + if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) { + $orderedPolicyTerms[$key] = $value; + } + } + + + $updatedPolicyTerms = json_encode($orderedPolicyTerms); + $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]); + } + } + } + } diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 0f735bdc..25c517c1 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -690,6 +690,7 @@ class PolicyTransactionController extends BaseController ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->where('policy_transaction.id', $id) + ->where('policy_transaction.is_active', 1) ->first(); // $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '') @@ -810,6 +811,21 @@ class PolicyTransactionController extends BaseController } + public function removePolicyTransaction($id) + { + if ($id) { + + $data['is_active'] = 0; + $this->policyTransactionModel->where('id', $id)->set($data)->update(); + $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200); + + } else { + + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy transaction'], 200); + } + } + //------------------------------------------------------------------------------------------------ // Policy Transaction Endorsement @@ -962,6 +978,7 @@ class PolicyTransactionController extends BaseController ->where('action_type', 'inception') ->where('client_id', $this->request->getPost('client_id')) ->where('client_policy_id', $this->request->getPost('client_policy_id')) + ->where('policy_transaction.is_active', 1) ->first(); $data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1); @@ -1089,6 +1106,7 @@ class PolicyTransactionController extends BaseController ->join('clients', 'clients.id = policy_transaction.client_id') ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') ->where('policy_transaction.id', $id) + ->where('policy_transaction.is_active', 1) ->first(); // $data['policy_start_date'] = empty($data['policy_start_date']) ? '' : date('d/m/Y', strtotime($data['s_date'])); @@ -1278,6 +1296,8 @@ class PolicyTransactionController extends BaseController ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id') ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id') ->where('policy_transaction.id', $pt_id) + ->where('policy_transaction.is_active', 1) + ->where('pt_co_share_details.is_active', 1) ->where('pt_co_share_details.statement_id IS NOT NULL') ->where('insurer_statements.invoice_no IS NOT NULL') ->countAllResults(); diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 3fa28edd..ba54a5ce 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -386,7 +386,11 @@ class PolicyTransactionModel extends Model $builder->orderBy('policy_transaction.id', 'desc'); - return $builder->get()->getResultArray(); + $result = $builder->get()->getResultArray(); + + // dd($this->db->getLastQuery()); + + return $result; } public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0) diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php index 39b2f769..bef8a1fc 100755 --- a/app/Views/layout/footer.php +++ b/app/Views/layout/footer.php @@ -862,6 +862,69 @@ } + + \ No newline at end of file diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 4f6c0f36..2097e3a9 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -317,7 +317,7 @@