FIX_UAT_REPOTED_RRFE

This commit is contained in:
velz 2024-08-07 09:19:42 +05:30
parent 87ef964665
commit 8c648cd91d
9 changed files with 142 additions and 36 deletions

View File

@ -1034,7 +1034,7 @@ class ClientController extends AdminController
'parents-in-law'=> $this->request->getPost('parents-in-law'), 'parents-in-law'=> $this->request->getPost('parents-in-law'),
]; ];
if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) { if ($policy_grid_id == 1 || $policy_grid_id == 2 ) {
$relation_data = [ $relation_data = [
'self' => 1, 'self' => 1,
'spouse' => 'NA', 'spouse' => 'NA',
@ -1220,7 +1220,6 @@ class ClientController extends AdminController
$age_from = $this->request->getPost('5_age_from[]'); $age_from = $this->request->getPost('5_age_from[]');
$age_to = $this->request->getPost('5_age_to[]'); $age_to = $this->request->getPost('5_age_to[]');
$unit = $this->request->getPost('5_unit[]'); $unit = $this->request->getPost('5_unit[]');
for ($i = 0; $i < count($premium); $i++) { for ($i = 0; $i < count($premium); $i++) {
$data['premium'] = str_replace(',', '', $premium[$i]); $data['premium'] = str_replace(',', '', $premium[$i]);
$data['si'] = str_replace(',', '', $sum_insure[$i]); $data['si'] = str_replace(',', '', $sum_insure[$i]);
@ -1427,7 +1426,7 @@ class ClientController extends AdminController
} }
} catch (\Exception $e) { } catch (\Exception $e) {
echo 'Error: ' . $e->getMessage(); echo 'Error: ' . $e->getMessage(). ' at line no ' . $e->getLine();
} }
} }

View File

@ -1511,8 +1511,11 @@ class EmployeeController extends AdminController
$client_id = $json->client_id; $client_id = $json->client_id;
$policy_id = $json->policy_id; $policy_id = $json->policy_id;
$branch_id = $json->branch_id; $branch_id = $json->branch_id;
$unit_id = $json->unit_id;
$action = $json->action;
$family_code = $json->emp_code;
$tabledata = $json->data; $tabledata = $json->data;
$existing_famility_details = [];
if(count($tabledata)) if(count($tabledata))
{ {
$family_details = []; $family_details = [];
@ -1523,7 +1526,7 @@ class EmployeeController extends AdminController
{ {
$temp[0] = $row['column1'];//sno $temp[0] = $row['column1'];//sno
$temp[1] = $row['column2'];//emp code $temp[1] = $family_code != "" ? $family_code : $row['column2'];//emp code
$temp[2] = $row['column3'];//name $temp[2] = $row['column3'];//name
$temp[3] = $row['column4'];//DOB $temp[3] = $row['column4'];//DOB
$temp[4] = strtoupper($row['column5']);//Gender $temp[4] = strtoupper($row['column5']);//Gender
@ -1540,14 +1543,29 @@ class EmployeeController extends AdminController
$temp[15] = '';//RFE $temp[15] = '';//RFE
$temp[16] = '';//DOE $temp[16] = '';//DOE
$temp[17] = '';//Unit $temp[17] = '';//Unit
$temp[18] = $row['column11'];//unit $temp[18] = $unit_id;//unit
$family_details[] = $temp; $family_details[] = $temp;
} }
} }
} }
// print_r($family_details); if($action == 'dependent_addition')
// return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200); {
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $family_code,client_id: $client_id,client_policy_id: $policy_id,emp_status: ['active'],policy_status:['active'],client_branch_id: [ $branch_id ]);
// ~dd($this->employeeModel->getLastQuery());
if(!count($existing_famility_details))
{
return $this->respond(['dataStatus' => false, 'code' => 404, 'data' => [],'messgae' => "No Data found for emp code $family_code"], 200);
}
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,[]);
// Kint::dump($existing_famility_details);
$family_details = array_merge($family_details,$existing_famility_details);
$family_details = data_group_by_family($family_details)[ $family_code ];// reason to call this again is bring self to first index of the array
// dd($family);
}
//get policy details //get policy details
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id); $policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
$policy_details = (array)$policy_details[0]; $policy_details = (array)$policy_details[0];
@ -1570,7 +1588,7 @@ class EmployeeController extends AdminController
} }
} }
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200); return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['new' => $data,'old' => $existing_famility_details], 200]);
} }
} }

View File

@ -1654,6 +1654,10 @@ class EmployeeServiceController extends AdminController
}// if end }// if end
}// is array check end }// is array check end
else
{
$this->myLogger->logme('error','######Incoming value is not an array');
}
}// for end }// for end
}//function end }//function end

View File

@ -241,6 +241,10 @@ table.dataTable thead th {
$('#opening_bal').val(''); $('#opening_bal').val('');
$('#CDMasterForm')[0].reset(); $('#CDMasterForm')[0].reset();
$('#CDMasterForm').parsley().reset(); $('#CDMasterForm').parsley().reset();
$('#client_id').prop("disabled", false);
$('#insurer_id').prop("disabled", false);
$('#cd_ac_no').prop("disabled", false);
}) })
@ -261,9 +265,12 @@ table.dataTable thead th {
$('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>'); $('#CDMasterForm').attr('action', '<?php echo base_url('master/cash_deposite/edit');?>');
$('#CD_Master_ID').val(res.data.id); $('#CD_Master_ID').val(res.data.id);
$('#client_id').val(res.data.client_id).change(); $('#client_id').val(res.data.client_id).change();
$('#client_id').prop("disabled", true);
$('#insurer_id').val(res.data.insurer_id).change(); $('#insurer_id').val(res.data.insurer_id).change();
$('#insurer_id').prop("disabled", true);
$('#opening_date').val(res.data.opening_date); $('#opening_date').val(res.data.opening_date);
$('#cd_ac_no').val(res.data.cd_ac_no); $('#cd_ac_no').val(res.data.cd_ac_no);
$('#cd_ac_no').prop("disabled", true);
$('#opening_bal').val(res.data.opening_bal); $('#opening_bal').val(res.data.opening_bal);
$('#btnSubmit').html('Update'); $('#btnSubmit').html('Update');
@ -279,6 +286,10 @@ table.dataTable thead th {
$('#cd_ac_no').change(function(){ $('#cd_ac_no').change(function(){
var cd_ac_no = $(this).val(); var cd_ac_no = $(this).val();
console.log(cd_ac_no +'-'+cd_ac_no.length);
cd_ac_no = cd_ac_no.trim();
console.log(cd_ac_no +'-'+cd_ac_no.length);
$.ajax({ $.ajax({
url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no, url: '<?php echo base_url('util/check_cd_ac_no/');?>'+cd_ac_no,

View File

@ -341,7 +341,7 @@
<td>${policy_name_data}</td> <td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td> <td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td> <td>${tpaValue}</td>
<td>${(item.open_date)} / ${(item.close_date)}</td> <td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td> <td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td> <td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td> <td>

View File

@ -1004,7 +1004,12 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
}else{ }else{
$("#event_type").removeAttr("multiple"); $("#event_type").removeAttr("multiple");
$("#event_type").attr("name", "event_type"); $("#event_type").attr("name", "event_type");
$("#event_type").select2('destroy');
if ($('event_type').data('select2')) {
$('event_type').select2('destroy');
}
// $("#event_type").select2('destroy');
} }

View File

@ -100,7 +100,7 @@
<a data-id="<?php echo $file['id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a> <a data-id="<?php echo $file['id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
<?php if ($file['status'] == 'success') { ?> <?php if ($file['status'] == 'success') { ?>
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a> <a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate2" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
<?php } ?> <?php } ?>
</div> </div>
@ -246,7 +246,7 @@ $('body').on('click', '.upload_button', function() {
}) })
$('body').on('click', '.truncate', function(event) { $('body').on('click', '.truncate2', function(event) {
event.preventDefault(); event.preventDefault();
// console.log(event); // console.log(event);
var fileId = JSON.parse(this.getAttribute('data-id')); var fileId = JSON.parse(this.getAttribute('data-id'));

View File

@ -36,91 +36,91 @@ const excel_headers = {
1: { 1: {
1: { 1: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
}, },
2: { 2: {
"unit": "Units", "unit": "Unit",
"basic_pay": "Basic Pay", "basic_pay": "Basic Pay",
}, },
3: { 3: {
"unit": "Units", "unit": "Unit",
"band_or_grade": "Band or Grade", "band_or_grade": "Band or Grade",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
} }
}, },
2: { 2: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"premium": "Premium" "premium": "Premium"
}, },
3: { 3: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"premium": "Premium" "premium": "Premium"
}, },
4: { 4: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"from_age": "From Age", "from_age": "From Age",
"to_age": "To Age", "to_age": "To Age",
"premium": "Premium" "premium": "Premium"
}, },
5: { 5: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"from_age": "From Age", "from_age": "From Age",
"to_age": "To Age", "to_age": "To Age",
"premium": "Premium" "premium": "Premium"
}, },
6: { 6: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"from_age": "From Age", "from_age": "From Age",
"to_age": "To Age", "to_age": "To Age",
"premium": "Premium" "premium": "Premium"
}, },
7: { 7: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"from_age": "From Age", "from_age": "From Age",
"to_age": "To Age", "to_age": "To Age",
"premium": "Premium" "premium": "Premium"
}, },
8: { 8: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"grade": "Grade", "grade": "Grade",
"premium": "Premium" "premium": "Premium"
}, },
9: { 9: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"premium": "Premium" "premium": "Premium"
}, },
10: { 10: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"from_age": "From Age", "from_age": "From Age",
"to_age": "To Age", "to_age": "To Age",
"premium": "Premium" "premium": "Premium"
}, },
11: { 11: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"grade": "Grade", "grade": "Grade",
"premium": "Premium", "premium": "Premium",
"max_si": "Max Si" "max_si": "Max Si"
}, },
12: { 12: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"relationship": "Relationship", "relationship": "Relationship",
"premium": "Premium" "premium": "Premium"
}, },
13: { 13: {
"unit": "Units", "unit": "Unit",
"sum_insured": "Sum Insured", "sum_insured": "Sum Insured",
"relationship": "Relationship", "relationship": "Relationship",
"from_age": "From Age", "from_age": "From Age",
@ -286,8 +286,10 @@ function generateTable(unique_id) {
// console.log('Excepted HEADERS' , JSON.stringify(expectedHeader)) // console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
if (secondKey != 2) { if (secondKey != 2 && secondKey != undefined) {
console.log('expectedHeader' + secondKey + '-' + formatType);
console.log(expectedHeader);
console.log(excel_headers[formatType]);
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) { if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey])); const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i])); const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));

View File

@ -78,10 +78,21 @@
</div> </div>
<div class="row"> <div class="row">
<!-- <div class="col-6" style="text-align: right;"> <div class="form-group col-md-3">
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a> <label>Action</label> <br />
</div> --> <select name="action" class="form-control" id="action">
<div class="col-12" style="text-align: right;"> <!-- <option value="0">Select</option> -->
<option value="inception" selected="selected">Inception/Addition</option>
<option value="dependent_addition">Dependent Addition</option>
</select>
</div>
<div class="form-group col-md-2">
<label>Employee Code</label> <br />
<input type="text" class="form-control" id="emp_code" name="emp_code" value="">
</div>
<div class="col-6" style="text-align: right;">
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="checkDependentConflict(event);" >Check Dependent conflict</a> <a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="checkDependentConflict(event);" >Check Dependent conflict</a>
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc premium</a> <a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc premium</a>
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a> <a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a>
@ -147,6 +158,34 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="oldrestable" style="display: none;">
<thead class="bg-light">
<tr>
<th class="small-width">SNO</th>
<th class="small-width">Emp code</th>
<th class="large-width">Name</th>
<th class="medium-width">DOB</th>
<th class="medium-width">Relation</th>
<th class="large-width">Rack rate name</th>
<th class="small-width">Grid ID</th>
<th class="small-width">Is Self</th>
<th class="small-width">Premium type</th>
<th class="large-width">SI</th>
<th class="medium-width">premium</th>
<th class="small-width">Policy days</th>
<th class="small-width">no of days</th>
<th class="medium-width">Rata premium</th>
<th class="medium-width">GST</th>
</tr>
</thead>
<tbody id='oldrestablebody'>
</tbody>
</table>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable"> <table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable">
<thead class="bg-light"> <thead class="bg-light">
<tr> <tr>
@ -540,16 +579,31 @@
var policy_id = $('#policies').val(); var policy_id = $('#policies').val();
var branch_id = $('#branch_id').val(); var branch_id = $('#branch_id').val();
var unit_id = $('#unit_id').val(); var unit_id = $('#unit_id').val();
var action = $('#action').val();
var emp_code = $('#emp_code').val();
console.log(client_id + '-' + policy_id); console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') { if (client_id == '0' || policy_id == '0') {
alert('Please select all values in dropdowns.'); alert('Please select all values in dropdowns.');
return; return;
} }
if (action == 'dependent_addition') {
if(emp_code.trim() == "")
{
alert('Enter emp code');
return;
}
}
// return;
var queryParams = { var queryParams = {
client_id: client_id, client_id: client_id,
policy_id: policy_id, policy_id: policy_id,
branch_id: branch_id, branch_id: branch_id,
unit_id: unit_id,
action: action,
emp_code: emp_code,
data: tabledata, data: tabledata,
}; };
@ -577,8 +631,10 @@
displayData(response.data); displayData(response.data);
} else if (response.code === 404 && response.dataStatus === false) { } else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response); console.error('no data found', response);
alert(response.messgae);
} else { } else {
console.error('Something went wrong!'); console.error('Something went wrong!');
alert('Something went wrong!');
} }
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
@ -659,8 +715,19 @@
function displayData(data) function displayData(data)
{ {
const tableBody = document.getElementById("restablebody"); displayTable(data.new,"restablebody");
$("#restablebody").empty(); if(data.old.length())
{
$('#oldrestablebody').prop('display','block');
displayTable(data.new,"oldrestablebody");
}
}
function displayTable(data,tableID)
{
var old_data = data.old;
const tableBody = document.getElementById(tableID);
$(("#".tableID)).empty();
const existingRowCount = tableBody.rows.length; const existingRowCount = tableBody.rows.length;
for(i = 0; i < data.length; i++) for(i = 0; i < data.length; i++)
{ {