CHANGE_BDS_MINOR_CRS : RV

This commit is contained in:
VENKATESHWARAN 2025-07-17 15:22:29 +05:30
parent bf6924f855
commit 214b63fc28
8 changed files with 86 additions and 28 deletions

View File

@ -134,16 +134,17 @@ class PolicyTransactionController extends BaseController
'send' => 'Sent', 'send' => 'Sent',
'recived' => 'Payment Received', 'recived' => 'Payment Received',
]; ];
$data['vehicle_type'] = [ // $data['vehicle_type'] = [
'two_wheeler' => 'Two Wheeler', // 'two_wheeler' => 'Two Wheeler',
'four_wheeler' => 'Four Wheeler', // 'four_wheeler' => 'Four Wheeler',
'truck' => 'Truck', // 'truck' => 'Truck',
'bus' => 'Bus', // 'bus' => 'Bus',
'van' => 'Van', // 'van' => 'Van',
'suv' => 'SUV', // 'suv' => 'SUV',
'motorcycle' => 'Motorcycle', // 'motorcycle' => 'Motorcycle',
'bicycle' => 'Bicycle' // 'bicycle' => 'Bicycle'
]; // ];
$data['vehicle_type'] = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray();
$data['vehicle_des'] = [ $data['vehicle_des'] = [
'commercial' => 'Commercial', 'commercial' => 'Commercial',
'private' => 'Private', 'private' => 'Private',
@ -1810,6 +1811,8 @@ class PolicyTransactionController extends BaseController
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll(); $data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['policy_types'] = $this->policyTypeModel->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['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 //filter datas
@ -1823,6 +1826,7 @@ class PolicyTransactionController extends BaseController
$client_branch_id = $this->request->getGet('client_branch_id'); $client_branch_id = $this->request->getGet('client_branch_id');
$insurer_branch_id = $this->request->getGet('insurer_branch_id'); $insurer_branch_id = $this->request->getGet('insurer_branch_id');
$client_policy_id = $this->request->getGet('client_policy_id'); $client_policy_id = $this->request->getGet('client_policy_id');
$user_id = $this->request->getGet('user_id');
if ($date_type == 'statement_month') { if ($date_type == 'statement_month') {
$start_date = (string)date('Y-m-01', strtotime($start_date)); $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; $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; $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; $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')) { if ($this->request->is('post')) {
$isFromDashboard = $this->request->getPost("is_dashboard"); $isFromDashboard = $this->request->getPost("is_dashboard");
@ -1860,8 +1865,8 @@ class PolicyTransactionController extends BaseController
// dd($ids); // dd($ids);
} }
//Actual data for the list //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 : ''); $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['report_list']); // dd($data);
$this->loadLayout('report_bds_filter', $data); $this->loadLayout('report_bds_filter', $data);
} }

View File

@ -592,7 +592,7 @@ class PolicyTransactionModel extends Model
// return $result; // 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 = ''; $date_condition = '';
@ -764,7 +764,8 @@ class PolicyTransactionModel extends Model
) )
), ),
2 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') ->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('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 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 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('policy_transaction.is_active', 1)
->where('pt_co_share_details.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); $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) { 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) 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') $builder = $this->db->table('policy_transaction')
->select(' ->select("
policy_transaction.*, policy_transaction.*,
clients.short_name AS client_short_name, clients.short_name AS client_short_name,
clients.client_code, clients.client_code,
@ -978,14 +984,17 @@ class PolicyTransactionModel extends Model
pt_co_share_details.agreed_amt AS amount, pt_co_share_details.agreed_amt AS amount,
pt_co_share_details.bp_amt AS bp, pt_co_share_details.bp_amt AS bp,
pt_co_share_details.tp_amt AS tp, 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('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.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('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.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('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.is_active', 1)
->where('policy_transaction.action_type', 'inception'); ->where('policy_transaction.action_type', 'inception');

View File

@ -72,10 +72,12 @@ class VehicleModel extends Model
ELSE '-' ELSE '-'
END AS owner_type, END AS owner_type,
clients.client_name as owner_name, 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('clients', 'vehicle.owner = clients.id')
->join('client_branch', 'vehicle.branch_id = client_branch.id', 'left') ->join('client_branch', 'vehicle.branch_id = client_branch.id', 'left')
->join('vehicle_type', 'vehicle.type = vehicle_type.id', 'left')
->where('vehicle.is_active', 1) ->where('vehicle.is_active', 1)
->orderBy('vehicle.id', 'desc') ->orderBy('vehicle.id', 'desc')
->get() ->get()

View File

@ -834,13 +834,18 @@
</select> </select>
</div> </div>
<div class="form-group col-md-3">
<label for="new_vehicle_switch">New Vehicle</label>
<input id="new_vehicle_switch" type="checkbox" name="new_vehicle" value="1" data-toggle="toggle" data-on="Yes" data-off="No" data-onstyle="info" data-offstyle="dark" data-style="border" data-width="218">
</div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="cost_center">Vehicle No<span class="text-danger">*</span></label> <label for="modal_vehicle_no">Vehicle No<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="modal_vehicle_no" placeholder="Enter Vehicle No" name="vehicle_no" onchange="validateInput(this, 'vehicle', 'vehicle_no')" required> <input type="text" class="form-control" id="modal_vehicle_no" placeholder="Enter Vehicle No" name="vehicle_no" onchange="validateInput(this, 'vehicle', 'vehicle_no')" required>
</div> </div>
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="rc">RC Book <span class="text-danger">*</span></label> <label for="rc">Chassis Book <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="rc" placeholder="Enter RC Book No" name="rc" onchange="validateInput(this, 'vehicle', 'rc')" required> <input type="text" class="form-control" id="rc" placeholder="Enter RC Book No" name="rc" onchange="validateInput(this, 'vehicle', 'rc')" required>
</div> </div>
@ -851,7 +856,7 @@
<?php <?php
if (isset($vehicle_type) && count($vehicle_type)) { if (isset($vehicle_type) && count($vehicle_type)) {
foreach ($vehicle_type as $key => $value) { foreach ($vehicle_type as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>"; echo "<option value=" . $value['id'] . ">" . $value['vehicle_type'] . "</option>";
} }
} }
?> ?>
@ -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('<span class="text-danger">*</span>');
}
}
});
</script> </script>

View File

@ -249,13 +249,10 @@ table.dataTable tbody td {
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -291,6 +288,7 @@ table.dataTable tbody td {
<th><div class="column-header">No of Insured</div></th> <th><div class="column-header">No of Insured</div></th>
<th><div class="column-header">No of Dependents</div></th> <th><div class="column-header">No of Dependents</div></th>
<th><div class="column-header">Status</div></th> <th><div class="column-header">Status</div></th>
<th><div class="column-header">User</div></th>
<th><div class="column-header">Action</div></th> <th><div class="column-header">Action</div></th>
</tr> </tr>
</thead> </thead>
@ -312,6 +310,7 @@ table.dataTable tbody td {
<td class="right-align-input"><?php echo $row['emp_count']; ?></td> <td class="right-align-input"><?php echo $row['emp_count']; ?></td>
<td class="right-align-input"><?php echo $row['dependent_count']; ?></td> <td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
<td><?php echo $policy_status[$row['status']]; ?></td> <td><?php echo $policy_status[$row['status']]; ?></td>
<td><?php echo $row['user_name']; ?></td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a> <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
@ -770,7 +769,7 @@ function appendVehicles(data, vehicle_id)
$.each(data, function(index, item) { $.each(data, function(index, item) {
var option = $('<option>', { var option = $('<option>', {
value: item.id, value: item.id,
text: item.vehicle_no, text: item.vehicle_no ?? item.rc,
'data-cid': item.owner, 'data-cid': item.owner,
'data-bid': item.branch_id, 'data-bid': item.branch_id,
'data-cty': item.client_type, 'data-cty': item.client_type,

View File

@ -37,12 +37,14 @@ table.dataTable tbody td {
<strong>Total Rewards:</strong> <span id="total_rewards">0.00</span> | <strong>Total Rewards:</strong> <span id="total_rewards">0.00</span> |
<strong>Total IRDA Revenue INR:</strong> <span id="total_irda">0.00</span> | <strong>Total IRDA Revenue INR:</strong> <span id="total_irda">0.00</span> |
<strong>Total Billed Amount:</strong> <span id="total_billed">0.00</span> | <strong>Total Billed Amount:</strong> <span id="total_billed">0.00</span> |
<strong>Total Unbilled Amount:</strong> <span id="total_unbilled">0.00</span> <strong>Total Unbilled Amount:</strong> <span id="total_unbilled">0.00</span> |
<strong>Total Policy Count:</strong> <span id="total_policy_count"><?= $policy_count ?></span>
</div> </div>
<table id="scroll-horizontal-datatable" class="table w-100 nowrap"> <table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
<th>S. No</th> <th>S. No</th>
<th>User</th>
<th>Month</th> <th>Month</th>
<th>Business Type</th> <th>Business Type</th>
<th>Client Type</th> <th>Client Type</th>
@ -80,6 +82,7 @@ table.dataTable tbody td {
<?php foreach($report_list as $index => $row){ ?> <?php foreach($report_list as $index => $row){ ?>
<tr> <tr>
<td><?= $index + 1 ?></td> <td><?= $index + 1 ?></td>
<td><?php echo $row['user_name']; ?></td>
<td><?php echo $row['policy_issue_month']; ?></td> <td><?php echo $row['policy_issue_month']; ?></td>
<td><?php echo $row['revenue_type']; ?></td> <td><?php echo $row['revenue_type']; ?></td>
<td><?php echo $row['client_type']; ?></td> <td><?php echo $row['client_type']; ?></td>

View File

@ -83,6 +83,19 @@
</select> </select>
</div> </div>
<div class="form-group col-md-3">
<label for="user_id">Users<span class="text-danger"></span></label>
<select class="form-control" id="user_id" name="user_id" >
<option value="0">Select user</option>
<?php
if (isset($users) && count($users)) {
foreach ($users as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['first_name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Date Type<span class="text-danger"></span></label> <label>Date Type<span class="text-danger"></span></label>
@ -155,6 +168,8 @@ $(document).ready(function() {
$('#insurer_branch_id').select2(); $('#insurer_branch_id').select2();
$('#policy_type_id').select2(); $('#policy_type_id').select2();
$('#client_policy_id').select2(); $('#client_policy_id').select2();
$('#user_id').select2();
}) })
function fetchEmpolyeeList(event) function fetchEmpolyeeList(event)
@ -171,6 +186,8 @@ function fetchEmpolyeeList(event)
var client_branch_id = $('#client_branch_id').val(); var client_branch_id = $('#client_branch_id').val();
var insurer_branch_id = $('#insurer_branch_id').val(); var insurer_branch_id = $('#insurer_branch_id').val();
var client_policy_id = $('#client_policy_id').val(); var client_policy_id = $('#client_policy_id').val();
var user_id = $('#user_id').val();
console.log(start_date + '-' + end_date); console.log(start_date + '-' + end_date);
@ -185,6 +202,7 @@ function fetchEmpolyeeList(event)
client_branch_id: client_branch_id, client_branch_id: client_branch_id,
insurer_branch_id: insurer_branch_id, insurer_branch_id: insurer_branch_id,
client_policy_id: client_policy_id, client_policy_id: client_policy_id,
user_id: user_id,
}; };
const queryString = objectToQueryString(queryParams); 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 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 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 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) hideDateField(date_type)
@ -226,6 +245,7 @@ function getURLParams()
console.log('client_branch_id', client_branch_id) console.log('client_branch_id', client_branch_id)
console.log('insurer_branch_id', insurer_branch_id) console.log('insurer_branch_id', insurer_branch_id)
console.log('client_policy_id', client_policy_id) console.log('client_policy_id', client_policy_id)
console.log('user_id', user_id)
// Log the values or use them as needed // Log the values or use them as needed
console.log('Start Date:', startDate); console.log('Start Date:', startDate);
@ -237,6 +257,7 @@ function getURLParams()
$('#end_date').val(endDate) $('#end_date').val(endDate)
$('#client_id').val(client_id).select2() $('#client_id').val(client_id).select2()
$('#insurer_id').val(insurer_id).select2() $('#insurer_id').val(insurer_id).select2()
$('#user_id').val(user_id).select2()
$('#policy_type_id').val(policy_type_id).select2() $('#policy_type_id').val(policy_type_id).select2()
$('#date_type').val(date_type).trigger('change'); $('#date_type').val(date_type).trigger('change');
$('#issuer').val(issuer) $('#issuer').val(issuer)

View File

@ -85,7 +85,7 @@ table.dataTable tbody td {
<td><?php echo $row['owner_name']; ?></td> <td><?php echo $row['owner_name']; ?></td>
<td><?php echo $row['rc']; ?></td> <td><?php echo $row['rc']; ?></td>
<td><?php echo $row['vehicle_no']; ?></td> <td><?php echo $row['vehicle_no']; ?></td>
<td><?php echo $vehicle_type[$row['type']] ?? ""; ?></td> <td><?php echo $row['vehicle_type']; ?></td>
<td><?php echo $vehicle_des[$row['description']] ?? ""; ?></td> <td><?php echo $vehicle_des[$row['description']] ?? ""; ?></td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">