From d88147a53d283639b8a1056cb24c6c94e395f2dc Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Sat, 11 Oct 2025 18:48:37 +0530 Subject: [PATCH 01/35] FIX_resolved - Email duplication based on ClientBrach testcase wise. --- app/Views/client_branch.php | 117 ++++++++++++++++++++++++++---------- 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 31e08346..178439fa 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -986,55 +986,108 @@ function validateDuplicateByClientBranch(input, field, submitButId) { let message = label ? label + " is duplicate!" : "Value is duplicate!"; console.log(`cId: ${clientId} | bId: ${branchId}`); - + // Don't forgot be careful // 1 Local duplication check (User entered) let isLocalDuplicate = false; $('input[name="' + field + '[]"]').each(function(index) { + let compareVal = $(this).val().trim(); console.log(`Entered value: ${value} | Contact ${index+1} value: ${$(this).val()}`); - if (this !== input && $(this).val().trim() === value) { + if (this !== input && compareVal !== '' && compareVal === value) { isLocalDuplicate = true; - return false; // break loop + return false; } }); if (isLocalDuplicate) { console.log(`r u n Local`); - console.log(`btn Dis - true`); + console.log(`duplicate found for ${field}`); toastr.warning(message, 'WARNING'); $('#' + submitButId).prop('disabled', true); - return; // don’t call server if duplicate in UI + return; } - + + // important Skip empty values + if (value === '') { + checkAllFieldsValid(submitButId); + return; + } + // Don't forgot be careful // 2 Server-side duplicate check (DB) - if (!isLocalDuplicate && value !== '') { - - $.ajax({ - url: '', - type: 'POST', - data: { - client_id: clientId, - branch_id: branchId, - value: value, - field: field - }, - dataType: 'json', - success: function(response) { - if (response.isDuplicate) { - console.log(`r u n Server`); - console.log(`btn Dis - true`); - toastr.warning(message, 'WARNING'); - $('#' + submitButId).prop('disabled', true); - } else { - console.log(`btn Dis - false`); - $('#' + submitButId).prop('disabled', false); - } - }, - error: function(xhr, status, error) { - console.error('AJAX Error:', error); + $.ajax({ + url: '', + type: 'POST', + data: { + client_id: clientId, + branch_id: branchId, + value: value, + field: field + }, + dataType: 'json', + success: function(response) { + if (response.isDuplicate) { + console.log(`r u n Server`); + console.log(`duplicate found for ${field}`); + toastr.warning(message, 'WARNING'); + $('#' + submitButId).prop('disabled', true); + } else { + console.log(`No duplicate for ${field}`); + checkAllFieldsValid(submitButId); } - }); + }, + error: function(xhr, status, error) { + console.error('AJAX Error:', error); + } + }); +} + + +// recheck all contacts before enabling submit +function checkAllFieldsValid(submitButId) { + let emailDuplicates = false; + let mobileDuplicates = false; + + // cross check all EMAIL duplicates + let emailSeen = []; + $('input[name="email[]"]').each(function() { + let val = $(this).val().trim(); + if (val && emailSeen.includes(val)) { + emailDuplicates = true; + } else if (val) { + emailSeen.push(val); + } + }); + + // cross check all MOBILE duplicates + let mobileSeen = []; + $('input[name="mobile[]"]').each(function() { + let val = $(this).val().trim(); + if (val && mobileSeen.includes(val)) { + mobileDuplicates = true; + } else if (val) { + mobileSeen.push(val); + } + }); + + if (emailDuplicates || mobileDuplicates) { + $('#' + submitButId).prop('disabled', true); + // show correct message based on what’s duplicated + if (emailDuplicates && mobileDuplicates) { + toastr.warning("Email and Mobile values are duplicate!", "WARNING"); + console.log('Both Email and Mobile duplicates'); + } else if (emailDuplicates) { + toastr.warning("Email duplicate!", "WARNING"); + console.log('Cross Check Email duplicates'); + } else if (mobileDuplicates) { + toastr.warning("Mobile duplicate!", "WARNING"); + console.log('Cross Check Mobile duplicates'); + } + console.log(`btn Dis - true`); + } else { + console.log('unique — enable'); + console.log(`btn Dis - false`); + $('#' + submitButId).prop('disabled', false); } } From 950c117a2eaef439c8391ecf5bc1e47df6caa778 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 11 Oct 2025 19:32:05 +0530 Subject: [PATCH 02/35] CHANGE_HR_ACCESS_SAVE --- app/Controllers/ClientController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ee7ae376..1529e549 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -7305,7 +7305,9 @@ class ClientController extends AdminController $pre_hr_id = $db2->table('client_branch cb') ->select('lc.id') ->join('level_contacts lc','lc.ref_id = cb.id') - ->where('cb.id',$pre_branch_id)->where('cb.is_Active',1)->where('lc.is_Active',1)->get()->getResultArray()[0]['id']??""; + ->where('lc.contact_type', 'client') + ->where('cb.id',$pre_branch_id)->where('cb.is_Active',1) + ->where('lc.is_Active',1)->get()->getResultArray()[0]['id']??""; return $pre_hr_id; } From fadcd8d6857a0b6a15e1651915f58b039be3ecf2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 13 Oct 2025 14:36:36 +0530 Subject: [PATCH 03/35] FEAT_MASTERS : RV --- app/Controllers/MasterController.php | 91 +- app/Models/VehicleTypeModel.php | 54 + app/Views/nhance_branch_list.php | 207 ++++ app/Views/vehicle_type_list.php | 1692 ++++++++++++++++++++++++++ 4 files changed, 2043 insertions(+), 1 deletion(-) create mode 100644 app/Models/VehicleTypeModel.php create mode 100644 app/Views/nhance_branch_list.php create mode 100644 app/Views/vehicle_type_list.php diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 013a9324..cde00cf7 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -33,6 +33,7 @@ use App\Models\ClientDepositModel; use App\Models\EmployeePolicyModel; use App\Models\FileModel; use App\Models\InsurerExcelExportTemplateModel; +use App\Models\NhanceBranchModel; use App\Models\SettingsModel; use App\Models\VehicleModel; @@ -1618,7 +1619,8 @@ class MasterController extends AdminController //Vehicle Master data Function public function VehicleMasterList() - { $data['tab_name'] = 'Vehicle Master'; + { + $data['tab_name'] = 'Vehicle Master'; $data['page_name'] = 'Vehicles'; $data['vehicle_type'] = [ 'two_wheeler' => 'Two Wheeler', @@ -2020,4 +2022,91 @@ class MasterController extends AdminController dd($result); } + public function nhanceBranchMaster() + { + $nhanceBranchModel = new NhanceBranchModel(); + + if ($this->request->is('post')) { + + $id = $this->request->getPost('pk') ?? null; + $data = $this->request->getPost(); + print_r($data); die; + + if (empty($id)) { + $update_status = $nhanceBranchModel->insert($data); + } else { + $update_status = $nhanceBranchModel->where('id', $id)->set($data)->update(); + } + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'Nhance Branch Master updated successfully', + 'data' => $data + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to update', + 'data' => $data + ], 200); + } + + } elseif ($this->request->is('get')) { + + $id = $this->request->getGet('pk') ?? null; + + if (!empty($id)) { + $data = $nhanceBranchModel->where('is_active', 1)->where('id', $id)->findAll(); + if (!empty($data)) { + return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200); + } else { + return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200); + } + } + + $data = $nhanceBranchModel->where('is_active', 1)->findAll(); + return $this->loadLayout('nhance_branch_list', ['data' => $data]); + + } elseif ($this->request->is('delete')) { + + $input = $this->request->getRawInput(); + $id = $input['pk'] ?? null; + + if (empty($id)) { + return $this->respond([ + 'status' => false, + 'code' => 404, + 'message' => 'No ID provided for deletion' + ], 200); + } + + $update_status = $nhanceBranchModel->where('id', $id)->set(['is_active' => 0])->update(); + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'Data removed successfully', + 'pk' => $id + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to remove data', + 'pk' => $id + ], 200); + } + } + } + + + public function vehicleTypeMaster() + { + + } + } \ No newline at end of file diff --git a/app/Models/VehicleTypeModel.php b/app/Models/VehicleTypeModel.php new file mode 100644 index 00000000..46fdc3c9 --- /dev/null +++ b/app/Models/VehicleTypeModel.php @@ -0,0 +1,54 @@ + +.dataTables_filter { + position: absolute; +} + + + +
+
+
+
+ + + + + + + + + + $row) { ?> + + + + + + + + +
S.No.Branch NameAction
+ +
+
+
+
+
+ + + + + + + diff --git a/app/Views/vehicle_type_list.php b/app/Views/vehicle_type_list.php new file mode 100644 index 00000000..3cc0de76 --- /dev/null +++ b/app/Views/vehicle_type_list.php @@ -0,0 +1,1692 @@ + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
S.No.Mobile NoRoleStatusAction
first_name; ?>email; ?>mobile; ?>user_role; ?> + + is_active == 1){ echo 'Active'; }else{ echo 'In-Active'; } ?> + + + +
+ + +
+
+
+ +
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TeamModuleAccess Rights
ManagementBDS - All accessAll access
FinanceBDS - Policy TransactionPolicy | Endorsement | Statement Upload
BDS - ReportTAT wise | ACM Status wise | ACM TAT wise
BDS - Pending ActionsFinance Team
BDS - MastersVehicle | CD
BDS - Documents
BusinessBDS - Policy TransactionPolicy | Endorsement
BDS - ReportTAT wise | ACM Status wise | ACM TAT wise
BDS - Pending ActionsBusiness Team
BDS - MastersVehicle | CD
BDS - Documents
POSBDS - Policy TransactionPolicy | Endorsement
BDS - ReportBDS, TAT wise | ACM Status wise | ACM TAT wise
EnrollmentInception File UploadAll access
ClaimsClaimsAll access
SalesLEADLead creation | RFQ creation
Business SupportLEADAll access
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TeamModuleAccess Rights
HeadAll modulesAll access
AdminAll modulesAll access
ManagerAccess to all modules except the "Masters" moduleAll access
Account ManagerAccess to all modules except the "Masters" moduleAll access without "Delete option"
StaffBased on the "Teams"Based on the "Teams"
+
+
+ + + + + + \ No newline at end of file From 654041d725377580c7f914546f85a7de4549f194 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 13 Oct 2025 14:44:59 +0530 Subject: [PATCH 04/35] CHANGE_ROUTE --- app/Config/Routes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 31453be4..0cd7f7fe 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -395,6 +395,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get('getMemberDataExcelFileErrors', 'LeadsController::getMemberDataExcelFileErrors'); $routes->post('savePlacementDataAndValidateMemberDataFile', 'LeadsController::savePlacementDataAndValidateMemberDataFile'); $routes->get('checkMemberDataFileValidationStatus', 'LeadsController::checkMemberDataFileValidationStatus'); + $routes->match(['get', 'post', 'delete'], 'nhanceBranchMaster', 'MasterController::nhanceBranchMaster'); + }); $routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail"); From df1932e5acbdafedb97ac431e10dd023877cda4b Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Mon, 13 Oct 2025 15:26:30 +0530 Subject: [PATCH 05/35] CHANGE_UI_FIX - VADIVEL J 2025-10-13 --- app/Controllers/TestingController.php | 46 +++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index e6f377c7..d003037e 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -362,6 +362,17 @@ class TestingController extends BaseController $pre_clients_list = $this->getNonDuplicatePreClients(); + $log_post_clients_list = $post_clients_list ; + + $log_pre_clients_list = $pre_clients_list ; + + log_message('error', 'Post Clients to be processed: ' . count($log_post_clients_list)); + log_message('error', 'Pre Clients to be processed: ' . count($log_pre_clients_list)); + + + + $matched_Count = 0 ; + $expected_match_count = min(count($post_clients_list), count($pre_clients_list)); if ( @@ -372,12 +383,18 @@ class TestingController extends BaseController $postDB = \Config\Database::connect(); $preDB = \Config\Database::connect('preDB'); - foreach ($post_clients_list as $post_client) { + foreach ($post_clients_list as $index => $post_client) { - foreach ($pre_clients_list as $pre_client) { + foreach ($pre_clients_list as $index => $pre_client) { if (trim($post_client['short_name']) == trim($pre_client['short_name'])) { + unset($log_post_clients_list[$index]); + unset($log_pre_clients_list[$index]); + + $matched_Count++; + + $postDB->table('clients')->where('id', $post_client['id'])->update(['pre_client_id' => $pre_client['id']]); $preDB->table('clients')->where('id', $pre_client['id'])->update(['post_client_id' => $post_client['id']]); @@ -426,7 +443,32 @@ class TestingController extends BaseController } } } + + + log_message('error', 'Expected Match Count : ' . $expected_match_count); + log_message('error', 'Total Matched Count: ' . $matched_Count); + log_message('error', 'Total UnMatched Count: ' . $expected_match_count - $matched_Count); + + + log_message('error','unmatched_reocrds'); + + $log_post_clients_list = array_values($log_post_clients_list); + $log_pre_clients_list = array_values($log_pre_clients_list); + + if( (count($log_pre_clients_list) < count($log_post_clients_list))){ + log_message('error',"unmatched records count from pre- ". count($log_pre_clients_list)); + log_message('error',print_r($log_pre_clients_list,true)); + } else { + log_message('error',"unmatched records count from post - ".count($log_post_clients_list)); + log_message('error',print_r($log_post_clients_list,true)); + } + + } + + return $this->response->setJSON(['status' => 'success', 'message' => 'Client and Branch mapping completed.'])->setStatusCode(200); + + } From eb7e3f3f92fc3ca0fb3b28e35c8861933c7b7a45 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 14 Oct 2025 10:26:31 +0530 Subject: [PATCH 06/35] CHANGE_BDS_CHANGES --- app/Controllers/ClientController.php | 2 +- app/Controllers/PolicyTransactionController.php | 15 ++++++++++++--- app/Models/ClientPolicyModel.php | 1 + app/Models/EmployeePolicyModel.php | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 1529e549..bcadb66d 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4669,7 +4669,7 @@ class ClientController extends AdminController // Additional logic for non-individual clients (client_type != 2) $branch_insert = null; if ($client_type != 2) { - $unit[] = $postData['short_name'] . '-' . $postData['branch_code'] ?? 001; + $unit[] = $postData['short_name'] . '-' . ($postData['branch_code'] ?? 001); $branch_data = [ 'client_id' => $client_insert, 'branch_name' => $postData['branch_name'], diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index db8be45b..d2b45648 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -594,6 +594,7 @@ class PolicyTransactionController extends BaseController 'client_branch_id' => $data['client_branch_id'] ?? 0, 'cd_ac_pk' => $data['cd_ac_no'] ?? null, 'gst' => 18, + 'policy_entry_from' => 2, ]; } @@ -1397,6 +1398,12 @@ class PolicyTransactionController extends BaseController ->orderBy('id', 'asc') ->first(); + $pt_id = null; + if(!empty($data)){ + $inception_data = $this->policyTransactionModel->where('policy_no', $data['policy_no'])->where('client_id', $data['client_id'])->first(); + $pt_id = $inception_data['id']; + } + if (!empty($data['policy_start_date'])) { $data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y'); @@ -1559,7 +1566,7 @@ class PolicyTransactionController extends BaseController // print_r($data['endorse_eff_date']); die; if ($data) { - return $this->respond(['status' => true, 'data' => $data], 200); + return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200); } else { return $this->respond(['status' => false], 200); } @@ -1709,14 +1716,16 @@ class PolicyTransactionController extends BaseController ") ->join('policy_transaction', 'policy_transaction.id = pt_co_share_details.pt_id') ->where('policy_transaction.client_id', $client_id) - ->where('policy_transaction.client_policy_id', $client_policy_id) + // ->where('policy_transaction.client_policy_id', $client_policy_id) + ->where('policy_transaction.id', $client_policy_id) ->where('policy_transaction.action_type', 'inception') ->where('policy_transaction.is_active', 1) ->findAll(); $is_copay_yes = $this->policyTransactionModel ->where('client_id', $client_id) - ->where('client_policy_id', $client_policy_id) + // ->where('client_policy_id', $client_policy_id) + ->where('id', $client_policy_id) ->where('action_type', 'inception') ->where('is_active', 1) ->first(); diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 132080de..152cad7f 100755 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -55,6 +55,7 @@ class ClientPolicyModel extends Model "cd_ac_pk", "is_lgbtq", "placement_json", + "policy_entry_from", ]; // Callbacks diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 348d309d..041ac791 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -1492,6 +1492,7 @@ class EmployeePolicyModel extends Model tpa.tpa_logo AS tpa_logo, tpa.front_card, tpa.back_card, + tpa.network_hospitals, tpa.short_name AS tpa_short_name' ) @@ -1557,6 +1558,7 @@ class EmployeePolicyModel extends Model tpa.tpa_logo AS tpa_logo, tpa.front_card, tpa.back_card, + tpa.network_hospitals, tpa.short_name AS tpa_short_name' ) From 19c3c12f5876c23daf9e7415ef8dde7b62d94c71 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 14 Oct 2025 10:40:39 +0530 Subject: [PATCH 07/35] CHANGE_Mail_template_filename_issue - VADIVEL J 2025-10-14 --- app/Helpers/utility_helper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index c03ffcc9..f66229f5 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -57,6 +57,7 @@ if (!function_exists('file_Upload')) { if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) { $fileToUpload->move($filepath); $fileName = $fileToUpload->getName(); + $fileName = preg_replace('/[\s\x{00A0}\x{200B}-\x{200D}\x{FEFF}]/u', '', $fileName); return $fileName; } else { return ""; From eeef23512d60e0d4123f6706a10b233e912045e2 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 14 Oct 2025 14:08:39 +0530 Subject: [PATCH 08/35] CHANGE_VEHICLE_NO_VALIDATION : RV --- .../policy_transaction_inception_form.php | 1946 +++++++++++------ 1 file changed, 1264 insertions(+), 682 deletions(-) diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 4ccac05a..268d952b 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -1,162 +1,260 @@ + +
@@ -200,117 +298,116 @@
- -
- -
-
-
-
-
- - + + $value) { + echo ""; } - ?> - -
- + } + ?> +
-
- -
- - -
- -
- - -
- -
- - -
- - - -
- - -
+
-
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ + +
+
+
- +
-
- -
+
+ +
@@ -526,344 +623,340 @@ @@ -5616,6 +6160,8 @@ $(".individual_client").find("select, input, textarea").val("").prop("required", true); } + toggleRequiredWithAsterisk('#gst', false); + toggleRequiredWithAsterisk('#mobile', false); $("#client_form_row_div").on("input change", "input, select, textarea", function () { if ($("#client_type").val() === "") { @@ -5661,39 +6207,75 @@ toastr.warning(message, 'WARNING'); // $(input).val(''); isGSTValid = false; - $('#client_add_modal_submit_btn').prop('disabled', true); + $('#client_form_submit_btn').prop('disabled', true); + $('#vehicle_form_submit_btn_id_for_disable').prop('disabled', true); } else { isGSTValid = true; - $('#client_add_modal_submit_btn').prop('disabled', false); + $('#client_form_submit_btn').prop('disabled', false); + $('#vehicle_form_submit_btn_id_for_disable').prop('disabled', false); } }); - $('#hide_smbt_btn button').prop('disabled', false); + $('#hide_smbt_btn_button').prop('disabled', false); } $('#client_type').on('change', function() { let client_type = $(this).val(); + console.log( "client_type", client_type); if(client_type == 1){ $('.group_client').show(); $('.individual_client').hide(); $(".group_client").find("select, input, textarea").val("").prop("required", true); $(".individual_client").find("select, input, textarea").val("").prop("required", false); + toggleRequiredWithAsterisk('#gst', false); }else{ $('.group_client').hide(); $('.individual_client').show(); $(".group_client").find("select, input, textarea").val("").prop("required", false); $(".individual_client").find("select, input, textarea").val("").prop("required", true); + toggleRequiredWithAsterisk('#gst', false); } }); + function toggleRequiredWithAsterisk(inputSelector, makeRequired) { + + var $input = $(inputSelector); + var $label = $input.closest('.form-group').find('label'); + + console.log('Toggling required for:', inputSelector, 'Make required:', makeRequired); + + if(makeRequired) { + $input.attr('required', true); + console.log('Added required attribute'); + + // Add asterisk if not already present + if($label.find('span.text-danger').length === 0) { + $label.append(' *'); + console.log('Added * to label'); + } else { + console.log('* already exists in label'); + } + } else { + $input.removeAttr('required'); + console.log('Removed required attribute'); + + // Remove asterisk + $label.find('span.text-danger').remove(); + console.log('Removed * from label'); + } + + console.log('Current input attributes:', $input.prop('outerHTML')); + console.log('Current label html:', $label.html()); + } + $(document).on("input change", "input[name='total[]']", function () { let val = $(this).val(); console.log("✅ total[] changed:", val); }); - \ No newline at end of file + From 5700b1cc252c0ca684002e2035a8ca44832a89e5 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 14 Oct 2025 14:19:57 +0530 Subject: [PATCH 09/35] CHANGE_Mail_template_filename_issue - VADIVEL J 2025-10-14 --- app/Config/Routes.php | 1 + app/Controllers/TestingController.php | 72 +++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0cd7f7fe..58aa95b4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -713,6 +713,7 @@ $routes->group('test', function($routes) { $routes->get('mapping_client_id_and_branch_id','TestingController::mapping_client_id_and_branch_id'); $routes->get('membervalidation', 'TestingController::membervalidation'); $routes->get('generateExcel', 'TestingController::generateExcel'); + $routes->get('logo_renaming','TestingController::logo_renaming'); }); $routes->cli('cli/testcli', 'TestingController::testcli'); diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index d003037e..9104f3f5 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -715,4 +715,76 @@ class TestingController extends BaseController ]; } + + public function logo_renaming(){ + + $directory = ROOTPATH . 'public/uploads/logo/'; + + if (!is_dir($directory)) { + die("Directory not found: $directory"); + } + + $files = scandir($directory); + + $client_logo_files = $this->get_client_logo_files(); + + $rename_files = ""; + $failed_rename_files = ""; + + foreach ($files as $file) { + // Skip system entries + if ($file === '.' || $file === '..' ) { + continue; + } + + + $oldPath = $directory . $file; + + if (is_file($oldPath) && in_array(trim($file) , $client_logo_files)) { + + // Remove all spaces from filename + $newFileName = preg_replace('/\s+|\x{00A0}|\x{200B}|\x{200C}|\x{200D}|\x{FEFF}/u', '', $file); + + $newPath = $directory . $newFileName; + + // Only rename if the name changed + if ($oldPath !== $newPath) { + if (rename($oldPath, $newPath)) { + $rename_files .= "\n Renamed: $file → $newFileName \n"; + } else { + $failed_rename_files .= "\n Failed file: $file \n"; + } + } + } + } + log_message('error', 'Renamed Files: ' . $rename_files); + log_message('error', 'Failed Renames: ' . $failed_rename_files); + + return $this->response->setJSON(['status' => 'success', + 'message' => 'Logo renaming completed. kindly check backend logs for details', + 'data' => [ + 'renamed_files' => $rename_files, + 'failed_renames' => $failed_rename_files + ] + ])->setStatusCode(200); + } + + public function get_client_logo_files(){ + + $db = \Config\Database::connect(); + + $sql = "SELECT client_logo FROM clients WHERE client_logo IS NOT NULL AND TRIM(client_logo) <> '' "; + + $query = $db->query($sql); + + $results = $query->getResultArray() ?? []; + + $files = array_map(function($item) { + return trim($item['client_logo']); + }, $results); + + return $files; + } + + } From 77406ef3359e7c667dcfbfece170f6cad74f7f1e Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 14 Oct 2025 14:55:01 +0530 Subject: [PATCH 10/35] CHANGE_Mail_template_filename_issue - VADIVEL J 2025-10-14 --- app/Controllers/TestingController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index 9104f3f5..a7cdddd1 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -757,8 +757,12 @@ class TestingController extends BaseController } } } + + $dbUpdated = $this->update_client_logo_files(); + log_message('error', 'Renamed Files: ' . $rename_files); log_message('error', 'Failed Renames: ' . $failed_rename_files); + log_message('error', 'Database Update Status: ' . ($dbUpdated ? 'Success' : 'No changes made')); return $this->response->setJSON(['status' => 'success', 'message' => 'Logo renaming completed. kindly check backend logs for details', @@ -786,5 +790,22 @@ class TestingController extends BaseController return $files; } + public function update_client_logo_files(){ + + $db = \Config\Database::connect(); + + $sql = "UPDATE clients + SET client_logo = REPLACE(REPLACE(REPLACE(client_logo, CHAR(160), ''), ' ', ''), '\t', '') + WHERE client_logo IS NOT NULL + AND TRIM(client_logo) <> '' + "; + + $query = $db->query($sql); + + return $db->affectedRows() > 0; + + + } + } From 7b1d98d86ce749e15495f13ecc0c92982b467d49 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Tue, 14 Oct 2025 15:03:43 +0530 Subject: [PATCH 11/35] FIX_Master screen --- app/Config/Routes.php | 3 + app/Controllers/MasterController.php | 174 +++++++++++- app/Models/RTOModel.php | 57 ++++ app/Views/layout/header.php | 9 + app/Views/nhance_branch_list.php | 159 ++++++++--- .../policy_transaction_inception_form.php | 61 +++++ app/Views/rto_master_list.php | 254 ++++++++++++++++++ app/Views/vehicle_type_master_list.php | 230 ++++++++++++++++ 8 files changed, 905 insertions(+), 42 deletions(-) create mode 100644 app/Models/RTOModel.php create mode 100644 app/Views/rto_master_list.php create mode 100755 app/Views/vehicle_type_master_list.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 58aa95b4..877ba46e 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -396,6 +396,9 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->post('savePlacementDataAndValidateMemberDataFile', 'LeadsController::savePlacementDataAndValidateMemberDataFile'); $routes->get('checkMemberDataFileValidationStatus', 'LeadsController::checkMemberDataFileValidationStatus'); $routes->match(['get', 'post', 'delete'], 'nhanceBranchMaster', 'MasterController::nhanceBranchMaster'); + $routes->match(['get', 'post', 'delete'], 'vehicleTypeMaster', 'MasterController::vehicleTypeMaster'); + $routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster'); + }); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index cde00cf7..19cde67b 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -36,6 +36,8 @@ use App\Models\InsurerExcelExportTemplateModel; use App\Models\NhanceBranchModel; use App\Models\SettingsModel; use App\Models\VehicleModel; +use App\Models\VehicleTypeModel; +use App\Models\RTOModel; use CodeIgniter\CLI\CLI; @@ -2022,15 +2024,19 @@ class MasterController extends AdminController dd($result); } + //---------------------------------------------------------------------------------------------------------- + public function nhanceBranchMaster() { $nhanceBranchModel = new NhanceBranchModel(); + $method = $this->request->getMethod(); + $data['tab_name'] = 'Nhance Branch'; + $data['page_name'] = 'Nhance Branchs'; - if ($this->request->is('post')) { + if ($method === 'post') { $id = $this->request->getPost('pk') ?? null; $data = $this->request->getPost(); - print_r($data); die; if (empty($id)) { $update_status = $nhanceBranchModel->insert($data); @@ -2054,7 +2060,7 @@ class MasterController extends AdminController ], 200); } - } elseif ($this->request->is('get')) { + } elseif ($method === 'get') { $id = $this->request->getGet('pk') ?? null; @@ -2070,7 +2076,7 @@ class MasterController extends AdminController $data = $nhanceBranchModel->where('is_active', 1)->findAll(); return $this->loadLayout('nhance_branch_list', ['data' => $data]); - } elseif ($this->request->is('delete')) { + } elseif ($method === 'delete') { $input = $this->request->getRawInput(); $id = $input['pk'] ?? null; @@ -2106,7 +2112,167 @@ class MasterController extends AdminController public function vehicleTypeMaster() { + $vehicleTypeModel = new VehicleTypeModel(); + $method = $this->request->getMethod(); + $data['tab_name'] = 'Vehicle Type'; + $data['page_name'] = 'Vehicle Types'; + if ($method === 'post') { + $id = $this->request->getPost('pk') ?? null; + $data = $this->request->getPost(); + + if (empty($id)) { + $update_status = $vehicleTypeModel->insert($data); + } else { + $update_status = $vehicleTypeModel->where('id', $id)->set($data)->update(); + } + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'Vehicle Type Master updated successfully', + 'data' => $data + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to update', + 'data' => $data + ], 200); + } + + } elseif ($method === 'get') { + + $id = $this->request->getGet('pk') ?? null; + + if (!empty($id)) { + $data = $vehicleTypeModel->where('is_active', 1)->where('id', $id)->findAll(); + if (!empty($data)) { + return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200); + } else { + return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200); + } + } + + $data = $vehicleTypeModel->where('is_active', 1)->findAll(); + return $this->loadLayout('vehicle_type_master_list', ['data' => $data]); + + } elseif ($method === 'delete') { + + $input = $this->request->getRawInput(); + $id = $input['pk'] ?? null; + + if (empty($id)) { + return $this->respond([ + 'status' => false, + 'code' => 404, + 'message' => 'No ID provided for deletion' + ], 200); + } + + $update_status = $vehicleTypeModel->where('id', $id)->set(['is_active' => 0])->update(); + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'Data removed successfully', + 'pk' => $id + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to remove data', + 'pk' => $id + ], 200); + } + } + } + + public function rtoMaster() + { + $rtoModel = new RTOModel(); + $method = $this->request->getMethod(); + $data['tab_name'] = 'RTO'; + $data['page_name'] = 'RTO'; + + if ($method === 'post') { + + $id = $this->request->getPost('pk') ?? null; + $data = $this->request->getPost(); + + if (empty($id)) { + $update_status = $rtoModel->insert($data); + } else { + $update_status = $rtoModel->where('id', $id)->set($data)->update(); + } + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'RTO Master updated successfully', + 'data' => $data + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to update', + 'data' => $data + ], 200); + } + + } elseif ($method === 'get') { + + $id = $this->request->getGet('pk') ?? null; + + if (!empty($id)) { + $data = $rtoModel->where('is_active', 1)->where('id', $id)->findAll(); + if (!empty($data)) { + return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200); + } else { + return $this->respond(['status' => false, 'code' => 400, 'message' => 'No data found'], 200); + } + } + + $data = $rtoModel->where('is_active', 1)->findAll(); + return $this->loadLayout('rto_master_list', ['data' => $data]); + + } elseif ($method === 'delete') { + + $input = $this->request->getRawInput(); + $id = $input['pk'] ?? null; + + if (empty($id)) { + return $this->respond([ + 'status' => false, + 'code' => 404, + 'message' => 'No ID provided for deletion' + ], 200); + } + + $update_status = $rtoModel->where('id', $id)->set(['is_active' => 0])->update(); + + if ($update_status) { + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'Data removed successfully', + 'pk' => $id + ], 200); + } else { + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Failed to remove data', + 'pk' => $id + ], 200); + } + } } } \ No newline at end of file diff --git a/app/Models/RTOModel.php b/app/Models/RTOModel.php new file mode 100644 index 00000000..6f5abcab --- /dev/null +++ b/app/Models/RTOModel.php @@ -0,0 +1,57 @@ + Users +
  • + Nhance Branch +
  • +
  • + Vehicle Type +
  • +
  • + RTO +
  • diff --git a/app/Views/nhance_branch_list.php b/app/Views/nhance_branch_list.php index 97660071..f3655ec8 100644 --- a/app/Views/nhance_branch_list.php +++ b/app/Views/nhance_branch_list.php @@ -14,25 +14,43 @@ S.No. Branch Name + Action + $row) { ?> - +    + + + + No data available + + @@ -43,14 +61,15 @@ +
    + + +
    +
    From b1d67886e2a22e621cd38d2a00470488ec399ab9 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 15 Oct 2025 10:15:47 +0530 Subject: [PATCH 14/35] FIX_FAMILY_COM --- app/Views/view_rfq.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index d3139864..1c213669 100644 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -1360,7 +1360,7 @@ $(document).ready(function () { if (lead_status != "won") { console.log("Lead status is not 'won', setting interval for submitData"); - // startInterval(); + startInterval(); } else { console.log("Lead status is 'won', submitData will not be called"); } @@ -1557,8 +1557,8 @@ function saveFamilyMembersDetails() { function resetFamiliyDialogModalValues() { - $('#familiy_dialog_row_index').val(''); - $('#familiy_dialog_column_index').val(''); + // $('#familiy_dialog_row_index').val(''); + // $('#familiy_dialog_column_index').val(''); // Reset Self $('#family_self').prop('checked', true); @@ -3751,6 +3751,8 @@ function setCellInnerHTMLByCellIndex(tableId, rowIndex, colIndex, htmlContent) { // Set the innerHTML of the cell cell.innerHTML = htmlContent; console.log(`Updated cell at row ${rowIndex}, column ${colIndex} with content: ${htmlContent}`); + $('#familiy_dialog_row_index').val(''); + $('#familiy_dialog_column_index').val(''); } else { console.error(`Column index ${colIndex} does not exist in row ${rowIndex}`); } From ebb7b929419b1b1cab24aea8bfd3865234d15f35 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 15 Oct 2025 10:17:36 +0530 Subject: [PATCH 15/35] CHANGE_BDS_CHANGE --- app/Controllers/ClientController.php | 2 +- .../PolicyTransactionController.php | 33 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index bcadb66d..a625d914 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1613,7 +1613,7 @@ class ClientController extends AdminController if ($update) { - $policy_transaction_update = $this->deactivatePolicyTransactionsPolicy($id); + // $policy_transaction_update = $this->deactivatePolicyTransactionsPolicy($id); return $this->respond(['status' => true, 'code' => 200], 200); } else { diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index d2b45648..338b4c16 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -381,7 +381,7 @@ class PolicyTransactionController extends BaseController } if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) { - $this->processCompletedStatus($data, $client_policy_id, $data['insurer_id']); + $this->processCompletedStatus($data, $client_policy_id, $data['insurer_id'], $insert); } } @@ -435,7 +435,7 @@ class PolicyTransactionController extends BaseController if($old_pt_data['status'] != "completed"){ if ($data['status'] == 'completed' && $data['ct_type'] == 2) { if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) { - $this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']); + $this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id'], $id); } } } @@ -610,7 +610,7 @@ class PolicyTransactionController extends BaseController $this->policyTransactionStatusModel->insert($statusData); } - private function processCompletedStatus($data, $client_policy_id, $insurer_id) + private function processCompletedStatus($data, $client_policy_id, $insurer_id, $policyTranId) { $totalAmount = (int)$data['total'][0] ?? 0; $description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited for the ' . $data['emp_count'] . ' employees at Inception (BDS).'; @@ -631,7 +631,12 @@ class PolicyTransactionController extends BaseController 'cd_ac_pk' => $data['cd_ac_pk'] ]; - DepositHelper::saveDeposit($cdTransactionData, get_session_userid()); + $result = DepositHelper::saveDeposit($cdTransactionData, get_session_userid()); + + if(isset($result) && $result['success'] == true){ + $update_data['ct_tran_id'] = $result['insert_id']; + $this->policyTransactionModel->where('id', $policyTranId)->set($update_data)->update(); + } } private function cdCorrection($data, $amt) @@ -1026,13 +1031,12 @@ class PolicyTransactionController extends BaseController } } - public function removePolicyTransaction($id) - { + public function removePolicyTransaction($id, $type = 0) + { if ($id) { - $data['is_active'] = 0; $policy_transaction_data = $this->policyTransactionModel->where('id', $id)->first(); - if($policy_transaction_data['policy_type_id'] > 7){ + if($policy_transaction_data['policy_type_id'] > 7 && $type == 0){ $this->policyTransactionModel->where('id', $id)->set($data)->update(); $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); $this->clientPolicyModel->where('id', $policy_transaction_data['client_policy_id'])->set($data)->update(); @@ -1347,15 +1351,16 @@ class PolicyTransactionController extends BaseController } private function handleCompletedStatus($data, $policy_tran_id) - { + { if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) { $tolamt = (int) $data['total'][0] ?? 0; $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)'; + $cd_tranction_data = [ - 'amount' => $tolamt, + 'amount' => abs($tolamt), 'sub_type_id' => $data['action_type'] == 'deletion' ? 3 : 4, 'client_id' => $data['client_id'], 'client_policy_id' => $data['client_policy_id'], @@ -1370,7 +1375,13 @@ class PolicyTransactionController extends BaseController 'cd_ac_pk' => $data['cd_ac_pk'] ?? null, ]; - DepositHelper::saveDeposit($cd_tranction_data, get_session_userid()); + $result = DepositHelper::saveDeposit($cd_tranction_data, get_session_userid()); + + if(isset($result['success']) && $result['success']){ + $update_data['ct_tran_id'] = $result['insert_id']; + $this->policyTransactionModel->where('id', $policy_tran_id)->set($update_data)->update(); + } + } } From 5bcab5b7a5d6efe699b9ba79d03b77ec22ea59f4 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Wed, 15 Oct 2025 14:14:20 +0530 Subject: [PATCH 16/35] FIX_UI_support_Search_with_icon --- app/Views/leads_form_handler.php | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index cb17bb22..563c5933 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -452,6 +452,58 @@ if (isset($selected_lead_type)) { $('#salse_person_id').trigger('change'); } + // $('#client_name').on('input', generateShortName); + + let shortNameTimer; + + $('#client_name').on('input', function() { + clearTimeout(shortNameTimer); + shortNameTimer = setTimeout(generateShortName, 200); + }); + + function generateShortName() { + let clientInput = $("#client_name"); + let shortInput = $("#client_short_name"); + let newClientName = clientInput.val().trim(); + + console.log(`LN : NEW - ${newClientName}`); + if (newClientName.length == 0) { + shortInput.val(''); + return; + } + + let shortName = newClientName.substring(0, 10).replace(/\s+/g, '').toUpperCase(); + makeUniqueShortName(shortName); + } + + function makeUniqueShortName(baseName) { + let input = $("#client_short_name")[0]; + + checkDuplicateTableFieldValue("clients", "short_name", baseName, function(isDuplicate) { + if (isDuplicate) { + let counter = 1; + function tryNext() { + let padded = String(counter).padStart(3, '0'); // 001, 002, 003 + let newName = baseName + padded; + + checkDuplicateTableFieldValue("clients", "short_name", newName, function(exists) { + if (exists) { + counter++; + tryNext(); + } else { + $("#client_short_name").val(newName); + validateInput(input, "clients", "short_name"); + } + }); + } + tryNext(); + } else { + $("#client_short_name").val(baseName); + validateInput(input, "clients", "short_name"); + } + }); + } + function validateInput(input, table, field){ let client_type = $('#client_type').val(); From aec914c9880f786a8adcbda2e126c20d148dddbc Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 15 Oct 2025 15:25:14 +0530 Subject: [PATCH 17/35] CHANGE_BDS_CHANGES : RV --- app/Controllers/ClientController.php | 8 +- app/Controllers/DashboardController.php | 15 +- app/Controllers/EmployeeController.php | 51 +- .../PolicyTransactionController.php | 111 +- app/Helpers/DepositHelper.php | 3 +- app/Models/ClientDepositModel.php | 3 +- app/Models/EmployeePolicyModel.php | 4 +- app/Models/PolicyTransactionModel.php | 22 +- app/Views/DashBoard.php | 6 +- .../policy_transaction_endorsement_form.php | 4959 +++++++++-------- .../policy_transaction_endorsement_list.php | 43 +- .../policy_transaction_inception_form.php | 373 +- .../policy_transaction_inception_list.php | 1 + writable/e_card_template/new_ecard.html | 271 + 14 files changed, 3216 insertions(+), 2654 deletions(-) create mode 100644 writable/e_card_template/new_ecard.html diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index b3ce68e4..e09c74ec 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -518,8 +518,8 @@ class ClientController extends AdminController public function updateEmpAndPolicyStatus() { - $return = $this->clientPolicyModel->updateStatus(); + return $return; $this->myLogger->logme('error', 'Client Policy Status Update Count: {data}', ['data' => $return['client']]); $this->myLogger->logme('error', 'Employee Policy Status Update Count: {data}', ['data' => $return['emp']]); } @@ -5066,10 +5066,12 @@ class ClientController extends AdminController ->where('policy_no', $policy_no) ->countAllResults(); + $client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('policy_status', 1)->where('policy_no', trim($policy_no))->first(); + if ($data > 0) { - return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data], 200); + return $this->respond(['status' => true, 'message' => 'This policy number is already linked to another client', 'data' => $data, 'code' => 409, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200); } else { - return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data], 200); + return $this->respond(['status' => false, 'message' => 'No Data Found', 'code' => 404, 'received_data' => $received_data, 'client_policy_id' => $client_policy_data['id'] ?? null], 200); } } diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index 73c2e31a..369f9444 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -225,20 +225,23 @@ class DashboardController extends AdminController $pendingActionsController = new PendingActionsController; $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard(); - $businessTeamData = $this->policyTransactionModel->getBusinessReportList(); - $financeTeamData = $this->policyTransactionModel->getFinanceReportList(); - $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData); - $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData); + //BDS dashboard data + // $businessTeamData = $this->policyTransactionModel->getBusinessReportList(); + // $financeTeamData = $this->policyTransactionModel->getFinanceReportList(); + // $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData); + // $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData); + $businessTeamData = []; + $financeTeamData = []; + $businessTeamStatusData = []; + $financeTeamStatusData = []; $data['client_branch_emp_list'] = $results; $session = \Config\Services::session(); $session->set('enrollment_data', json_encode($data)); - // echo "
    ";
                 $data['pendingActionsData'] = $pendingActionsData;
                 $data['businessTeamCount'] = count($businessTeamData) ?? 0;
    -            // dd($businessTeamData);
                 $data['financeTeamCount'] = count($financeTeamData) ?? 0;
                 $data['businessTeamStatusData'] = $businessTeamStatusData;
                 $data['financeTeamStatusData'] = $financeTeamStatusData;
    diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
    index a4666518..3bf6a341 100755
    --- a/app/Controllers/EmployeeController.php
    +++ b/app/Controllers/EmployeeController.php
    @@ -35,7 +35,7 @@ use App\Controllers\JobWorker;
     use App\Controllers\Jobs\SubJob;
     use App\Controllers\EmployeeServiceController;
     use App\Controllers\EmpDataServiceController;
    -
    +use App\Models\ThzMasterModel;
     use CodeIgniter\API\ResponseTrait;
     
     use PhpOffice\PhpSpreadsheet\Spreadsheet;
    @@ -1471,6 +1471,7 @@ class EmployeeController extends AdminController
                 $template_data_path = WRITEPATH . 'e_card_template/';
                 // $tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
                 $tpa_short_name = 'common.html';
    +            // $tpa_short_name = 'new_ecard.html';
                 $final_path = $template_data_path . $tpa_short_name;
             
                 $this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
    @@ -1523,10 +1524,12 @@ class EmployeeController extends AdminController
                         '{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
                         '{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
                         '{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
    +                    '{NHANCE_N_LOGO}' => base_url() . 'public/assets/images/Nhance_Favi.png',
                     ];
     
                     $placeholders['{LEVELS}'] = $this->generateAcmAndMForEcard($client_id);
    -        
    +                $placeholders['{NETWORK_HOSPITAL}'] = $this->generateNetworkHospitalsForEcard($value['network_hospitals']);
    +       
                     foreach ($placeholders as $placeholder => $replaceValue) {
                         $htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
                     }
    @@ -1534,13 +1537,23 @@ class EmployeeController extends AdminController
                     $html .= $htmlContent;
                 }
     
    +            // return $html;
                 // DomPdf 
                 $options = new Options();
                 $options->set('isRemoteEnabled', true);
                 $options->set('isHtml5ParserEnabled', true);
     
                 $dompdf = new Dompdf($options);
    -            $dompdf->loadHtml('' . $html); // remove the margin
    +            // $dompdf->loadHtml('' . $html); // remove the margin
    +            $dompdf->loadHtml('
    +                
    +                ' . $html
    +            );
    +
                 $dompdf->setPaper('A4', 'portrait');
                 $dompdf->render();
     
    @@ -2939,20 +2952,43 @@ class EmployeeController extends AdminController
         
             // Generate the HTML content
             $html = '';
    -    
    +        
    +        $level_index = 1;
             foreach ($levels as $level => $contacts) {
                 $displayLevel = $level == 3 ? 1 : 2; // Switch levels for display
    -            $html .= '
    Level ' . $displayLevel . '
    '; + if($level_index == 1){ + $html .= 'Level ' . $displayLevel . '
    '; + }else{ + $html .= '
    Level ' . $displayLevel . '
    '; + } foreach ($contacts as $index => $contact) { $html .= ($index + 1) . '. ' . $contact['first_name'] . ' / ' . $contact['mobile'] . ' / ' . $contact['email'] . '
    '; } + $level_index++; } - $html .= '


    '; + $html .= '
    '; return $html; } + public function generateNetworkHospitalsForEcard($network_hospitals) + { + $html = ""; + if (!empty($network_hospitals)) { + $html = '
    + Network Hospital: + ' . $network_hospitals . ' +
    '; + } + + // For debugging + // print_r($html); die; + + return $html; + } + + public function getBatchFileData() { $file_id = $this->request->getGet('file_id'); @@ -3065,7 +3101,8 @@ class EmployeeController extends AdminController } else { $text = "create"; $data['created_by'] = get_session_userid(); - $this->thzMasterModel->insert($data); + $thzMasterModel = new ThzMasterModel(); + $thzMasterModel->insert($data); $insertID = $this->partnerEndorsementRequestModel->insertID(); $result = true; } diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 65c7db4f..41499b5a 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -263,6 +263,7 @@ class PolicyTransactionController extends BaseController $data = $this->preparePolicyData(); $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); $data['issuer'] = 2; + $data['status'] = 'completed'; $this->myLogger->logme('error', 'Policy Trancaction modified form data ( insert data ) : '. json_encode($data)); @@ -278,7 +279,6 @@ class PolicyTransactionController extends BaseController $data = $this->request->getPost(); // print_r($data); die; - // var_dump($data); die; if (empty($data['policy_issue_date'])) { $data['policy_issue_date'] = null; @@ -306,7 +306,6 @@ class PolicyTransactionController extends BaseController $data['last_action_date'] = change_date_format($data['last_action_date']); } - // Separate Insurer and TPA Branch IDs and IDs if (isset($data['insurer_id']) && !empty($data['insurer_id'])) { list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']); @@ -375,6 +374,7 @@ class PolicyTransactionController extends BaseController $pt_co_share_details = $this->insertOrUpdateCoShareDetails($data, $insert); + $client_policy_id = null; if ($data['ct_type'] == 2) { $client_policy_insert_data = $this->prepareClientPolicyInsertData($data); $client_policy_id = $this->clientPolicyModel->insert($client_policy_insert_data); @@ -393,7 +393,6 @@ class PolicyTransactionController extends BaseController $clientController = new ClientController(); $data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']); $data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']); - $data['entity_type_id'] = $client_data['entity_type_id']; return $this->respondSuccess($insert, "Policy transaction created successfully", $data); @@ -434,20 +433,20 @@ class PolicyTransactionController extends BaseController } } - if($old_pt_data['status'] != "completed"){ - if ($data['status'] == 'completed' && $data['ct_type'] == 2) { - if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) { - $this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id'], $id); - } - } - } + // if($old_pt_data['status'] != "completed"){ + // if ($data['status'] == 'completed' && $data['ct_type'] == 2) { + // if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) { + // $this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id'], $id); + // } + // } + // } $data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll(); } if(isset($data['cd_amt_changed']) && !empty($data['cd_amt_changed'])){ $policy_data = $this->policyTransactionModel->where('is_active', 1)->where('id', $id)->first(); - $this->cdCorrection($policy_data, $data['cd_amt_changed']); + $this->cdCorrection($policy_data, $data['cd_amt_changed'], $id); } $client_data = $this->clientModel->where('id', $data['client_id'])->first(); @@ -469,10 +468,6 @@ class PolicyTransactionController extends BaseController { // Prepare data for insertion and updating $coShareDetails = []; - - // print_r($data); die; - // die; - if (isset($data['co_share_id']) && !empty($data['co_share_id'])) { $this->removePtCoShareRecords($data['co_share_id'], $pt_id); } @@ -566,7 +561,6 @@ class PolicyTransactionController extends BaseController } // print_r($this->PTCOShareDetailsModel->getLastQuery()); die; - // print_r($coShareDetails); // die; @@ -630,7 +624,8 @@ class PolicyTransactionController extends BaseController 'updated_by' => get_session_userid(), 'event_name' => 'inception', 'is_active' => 1, - 'cd_ac_pk' => $data['cd_ac_pk'] + 'cd_ac_pk' => $data['cd_ac_pk'], + 'pt_id' => $policyTranId ?? null, ]; $result = DepositHelper::saveDeposit($cdTransactionData, get_session_userid()); @@ -641,7 +636,7 @@ class PolicyTransactionController extends BaseController } } - private function cdCorrection($data, $amt) + private function cdCorrection($data, $amt, $policyTranId) { $totalAmount = (int)($amt ?? 0); $description = 'The following amount of Rs. ' . $totalAmount . '/- has been debited towards the difference arising from the change in the BDS base premium.'; @@ -659,7 +654,8 @@ class PolicyTransactionController extends BaseController 'updated_by' => get_session_userid(), 'event_name' => 'inception', 'is_active' => 1, - 'cd_ac_pk' => $data['cd_ac_pk'] + 'cd_ac_pk' => $data['cd_ac_pk'], + 'pt_id' => $policyTranId ?? null, ]; DepositHelper::saveDeposit($cdTransactionData, get_session_userid()); @@ -1039,13 +1035,22 @@ class PolicyTransactionController extends BaseController $data['is_active'] = 0; $policy_transaction_data = $this->policyTransactionModel->where('id', $id)->first(); if($policy_transaction_data['policy_type_id'] > 7 && $type == 0){ + $this->policyTransactionModel->where('id', $id)->set($data)->update(); $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); $this->clientPolicyModel->where('id', $policy_transaction_data['client_policy_id'])->set($data)->update(); $this->policyTransactionModel->where('client_policy_id', $policy_transaction_data['client_policy_id'])->set($data)->update(); + + $cd_transaction_model = new ClientDepositModel(); + $this->$cd_transaction_model->where('policy_transaction_id', $id)->set($data)->update(); + }else{ $this->policyTransactionModel->where('id', $id)->set($data)->update(); $this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update(); + + $cd_transaction_model = new ClientDepositModel(); + $this->$cd_transaction_model->where('policy_transaction_id', $id)->set($data)->update(); + } return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200); } else { @@ -1173,6 +1178,7 @@ class PolicyTransactionController extends BaseController { $id = $this->request->getPost('id'); $data = $this->preparePolicyTransactionData(); + $data['status'] = 'completed'; // print_r($data); die; if (!$id) { @@ -1340,9 +1346,9 @@ class PolicyTransactionController extends BaseController if ($update) { $this->insertTransactionStatus($id, $data, 1); - if($old_endorse_data['status'] != "completed"){ - $this->handleCompletedStatus($data, $id); - } + // if($old_endorse_data['status'] != "completed"){ + // $this->handleCompletedStatus($data, $id); + // } $this->insertOrUpdateCoShareDetails($data, $id); @@ -1358,30 +1364,33 @@ class PolicyTransactionController extends BaseController $tolamt = (int) $data['total'][0] ?? 0; - $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . - ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)'; - - $cd_tranction_data = [ - 'amount' => abs($tolamt), - 'sub_type_id' => $data['action_type'] == 'deletion' ? 3 : 4, - 'client_id' => $data['client_id'], - 'client_policy_id' => $data['client_policy_id'], - 'endorsement_no' => null, - 'cd_ac_no' => $data['cd_ac_no'] ?? null, - 'insurer_id' => $data['insurer_id'], - 'description' => $description, - 'transaction_type' => $data['action_type'] == 'deletion' ? 'Credit' : 'Debit', - 'updated_by' => get_session_userid(), - 'event_name' => $data['action_type'], - 'is_active' => 1, - 'cd_ac_pk' => $data['cd_ac_pk'] ?? null, - ]; + if(!empty($tolamt)){ + $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . + ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction (BDS)'; + + $cd_tranction_data = [ + 'amount' => abs($tolamt), + 'sub_type_id' => $data['action_type'] == 'deletion' ? 3 : 4, + 'client_id' => $data['client_id'], + 'client_policy_id' => $data['client_policy_id'], + 'endorsement_no' => null, + 'cd_ac_no' => $data['cd_ac_no'] ?? null, + 'insurer_id' => $data['insurer_id'], + 'description' => $description, + 'transaction_type' => $data['action_type'] == 'deletion' ? 'Credit' : 'Debit', + 'updated_by' => get_session_userid(), + 'event_name' => $data['action_type'], + 'is_active' => 1, + 'cd_ac_pk' => $data['cd_ac_pk'] ?? null, + 'pt_id' => $policy_tran_id ?? null, + ]; - $result = DepositHelper::saveDeposit($cd_tranction_data, get_session_userid()); + $result = DepositHelper::saveDeposit($cd_tranction_data, get_session_userid()); - if(isset($result['success']) && $result['success']){ - $update_data['ct_tran_id'] = $result['insert_id']; - $this->policyTransactionModel->where('id', $policy_tran_id)->set($update_data)->update(); + if(isset($result['success']) && $result['success']){ + $update_data['ct_tran_id'] = $result['insert_id']; + $this->policyTransactionModel->where('id', $policy_tran_id)->set($update_data)->update(); + } } } @@ -1411,13 +1420,13 @@ class PolicyTransactionController extends BaseController ->orderBy('id', 'asc') ->first(); - $pt_id = null; + $pt_id = null; + if(!empty($data)){ $inception_data = $this->policyTransactionModel->where('policy_no', $data['policy_no'])->where('client_id', $data['client_id'])->first(); $pt_id = $inception_data['id']; } - if (!empty($data['policy_start_date'])) { $data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y'); } @@ -1578,6 +1587,16 @@ class PolicyTransactionController extends BaseController // print_r($data['endorse_eff_date']); die; + $pt_bp_amt = $this->PTCOShareDetailsModel + ->select('bp_amt, amount') + ->where('pt_id', $id) + ->where('co_share_type', 1) + ->where('is_active', 1) + ->first(); + + // dd(db_connect()->getLastQuery() ,$pt_bp_amt); + $data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null; + if ($data) { return $this->respond(['status' => true, 'data' => $data, 'pt_id' => $pt_id], 200); } else { diff --git a/app/Helpers/DepositHelper.php b/app/Helpers/DepositHelper.php index 9549f8a1..495797f3 100755 --- a/app/Helpers/DepositHelper.php +++ b/app/Helpers/DepositHelper.php @@ -66,7 +66,8 @@ class DepositHelper 'updated_by' => $data['updated_by'], 'balance' => $newBalance, // Include the new balance in the data array 'cd_ac_pk'=> isset($data['cd_ac_pk'])?$data['cd_ac_pk']:null, - 'record_date' => $data['record_date'] ?? null + 'record_date' => $data['record_date'] ?? null, + 'policy_transaction_id' => $data['pt_id'] ?? null ]; // Insert data and get the insert ID diff --git a/app/Models/ClientDepositModel.php b/app/Models/ClientDepositModel.php index 9d45f38f..8a61b204 100755 --- a/app/Models/ClientDepositModel.php +++ b/app/Models/ClientDepositModel.php @@ -28,7 +28,8 @@ class ClientDepositModel extends Model "event_name", "unit", "cd_ac_pk", - "record_date" + "record_date", + "policy_transaction_id", ]; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 041ac791..bea76e50 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -1471,7 +1471,7 @@ class EmployeePolicyModel extends Model ep.tpa_id, ep.uhid, - ep.policy_end_date, + cp.policy_end_date, ep.basic_cover_si, clients.client_name, @@ -1537,7 +1537,7 @@ class EmployeePolicyModel extends Model ep.tpa_id, ep.uhid, - ep.policy_end_date, + cp.policy_end_date, ep.basic_cover_si, clients.client_name, diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 6ea94e65..2e935ead 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -305,7 +305,7 @@ class PolicyTransactionModel extends Model if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) { - $fromDate = date('Y-m-d', strtotime('-30 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -881,7 +881,7 @@ class PolicyTransactionModel extends Model if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) { - $fromDate = date('Y-m-d', strtotime('-60 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); if (empty($where)) { @@ -1060,7 +1060,7 @@ class PolicyTransactionModel extends Model // Default to Last 30 Days if No Filters Are Applied if (empty($client_id) && empty($insurer_id) && empty($policy_type_id) && empty($date_type) && empty($issuer) && empty($where)) { - $fromDate = date('Y-m-d', strtotime('-60 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1108,7 +1108,7 @@ class PolicyTransactionModel extends Model ->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left') ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left') ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') - ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') + ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') ->where('policy_transaction.is_active', 1) ->where('policy_transaction.action_type !=', 'inception'); @@ -1163,7 +1163,7 @@ class PolicyTransactionModel extends Model if ($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0) { - $fromDate = date('Y-m-d', strtotime('-60 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1313,7 +1313,7 @@ class PolicyTransactionModel extends Model ->where('policy_transaction.' . $date_type . '<=', $endDate); } else { - $fromDate = date('Y-m-d', strtotime('-30 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1416,7 +1416,7 @@ class PolicyTransactionModel extends Model ->where('policy_transaction.' . $date_type . '<=', $endDate); } else { - $fromDate = date('Y-m-d', strtotime('-30 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1457,7 +1457,7 @@ class PolicyTransactionModel extends Model public function getFinanceReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0) { - $dateThreshold = date('Y-m-d H:i:s', strtotime("- 3 days")); + $dateThreshold = date('Y-m-d H:i:s', strtotime("-90 days")); $builder = $this->db->table('policy_transaction') ->select(" @@ -1519,7 +1519,7 @@ class PolicyTransactionModel extends Model ->where('policy_transaction.' . $date_type . '<=', $endDate); } else { - $fromDate = date('Y-m-d', strtotime('-30 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1624,7 +1624,7 @@ class PolicyTransactionModel extends Model $builder->where('policy_transaction.' . $date_type . '>=', $startDate) ->where('policy_transaction.' . $date_type . '<=', $endDate); } else { - $fromDate = date('Y-m-d', strtotime('-30 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); $builder->where('policy_transaction.created_at >=', $fromDate) @@ -1712,7 +1712,7 @@ class PolicyTransactionModel extends Model //function for fetch renewal report data public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer = null) { - $fromDate = date('Y-m-d', strtotime('-60 days')); + $fromDate = date('Y-m-d', strtotime('-90 days')); $toDate = date('Y-m-d 23:59:59'); if (!empty($start_date) && !empty($end_date)) { diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php index ba72d495..e71d67ff 100755 --- a/app/Views/DashBoard.php +++ b/app/Views/DashBoard.php @@ -208,7 +208,7 @@ -