From 599dfda3f6d86cf317b30487247241b27d336ee9 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Wed, 12 Feb 2025 14:52:51 +0530 Subject: [PATCH 1/4] FIX_RFQ_GMC_SRI --- app/Views/leads_form.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 92d6af73..438f6ead 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -494,7 +494,7 @@ function getLeadsDataForEdit(input) { $('#freshDiv').hide(); $('.proposed_div').show().find('select, input').attr('required', 'required'); $('#policy_end_date, #policy_start_date, #claim').removeAttr('required'); - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.emp_title').text('No of Employees at Inception') @@ -516,7 +516,7 @@ function getLeadsDataForEdit(input) { $('.depnd_title').text('No of Dependents') $('.total_title').text('Total Lives') }else{ - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.emp_title').text('No of Employees at Inception') @@ -527,7 +527,7 @@ function getLeadsDataForEdit(input) { } if(res.data.policy_type_id != 2){ - + $('.gpa_hide_div_'+increment).hide(); $('.gpa_show_div_'+increment).show(); $('.gpa_div_elements_'+increment).show(); @@ -1141,7 +1141,7 @@ function addHTMLInput(check) { // $('.proposed_div').show().find('select, input').attr('required', 'required'); $('.proposed_div').show(); - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.emp_title').text('No of Employees at Inception') @@ -1163,7 +1163,7 @@ function addHTMLInput(check) { $('.depnd_title').text('No of Dependents') $('.total_title').text('Total Lives') }else{ - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.emp_title').text('No of Employees at Inception') $('.depnd_title').text(' No of Dependents at Inception') @@ -1468,7 +1468,7 @@ $('#lead_type').change(function() { $('#policy_start_date').removeAttr('required'); $('#claims').removeAttr('required'); $('#freshDiv').hide(); - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.gpa_div_elements').show(); @@ -1516,7 +1516,7 @@ $('#lead_type').change(function() { $('.gpa_div_elements').show(); }else{ - $('.freashDiv').show() + // $('.freashDiv').show() $('.renewalDiv').hide() $('.emp_title').text('No of Employees at Inception') @@ -1614,12 +1614,14 @@ function showGpaColumns(input){ let policy_type_id = $(input).val() let increment = input.id.split("_").pop(); if(policy_type_id != 2){ + $('.freashDiv').hide() $('.gpa_hide_div_'+increment).hide(); $('.gpa_show_div_'+increment).show(); $('.gpa_div_elements_'+increment).show(); $('.emp_title').text('No of Employees at Inception') $('.total_title').text('Total Sum Insured at Inception') }else{ + $('.freashDiv').show() $('.gpa_hide_div_'+increment).show(); } @@ -1645,7 +1647,7 @@ function getURLParamsForReport() { console.log('lead_id', lead_id); // Retain the log if necessary } -$('#policy_type_id').change(function() { +$('.policy_type_id').change(function() { console.log("policy type changed"); var policy_type_id = $(this).val(); if (policy_type_id == 2) { From 91cc9f812cbaa0af5a65ad63ee22c7004b309bde Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Sat, 15 Feb 2025 11:40:17 +0530 Subject: [PATCH 2/4] FIX_RFQ_MODULE --- app/Controllers/LeadsController.php | 67 +- app/Views/leads_form.php | 2385 ++++++++++++++++----------- app/Views/leads_list.php | 48 +- 3 files changed, 1494 insertions(+), 1006 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index d274600b..ddd29387 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -64,6 +64,9 @@ class LeadsController extends BaseController protected $clientType; protected $leadType; protected $leadsStatus; + protected $claim_type_for_gpa; + protected $cause_of_death; + public function __construct() { @@ -96,6 +99,19 @@ class LeadsController extends BaseController 'completed_with_corrections' => 'Completed with Corrections', 'completed_without_corrections' => 'Completed w/o Corrections', ]; + $this->claim_type_for_gpa = [ + 'accident_death' => 'Accident Death', + 'permanent_total_disablement' => 'Permanent Total Disablement', + 'permanent_partial_disablement' => 'Permanent Partial Disablement', + 'temporary_total_disablement_benefit' => 'Temporary Total Disablement benefit' + ]; + + $this->cause_of_death = [ + 'natural_death' => 'Natural Death', + 'suicide' => 'Suicide', + 'accident' => 'Accident' + ]; + } public function viewLeadsList() @@ -123,7 +139,7 @@ class LeadsController extends BaseController // Fetch insurer and TPA branch data $data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames(); $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames(); - + // print_r($data['tpa']);die(); // Fetch sales team members who are active in team 5 $data['salse_team'] = $this->userModel ->select('user_profiles.*') @@ -134,7 +150,10 @@ class LeadsController extends BaseController ->findAll(); // dd($data); - + $data['lastFiveYears'] = $this->getLastFiveFinancialYears(); + $data['gpaClaimType'] = $this->claim_type_for_gpa; + $data['causeOfDeath'] = $this->cause_of_death; + // dd($lastFiveYears); if ($this->request->is('get')) { // Fetch leads data $data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising(); @@ -270,7 +289,25 @@ class LeadsController extends BaseController $last_3_years_claims = null; if($value != 2){ - $last_3_years_claims = $data['finyear']; + $last_3_years_claims = []; + $finyear = json_decode($data['finyear']); + + foreach ($finyear as $year){ + $received_policy_type = ($year->finyear[0]->policy_type); + if ($value == $received_policy_type){ + array_push($last_3_years_claims,$year); + }else{ + continue; + } + // print_r($last_3_years_claims); + + // $last_3_years_claims = json_encode($last_3_years_claims); + } + $last_3_years_claims = json_encode($last_3_years_claims); + // print_r($last_3_years_claims); + // die(); + + // $last_3_years_claims = $data['finyear']; } $processedData[] = [ @@ -338,7 +375,7 @@ class LeadsController extends BaseController 'notes' => $data['notes'] ?? null, ]; } - + // print_r($processedData);die(); return $processedData; } @@ -2103,4 +2140,26 @@ class LeadsController extends BaseController } + function getLastFiveFinancialYears() { + $currentYear = date('Y'); + $currentMonth = date('m'); + + // In India, the financial year starts from April (04) + if ($currentMonth < 4) { + $currentYear--; // Adjust year if it's Jan-Mar + } + + $financialYears = []; + + for ($i = 0; $i < 5; $i++) { + $startYear = $currentYear - $i - 1; + $endYear = $currentYear - $i; + $financialYears[] = "$startYear-$endYear"; + } + + return $financialYears; + } + + + } diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index fe5079b7..0587df3e 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -1,38 +1,41 @@ @@ -82,11 +85,11 @@ @@ -103,11 +106,11 @@ @@ -117,11 +120,11 @@ @@ -233,11 +236,11 @@ @@ -247,16 +250,16 @@ @@ -280,242 +283,316 @@ \ No newline at end of file diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 9c6c8390..261083b4 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -161,28 +161,29 @@ table.dataTable tbody td { @@ -320,6 +332,7 @@ $(document).ready(function() { var insurerId = 'id; ?>'; var transactionTypeValue = $('input[name="transactionMode"]:checked').val(); var subType = ""; + var record_date = $('#record_date').val(); if(amount == ""){ toastr.warning('Amount field is required') @@ -372,7 +385,8 @@ $(document).ready(function() { transaction_type: transactionType, sub_type_id: subType, // Include sub_type_id client_id: clientId, - insurer_id: insurerId + insurer_id: insurerId, + record_date : record_date }, success: function(response) { // Handle success response From 392362fb0d5c814653d1f61faa2d82187dcc9054 Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Sat, 15 Feb 2025 17:49:38 +0530 Subject: [PATCH 4/4] FEAT_EMP_HISTORY_SRI --- app/Config/Routes.php | 1 + app/Controllers/EmployeeController.php | 17 ++++ app/Views/employee_data_list.php | 135 +++++++++++++++++++++++++ 3 files changed, 153 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b3c5c7a4..f6311b6d 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -161,6 +161,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) { $routes->get("test-rack-rate", "EmployeeController::testRackRate"); $routes->post("test-rack-rate", "EmployeeController::testRackRate"); $routes->get('test_members_list', 'EmployeeController::test_members_list'); + $routes->post('get_emp_history','EmployeeController::getEmpHistory'); }); $routes->group("/master", ["filter" => "authMVC"], function ($routes) { diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 09092020..b27a0dae 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -25,6 +25,7 @@ use App\Models\InsurerExcelExportTemplateModel; use App\Models\InsurerModel; use App\Models\ClientDepositModel; use App\Models\PolicyPremium2Model; +use App\Models\AuditHistoryModel; use App\Controllers\Jobs; @@ -64,6 +65,7 @@ class EmployeeController extends AdminController protected $insurerModel; protected $cashDepositModel; protected $PolicyPremium2Model; + protected $auditHistory; public function __construct() { @@ -84,6 +86,7 @@ class EmployeeController extends AdminController $this->insurerModel = new InsurerModel(); $this->cashDepositModel = new ClientDepositModel(); $this->PolicyPremium2Model = new PolicyPremium2Model(); + $this->auditHistory = new AuditHistoryModel(); } public function list() @@ -2725,4 +2728,18 @@ class EmployeeController extends AdminController } } + public function getEmpHistory(){ + + $emp_id = $this->request->getPost('emp_id'); + + $data['emp_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_id)->where('table_name','employees')->findAll(); + + $emp_pol_pk = $this->employeePolicyModel->select('id')->where('employee_id',$emp_id)->first()['id']; + $data['emp_pol_history'] = $this->auditHistory->select('field_name,old_value,new_value,created_by,created_at')->where('pk',$emp_pol_pk)->where('table_name','employee_polices')->findAll(); + + return $this->respond(['status' => true, 'data' => $data],200); + + + } + } diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 93fc893d..1f26c391 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -46,6 +46,38 @@ + +
@@ -154,6 +186,8 @@ ) { ?> Edit + Employee History + @@ -270,6 +304,20 @@
+ + + +