From 214b63fc2880003020e876919810b532b29b19f4 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 17 Jul 2025 15:22:29 +0530 Subject: [PATCH 1/7] CHANGE_BDS_MINOR_CRS : RV --- .../PolicyTransactionController.php | 29 +++++++++++-------- app/Models/PolicyTransactionModel.php | 19 ++++++++---- app/Models/VehicleModel.php | 4 ++- .../policy_transaction_inception_form.php | 27 ++++++++++++++--- .../policy_transaction_inception_list.php | 7 ++--- app/Views/report_bds.php | 5 +++- app/Views/report_bds_filter.php | 21 ++++++++++++++ app/Views/vehicle_master_list.php | 2 +- 8 files changed, 86 insertions(+), 28 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 9a275f79..3d9ee4f6 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -134,16 +134,17 @@ class PolicyTransactionController extends BaseController 'send' => 'Sent', 'recived' => 'Payment Received', ]; - $data['vehicle_type'] = [ - 'two_wheeler' => 'Two Wheeler', - 'four_wheeler' => 'Four Wheeler', - 'truck' => 'Truck', - 'bus' => 'Bus', - 'van' => 'Van', - 'suv' => 'SUV', - 'motorcycle' => 'Motorcycle', - 'bicycle' => 'Bicycle' - ]; + // $data['vehicle_type'] = [ + // 'two_wheeler' => 'Two Wheeler', + // 'four_wheeler' => 'Four Wheeler', + // 'truck' => 'Truck', + // 'bus' => 'Bus', + // 'van' => 'Van', + // 'suv' => 'SUV', + // 'motorcycle' => 'Motorcycle', + // 'bicycle' => 'Bicycle' + // ]; + $data['vehicle_type'] = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray(); $data['vehicle_des'] = [ 'commercial' => 'Commercial', 'private' => 'Private', @@ -1810,6 +1811,8 @@ class PolicyTransactionController extends BaseController $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll(); $data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll(); $data['clients'] = $this->clientModel->where('is_active', 1)->findAll(); + $data['users'] = $this->userModel->where('is_active', 1)->findAll(); + $data['policy_count'] = $this->policyTransactionModel->where('is_active', 1)->countAllResults(); //filter datas @@ -1823,6 +1826,7 @@ class PolicyTransactionController extends BaseController $client_branch_id = $this->request->getGet('client_branch_id'); $insurer_branch_id = $this->request->getGet('insurer_branch_id'); $client_policy_id = $this->request->getGet('client_policy_id'); + $user_id = $this->request->getGet('user_id'); if ($date_type == 'statement_month') { $start_date = (string)date('Y-m-01', strtotime($start_date)); @@ -1842,6 +1846,7 @@ class PolicyTransactionController extends BaseController $client_branch_id = (!isset($client_branch_id) || $client_branch_id === '' || $client_branch_id === null) ? 0 : $client_branch_id; $insurer_branch_id = (!isset($insurer_branch_id) || $insurer_branch_id === '' || $insurer_branch_id === null) ? 0 : $insurer_branch_id; $client_policy_id = (!isset($client_policy_id) || $client_policy_id === '' || $client_policy_id === null) ? 0 : $client_policy_id; + $user_id = (!isset($user_id) || $user_id === '' || $user_id === null) ? 0 : $user_id; if ($this->request->is('post')) { $isFromDashboard = $this->request->getPost("is_dashboard"); @@ -1860,8 +1865,8 @@ class PolicyTransactionController extends BaseController // dd($ids); } //Actual data for the list - $data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id, isset($where) ? $where : ''); - //!dd($data['report_list']); + $data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id, $user_id, isset($where) ? $where : ''); + // dd($data); $this->loadLayout('report_bds_filter', $data); } diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index ec355e34..49170213 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -592,7 +592,7 @@ class PolicyTransactionModel extends Model // return $result; // } - public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $where = []) + public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $user_id = 0, $where = []) { $date_condition = ''; @@ -764,7 +764,8 @@ class PolicyTransactionModel extends Model ) ), 2 - ) AS unbilled_amt + ) AS unbilled_amt, + created_user.first_name as user_name ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') @@ -781,6 +782,7 @@ class PolicyTransactionModel extends Model ->join('tpa_branch', 'policy_transaction.tpa_branch_id = tpa_branch.id', 'left') ->join('user_profiles AS sales_user', 'policy_transaction.sales_generated_by = sales_user.id', 'left') ->join('user_profiles AS service_user', 'policy_transaction.serviced_by = service_user.id', 'left') + ->join('user_profiles AS created_user', 'policy_transaction.created_by = created_user.id', 'left') ->where('policy_transaction.is_active', 1) ->where('pt_co_share_details.is_active', 1); @@ -851,6 +853,10 @@ class PolicyTransactionModel extends Model $builder->where('policy_transaction.client_policy_id', $client_policy_id); } + if ($user_id != 0) { + $builder->where('policy_transaction.created_by', $user_id); + } + if ($policy_type_id != 0) { @@ -965,7 +971,7 @@ class PolicyTransactionModel extends Model public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0, $where = null) { $builder = $this->db->table('policy_transaction') - ->select(' + ->select(" policy_transaction.*, clients.short_name AS client_short_name, clients.client_code, @@ -978,14 +984,17 @@ class PolicyTransactionModel extends Model pt_co_share_details.agreed_amt AS amount, pt_co_share_details.bp_amt AS bp, pt_co_share_details.tp_amt AS tp, - clients.pan - ') + clients.pan, + DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at, + user_profiles.first_name as user_name + ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left') ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left') ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') + ->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left') ->where('policy_transaction.is_active', 1) ->where('policy_transaction.action_type', 'inception'); diff --git a/app/Models/VehicleModel.php b/app/Models/VehicleModel.php index dda3af1c..81459170 100644 --- a/app/Models/VehicleModel.php +++ b/app/Models/VehicleModel.php @@ -72,10 +72,12 @@ class VehicleModel extends Model ELSE '-' END AS owner_type, clients.client_name as owner_name, - client_branch.branch_name as owner_branch + client_branch.branch_name as owner_branch, + vehicle_type.vehicle_type ") ->join('clients', 'vehicle.owner = clients.id') ->join('client_branch', 'vehicle.branch_id = client_branch.id', 'left') + ->join('vehicle_type', 'vehicle.type = vehicle_type.id', 'left') ->where('vehicle.is_active', 1) ->orderBy('vehicle.id', 'desc') ->get() diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 184a5065..fb494e26 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -833,14 +833,19 @@ - + +
+ + +
+
- +
- +
@@ -851,7 +856,7 @@ $value) { - echo ""; + echo ""; } } ?> @@ -4898,4 +4903,18 @@ function getColumnIndexes(count = 0) { }); } +$('#new_vehicle_switch').change(function () { + if ($(this).is(':checked')) { + $('#modal_vehicle_no').prop('required', false); + $('label[for="modal_vehicle_no"] span.text-danger').remove(); // Remove the asterisk + } else { + $('#modal_vehicle_no').prop('required', true); + // Add asterisk only if not already present + if ($('label[for="modal_vehicle_no"] span.text-danger').length === 0) { + $('label[for="modal_vehicle_no"]').append('*'); + } + } +}); + + \ No newline at end of file diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index f51f5382..59218b46 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -249,13 +249,10 @@ table.dataTable tbody td { - - - @@ -291,6 +288,7 @@ table.dataTable tbody td {
No of Insured
No of Dependents
Status
+
User
Action
@@ -312,6 +310,7 @@ table.dataTable tbody td { + + @@ -80,6 +82,7 @@ table.dataTable tbody td { $row){ ?> + diff --git a/app/Views/report_bds_filter.php b/app/Views/report_bds_filter.php index 373ef985..78ea3d46 100644 --- a/app/Views/report_bds_filter.php +++ b/app/Views/report_bds_filter.php @@ -83,6 +83,19 @@ +
+ + +
@@ -155,6 +168,8 @@ $(document).ready(function() { $('#insurer_branch_id').select2(); $('#policy_type_id').select2(); $('#client_policy_id').select2(); + $('#user_id').select2(); + }) function fetchEmpolyeeList(event) @@ -171,6 +186,8 @@ function fetchEmpolyeeList(event) var client_branch_id = $('#client_branch_id').val(); var insurer_branch_id = $('#insurer_branch_id').val(); var client_policy_id = $('#client_policy_id').val(); + var user_id = $('#user_id').val(); + console.log(start_date + '-' + end_date); @@ -185,6 +202,7 @@ function fetchEmpolyeeList(event) client_branch_id: client_branch_id, insurer_branch_id: insurer_branch_id, client_policy_id: client_policy_id, + user_id: user_id, }; const queryString = objectToQueryString(queryParams); @@ -213,6 +231,7 @@ function getURLParams() const client_branch_id = params.get('client_branch_id') || 0; // Default to 0 if not found const insurer_branch_id = params.get('insurer_branch_id') || 0; // Default to 0 if not found const client_policy_id = params.get('client_policy_id') || 0; // Default to 0 if not found + const user_id = params.get('user_id') || 0; // Default to 0 if not found hideDateField(date_type) @@ -226,6 +245,7 @@ function getURLParams() console.log('client_branch_id', client_branch_id) console.log('insurer_branch_id', insurer_branch_id) console.log('client_policy_id', client_policy_id) + console.log('user_id', user_id) // Log the values or use them as needed console.log('Start Date:', startDate); @@ -237,6 +257,7 @@ function getURLParams() $('#end_date').val(endDate) $('#client_id').val(client_id).select2() $('#insurer_id').val(insurer_id).select2() + $('#user_id').val(user_id).select2() $('#policy_type_id').val(policy_type_id).select2() $('#date_type').val(date_type).trigger('change'); $('#issuer').val(issuer) diff --git a/app/Views/vehicle_master_list.php b/app/Views/vehicle_master_list.php index 67a9bc94..af49272b 100644 --- a/app/Views/vehicle_master_list.php +++ b/app/Views/vehicle_master_list.php @@ -85,7 +85,7 @@ table.dataTable tbody td {
- +
S. NoUser Month Business Type Client Type
- - + +
@@ -971,6 +971,7 @@
+