CHANGE_RENEWAL_REPORT_CHANGE
This commit is contained in:
parent
f1e4dade06
commit
fff305be38
@ -15,6 +15,7 @@ use App\Models\PolicyTransactionModel;
|
||||
use App\Models\PTCOShareDetailsModel;
|
||||
use App\Models\COShareStmtDetailsModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\NhanceBranchModel;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
@ -34,6 +35,7 @@ class BDSReportController extends AdminController
|
||||
protected $coShareStmtDetailsModel;
|
||||
protected $policyTypeModel;
|
||||
protected $policyTatReportType;
|
||||
protected $nhanceBranchModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -47,6 +49,7 @@ class BDSReportController extends AdminController
|
||||
$this->PTCOShareDetailsModel = new PTCOShareDetailsModel();
|
||||
$this->coShareStmtDetailsModel = new COShareStmtDetailsModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->nhanceBranchModel = new NhanceBranchModel();
|
||||
|
||||
|
||||
$this->policyTatReportType = [
|
||||
@ -925,7 +928,7 @@ class BDSReportController extends AdminController
|
||||
$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['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();;
|
||||
$data['tab_name'] = "Renewal Reports";
|
||||
$data['page_name'] = "Renewal Report";
|
||||
return $this->loadLayout('renewal_search', $data);
|
||||
@ -935,11 +938,11 @@ class BDSReportController extends AdminController
|
||||
$toDate = $this->request->getPost('toDate');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_type = $this->request->getPost('client_type');
|
||||
$issuer = $this->request->getPost('issuer');
|
||||
$issuer_branch = $this->request->getPost('issuer_branch');
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer);
|
||||
$data['renewal_data'] = $this->policyTransactionModel->getRenewalReportData($fromDate, $toDate, $client_type, $client_id, $issuer_branch);
|
||||
// print_r($data); die;
|
||||
$view_name = "bds_renewal_report_list";
|
||||
$html = view('bds_renewal_report_list', $data);
|
||||
|
||||
@ -1787,7 +1787,7 @@
|
||||
|
||||
|
||||
//function for fetch renewal report data
|
||||
public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer = null)
|
||||
public function getRenewalReportData($start_date = null, $end_date = null, $client_type = null, $client = null, $issuer_branch = null)
|
||||
{
|
||||
$fromDate = date('Y-m-d', strtotime('-90 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
@ -1815,13 +1815,14 @@
|
||||
->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')
|
||||
->join('leads', 'pt.client_policy_id = leads.source_policy_id and leads.source_policy_id != 0 and leads.is_active = 1', 'left')
|
||||
->where('pt.renewal_date >=', $fromDate)
|
||||
->where('pt.renewal_date <=', $toDate)
|
||||
->where('pt.is_active', 1)
|
||||
->where('pt.source_client_policy_id != pt.client_policy_id')
|
||||
->where('pt_co.is_active', 1)
|
||||
->where('pt.action_type', "inception");
|
||||
->where('pt.action_type', "inception")
|
||||
->where("NOT EXISTS (SELECT 1 FROM policy_transaction p2 WHERE p2.source_client_policy_id = pt.client_policy_id AND p2.is_active = 1)");
|
||||
|
||||
|
||||
// Apply filters if parameters are provided
|
||||
if (!empty($client_type)) {
|
||||
@ -1830,8 +1831,8 @@
|
||||
if (!empty($client)) {
|
||||
$query->where('pt.client_id', $client);
|
||||
}
|
||||
if (!empty($issuer)) { // Corrected condition to check $issuer
|
||||
$query->where('pt.issuer', $issuer);
|
||||
if (!empty($issuer_branch)) { // Corrected condition to check $issuer
|
||||
$query->where('pt.issuer_branch', $issuer_branch);
|
||||
}
|
||||
|
||||
$query->groupBy('pt.id');
|
||||
|
||||
@ -30,13 +30,13 @@
|
||||
</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>
|
||||
<label for="client_branch">Nhance Branch<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="issuer_branch" name="issuer_branch">
|
||||
<option value="">Select Branch</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
if (isset($issuer_branch) && count($issuer_branch)) {
|
||||
foreach ($issuer_branch as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['branch_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -133,13 +133,13 @@
|
||||
var toDate = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var client_type = $('#client_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
var issuer_branch = $('#issuer_branch').val();
|
||||
var requestData = {
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
client_id: client_id,
|
||||
client_type: client_type,
|
||||
issuer: issuer,
|
||||
issuer_branch: issuer_branch,
|
||||
};
|
||||
console.log(typeof fromDate);
|
||||
var url = '<?= base_url('/bdsReport/renewal_report') ?>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user