FEAT_UNLAYER_ADDED_TO_ALL_MAIL_TEMPLATES_SRI
This commit is contained in:
commit
00ff7e4ce5
@ -903,16 +903,26 @@ class BDSReportController extends AdminController
|
||||
public function renewalReport()
|
||||
{
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
|
||||
$default_start = new \DateTime();
|
||||
$data['default_end'] = $default_start->format('d-m-Y');
|
||||
$data['default_start'] = $default_start->modify('-60 days')->format('d-m-Y');
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['page_name'] = "Renewal Report";
|
||||
return $this->loadLayout('renewal_search', $data);
|
||||
|
||||
} else {
|
||||
|
||||
$data['page_name'] = "Renewal Report";
|
||||
$fromDate = $this->request->getPost('fromDate');
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_type = $this->request->getPost('client_type');
|
||||
$issuer = $this->request->getPost('issuer');
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
// print_r($data); die;
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
return $this->respond(['status' => true, 'html' => $html], 200);
|
||||
}
|
||||
|
||||
@ -2225,7 +2225,7 @@ class EmployeeController extends AdminController
|
||||
// print_rr($data);die();
|
||||
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
|
||||
if(isset( $data['dob'])){
|
||||
$data['dob'] = change_date_format($data['dob'], 'd/m/Y', 'Y-m-d');
|
||||
$data['dob'] = change_date_format($data['dob'], null, 'Y-m-d');
|
||||
}
|
||||
// print_rr($data); die;
|
||||
|
||||
|
||||
@ -737,7 +737,7 @@ class EmployeeRestController extends AdminController
|
||||
$jwt = $this->request->getHeaderLine('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
|
||||
$token = $jwtParts[2];
|
||||
$token = $jwtParts[1];
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
|
||||
|
||||
@ -1193,5 +1193,62 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
|
||||
//function for fetch renewal report data
|
||||
public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer = null)
|
||||
{
|
||||
$fromDate = date('Y-m-d', strtotime('-60 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
if (!empty($start_date) && !empty($end_date)) {
|
||||
$fromDate = change_date_format($start_date);
|
||||
$toDate = change_date_format($end_date);
|
||||
}
|
||||
|
||||
$query = $this->db->table('policy_transaction pt')
|
||||
->select('
|
||||
pt.*,
|
||||
c.client_name,
|
||||
c.short_name AS client_short_name,
|
||||
c.client_type,
|
||||
policy_type.policy_type,
|
||||
i.name as insurer_name,
|
||||
ib.branch_name as insurer_branch_name,
|
||||
vehicle.vehicle_no,
|
||||
leads.status as lead_status
|
||||
')
|
||||
->join('clients c', 'pt.client_id = c.id', 'left')
|
||||
->join('pt_co_share_details pt_co', 'pt.id = pt_co.pt_id and pt_co.co_share_type = 1', 'left')
|
||||
->join('insurers i', 'pt_co.insurer_id = i.id', 'left')
|
||||
->join('insurer_branch ib', 'pt_co.insurer_branch_id = ib.id', 'left')
|
||||
->join('policy_type', 'pt.policy_type_id = policy_type.id', 'left')
|
||||
->join('vehicle', 'pt.vehicle_id = vehicle.id and vehicle.is_active = 1', 'left')
|
||||
->join('leads', 'pt.client_policy_id = leads.source_policy_id and leads.source_policy_id != 0 and leads.is_active = 1', 'left')
|
||||
->where('pt.policy_end_date >=', $fromDate)
|
||||
->where('pt.policy_end_date <=', $toDate)
|
||||
->where('pt.is_active', 1)
|
||||
->where('pt_co.is_active', 1)
|
||||
->where('pt.action_type', "inception");
|
||||
|
||||
// Apply filters if parameters are provided
|
||||
if (!empty($client_type)) {
|
||||
$query->where('c.client_type', $client_type);
|
||||
}
|
||||
if (!empty($client)) {
|
||||
$query->where('pt.client_id', $client);
|
||||
}
|
||||
if (!empty($issuer)) { // Corrected condition to check $issuer
|
||||
$query->where('pt.issuer', $issuer);
|
||||
}
|
||||
|
||||
$query->groupBy('pt.id');
|
||||
$query->orderBy('pt.id', 'DESC');
|
||||
// Fetch and return results
|
||||
$results = $query->get()->getResultArray();
|
||||
// print($this->db->getLastQuery()); die;
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,145 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Renewal Policy List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>
|
||||
<div class="column-header">S.No.</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Renewal Month</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Issuer</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Name</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insurer Branch</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Insured</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Client Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Business Type</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Date of Issue </div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Start Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Policy Expiry Date</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Vehicle No</div>
|
||||
</th>
|
||||
<th>
|
||||
<div class="column-header">Lead Status</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($renewal_data as $index => $row) { ?>
|
||||
<tr>
|
||||
<td><?php echo $index+1; ?></td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? ' - ' : date('M-Y', strtotime($row['policy_end_date'])); ?>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_no'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['insurer_branch_name'] ?? ' - '; ?></td>
|
||||
<td><?php echo $row['client_name'] ?? ' - ' ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['revenue_type'] ?? ' - ' ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?>
|
||||
</td>
|
||||
<td><?php echo $row['vehicle_no'] ?? ' - ' ?></td>
|
||||
<td><?php echo ucfirst($row['lead_status'] ?? ' - ') ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
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
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Renewal-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Renewal-List',
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
},
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 20, // Set default number of rows per page (optional)
|
||||
ordering: true,
|
||||
});
|
||||
} else {
|
||||
console.error("Table atet found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@ -739,6 +739,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/irba_report') ?>">IRDA Reports</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4" id="date_div">
|
||||
<div class="form-group col-md-3" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
@ -23,10 +23,24 @@
|
||||
<input type="hidden" id="endDate" value=<?= $default_end ?>>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="issuer" name="issuer">
|
||||
<option value="">Select Issuer</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3 client_type_div">
|
||||
<label for="client_type">Client Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_type" name="client_type" required>
|
||||
<label for="client_type">Client Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_type" name="client_type">
|
||||
<option value="">Select Client type</option>
|
||||
<option value="1">Group</option>
|
||||
<option value="2">Individual</option>
|
||||
@ -34,8 +48,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_id" name="client_id" required>
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="">Select Client</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -55,11 +69,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mb-1">
|
||||
|
||||
<div id="report"></div>
|
||||
</div>
|
||||
<div id="report"></div>
|
||||
|
||||
<script>
|
||||
let client_list = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy();
|
||||
$('#client_id').select2();
|
||||
})
|
||||
|
||||
$(function() {
|
||||
|
||||
var start = $('#startDate').val();
|
||||
@ -79,54 +99,35 @@ $(function() {
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
],
|
||||
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year')
|
||||
.endOf('year')
|
||||
]
|
||||
'Next 7 Days': [moment(), moment().add(6, 'days')], // Next 7 Days
|
||||
'Next 30 Days': [moment(), moment().add(29, 'days')], // Next 30 Days
|
||||
'Next Month': [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf(
|
||||
'month')], // Next Month
|
||||
'Next Year': [moment().add(1, 'year').startOf('year'), moment().add(1, 'year').endOf(
|
||||
'year')], // Next Year
|
||||
'Current Year': [moment().startOf('year'), moment().endOf('year')] // Current Year
|
||||
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$('#category').on('click', function() {
|
||||
|
||||
var choosed_option = $('#category').val();
|
||||
$("#report_type").val('0');
|
||||
if (choosed_option == 'life') {
|
||||
$("#report_type option[value='insurer']").show();
|
||||
$("#report_type option[value='bap']").hide();
|
||||
$("#report_type option[value='bapClient']").hide();
|
||||
$("#report_type option[value='bapInsurer']").hide();
|
||||
$("#report_type option[value='client']").show();
|
||||
|
||||
} else if (choosed_option == 'nonLife') {
|
||||
$("#report_type option[value='insurer']").show();
|
||||
$("#report_type option[value='bap']").show();
|
||||
$("#report_type option[value='bapClient']").show();
|
||||
$("#report_type option[value='bapInsurer']").show();
|
||||
$("#report_type option[value='client']").hide();
|
||||
}
|
||||
})
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
function fetchReportPage() {
|
||||
|
||||
var fromDate = $('#startDate').val();
|
||||
var toDate = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var report_type = $('#report_type').val();
|
||||
var client_type = $('#client_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
category: category,
|
||||
report_type: report_type
|
||||
client_id: client_id,
|
||||
client_type: client_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
|
||||
@ -156,4 +157,80 @@ function fetchReportPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
//get client , branch, policy data
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
client_list = res.client_data;
|
||||
appendClients(res.client_data);
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//append the clients data
|
||||
function appendClients(data) {
|
||||
$('#client_id').empty();
|
||||
|
||||
$('#client_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select Client'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
'data-name': item.client_name,
|
||||
});
|
||||
|
||||
$('#client_id').append(option).select2();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#client_type').on('change', function() {
|
||||
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
// console.log('selectedClientType', selectedClientType);
|
||||
|
||||
// Clear and add default options for client
|
||||
$('#client_id').empty().append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Client'
|
||||
}))
|
||||
|
||||
// Populate client options based on selected client type
|
||||
if (selectedClientType) {
|
||||
|
||||
$.each(client_list, function(index, item) {
|
||||
if (item.client_type == selectedClientType) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name,
|
||||
});
|
||||
$('#client_id').append(option);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Initialize or refresh Select2 for both dropdowns
|
||||
$('#client_id').select2();
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user