From ab420c7054ea02e68883acf4dd89a0c446cc1bdc Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 19 Nov 2025 11:01:31 +0530 Subject: [PATCH 01/71] FIX_CLAIM_STATUS --- app/Controllers/EmployeeRestController.php | 2 ++ app/Models/TicketMasterModel.php | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 733c2352..19563217 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3850,6 +3850,8 @@ class EmployeeRestController extends AdminController foreach ($client_claim_status as $claim_key => $claim_value) { if (in_array($value['claim_status_id'], $claim_value)) { // Corrected argument order $ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array + }else if(in_array($value['old_status_id'], $claim_value)){ + $ticket_data[$key]['claim_status'] = $claim_key ?? null; // Assign back to the main array } } diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 05196827..bf40409b 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -793,7 +793,26 @@ class TicketMasterModel extends Model //api public function get_ticket_data($emp_id, $returnType,$ticket_type = null, $ticket_id = null) { - $query = $this->select('ticket_master.*, tms.mail_subject as subject, tms.id as ticket_message_id') + $query = $this->select(" + + ticket_master.*, + tms.mail_subject as subject, + tms.id as ticket_message_id, + ( + SELECT th1.old_value + FROM ticket_history th1 + JOIN ticket_claim_status tcs ON th1.old_value = tcs.id + WHERE th1.field_name = 'claim_status_id' + AND th1.ticket_id = ticket_master.id + AND th1.id = ( + SELECT MAX(th2.id) + FROM ticket_history th2 + WHERE th2.ticket_id = th1.ticket_id + AND th2.field_name = 'claim_status_id' + ) + ) AS old_status_id + + ") ->join('ticket_messages tms', 'ticket_master.id = tms.ticket_id', 'left') ->where('ticket_master.is_active', 1); $query->whereIn('sender', ['staff', 'user']); From f9d6b761abbaf3b5859cc9088f08e48a707949df Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Wed, 19 Nov 2025 11:00:44 +0530 Subject: [PATCH 02/71] CHANGE_invoicePolicyMapping --- app/Config/Routes.php | 5 +- app/Controllers/PayoutController.php | 268 ++++- .../PolicyTransactionController.php | 14 - app/Models/InvoiceItemModel.php | 25 + app/Models/InvoiceModel.php | 55 +- app/Views/invoice_policy_mapping.php | 970 ++++++++++++++++++ app/Views/invoice_policy_mapping_add.php | 543 ++++++++++ app/Views/payout_list.php | 17 +- 8 files changed, 1873 insertions(+), 24 deletions(-) create mode 100644 app/Views/invoice_policy_mapping.php create mode 100755 app/Views/invoice_policy_mapping_add.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 634252a7..4f0580df 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -480,7 +480,6 @@ $routes->group("rfq", ["filter" => "authMVC"], function ($routes) { $routes->get("driveListFiles", "GoogleDriveController::listFiles"); $routes->post('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']); $routes->get('dmsSearch', 'PolicyTransactionController::dmsSearch', ['filter' => 'authMVC']); -$routes->get('payouts', 'PolicyTransactionController::payouts', ['filter' => 'authMVC']); $routes->get('downloadGdriveFile', 'GoogleDriveController::downloadGdriveFile', ['filter' => 'authMVC']); $routes->get('cli/sendZeptoMail', 'MasterController::testZeptoSMTP'); @@ -774,6 +773,10 @@ $routes->group('payout', function($routes) { $routes->post('fetchUtrDetails',"PayoutController::fetchUtrDetails"); $routes->post('saveUtrDetails',"PayoutController::saveUtrDetails"); $routes->post('removeUtrDetails',"PayoutController::removeUtrDetails"); + // invoice policy mapping + $routes->get('invoices', 'PayoutController::invoices'); + $routes->post('invoices/save', 'PayoutController::saveInvoice'); + $routes->get('invoices/history', 'PayoutController::auditHistory'); }); //PARTNER COMMISSION diff --git a/app/Controllers/PayoutController.php b/app/Controllers/PayoutController.php index 02bbe1b2..5c86ff39 100644 --- a/app/Controllers/PayoutController.php +++ b/app/Controllers/PayoutController.php @@ -9,6 +9,7 @@ use App\Models\InvoiceItemModel; use App\Models\InvoiceModel; use App\Models\InvoiceUtrModel; use App\Models\PolicyTransactionModel; +use App\Models\AuditHistoryModel; class PayoutController extends BaseController { @@ -20,21 +21,23 @@ class PayoutController extends BaseController protected $policyTransactionModel; protected $payout_status; + protected $auditHistory; + public function __construct() { set_session_context('PayoutController'); $this->myLogger = \Config\Services::mylogger(); $this->payout_status = [ - 1 => "Draft", - 2 => "Pending", - 3 => "Complete", + 1 => "Pending", + 2 => "Complete", ]; $this->invoiceItemModel = new InvoiceItemModel(); $this->invoiceModel = new InvoiceModel(); $this->invoiceUtrModel = new InvoiceUtrModel(); $this->policyTransactionModel = new PolicyTransactionModel(); + $this->auditHistory = new AuditHistoryModel(); } public function payoutList() @@ -189,4 +192,263 @@ class PayoutController extends BaseController } + /*************************************************************************************************************/ + //... Payout-invoice Mapping Commission's amount and Adjustment's Amount - Data Display + public function invoices() + { + + $type = $this->request->getGet('type'); + + $title = $type === 'add' ? 'Add Invoices' + : ($type === 'edit' ? 'Edit Invoices' + : ($type === 'adjustment' ? 'Adjustment Invoices' + : 'Invoices')); + + $data['tab_name'] = $title; + $data['page_name'] = $title; + + $id = $this->request->getGet('id'); + + + $data['agents'] = $this->invoiceModel->agentList(); // common both add and edit + // $data['checked_policy_numbers'] = []; + // $data['invoice'] = []; + // $data['extra_payouts'] = []; + + //... Now Seperated add => 'policy_transaction_payouts1' + //... Now Seperated edit and adjustment => 'policy_transaction_payouts' old file + //... Reason : Due Datatable issues Export button Searching like that so seperated + if ($type === 'add') { + $invoiceNo = $this->generateInvoiceNumber(); + $data['payouts'] = $this->invoiceModel->payoutList(1); + $data['invoice_number'] = $invoiceNo; + return $this->loadLayout('invoice_policy_mapping_add', $data); + } + + if (($type === 'edit' || $type === 'adjustment') && !empty($id)) { + + $invoice = $this->invoiceModel->where('id', $id)->first(); + $data['freeze_edit'] = $this->auditHistory->where('table_name', 'partner_invoice')->where('pk', $id)->countAllResults(); + + $agentId = $invoice['agent_id'] ?? null; + + $data['payouts'] = $this->invoiceModel->payoutList(2 ,$agentId,$id); + $data['extra_payouts'] = $agentId ? $this->invoiceModel->payoutList(3, $agentId) : []; + + $invoice_items = $this->invoiceItemModel->where('invoice_id', $id)->findAll(); + + if (!$invoice) { return redirect()->to('payout/invoices')->with('error', 'Invoice not found'); } + + $data['invoice'] = $invoice; + $data['invoice_items'] = $invoice_items; + // Initialize array for policy numbers + $data['checked_policy_numbers'] = array_column(array_filter($invoice_items, fn($ii) => isset($ii['is_active']) && $ii['is_active'] == 1),'policy_no'); + + $data['invoice_number']= $invoice['invoice_no']; + $data['type'] = $type; + + return $this->loadLayout('invoice_policy_mapping', $data); + + } + + + } + + //... Payout-invoice Mapping - Save/update/soft Delete/Hard Delete Data + public function saveInvoice() + { + $json = $this->request->getJSON(true); + + if (!$json) { + return $this->response->setJSON(['error' => 'Invalid JSON','message' => 'Invalid JSON received.'])->setStatusCode(400); + } + + $id = $json['invoice_id'] ?? null; + try { + + //... ADD Part + if (empty($id)) { + + $invoiceData = [ + 'invoice_no' => $json['invoice_no'], + 'agent_id' => $json['agent_id'], + 'invoice_date' => $json['invoice_date'], + 'invoice_amount' => $json['invoice_amount'], + 'payout_status' => 1 + ]; + + $invoiceId = $this->invoiceModel->insert($invoiceData); + + foreach ($json['policies'] as $p) { + $this->invoiceItemModel->insert([ + 'invoice_id' => $invoiceId, + 'policy_id' => $p['policy_id'], + 'policy_no' => $p['policy_no'], + 'commission_amount' => $p['commission_amount'], + 'is_active' => 1 + ]); + } + + $message = "Invoice created successfully.\nInvoice No: " . $json['invoice_no']; + + } + + // ... EDIT part + if (!empty($id)) { + + $invoiceId = $id; + + $invoiceData = [ + 'invoice_no' => $json['invoice_no'], + 'agent_id' => $json['agent_id'], + 'invoice_date' => $json['invoice_date'], + 'invoice_amount' => $json['invoice_amount'], + ]; + + $this->invoiceModel->update($invoiceId, $invoiceData); + + //... Fetch existing invoice item rows + $existingItems = $this->invoiceItemModel + ->where('invoice_id', $invoiceId) + ->findAll(); + + //... Create map by policy_no + $existingMap = []; + foreach ($existingItems as $item) { + $existingMap[$item['policy_no']] = $item; + } + + $newPolicyNos = []; + + //... Loop new JSON policies + foreach ($json['policies'] as $p) { + + $newPolicyNos[] = $p['policy_no']; + + if (isset($existingMap[$p['policy_no']])) { + + //... Update existing item + $this->invoiceItemModel + ->where('id', $existingMap[$p['policy_no']]['id']) + ->set([ + 'commission_amount' => $p['commission_amount'], + 'is_active' => 1 + ]) + ->update(); + + } else { + + //... Insert new item + $this->invoiceItemModel->insert([ + 'invoice_id' => $invoiceId, + 'policy_id' => $p['policy_id'], + 'policy_no' => $p['policy_no'], + 'commission_amount' => $p['commission_amount'], + 'is_active' => 1, + ]); + } + } + + //... Delete items removed in JSON (hard delete) + foreach ($existingItems as $old) { + if (!in_array($old['policy_no'], $newPolicyNos)) { + $this->invoiceItemModel + ->where('id', $old['id']) + ->delete(); + } + } + //... Delete items removed in JSON (soft delete REF : SVM ) + // foreach ($existingItems as $old) { + // if (!in_array($old['policy_no'], $newPolicyNos)) { + // $this->invoiceItemModel + // ->where('id', $old['id']) + // ->set(['is_active' => 0]) + // ->update(); + // } + // } + + $message = "Invoice updated successfully."; + + } + + return $this->response->setJSON([ + 'status' => 'success', + 'message' => $message, + 'invoice_id' => $invoiceId + ]); + + } catch (\Exception $e) { + + return $this->response->setJSON([ + 'status' => 'error', + 'message' => 'Unexpected error occurred: ' . $e->getMessage() + ]); + } + } + + + + + //... Payout-invoice Mapping - Invoice number is auto-generated only for the Add mode. + // Note: It will change each time the page is reloaded.. (REF:MGW) + private function generateInvoiceNumber() + { + $year = date('Y'); + $month = date('m'); + + do { + // random 3-digit number + $random = str_pad(rand(1, 999), 3, '0', STR_PAD_LEFT); + $invoiceNo = "INV{$year}{$month}{$random}"; + + // check main invoice table + $existsMain = $this->invoiceModel + ->where('invoice_no', $invoiceNo) + ->first(); + + // check partner invoice table + $existsPartner = $this->invoiceModel + ->where('invoice_no', $invoiceNo) + ->first(); + + } while ($existsMain || $existsPartner); // regenerate if duplicate found + + return $invoiceNo; + } + + //... Payout-invoice Mapping Audit History Based on "Adjustment" value (REF: KV,SVM) + public function auditHistory() + { + + + $iid = $this->request->getGet('id'); + + $details['invoice'] = $this->auditHistory + ->select('auditing_history.*,partner_invoice.invoice_no, user_profiles.first_name as created_name') + ->join('user_profiles', 'user_profiles.id = auditing_history.created_by', 'left') + ->join('partner_invoice', 'partner_invoice.id = auditing_history.pk', 'left') + ->where('auditing_history.table_name', 'partner_invoice') // ok + ->where('auditing_history.pk', $iid) + ->orderBy('auditing_history.created_at', 'desc') + ->get() + ->getResultArray(); + + $details['invoice_child'] = $this->auditHistory + ->select('auditing_history.*,partner_invoice.invoice_no, user_profiles.first_name as created_name') + ->join('user_profiles', 'user_profiles.id = auditing_history.created_by', 'left') + ->join('partner_invoice_items', 'partner_invoice_items.id = auditing_history.pk', 'left') + ->join('partner_invoice', 'partner_invoice.id = partner_invoice_items.invoice_id', 'left') + ->where('auditing_history.table_name', 'partner_invoice_items') // FIXED + ->where('partner_invoice.id', $iid) + ->orderBy('auditing_history.created_at', 'desc') + ->get() + ->getResultArray(); + + return $this->response->setJSON([ + 'status' => 'success', + 'data' => $details + ]); + + } + } diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 8d24f27b..a2f88d5f 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -2811,20 +2811,6 @@ $this->loadLayout('dms_search', $data); } - public function payouts() - { - - $data['tab_name'] = 'Payouts'; - $data['page_name'] = 'Payouts'; - $data['payouts'] = []; - $data['agents'] = [ 1 => "Agent 1", 2 => "Agent 2", 3 => "Agent 3", 4 => "Agent 4", 5 => "Agent 5", 6 => "Agent 6", 7 => "Agent 7", 8 => "Agent 8"]; - $data['brokers'] = []; - - if ($this->request->is('post')) {} - if ($this->request->is('get')) {} - - $this->loadLayout('policy_transaction_payouts', $data); - } //--------------------------------------------------------------------------------------------------- public function getCoShareStatementDetails($pt_id) diff --git a/app/Models/InvoiceItemModel.php b/app/Models/InvoiceItemModel.php index 328be1d9..2533dd0f 100644 --- a/app/Models/InvoiceItemModel.php +++ b/app/Models/InvoiceItemModel.php @@ -38,4 +38,29 @@ class InvoiceItemModel extends Model protected $validationMessages = []; protected $skipValidation = false; + + protected $beforeInsert = ["checkAndAddCreatedByValue"]; + protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"]; + + protected function checkAndAddCreatedByValue(array $data) + { + // Check if 'updated_by' value is null or empty + if (empty($data['data']['created_by'])) { + // Set 'updated_by' value to the current session user ID + $data['data']['created_by'] = get_session_userid(); + } + + return $data; + } + + protected function checkAndUpdateUpdatedByValue(array $data) + { + // Check if 'updated_by' value is null or empty + if (empty($data['data']['updated_by'])) { + // Set 'updated_by' value to the current session user ID + $data['data']['updated_by'] = get_session_userid(); + } + + return $data; + } } diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index 49d91ced..ea5fc4d3 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -29,7 +29,7 @@ class InvoiceModel extends Model protected $useTimestamps = false; protected $createdField = 'created_at'; protected $updatedField = 'updated_at'; - + // Validation (optional) protected $validationRules = [ 'invoice_no' => 'required|max_length[100]', @@ -187,4 +187,57 @@ class InvoiceModel extends Model return $data; } + + + public function payoutList($flag, $agentId = null, $invoiceId = null) + { + $builder = $this->db->table('policy_transaction pt') + ->select(' + pt.id, + pt.policy_no AS policyNo, + pt.agent_id AS agentId, + pp.insured_name AS customer, + pp.premium_amount AS premium, + pp.commission_amount AS commission, + pp.issued_date AS date_db, + DATE_FORMAT(pp.issued_date, "%d/%m/%Y") AS date, + pii.id AS invoiceItemId + ') + ->join('partner_policy pp','pt.policy_no = pp.policy_number AND pt.agent_id = pp.agent_id','left') + ->where('pt.is_active',1) + ->where('pt.agent_id IS NOT NULL', null, false); + + if ($flag == 1) { // Add mode + // EXCLUDE all policies that exist in partner_invoice_items + $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','left'); + $builder->where("pt.policy_no NOT IN (SELECT policy_no FROM partner_invoice_items)", null, false); + } + + if ($flag == 2) { // Edit mode + // Policies belonging to a specific invoice + $builder->select('pii.commission_amount as paid_amount'); + $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','inner'); // must exist + $builder->join('partner_invoice pi','pi.id = pii.invoice_id','inner'); // must exist + $builder->where('pii.is_active',1); + if ($invoiceId) { + $builder->where('pi.id', $invoiceId); // only policies of this invoice + } + if ($agentId) { + $builder->where('pt.agent_id', $agentId); + } + } + + if ($flag == 3) { // Extra policies + // Policies not assigned to any invoice + $builder->select('pii.commission_amount as paid_amount'); + $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','left'); + $builder->where('pii.id IS NULL', null, false); + if ($agentId) { + $builder->where('pt.agent_id', $agentId); + } + } + + return $builder->get()->getResultArray(); + } + } diff --git a/app/Views/invoice_policy_mapping.php b/app/Views/invoice_policy_mapping.php new file mode 100644 index 00000000..12d18e6b --- /dev/null +++ b/app/Views/invoice_policy_mapping.php @@ -0,0 +1,970 @@ + + +
+
+
+
+

+ + + + Invoice Details + + + +

+
+
+ +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ + +
+

+ Policy Selection + +

+
+ + +
+ + + + + + + + + + + + + + + + +
+ + +
+ + + +
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + +
Policy No
Customer
Premium
Policy Issues Date
Commission Amount
Paid Amount
+ + +
+
+
+ Selected Policies + 0 +
+ +
+ Total Commission + ₹0.00 +
+ + +
+ Total Paid Amount + ₹0.00 +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/app/Views/invoice_policy_mapping_add.php b/app/Views/invoice_policy_mapping_add.php new file mode 100755 index 00000000..43238c83 --- /dev/null +++ b/app/Views/invoice_policy_mapping_add.php @@ -0,0 +1,543 @@ + + + +
+
+
+
+

+ + + + Invoice Details + + + +

+
+
+ +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+

+ Policy Selection + +

+
+ +
+ + + + +
+ + + + + +
+ +
+ +
+
+
+ + + + + + + + + + + + + + +
Policy No
Customer
Premium
Policy Issues Date
Commission Amount
+
+ +
+
+
+ Selected Policies + 0 +
+ +
+ Total Commission + ₹0.00 +
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/payout_list.php b/app/Views/payout_list.php index df7d3c79..ff2a36f2 100644 --- a/app/Views/payout_list.php +++ b/app/Views/payout_list.php @@ -182,11 +182,18 @@
-
-
--> +
+
+ +
+
@@ -219,8 +226,8 @@ From 4121fee9aacbcea61f0508603e69bc1e33ff5f43 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 19 Nov 2025 14:18:53 +0530 Subject: [PATCH 03/71] FEAT_COND_COMMISION_UPLOAD_DEL_FLAG --- .../InsuranceCommissionController.php | 7 +++++-- app/Libraries/RuleImportService.php | 21 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/Controllers/InsuranceCommissionController.php b/app/Controllers/InsuranceCommissionController.php index 3798237a..f2907bf6 100644 --- a/app/Controllers/InsuranceCommissionController.php +++ b/app/Controllers/InsuranceCommissionController.php @@ -13,7 +13,7 @@ class InsuranceCommissionController extends AdminController public function __construct() { - set_session_context('Client'); + set_session_context('InsuranceCommissionController'); $this->myLogger = \Config\Services::mylogger(); // Load rules file if present in writable config path // $rulesPath = WRITEPATH . 'config/insurance_rules.json'; @@ -122,7 +122,10 @@ class InsuranceCommissionController extends AdminController // Normalise department keys to lowercase for consistent lookups $this->rules = []; foreach ($parsed as $dept => $rules) { - $this->rules[strtolower($dept)] = $rules; + if($rules['is_deleted'] === false) + { + $this->rules[strtolower($dept)] = $rules; + } } // print_r($this->rules);die(); diff --git a/app/Libraries/RuleImportService.php b/app/Libraries/RuleImportService.php index 3e471f57..a4169916 100644 --- a/app/Libraries/RuleImportService.php +++ b/app/Libraries/RuleImportService.php @@ -62,6 +62,7 @@ class RuleImportService protected array $expectedColumns; protected array $columnValidators; + protected array $incomingData; protected string $annotatedDir; protected string $department; protected string $uploadedCommissionFileID; @@ -148,7 +149,7 @@ class RuleImportService { // dd($params); $startTime = microtime(true); - + $this->incomingData = $params; try { $this->department = $params['department']; $this->uploadedCommissionFileID = $params['id']; @@ -898,13 +899,25 @@ class RuleImportService */ protected function convertRowToRule(array $rowData): array { + $temp_rule_id = $this->generateRuleId($rowData); + //rule_e07f52d4366a2_32_oct2025_3_com + + $conditions = $this->buildConditions($rowData); + $temp_rule_id .= '_'.$this->incomingData['id'].'_'. strtolower(date('MY')).'_'.(count($conditions)); + $calculation = $this->buildCalculation($rowData); + + + $temp_rule_id .= '_'.substr($calculation['type'], 0, 3); + $rule = [ - 'id' => $this->generateRuleId($rowData), + 'id' => $temp_rule_id, 'name' => $this->sanitize($rowData[self::COL_RULE_NAME] ?? ''), 'department' => $this->department, + 'is_deleted' => false, 'file_id' => $this->uploadedCommissionFileID, - 'conditions' => $this->buildConditions($rowData), - 'calculation' => $this->buildCalculation($rowData) + 'conditions' => $conditions, + 'calculation' => $calculation + ]; return $rule; From ddbffe3c55ed1badb212ae56c91a70877bc7b756 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Wed, 19 Nov 2025 16:01:33 +0530 Subject: [PATCH 04/71] FIX_Over all search bar, search icon and close icon merged. Need to fix this issue. --- app/Views/add_image_list.php | 9 ++--- app/Views/cd_master_list.php | 22 ++++++------ app/Views/client_deposit_list.php | 4 +-- app/Views/client_list.php | 4 +-- app/Views/client_policy.php | 28 +++++++++++++++ app/Views/dms_search.php | 16 ++++++++- app/Views/hr_activity_history.php | 14 ++++++-- app/Views/insurer_statement_list.php | 35 ++++++++++++++++--- .../policy_transaction_endorsement_list.php | 3 +- .../policy_transaction_inception_list.php | 3 +- app/Views/thz_list.php | 12 +++++-- app/Views/vehicle_master_list.php | 28 +++++++++------ app/Views/vehicle_type_master_list.php | 10 +++--- 13 files changed, 142 insertions(+), 46 deletions(-) diff --git a/app/Views/add_image_list.php b/app/Views/add_image_list.php index 46332236..c47c5880 100755 --- a/app/Views/add_image_list.php +++ b/app/Views/add_image_list.php @@ -36,9 +36,9 @@ table.dataTable thead th {
- - - + + + @@ -222,7 +222,8 @@ var table; $(document).ready(function() { table = $('#tickets-table').DataTable({ - dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, button right + // dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, button right + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [ diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index c0ff4584..c530a6bb 100755 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -17,6 +17,8 @@ table.dataTable thead th { max-width: 98% !important; } +.column-header {margin-right: 10px;} + .custom-dropdown-menu { display: none; position: absolute; @@ -70,15 +72,15 @@ table.dataTable thead th {
Advertisement Image NameStatusAction
Advertisement Image Name
Status
Action
- - - - - - - - - + + + + + + + + + @@ -215,7 +217,7 @@ table.dataTable thead th { $('#scroll-horizontal-datatable').DataTable({ scrollX: true, - dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + + dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [ diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php index c8be27ae..a86ffa11 100755 --- a/app/Views/client_deposit_list.php +++ b/app/Views/client_deposit_list.php @@ -103,9 +103,9 @@ $(document).ready(function() {
_INPUT_ + style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666;"> + style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666; display:none;">
`, searchPlaceholder: "Search", emptyTable: '
No Data found
' diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 1a2f21f4..473d75fe 100755 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -344,9 +344,9 @@ $(document).ready(function()
_INPUT_ + style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666;"> + style="position:absolute; right:11px; top:50%; transform:translateY(-53%); color:#666; display:none;">
`, searchPlaceholder: "Search", emptyTable: '
No Data found
' diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index cb197be9..a64e3fc3 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -560,6 +560,20 @@ input:checked + .slider_blue::before { searching: true, autoWidth: false, responsive: true, + language: { + search: ` +
+ _INPUT_ + + + +
+ `, + searchPlaceholder: "Search", + emptyTable: '
No Data found
' + }, }); @@ -2543,6 +2557,20 @@ $(document).ready(function () { searching: true, autoWidth: false, responsive: true, + // language: { + // search: ` + //
+ // _INPUT_ + // + + // + //
+ // `, + // searchPlaceholder: "Search", + // emptyTable: '
No Data found
' + // }, }); diff --git a/app/Views/dms_search.php b/app/Views/dms_search.php index 6bdd968a..1808ab8b 100644 --- a/app/Views/dms_search.php +++ b/app/Views/dms_search.php @@ -173,7 +173,7 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [{ @@ -197,6 +197,20 @@ }], paging: true, pageLength: 10, + language: { + search: ` +
+ _INPUT_ + + + +
+ `, + searchPlaceholder: "Search", + emptyTable: '
No Data found
' + }, order: [ [0, 'desc'] ] diff --git a/app/Views/hr_activity_history.php b/app/Views/hr_activity_history.php index 8f52d592..f069c886 100644 --- a/app/Views/hr_activity_history.php +++ b/app/Views/hr_activity_history.php @@ -102,8 +102,18 @@ $(document).ready(function () { "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", language: { - search: "_INPUT_", - searchPlaceholder: "Search..." + search: ` +
+ _INPUT_ + + + +
+ `, + searchPlaceholder: "Search", + emptyTable: '
No Data found
' }, paging: true, pageLength: 10, diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 197d19ed..b0c05935 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -164,6 +164,15 @@ margin-left: 5px; border-radius: 6px; } + th.no-sort { + pointer-events: none; /* disable click */ + } + + th.no-sort:before, + th.no-sort:after { + display: none !important; /* hide DataTables sorting arrows */ + } +
@@ -205,11 +214,12 @@
-
+
+
S.No Client Name Insurer Name Insurer Branch Name Opening Date CD Account No Opening Amount Date/User Action 
S.No 
Client Name 
Insurer Name 
Insurer Branch Name 
Opening Date 
CD Account No 
Opening Amount 
Date/User 
Action 
- + @@ -1734,9 +1744,24 @@ "order": [], // Disable initial sorting if needed "pageLength": 10, // "dom": '<"top"lf>rt<"bottom"ip><"clear">', // This places length and filter controls at top - "language": { - "lengthMenu": "Show _MENU_ entries", - "search": "Search:" + // "language": { + // "lengthMenu": "Show _MENU_ entries", + // "search": "Search:" + // } + language: { + lengthMenu: "Show _MENU_ entries", + search: ` +
+ _INPUT_ + + + +
+ `, + searchPlaceholder: "Search", + emptyTable: '
No Data found
' } }); diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php index 59963f43..49c3a18b 100644 --- a/app/Views/policy_transaction_endorsement_list.php +++ b/app/Views/policy_transaction_endorsement_list.php @@ -489,7 +489,8 @@ table.dataTable thead th { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, buttons right + // dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, buttons right + dom: "<'row'<'col-12 d-flex justify-content-between'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector buttons: [ diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 37640c11..6566b389 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -561,7 +561,8 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, buttons right + // dom: "<'row'<'col-12'f><'col-sm-11 text-right'B>>" + // Filter left, buttons right + dom: "<'row'<'col-12 d-flex justify-content-between'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector buttons: [ diff --git a/app/Views/thz_list.php b/app/Views/thz_list.php index 63c64862..56134fa3 100644 --- a/app/Views/thz_list.php +++ b/app/Views/thz_list.php @@ -43,7 +43,7 @@ table.dataTable tbody td {
-
Insurer
+
@@ -315,7 +315,7 @@ table.dataTable tbody td { // Datatable document ready $(document).ready(function() { - var ticketsTable = $('#tickets-table'); + var ticketsTable = $('#thz-table'); if (ticketsTable.length) { ticketsTable.DataTable({ @@ -349,7 +349,7 @@ table.dataTable tbody td { orthogonal: 'sort' }, className: 'app-btn-primary ', - title: 'Tickets' + title: 'Tickets', sheetName: 'Tickets', } ] @@ -374,6 +374,12 @@ table.dataTable tbody td { } else { console.error("Table not found."); } + + $(document).on('click', '.datatable-clear-icon', function () { + const input = $(this).closest('.datatable-search-wrapper').find('input'); + input.val('').trigger('input'); + $('#thz-table').DataTable().search('').draw(); + }); }); diff --git a/app/Views/vehicle_master_list.php b/app/Views/vehicle_master_list.php index 2e54f852..b101c09c 100644 --- a/app/Views/vehicle_master_list.php +++ b/app/Views/vehicle_master_list.php @@ -15,6 +15,7 @@ table.dataTable tbody td { .col-12 { max-width: 98% !important; } +.column-header {margin-right: 10px;} .readonly-select { pointer-events: none; @@ -74,14 +75,14 @@ table.dataTable tbody td {
- - - - - - - - + + + + + + + + @@ -465,9 +466,11 @@ $(document).ready(function() { $(document).ready(function() { - $('#scroll-horizontal-datatable').DataTable({ + var ticketsTable = $('#scroll-horizontal-datatable'); + if (ticketsTable.length) { + ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" + + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", buttons: [ @@ -524,7 +527,10 @@ $(document).ready(function() { paging: true, pageLength: 10, order: [[0, 'desc']] - }); + }); + } else { + console.error("Table atet found."); + } }); function getEditVehicleDetailsData(input) { diff --git a/app/Views/vehicle_type_master_list.php b/app/Views/vehicle_type_master_list.php index fd6d0801..9cdcdb7d 100755 --- a/app/Views/vehicle_type_master_list.php +++ b/app/Views/vehicle_type_master_list.php @@ -2,6 +2,7 @@ .dataTables_filter { position: absolute; } +.column-header {margin-right: 10px;} @@ -12,10 +13,10 @@
S.No Owner Type Owner Name RC Book No Vehicle No Vehicle type Description Action 
S.No 
Owner Type 
Owner Name 
RC Book No 
Vehicle No 
Vehicle type 
Description 
Action 
- - + + - + @@ -94,7 +95,8 @@ var ticketsTable = $('#user-table'); ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right + // dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector buttons: [ From 0e1ccfe8ad4a1c8bb269436b5e928a2fa8099124 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Wed, 19 Nov 2025 16:18:00 +0530 Subject: [PATCH 05/71] FIX_Minor correction for sub-heading for the modal "Fetch employee data" under claims module --- app/Views/ticket_form_handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/ticket_form_handler.php b/app/Views/ticket_form_handler.php index 2478280b..149a9150 100644 --- a/app/Views/ticket_form_handler.php +++ b/app/Views/ticket_form_handler.php @@ -69,7 +69,7 @@

- Search by Mobile Number + Search by Employee ID / Mobile Number

From e6d9d073bd69b56479e33c32a1f14c797a60b2cb Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 19 Nov 2025 17:08:52 +0530 Subject: [PATCH 06/71] FEAT_COND_COMMISSION_FILE_UPLOAD_JSON_STRUCTURE_CHANGE --- app/Config/Routes.php | 1 + app/Controllers/RuleImportController.php | 37 ++++++++++++++++++++---- app/Libraries/RuleImportService.php | 6 +++- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4f0580df..f4413409 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -787,5 +787,6 @@ $routes->group('commission', function($routes) { $routes->get('downloadErrorFile',"RuleImportController::downloadErrorFile"); $routes->get("deleteCommissionData/(:any)", "RuleImportController::deleteCommissionData/$1"); $routes->get('checkSameEntry',"RuleImportController::checkSameEntry"); + $routes->get('checkRuleUsage',"RuleImportController::checkRuleUsage"); }); diff --git a/app/Controllers/RuleImportController.php b/app/Controllers/RuleImportController.php index f5579aac..09d01c5a 100644 --- a/app/Controllers/RuleImportController.php +++ b/app/Controllers/RuleImportController.php @@ -4,6 +4,9 @@ namespace App\Controllers; use CodeIgniter\API\ResponseTrait; use App\Models\CommissionFilesModel; use App\Models\InsurerModel; +use App\Models\PartnerPolicyModel; + + class RuleImportController extends AdminController { @@ -13,6 +16,7 @@ class RuleImportController extends AdminController protected $commissionFilesModel; protected $departments; protected $insurerModel; + protected $partnerPolicyModel; public function __construct() { @@ -20,7 +24,7 @@ class RuleImportController extends AdminController $this->myLogger = \Config\Services::mylogger(); $this->ruleImportService = \Config\Services::ruleImportService(); - + $this->partnerPolicyModel = new partnerPolicyModel(); $this->commissionFilesModel = new CommissionFilesModel(); $this->insurerModel = new InsurerModel(); $this->departments = [ @@ -194,6 +198,8 @@ class RuleImportController extends AdminController 'insurer_id' => (int)$insurerId, 'department' => $department, 'commission_month' => $commissionMonth, + 'created_by' => (int)$createdBy, + ]; $this->myLogger->logme('info', 'RuleImportController::upload - Calling ruleImportService->processUpload', ['payload' => $payload]); @@ -262,10 +268,22 @@ class RuleImportController extends AdminController // handle existing JSON file based on $override (bool) if (file_exists($jsonPath)) { if ($overwrite) { - // delete existing file before writing (deterministic overwrite) - if (!@unlink($jsonPath)) { - $this->myLogger->logme('warning', 'RuleImportController::upload - Failed to delete existing JSON before overwrite', ['json_path' => $jsonPath]); - // proceed to overwrite anyway by writing to the same path + // rename existing file before overwrite + if (file_exists($jsonPath)) { + + $backupPath = $jsonPath . '.' . date('YmdHis') . '.bak'; + + if (!@rename($jsonPath, $backupPath)) { + $this->myLogger->logme( + 'warning', + 'RuleImportController::upload - Failed to rename existing JSON before overwrite', + [ + 'json_path' => $jsonPath, + 'backup_path' => $backupPath + ] + ); + // continue anyway; writing to same path will overwrite + } } $finalJson = $jsonData; } else { @@ -641,5 +659,14 @@ class RuleImportController extends AdminController } } + public function checkRuleUsage() + { + $rule_id = $this->request->getGet('rule_id'); + + $count = $this->partnerPolicyModel->where('commission_applied_rule', $ruleName) + ->countAllResults(); + return $this->respond(['status' => true, 'code' => 200, 'count' => $count, 'message' => ""], 200); + } + } diff --git a/app/Libraries/RuleImportService.php b/app/Libraries/RuleImportService.php index a4169916..ff0f5fe5 100644 --- a/app/Libraries/RuleImportService.php +++ b/app/Libraries/RuleImportService.php @@ -916,7 +916,11 @@ class RuleImportService 'is_deleted' => false, 'file_id' => $this->uploadedCommissionFileID, 'conditions' => $conditions, - 'calculation' => $calculation + 'calculation' => $calculation, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + 'created_by' => $this->incomingData['created_by'], + 'updated_by' => $this->incomingData['created_by'], ]; From 1c75413b64b308bf48f0807c2259cd6724659593 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Wed, 19 Nov 2025 18:39:10 +0530 Subject: [PATCH 07/71] FIX_Mail Fixes --- app/Controllers/NotificationController.php | 74 +++++++++++++++++----- app/Helpers/MailHelper.php | 2 +- app/Views/notification.php | 23 ++----- 3 files changed, 64 insertions(+), 35 deletions(-) diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index ee50a0fd..98067fa9 100755 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -258,7 +258,7 @@ class NotificationController extends AdminController $template_id = $this->request->getPost('template_id'); - $test_mail = $this->request->getPost('test_mail'); + // $test_mail = $this->request->getPost('test_mail'); $test_mail_list = $this->request->getPost('test_mail_list'); @@ -268,27 +268,67 @@ class NotificationController extends AdminController if(!empty($notification_data)){ - $params = [ - 'client_data' => $client_data, - 'notification_data' => $notification_data, - 'test_mail' => $test_mail, - 'test_mail_list' => $test_mail_list - ]; + // First Index as test mail all are testmaillist + // $params = [ + // 'client_data' => $client_data, + // 'notification_data' => $notification_data, + // 'test_mail' => $test_mail, + // 'test_mail_list' => $test_mail_list + // ]; + // $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); + // if (!empty($testMailData)) { + // $mail_send_return1 = MailHelper::send_email($testMailData); + // $this->myLogger->logme("info", $mail_send_return1); + // $this->myLogger->logme("info", $mail_send_return1); + // return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); + // }else{ + // return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); + // } - $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); - // print_r($testMailData); die; - if (!empty($testMailData)) { - $mail_send_return1 = MailHelper::send_email($testMailData); - $this->myLogger->logme("info", $mail_send_return1); - $this->myLogger->logme("info", $mail_send_return1); + $mailArray = explode(',', $test_mail_list); + $successMails = []; + $failedMails = []; - return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]); + foreach ($mailArray as $singleMail) { + $singleMail = trim($singleMail); - }else{ + $params = [ + 'client_data' => $client_data, + 'notification_data' => $notification_data, + 'test_mail' => $singleMail, + 'test_mail_list' => "" // optional + ]; + + $testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params); + + if (!empty($testMailData)) { + $mail_send_return1 = MailHelper::send_email($testMailData); + + if ($mail_send_return1) { + $successMails[] = $singleMail; + } else { + $failedMails[] = $singleMail; + } + + $this->myLogger->logme("info", "Mail attempt to {$singleMail}: " . $mail_send_return1); + } else { + $failedMails[] = $singleMail; + $this->myLogger->logme("info", "Test Mail Data Does Not Exist for {$singleMail}"); + } + } + + // Prepare final response + if (!empty($successMails)) { + $responseMessage = "Count " . count($successMails) . " mail(s) sent successfully: \n" . implode("\n", $successMails); + if (!empty($failedMails)) { + $responseMessage .= "\nCount " . count($failedMails) . " mail(s) failed: \n" . implode("\n", $failedMails); + } + return $this->respond(['status' => true,'code' => 200,'message' => $responseMessage]); + } else { + return $this->respond(['status' => false,'code' => 200,'message' => 'All mails failed to send: ' . implode(", ", $failedMails)]); + } - return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']); - } }else{ return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']); diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index 89e90262..6c16ca8a 100755 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -318,7 +318,7 @@ class MailHelper $attachments = isset($params['attachments']) ? $params['attachments'] : []; $common = isset($params['common']) ? $params['common'] : ''; $bcc = isset($params['bcc']) ? $params['bcc'] : ''; - $cc = isset($params['cc']) ? $params['cc'] : ''; + $cc = (isset($params['cc']) && !empty($params['cc'])) ? $params['cc'] : ''; $from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail'); // $from_address = "claims@nhanceindia.in"; diff --git a/app/Views/notification.php b/app/Views/notification.php index b36d3845..553c8329 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -1368,7 +1368,7 @@ let test_mail_list = $('#common_mail').val(); - let test_mail = test_mail_list.split(',')[0] ?? ''; + let test_mail = test_mail_list.split(',')[0] ?? ''; //REF:SVM if (test_mail !== null || test_mail !== "") { @@ -1400,30 +1400,19 @@ type: "POST", data:{ template_id, - test_mail, - test_mail_list + test_mail_list, }, dataType: 'json', success: function(res) { - - console.log('Test mail send function response', res) + console.log('Test mail send function response', res); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - if (res.status == true) { - - let respond = res.respond; - console.log('Parsed respond', respond) - - if (respond.status == 'success') { - toastr.success(respond.message, 'SUCCESS') - } else { - toastr.warning(respond.message, 'WARNING') - } - + if (res.status === true) { + toastr.success(res.message, 'SUCCESS'); } else { - toastr.warning('Failed to sent mail', 'WARNING') + toastr.warning('Failed to send mail', 'WARNING'); } }, error: function(xhr, status, error) { From 5030acac1b657f8549cf4bc837df2c930369f208 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 20 Nov 2025 10:24:25 +0530 Subject: [PATCH 08/71] FIX_Minor Label Fixes --- app/Views/ticket_type_modal.php | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/app/Views/ticket_type_modal.php b/app/Views/ticket_type_modal.php index 4a4728b1..6120833d 100644 --- a/app/Views/ticket_type_modal.php +++ b/app/Views/ticket_type_modal.php @@ -1,3 +1,54 @@ + +
S.No.Vehicle Type
S.No.
Vehicle Type
Action
Action
@@ -269,6 +257,13 @@ "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector buttons: [ + { + text: 'Add', + className: 'btn app-btn-primary mr-2', // custom class + action: function(e, dt, node, config) { + addInvoiceButton(); + } + }, { extend: 'collection', text: ' Export ', @@ -361,4 +356,8 @@ }); } + function addInvoiceButton(){ + window.location.href='' + } + \ No newline at end of file From f1fc1926e91b9a83919df15fc50dece069544413 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Thu, 20 Nov 2025 18:31:18 +0530 Subject: [PATCH 16/71] FIX_datatable show range and payouts fixes --- app/Config/Routes.php | 2 + app/Controllers/PayoutController.php | 112 ++++++++++++------ app/Models/InvoiceModel.php | 30 +++-- app/Views/UserList.php | 8 +- app/Views/add_image_list.php | 5 +- app/Views/batch_list.php | 10 +- app/Views/bds_multi_report.php | 8 +- app/Views/bds_renewal_report_list.php | 6 +- app/Views/bds_report_Insurer_wise_Data.php | 8 +- app/Views/bds_report_bap_wise_data.php | 8 +- app/Views/bds_tat_wise_report.php | 10 +- app/Views/business_team_list.php | 8 +- app/Views/cd_master_list.php | 10 +- app/Views/claim_dump_file_list.php | 8 +- app/Views/claim_files_upload.php | 4 +- app/Views/claims_report_acc_manager_wise.php | 8 +- app/Views/claims_report_tpa_wise.php | 8 +- app/Views/client_deposit_list.php | 3 + app/Views/client_list.php | 9 +- app/Views/commission_file_upload.php | 10 +- app/Views/dms_search.php | 8 +- app/Views/drive_file_upload.php | 2 +- app/Views/employee_data_list.php | 8 +- app/Views/endorsement_list.php | 6 +- app/Views/file_list.php | 10 +- app/Views/finance_team_list.php | 10 +- app/Views/hr_activity_history.php | 6 +- app/Views/hr_file_upload.php | 6 +- app/Views/insurer_list.php | 8 +- app/Views/invoice_policy_mapping.php | 60 +++++----- app/Views/invoice_policy_mapping_add.php | 92 +++++++++++--- app/Views/irda_bap_client_report_list.php | 6 +- app/Views/irda_bap_insurer_report_list.php | 10 +- app/Views/irda_client_report_list.php | 10 +- app/Views/kyc_list.php | 10 +- app/Views/leads_list.php | 8 +- app/Views/nhance_branch_list.php | 6 +- app/Views/notification.php | 14 ++- app/Views/outstanding_report_list.php | 8 +- app/Views/payout_list.php | 58 ++++++--- app/Views/payout_utr_details.php | 2 +- .../policy_transaction_endorsement_list.php | 8 +- .../policy_transaction_inception_list.php | 8 +- app/Views/policy_type_list.php | 10 +- app/Views/report_bds.php | 10 +- app/Views/report_bds_new.php | 10 +- app/Views/report_bds_old.php | 6 +- app/Views/retail_endorsement_list.php | 10 +- app/Views/rto_master_list.php | 6 +- app/Views/tat_report_band_wise_list.php | 10 +- app/Views/test_members_list.php | 8 +- app/Views/thz_list.php | 8 +- app/Views/ticket_feedback_list.php | 10 +- app/Views/ticket_history.php | 10 +- app/Views/ticket_list.php | 10 +- app/Views/ticket_mail_template.php | 8 +- app/Views/tpa_list.php | 8 +- app/Views/variance_report_list.php | 8 +- app/Views/vehicle_docs.php | 2 +- app/Views/vehicle_master_list.php | 10 +- app/Views/vehicle_type_list.php | 8 +- app/Views/vehicle_type_master_list.php | 5 +- app/Views/view_deposit.php | 10 +- 63 files changed, 573 insertions(+), 233 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index d2a077fd..fe088694 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -777,6 +777,8 @@ $routes->group('payout', function($routes) { $routes->get('invoices', 'PayoutController::invoices'); $routes->post('invoices/save', 'PayoutController::saveInvoice'); $routes->get('invoices/history', 'PayoutController::auditHistory'); + $routes->get('invoice/generate-number/(:num)', 'PayoutController::generateInvoiceNumberAjax/$1'); + }); //PARTNER COMMISSION diff --git a/app/Controllers/PayoutController.php b/app/Controllers/PayoutController.php index 5c86ff39..e2479e42 100644 --- a/app/Controllers/PayoutController.php +++ b/app/Controllers/PayoutController.php @@ -30,7 +30,7 @@ class PayoutController extends BaseController $this->payout_status = [ 1 => "Pending", - 2 => "Complete", + 2 => "Completed", ]; $this->invoiceItemModel = new InvoiceItemModel(); @@ -84,7 +84,7 @@ class PayoutController extends BaseController // for list $data['payout_status'] = $this->payout_status; $data['agent_list'] = $this->invoiceModel->agentList(); - $data['page_name'] = "Payout"; + $data['page_name'] = "Invoices"; $payout_data['payout_list_data'] = $this->invoiceModel->invoiceList(); $data['payout_list'] = view('payout_list', $payout_data); @@ -199,10 +199,10 @@ class PayoutController extends BaseController $type = $this->request->getGet('type'); - $title = $type === 'add' ? 'Add Invoices' - : ($type === 'edit' ? 'Edit Invoices' - : ($type === 'adjustment' ? 'Adjustment Invoices' - : 'Invoices')); + $title = $type === 'add' ? 'Add Payouts' + : ($type === 'edit' ? 'Edit Payouts' + : ($type === 'adjustment' ? 'Payouts Adjustment' + : 'Payouts')); $data['tab_name'] = $title; $data['page_name'] = $title; @@ -219,9 +219,9 @@ class PayoutController extends BaseController //... Now Seperated edit and adjustment => 'policy_transaction_payouts' old file //... Reason : Due Datatable issues Export button Searching like that so seperated if ($type === 'add') { - $invoiceNo = $this->generateInvoiceNumber(); + // $invoiceNo = $this->generateInvoiceNumber(); $data['payouts'] = $this->invoiceModel->payoutList(1); - $data['invoice_number'] = $invoiceNo; + // $data['invoice_number'] = $invoiceNo; return $this->loadLayout('invoice_policy_mapping_add', $data); } @@ -229,6 +229,7 @@ class PayoutController extends BaseController $invoice = $this->invoiceModel->where('id', $id)->first(); $data['freeze_edit'] = $this->auditHistory->where('table_name', 'partner_invoice')->where('pk', $id)->countAllResults(); + $agentId = $invoice['agent_id'] ?? null; @@ -246,6 +247,7 @@ class PayoutController extends BaseController $data['invoice_number']= $invoice['invoice_no']; $data['type'] = $type; + $data['payout_status'] = $invoice['payout_status'] ; return $this->loadLayout('invoice_policy_mapping', $data); @@ -268,9 +270,18 @@ class PayoutController extends BaseController //... ADD Part if (empty($id)) { + $exists = $this->invoiceModel + ->where('invoice_no', $json['invoice_no']) + ->first(); + + if ($exists) { + $InvNum = $this->generateInvoiceNumber($json['agent_id']); + } else { + $InvNum = $json['invoice_no']; + } $invoiceData = [ - 'invoice_no' => $json['invoice_no'], + 'invoice_no' => $InvNum, 'agent_id' => $json['agent_id'], 'invoice_date' => $json['invoice_date'], 'invoice_amount' => $json['invoice_amount'], @@ -387,34 +398,69 @@ class PayoutController extends BaseController } - - + //... Payout-invoice Mapping - Invoice number is auto-generated only for the Add mode. - // Note: It will change each time the page is reloaded.. (REF:MGW) - private function generateInvoiceNumber() + // Note New Pattern : INV/AG001/20251101/xx (REF:SVM) + public function generateInvoiceNumberAjax($agentId) { - $year = date('Y'); - $month = date('m'); + if (!$agentId) { + return $this->response->setJSON([ + 'status' => 'error', + 'message' => 'Agent ID missing' + ]); + } - do { - // random 3-digit number - $random = str_pad(rand(1, 999), 3, '0', STR_PAD_LEFT); - $invoiceNo = "INV{$year}{$month}{$random}"; + $invoiceNo = $this->generateInvoiceNumber($agentId); - // check main invoice table - $existsMain = $this->invoiceModel - ->where('invoice_no', $invoiceNo) - ->first(); - - // check partner invoice table - $existsPartner = $this->invoiceModel - ->where('invoice_no', $invoiceNo) - ->first(); - - } while ($existsMain || $existsPartner); // regenerate if duplicate found - - return $invoiceNo; + return $this->response->setJSON([ + 'status' => 'success', + 'invoice_no' => $invoiceNo + ]); } + + //... Payout-invoice Mapping - Invoice number is auto-generated only for the Add mode. + // Note New Pattern : INV/AG001/20251101/xx (REF:SVM) + private function generateInvoiceNumber($agentId) + { + $agent = $this->invoiceModel->agentListById($agentId); + $agentCode = $agent["agent_code"]; + + $today = date("Ymd"); + $likePattern = "INV/$agentCode/$today/%"; + + $count = $this->invoiceModel + ->like("invoice_no", $likePattern) + ->countAllResults(); + + $nextNumber = $count + 1; + + return "INV/$agentCode/$today/$nextNumber"; + } + + // private function generateInvoiceNumber() + // { + // $year = date('Y'); + // $month = date('m'); + + // do { + // // random 3-digit number + // $random = str_pad(rand(1, 999), 3, '0', STR_PAD_LEFT); + // $invoiceNo = "INV{$year}{$month}{$random}"; + + // // check main invoice table + // $existsMain = $this->invoiceModel + // ->where('invoice_no', $invoiceNo) + // ->first(); + + // // check partner invoice table + // $existsPartner = $this->invoiceModel + // ->where('invoice_no', $invoiceNo) + // ->first(); + + // } while ($existsMain || $existsPartner); // regenerate if duplicate found + + // return $invoiceNo; + // } //... Payout-invoice Mapping Audit History Based on "Adjustment" value (REF: KV,SVM) public function auditHistory() @@ -434,7 +480,7 @@ class PayoutController extends BaseController ->getResultArray(); $details['invoice_child'] = $this->auditHistory - ->select('auditing_history.*,partner_invoice.invoice_no, user_profiles.first_name as created_name') + ->select('auditing_history.*,partner_invoice.invoice_no, user_profiles.first_name as created_name,partner_invoice_items.policy_no') ->join('user_profiles', 'user_profiles.id = auditing_history.created_by', 'left') ->join('partner_invoice_items', 'partner_invoice_items.id = auditing_history.pk', 'left') ->join('partner_invoice', 'partner_invoice.id = partner_invoice_items.invoice_id', 'left') diff --git a/app/Models/InvoiceModel.php b/app/Models/InvoiceModel.php index ea5fc4d3..d1c312f4 100644 --- a/app/Models/InvoiceModel.php +++ b/app/Models/InvoiceModel.php @@ -101,7 +101,7 @@ class InvoiceModel extends Model -- Payout status CASE WHEN payout_status = 1 THEN 'Pending' - WHEN payout_status = 2 THEN 'Complete' + WHEN payout_status = 2 THEN 'Completed' END AS status_text, partner_agent.name as agent_name @@ -175,7 +175,7 @@ class InvoiceModel extends Model -- Payout status CASE WHEN payout_status = 1 THEN 'Pending' - WHEN payout_status = 2 THEN 'Complete' + WHEN payout_status = 2 THEN 'Completed' END AS status_text, partner_agent.name as agent_name @@ -198,26 +198,26 @@ class InvoiceModel extends Model pt.agent_id AS agentId, pp.insured_name AS customer, pp.premium_amount AS premium, - pp.commission_amount AS commission, + COALESCE(pii.commission_amount, pp.commission_amount) AS commission, pp.issued_date AS date_db, DATE_FORMAT(pp.issued_date, "%d/%m/%Y") AS date, - pii.id AS invoiceItemId + pii.id AS invoiceItemId, + pii.commission_amount as paid_amount, + pi.payout_status ') + ->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','left') + ->join('partner_invoice pi','pi.id = pii.invoice_id','left') ->join('partner_policy pp','pt.policy_no = pp.policy_number AND pt.agent_id = pp.agent_id','left') ->where('pt.is_active',1) ->where('pt.agent_id IS NOT NULL', null, false); if ($flag == 1) { // Add mode - // EXCLUDE all policies that exist in partner_invoice_items - $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','left'); + // EXCLUDE all policies that exist in partner_invoice_items $builder->where("pt.policy_no NOT IN (SELECT policy_no FROM partner_invoice_items)", null, false); } if ($flag == 2) { // Edit mode // Policies belonging to a specific invoice - $builder->select('pii.commission_amount as paid_amount'); - $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','inner'); // must exist - $builder->join('partner_invoice pi','pi.id = pii.invoice_id','inner'); // must exist $builder->where('pii.is_active',1); if ($invoiceId) { $builder->where('pi.id', $invoiceId); // only policies of this invoice @@ -229,8 +229,6 @@ class InvoiceModel extends Model if ($flag == 3) { // Extra policies // Policies not assigned to any invoice - $builder->select('pii.commission_amount as paid_amount'); - $builder->join('partner_invoice_items pii','pii.policy_no = pt.policy_no','left'); $builder->where('pii.id IS NULL', null, false); if ($agentId) { $builder->where('pt.agent_id', $agentId); @@ -240,4 +238,14 @@ class InvoiceModel extends Model return $builder->get()->getResultArray(); } + public function agentListById($agentId) + { + return $this->db->table('partner_agent') + ->where('id', $agentId) + ->where('is_active', 1) + ->get() + ->getRowArray(); + } + + } diff --git a/app/Views/UserList.php b/app/Views/UserList.php index d0dca952..a991670d 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -858,9 +858,13 @@ table.dataTable tbody td { table = $('#user-table').DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-3'f><'col-sm-9'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-sm-3'f><'col-sm-9'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ // { // extend: 'collection', diff --git a/app/Views/add_image_list.php b/app/Views/add_image_list.php index c47c5880..034923f6 100755 --- a/app/Views/add_image_list.php +++ b/app/Views/add_image_list.php @@ -223,9 +223,12 @@ var table; $(document).ready(function() { table = $('#tickets-table').DataTable({ // dom: "<'row'<'col-sm-1'f><'col-sm-11 text-right'B>>" + // Filter left, button right + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: ' Add', diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php index 6600162f..7e66110d 100755 --- a/app/Views/batch_list.php +++ b/app/Views/batch_list.php @@ -224,9 +224,9 @@ $(document).ready(function() { $('#datatable-buttons').DataTable({ - dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", // buttons: [{ // extend: 'csv', // text: 'CSV', @@ -239,6 +239,10 @@ // left: "50px" // }); // }, + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [{ extend: 'collection', text: ' Export ', diff --git a/app/Views/bds_multi_report.php b/app/Views/bds_multi_report.php index 33fa456a..69d3b787 100644 --- a/app/Views/bds_multi_report.php +++ b/app/Views/bds_multi_report.php @@ -89,9 +89,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/bds_renewal_report_list.php b/app/Views/bds_renewal_report_list.php index c11290a7..d1dd8c17 100644 --- a/app/Views/bds_renewal_report_list.php +++ b/app/Views/bds_renewal_report_list.php @@ -117,9 +117,13 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-2'f><'col-sm-10 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 dom: "<'row'<'col-sm-2'f><'col-sm-10 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 + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/bds_report_Insurer_wise_Data.php b/app/Views/bds_report_Insurer_wise_Data.php index d020fb8c..a6e6e2a9 100644 --- a/app/Views/bds_report_Insurer_wise_Data.php +++ b/app/Views/bds_report_Insurer_wise_Data.php @@ -74,9 +74,13 @@ table.dataTable tbody td { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/bds_report_bap_wise_data.php b/app/Views/bds_report_bap_wise_data.php index 928ad3a4..8a5b467a 100644 --- a/app/Views/bds_report_bap_wise_data.php +++ b/app/Views/bds_report_bap_wise_data.php @@ -76,9 +76,13 @@ table.dataTable tbody td { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/bds_tat_wise_report.php b/app/Views/bds_tat_wise_report.php index c47cc259..41f85f71 100644 --- a/app/Views/bds_tat_wise_report.php +++ b/app/Views/bds_tat_wise_report.php @@ -91,9 +91,9 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + // dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", // buttons: [ // { // extend: 'csv', @@ -107,6 +107,10 @@ // }, // ], + dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/business_team_list.php b/app/Views/business_team_list.php index 3aeb2ed0..c00fcd6e 100644 --- a/app/Views/business_team_list.php +++ b/app/Views/business_team_list.php @@ -338,9 +338,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index c530a6bb..30c20b60 100755 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -217,9 +217,13 @@ table.dataTable thead th { $('#scroll-horizontal-datatable').DataTable({ scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + // dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", + dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: ' Add ', diff --git a/app/Views/claim_dump_file_list.php b/app/Views/claim_dump_file_list.php index 70282d89..a2f27a80 100644 --- a/app/Views/claim_dump_file_list.php +++ b/app/Views/claim_dump_file_list.php @@ -284,9 +284,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-7'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 dom: "<'row'<'col-sm-7'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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: 'Add', diff --git a/app/Views/claim_files_upload.php b/app/Views/claim_files_upload.php index 31888578..80eccfa0 100644 --- a/app/Views/claim_files_upload.php +++ b/app/Views/claim_files_upload.php @@ -56,7 +56,7 @@
- + @@ -266,7 +266,7 @@ function create_url_list(data) { let base_url = ""; - if (data && data.length > 0) { + if (data && data.length > 0) { let html = ""; data.forEach((item, index) => { diff --git a/app/Views/claims_report_acc_manager_wise.php b/app/Views/claims_report_acc_manager_wise.php index 177fe93f..066514d9 100644 --- a/app/Views/claims_report_acc_manager_wise.php +++ b/app/Views/claims_report_acc_manager_wise.php @@ -84,9 +84,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/claims_report_tpa_wise.php b/app/Views/claims_report_tpa_wise.php index fbf5daa5..55711b3e 100644 --- a/app/Views/claims_report_tpa_wise.php +++ b/app/Views/claims_report_tpa_wise.php @@ -82,9 +82,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php index a86ffa11..10aa6c74 100755 --- a/app/Views/client_deposit_list.php +++ b/app/Views/client_deposit_list.php @@ -71,6 +71,9 @@ $(document).ready(function() { $('#tickets-table').DataTable({ // dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 473d75fe..0df5b975 100755 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -298,10 +298,13 @@ var table; $(document).ready(function() { table = $('#tickets-table').DataTable({ + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", - + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: 'Add From Lead', diff --git a/app/Views/commission_file_upload.php b/app/Views/commission_file_upload.php index 71ecd86f..4bec2202 100644 --- a/app/Views/commission_file_upload.php +++ b/app/Views/commission_file_upload.php @@ -372,12 +372,14 @@ $(document).ready(function() { table = $('#tickets-table').DataTable({ scrollX: true, + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", - - buttons: [ - { + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], + buttons: [{ text: 'Upload ', className: 'btn app-btn-primary mr-2', // custom class action: function(e, dt, node, config) { diff --git a/app/Views/dms_search.php b/app/Views/dms_search.php index 1808ab8b..d09d3062 100644 --- a/app/Views/dms_search.php +++ b/app/Views/dms_search.php @@ -173,9 +173,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [{ extend: 'collection', text: ' Export ', diff --git a/app/Views/drive_file_upload.php b/app/Views/drive_file_upload.php index db20f6d4..96a4fc79 100644 --- a/app/Views/drive_file_upload.php +++ b/app/Views/drive_file_upload.php @@ -49,7 +49,7 @@
S.No S.No  Docs Name  File Name  Action 
- + diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 4b594084..f01ca1dc 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -341,9 +341,13 @@ if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/endorsement_list.php b/app/Views/endorsement_list.php index 8512e000..8eb95ddd 100755 --- a/app/Views/endorsement_list.php +++ b/app/Views/endorsement_list.php @@ -594,9 +594,13 @@ $(document).ready(function() { $('#tickets-table').DataTable({ + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [{ text: ' Add ', className: 'btn app-btn-primary mr-2', diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 52fb1940..aec37e3e 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -461,12 +461,16 @@ $(document).ready(function() { $('#tickets-table').DataTable({ - dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", + dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [{ extend: 'collection', text: ' Export ', diff --git a/app/Views/finance_team_list.php b/app/Views/finance_team_list.php index 6e6d2016..70855a6e 100644 --- a/app/Views/finance_team_list.php +++ b/app/Views/finance_team_list.php @@ -336,10 +336,14 @@ $(document).ready(function () { if (ticketsTable.length) { ticketsTable.DataTable({ - dom: - "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right + // dom: + // "<'row'<'col-sm-6'f><'col-sm-6 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 + dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/hr_activity_history.php b/app/Views/hr_activity_history.php index f069c886..4ecfdd28 100644 --- a/app/Views/hr_activity_history.php +++ b/app/Views/hr_activity_history.php @@ -98,9 +98,13 @@ $(document).ready(function () { var table = ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], language: { search: `
diff --git a/app/Views/hr_file_upload.php b/app/Views/hr_file_upload.php index 9d5cf1e5..4fe317a2 100644 --- a/app/Views/hr_file_upload.php +++ b/app/Views/hr_file_upload.php @@ -356,9 +356,13 @@ // for datatable $(document).ready(function() { $('#hr_tickets_table').DataTable({ + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [{ extend: 'collection', text: ' Export ', diff --git a/app/Views/insurer_list.php b/app/Views/insurer_list.php index bf145a61..977455a5 100755 --- a/app/Views/insurer_list.php +++ b/app/Views/insurer_list.php @@ -182,9 +182,13 @@ $(document).ready(function() { $('#tickets-table').DataTable({ + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>", dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: ' Add ', diff --git a/app/Views/invoice_policy_mapping.php b/app/Views/invoice_policy_mapping.php index 12d18e6b..870bcd66 100644 --- a/app/Views/invoice_policy_mapping.php +++ b/app/Views/invoice_policy_mapping.php @@ -136,12 +136,12 @@ table.dataTable tbody td { padding: 4px 4px !important; }
- +
@@ -198,14 +198,19 @@ table.dataTable tbody td { padding: 4px 4px !important; } function getEl(id) { return document.getElementById(id); } $(document).ready(function(){ - $('#agentSelect').select2 && $('#agentSelect').select2(); - const today = new Date().toISOString().split("T")[0]; + + // Initialize Select2 + if ($('#agentSelect').select2) $('#agentSelect').select2(); - if (getEl('agentSelect')) getEl('agentSelect').value = ""; - if (getEl('invoiceNo')) getEl('invoiceNo').value = ""; + // Clear fields without triggering change + $("#invoiceNo").val(""); + $("#agentSelect").val(""); // do NOT trigger change + + // Set max dates for date fields + const today = new Date().toISOString().split("T")[0]; if (getEl('invoiceDate')) getEl('invoiceDate').max = today; - if (getEl('invoiceDate')) getEl('invoiceDate').valueAsDate = new Date(); if (getEl('policyTillDate')) getEl('policyTillDate').max = today; + if (getEl('invoiceDate')) getEl('invoiceDate').valueAsDate = new Date(); if (getEl('policyTillDate')) getEl('policyTillDate').valueAsDate = new Date(); // Initial empty DataTable so buttons/search are available even before loading policies @@ -214,14 +219,12 @@ table.dataTable tbody td { padding: 4px 4px !important; } } - - - $('#tickets-table').DataTable({ dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', @@ -339,7 +342,8 @@ table.dataTable tbody td { padding: 4px 4px !important; } dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', @@ -471,13 +475,13 @@ table.dataTable tbody td { padding: 4px 4px !important; } // Reset filters (keeps agent selection; clear others) function resetFilters() { - ['fromDate','toDate','from_date','to_date','policyTillDate'].forEach(id => { - const el = getEl(id); - if (el) el.value = ''; + // Keep agent selected + ['fromDate','toDate','from_date','to_date'].forEach(id => { + if (getEl(id)) getEl(id).value = ''; }); - loadPolicies(); } + // Save invoice (AJAX) function saveInvoice() { const agentId = getEl('agentSelect')?.value || ''; @@ -536,8 +540,58 @@ table.dataTable tbody td { padding: 4px 4px !important; } let day = String(d.getDate()).padStart(2, '0'); let month = String(d.getMonth() + 1).padStart(2, '0'); let year = d.getFullYear(); - return `Invoice Policies List ${day}-${month}-${year}`; + return `Payouts (${day}-${month}-${year})`; } + function generateInvoiceNumberAjaxCall() { + let agentId = $("#agentSelect").val(); + + if (!agentId) { + $("#invoiceNo").val(""); + toastr.error("Please Select The Agent"); + return; + } + + $.ajax({ + url: "/" + agentId, + method: "GET", + dataType: "json", + success: function (res) { + if (res.status === "success") { + $("#invoiceNo").val(res.invoice_no); + } else { + toastr.error(res.message); + } + }, + error: function () { + toastr.error("Error generating invoice number"); + } + }); + } + // function searchPolicies() { + // filterPolicies(); + // } + // function filterPolicies() { + // const fromDate = document.getElementById('fromDate').value; + // const toDate = document.getElementById('toDate').value; + + // const agentId = document.getElementById('agentSelect').value; + // const policyTillDate = document.getElementById('policyTillDate').value; + + // if (!agentId) { + // alert('Please select an agent first'); + // return; + // } + + // filteredPolicies = allPolicies.filter(p => { + // if (p.agentId != agentId) return false; + // if (policyTillDate && p.date_db > policyTillDate) return false; + // if (fromDate && p.date_db < fromDate) return false; + // if (toDate && p.date_db > toDate) return false; + // return true; + // }); + + // loadPolicies(); + // } \ No newline at end of file diff --git a/app/Views/irda_bap_client_report_list.php b/app/Views/irda_bap_client_report_list.php index 78f89695..213423bf 100644 --- a/app/Views/irda_bap_client_report_list.php +++ b/app/Views/irda_bap_client_report_list.php @@ -206,9 +206,13 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/irda_bap_insurer_report_list.php b/app/Views/irda_bap_insurer_report_list.php index b57a2912..5b2f2ad9 100644 --- a/app/Views/irda_bap_insurer_report_list.php +++ b/app/Views/irda_bap_insurer_report_list.php @@ -239,9 +239,9 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 // buttons: [{ // extend: 'csv', // text: 'CSV', @@ -295,6 +295,10 @@ $(document).ready(function() { // } // ], + dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/irda_client_report_list.php b/app/Views/irda_client_report_list.php index 09df1196..aca84738 100644 --- a/app/Views/irda_client_report_list.php +++ b/app/Views/irda_client_report_list.php @@ -75,9 +75,9 @@ $(document).ready(function() { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, - dom: "<'row'<'col-sm-6'f><'col-sm-6 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 + // dom: "<'row'<'col-sm-6'f><'col-sm-6 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 // buttons: [{ // extend: 'csv', // text: 'CSV', @@ -131,6 +131,10 @@ $(document).ready(function() { // } // ], + dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { extend: 'collection', diff --git a/app/Views/kyc_list.php b/app/Views/kyc_list.php index 2e346371..54ca556f 100755 --- a/app/Views/kyc_list.php +++ b/app/Views/kyc_list.php @@ -176,11 +176,13 @@ $('#tickets-table').DataTable({ + // dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + + // "<'row'<'col-sm-12'tr>>" + + // "<'row'<'col-sm-5'i><'col-sm-7'p>>" , dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>" , - - + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: ' Add ', diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 8075471d..0ab3ab13 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -458,9 +458,13 @@ table.dataTable tbody td { if (ticketsTable.length) { ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-7'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 dom: "<'row'<'col-sm-7'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 + "<'row'<'col-sm-12'tr>>" + + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: 'Add', diff --git a/app/Views/nhance_branch_list.php b/app/Views/nhance_branch_list.php index 32c7c09c..3f8b2941 100644 --- a/app/Views/nhance_branch_list.php +++ b/app/Views/nhance_branch_list.php @@ -94,9 +94,13 @@ var ticketsTable = $('#user-table'); ticketsTable.DataTable({ scrollX: true, + // dom: "<'row'<'col-sm-7'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 dom: "<'row'<'col-sm-7'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 + "<'row'<'col-sm-5'i><'col-sm-3 text-center'l><'col-sm-4 text-end'p>>", + lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]], buttons: [ { text: 'Add', diff --git a/app/Views/notification.php b/app/Views/notification.php index 553c8329..956e9dc0 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -342,7 +342,7 @@ - +
+
S.No S.No  Docs Name  File Name  Action 
@@ -446,8 +447,7 @@
- - + - + + + - +
- +
- +
From 7884681d47568933b59af54105ea56682c6c9523 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 25 Nov 2025 14:55:48 +0530 Subject: [PATCH 28/71] FIX_THE_FAMILY_FLOATERS_ISSUE --- app/Controllers/ClientController.php | 1 + app/Controllers/EmployeeServiceController.php | 9 ++- app/Helpers/excel_util_helper.php | 69 ++++++++++++------- 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 0c6566f1..fcf5c373 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -5689,6 +5689,7 @@ class ClientController extends AdminController $empServiceController = new EmployeeServiceController(); // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']); // $res = $empServiceController->excelFileDataValidation(['file_id' => '865']); + // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]); // $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]); // $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]); // $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]); diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index cc5a3e86..b765eb52 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1387,13 +1387,16 @@ class EmployeeServiceController extends AdminController $family = array_merge($family,$existing_famility_details); $family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array // dd($family); - // $self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self')); - // $premium = (int)($self['temp']['rata_premimum'] ?? 0); - // foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium; + $self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self')); + $premium = (int)($self['temp']['rata_premimum'] ?? 0); + foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium; } // Kint::dump($family); $data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units); + if($file['action'] == 'dependent_addition') { + $data = validatet_family_floter_rata_premium($data); + } // dd($data); $employee_data_group_by_family[$emp_id] = $data; $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]); diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index f371120c..f48f7ce0 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -50,7 +50,6 @@ if (!function_exists('check_columns_name')) { } } - if (!function_exists('check_row_is_empty_or_null')) { function check_row_is_empty_or_null($arr) @@ -89,7 +88,6 @@ if (!function_exists('check_excel_date_format')) { } } - if (!function_exists('check_relationship')) { function check_relationship($row, $relationship, $policy_terms) { @@ -132,7 +130,6 @@ if (!function_exists('check_relationship')) { } } - if (!function_exists('check_doj')) { function check_doj($row) @@ -179,7 +176,6 @@ if (!function_exists('check_doc')) { } } - if (!function_exists('check_employee_band')) { function check_employee_band($row, $policy_terms, $slab_details) { @@ -218,7 +214,6 @@ if (!function_exists('check_employee_band')) { } } - if (!function_exists('check_si')) { function check_si($row, $policy_details, $slab_details) { @@ -326,7 +321,6 @@ if (!function_exists('check_basic_pay')) { } } - if (!function_exists('check_dob_diff')) { function check_dob_diff($row, $relationships, $default_age_ratio, $policy_details) { @@ -464,8 +458,6 @@ if (!function_exists('check_self_available_in_family')) { } } - - if (!function_exists('name_and_empid_check_in_db')) { function name_and_empid_check_in_db($family_data, $actionArr) { @@ -955,7 +947,6 @@ if (!function_exists('calculate_premium_new')) { } } - if (!function_exists('transform_excel_data_to_db')) { function transform_excel_data_to_db($memArr, $actionArr) { @@ -1022,16 +1013,15 @@ if (!function_exists('transform_excel_data_to_db')) { $result['temp']['rata_premimum'] = isset($memArr['temp']['rata_premimum']) ? $memArr['temp']['rata_premimum'] : 0; $result['policy_details'] = $policy; - // if(isset($memArr['self_rata_premium'])){ - // $result['self_rata_premium'] = $memArr['self_rata_premium'] ?? 0; - // } + if(isset($memArr['self_rata_premium'])){ + $result['self_rata_premium'] = $memArr['self_rata_premium'] ?? 0; + } return $result; } } } - if (!function_exists('premium_calculation_manager_old')) { function premium_calculation_manager_old($emp_data, $policy_terms, $slab_details, $default_si = null) { @@ -1844,14 +1834,13 @@ if (!function_exists('premium_calculation_manager')) { $emp_data['policy_details']['basic_cover_si'] = 0; $emp_data['policy_details']['premium'] = 0; - // if(isset($emp_data['self_rata_premium']) && !empty($emp_data['self_rata_premium'])){ - // $self_rata_premium = (int)($emp_data['self_rata_premium'] ?? 0); - // $dependent_rata_premium = (int)($emp_data['policy_details']['rata_premimum'] ?? 0); - // $actual_rata_premium = abs($dependent_rata_premium - $self_rata_premium); - // $emp_data['policy_details']['rata_premimum'] = $actual_rata_premium; - // $emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst / 100)), 2, '.', ''); - // } - + if(isset($emp_data['self_rata_premium']) && !empty($emp_data['self_rata_premium'])){ + $self_rata_premium = (int)($emp_data['self_rata_premium'] ?? 0); + $dependent_rata_premium = (int)($emp_data['policy_details']['rata_premimum'] ?? 0); + $actual_rata_premium = abs($dependent_rata_premium - $self_rata_premium); + $emp_data['policy_details']['rata_premimum'] = $actual_rata_premium; + $emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst / 100)), 2, '.', ''); + } }else if(strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 1 && ($emp_data['temp']['action'] == 'I' || $emp_data['temp']['action'] == 'A' || $emp_data['temp']['action'] == 'MI')){ @@ -1867,7 +1856,6 @@ if (!function_exists('premium_calculation_manager')) { } } - if (!function_exists('calculate_pro_rata_premimum')) { function calculate_pro_rata_premimum($premium, $employee_policy_coverage_days, $policy_coverage_days) { @@ -1990,7 +1978,6 @@ if (!function_exists('get_emp_policy_records_from_audit_history')) { } } - if (!function_exists('replace_original_data')) { function replace_original_data(array $original_data, array $current_data) { @@ -2062,7 +2049,6 @@ if (!function_exists('remap_default_age_ratio_into_relationship')) { } } - if (!function_exists('check_dup_mobileno')) { function check_dup_mobileno(array $row, array $existing_mobilenos) { @@ -2192,7 +2178,6 @@ if (!function_exists('convert_string_to_date')) { } } - if (!function_exists('transform_enrollment_row_to_inception_row')) { function transform_enrollment_row_to_inception_row($row) { @@ -2428,7 +2413,6 @@ if (!function_exists('check_unit')) { } } - if (!function_exists('transform_si_excel_row_to_calculatable_format')) { function transform_si_excel_row_to_calculatable_format(array $employee, array $employee_policy, array $maxage_and_maxcount, array $slab_details, string $applicable_slab_name, string $augmented_si, array $grid_master) { @@ -2888,3 +2872,36 @@ if (!function_exists('is_valid_or_empty_email')) { } } +if (!function_exists('validatet_family_floter_rata_premium')) { + function validatet_family_floter_rata_premium($family){ + + if (count($family) === 2) { + return $family; // skip if only two members + } + + $dependentRataGiven = false; + + foreach ($family as &$row) { + + // Skip if the member is self + if (strtolower($row['relationship']) == 'self') { + continue; + } + + // For dependents + if (isset($row['temp']['premium_type']) && $row['temp']['premium_type'] == 1) { + + if (!$dependentRataGiven) { + // First eligible dependent keeps premium + $dependentRataGiven = true; + } else { + $row['policy_details']['rata_premimum'] = 0; + $row['policy_details']['gst'] = 0; + } + + } + } + + return $family; + } +} From 6aafc8ae91a6f999d5dfea9d47264738286efcb4 Mon Sep 17 00:00:00 2001 From: velz Date: Tue, 25 Nov 2025 15:02:47 +0530 Subject: [PATCH 29/71] FIX_OPTIONS_ROUTE_ADDED_4_CORS --- app/Config/Routes.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2e8d6fb3..96252c3f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -3,6 +3,13 @@ use CodeIgniter\Router\RouteCollection; + +// Allow OPTIONS for all routes +$routes->options('(:any)', function() { + // This will never be called because the CORS filter returns early + // But having this route ensures OPTIONS isn't rejected as 404 +}); + /** * @var RouteCollection $routes */ From 3586c856ee43e3fee755ec3eedcfcc6e184ae310 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 25 Nov 2025 15:14:02 +0530 Subject: [PATCH 30/71] FIX_CLAIM_CONVERSATION_TEXT_REMOVE_HTML_TAGS --- app/Controllers/TicketController.php | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 18018d3c..87620e51 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -26,6 +26,7 @@ use App\Models\VehicleModel; use App\Models\PartnerPolicyModel; use DOMDocument; +use DOMXPath; use Psr\Log\LoggerInterface; use Kint\Kint; @@ -1313,7 +1314,7 @@ class TicketController extends BaseController } } - public function convertHtmlToText($html) + public function convertHtmlToTextOld($html) { if(!empty($html)){ $dom = new DOMDocument(); @@ -1324,6 +1325,36 @@ class TicketController extends BaseController } } + public function convertHtmlToText($html) + { + if (empty($html)) { + return ''; + } + + // Remove BOM / strange characters + $html = preg_replace('/[\x00-\x1F\x80-\xFF]/', ' ', $html); + + // Load HTML safely + $dom = new DOMDocument(); + libxml_use_internal_errors(true); + $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); + + // Remove style and script tags + $xpath = new DOMXPath($dom); + foreach ($xpath->query('//style|//script') as $node) { + $node->parentNode->removeChild($node); + } + + // Extract clean text + $text = $dom->textContent; + + // Clean extra spaces + $text = preg_replace('/\s+/', ' ', $text); + + return trim($text); + } + + public function removeTicket() { $ticket_id = $this->request->getGet('ticket_id'); From dcf6612ab480bd6ca17ad94d0edb1db37ad9e2c8 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 25 Nov 2025 15:44:13 +0530 Subject: [PATCH 31/71] FIX_Missing mandatory symbol for the claim number --- app/Views/ticket_form_gmc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 02f9dfb6..f59eab7b 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -333,7 +333,7 @@