Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
Smart 2024-10-23 14:06:32 +05:30
commit 3e5275ac1a
10 changed files with 145 additions and 112 deletions

View File

@ -2105,6 +2105,7 @@ class ClientController extends AdminController
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
$data['reasonableandcustomarycharges'] = str_replace(',', '', $this->request->getPost("reasonableandcustomarycharges"));
$data['daycaretreatment'] = str_replace(',', '', $this->request->getPost("daycaretreatment"));
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));

View File

@ -312,22 +312,6 @@ class EmpDataServiceController extends BaseController
'db_column_name' => 'total'
]
];
// get excel export format structure array
$template_json = $this->clientPolicyModel
->select('insurer_excel_export_template.jsoncolumns')
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
->where('client_policy.id', $export_data['client_policy_id'])
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
->where('insurer_excel_export_template.type_name', $export_data['actions'])
->first();
if(!empty($template_json) && $template_json != null){
$excel_header_columns = json_decode($template_json['jsoncolumns'], true);
}else{
return 6;
}
if( $export_data['insurer_or_tpa'] == 'tpa'){
@ -380,7 +364,7 @@ class EmpDataServiceController extends BaseController
[
'column_index' => 9,
'column_name' => 'DATE OF COVERAGE',
'db_column_name' => 'date_of_coverage'
'db_column_name' => 'date_coverage'
],
[
'column_index' => 10,
@ -438,6 +422,22 @@ class EmpDataServiceController extends BaseController
'db_column_name' => 'total'
]
];
}else{
// get excel export format structure array
$template_json = $this->clientPolicyModel
->select('insurer_excel_export_template.jsoncolumns')
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
->where('client_policy.id', $export_data['client_policy_id'])
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
->where('insurer_excel_export_template.type_name', $export_data['actions'])
->first();
if(!empty($template_json) && $template_json != null){
$excel_header_columns = json_decode($template_json['jsoncolumns'], true);
}else{
return 6;
}
}
$excel_data_info = generate_insurer_based_excel($excel_header_columns, $objects);
@ -1253,20 +1253,26 @@ class EmpDataServiceController extends BaseController
$insurer_or_tpa = $file['insurer_or_tpa'];
if ($insurer_or_tpa == 'tpa') {
$id = 'tpa_id';
} else if ($insurer_or_tpa == 'insurer') {
$id = 'uhid';
}
$ref_data = [
'client_id' => $client_id,
'client_policy_id' => $client_policy_id,
'client_branch_id' => $client_branch_id,
'insurer_or_tpa' => $insurer_or_tpa,
'event_type' => $file['event_type'],
];
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
$excel_data = $this->readExcelFileToArray($file_name_with_path);
$excel_header = $excel_data[0];
unset($excel_data[0]);
array_pop($excel_data);
// array_pop($excel_data);
$inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL'];
$inceptionHeader = ['S.No', 'NAME OF EMP/DEP','EMP ID','EMP/DEP TYPE','RELATIONSHIP CODE','DOB','GENDER','PRE EXISTING AILMENTS','BASIC COVER SI','DATE OF COVERAGE','AGE','RELATIONSHIP','REMARKS','POLICY END DATE','NO OF DAYS','TPA ID','UHID','PREMIUM','PR0 RATA PREMIUM','GST','TOTAL AMOUNT'];
foreach ($inceptionHeader as $key => $value) {
if($excel_header[$key] != $value){
@ -1280,49 +1286,50 @@ class EmpDataServiceController extends BaseController
$this->setPullNotification($file_data);
$this->myLogger->logme('error', 'Inception File Validation -- Upload the worng excel file');
return ['status' => 'error', 'message' => 'Upload the worng excel file'];
return ['status' => 'error', 'message' => 'Upload the worng excel file', 'excel_header' => $excel_header, 'inception_header' => $inceptionHeader];
}
}
$emp_count = count($excel_data);
$employee_data = $this->employeePolicyModel
->select('
employee_polices.id as emp_policy_id,
employees.name AS emp_name,
employees.emp_code AS emp_code,
"Has Define" as emp_type,
employees.relationship_code AS emp_relationship_code,
employees.dob AS emp_dob,
employees.gender AS emp_gender,
employee_polices.pre_existing_alignments,
employee_polices.basic_cover_si,
employee_polices.date_coverage,
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
employees.relationship AS emp_relationship,
employees.change_event AS change_event,
employee_polices.policy_end_date,
employee_polices.days,
employee_polices.tpa_id,
employee_polices.uhid,
employee_polices.premium,
employee_polices.rata_premimum,
employee_polices.gst,
(employee_polices.rata_premimum + employee_polices.gst) AS total
')
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employees.client_branch_id', $client_branch_id)
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employees.is_active', 1)
->where('employees.emp_status', 'active')
->findAll();
// ->select('
// employee_polices.id as emp_policy_id,
// employees.name AS emp_name,
// employees.emp_code AS emp_code,
// "Has Define" as emp_type,
// employees.relationship_code AS emp_relationship_code,
// employees.dob AS emp_dob,
// employees.gender AS emp_gender,
// employee_polices.pre_existing_alignments,
// employee_polices.basic_cover_si,
// employee_polices.date_coverage,
// TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
// employees.relationship AS emp_relationship,
// employees.change_event AS change_event,
// employee_polices.policy_end_date,
// employee_polices.days,
// employee_polices.tpa_id,
// employee_polices.uhid,
// employee_polices.premium,
// employee_polices.rata_premimum,
// employee_polices.gst,
// (employee_polices.rata_premimum + employee_polices.gst) AS total
// ')
// ->join('employees', 'employees.id = employee_polices.employee_id')
// ->where('employee_polices.client_policy_id', $client_policy_id)
// ->where('employees.client_id', $client_id)
// ->where('employees.client_branch_id', $client_branch_id)
// ->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
// ->where('employee_polices.is_active', 1)
// ->where('employee_polices.status', 'active')
// ->where('employees.is_active', 1)
// ->where('employees.emp_status', 'active')
// ->findAll();
@ -1372,15 +1379,14 @@ class EmpDataServiceController extends BaseController
$difference = $emp_data_count - $excel_data_count;
$status = 'in-progress';
if ($excel_data_count < $emp_data_count) {
if ($excel_data_count < $emp_data_count) {
$status = 'in-progress-partially';
$partially_updated_data = 'Expected : ' . $emp_data_count . ', ' . 'Updated : ' . $excel_data_count . ', ' . 'difference : ' . $difference;
$this->myLogger->logme('error', 'Inception File Validation -- excel file count partially : {data}', ['data' => $partially_updated_data]);
}
if ($emp_data_count < $excel_data_count) {
$data = [
@ -1498,11 +1504,11 @@ class EmpDataServiceController extends BaseController
];
}
if ($emp_value['days'] != $excel_data[$key][14]) {
if ($emp_value['no_of_days'] != $excel_data[$key][14]) {
$errors[$key][] = [
'row' => $key,
'column' => 14,
'db_data' => $emp_value['days'],
'db_data' => $emp_value['no_of_days'],
'excel_data' => $excel_data[$key][14]
];
}
@ -1516,11 +1522,11 @@ class EmpDataServiceController extends BaseController
];
}
if ($emp_value['rata_premimum'] != $excel_data[$key][18]) {
if ($emp_value['pro_rata_premium'] != $excel_data[$key][18]) {
$errors[$key][] = [
'row' => $key,
'column' => 18,
'db_data' => $emp_value['rata_premimum'],
'db_data' => $emp_value['pro_rata_premium'],
'excel_data' => $excel_data[$key][18]
];
}
@ -1557,7 +1563,7 @@ class EmpDataServiceController extends BaseController
}
}
$batch_list_id[] = $emp_value['emp_policy_id'];
$batch_list_id[] = $emp_value['primaryKey'];
}

View File

@ -1399,6 +1399,8 @@ class EmployeeController extends AdminController
$error_data = json_decode($file['error_data']);
// dd($error_data);
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
if (!file_exists($file_name_with_path)) {

View File

@ -175,6 +175,7 @@ class MasterController extends AdminController
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
$editData['db_column_name'] = [
'S.No.' => 'index',
'Employee Name' => 'emp_name',
'Employee ID' => 'emp_code',
'Date of Birth' => 'emp_dob',

View File

@ -168,7 +168,7 @@ class EmployeePolicyModel extends Model
//-------------------------------------------------------------------------------------------------------
public function getInceptionEmployeeDataForExportExcel($ref_data)
public function getInceptionEmployeeDataForExportExcel($ref_data, $return_type = 0)
{
$client_policy_id = $ref_data['client_policy_id'];
$client_branch_id = $ref_data['client_branch_id'];
@ -269,7 +269,12 @@ class EmployeePolicyModel extends Model
// Get the result set
$query = $this->db->query($sql);
$results = $query->getResult();
if($return_type == 1){
$results = $query->getResultArray();
}else{
$results = $query->getResult();
}
return $results;
}
@ -1019,6 +1024,7 @@ class EmployeePolicyModel extends Model
try {
// Execute the query
$this->db->query($sql);
// Commit the transaction
if ($this->db->transStatus() === FALSE) {

View File

@ -202,7 +202,7 @@ body {
</a>
</li>
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
<?php if(get_role_id() == 1 || get_role_id() == 5 && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li class="nav-item">
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">

View File

@ -34,6 +34,10 @@
position: absolute;
}
.right-align-input {
text-align: right;
}
</style>
<?php $pro_rata_total = 0; $gst_total = 0 ?>
@ -47,24 +51,23 @@
<h4 style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<?php if (isset($getData)) {
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<th class="font-weight-medium">Client/Branch</th>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<?php }
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<th class="font-weight-medium">Branch</th>
<?php } ?>
<?php } ?>
<?php } } ?>
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Name</th>
<th class="font-weight-medium">EMP Code</th>
<th class="font-weight-medium">Relationship</th>
<th class="font-weight-medium">Date of Birth</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurer name</th>
<th class="font-weight-medium">TPA ID</th>
@ -86,19 +89,18 @@
<tr>
<td><b><?php echo ($key + 1); ?></b></td>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<?php if (isset($getData)) {
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<td><?php echo $employee['client_short_name'] . ' - ' . $employee['client_branch_name']; ?></td>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<?php }
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<td><?php echo $employee['client_branch_name']; ?></td>
<?php } ?>
<?php } ?>
<?php } } ?>
<td><?php echo $employee['name'] . ' (' . $employee['emp_code'] . ' - ' . $employee['relationship'] . ')'; ?></td>
<td><?php echo $employee['name']; ?></td>
<td><?php echo $employee['emp_code']; ?></td>
<td><?php echo $employee['relationship']; ?></td>
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>
<td><?php echo $employee['insurer_short_name']; ?></td>
<td><?php echo $employee['tpa_id']; ?></td>
@ -132,24 +134,22 @@
<td><?php $pro_rata_total += $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum']); ?></td>
<td><?php $gst_total += $employee['gst']; echo format_indian_number($employee['gst']); ?></td>
</tr>
<?php }
} ?>
<?php } } ?>
</tbody>
<tfoot>
<tr>
<th></th>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<?php if (isset($getData)) {
if ($getData['client_id'] == '0' && $getData['policy_id'] == '0' && $getData['branch_id'] == '0' && ($getData['emp_code'] != "" || $getData['emp_name'] != "" || $getData['status'] != "")) { ?>
<th></th>
<?php } ?>
<?php } ?>
<?php if (isset($getData)) { ?>
<?php if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<?php }
if ($getData['client_id'] != '0' && $getData['branch_id'] == '0') { ?>
<th></th>
<?php } ?>
<?php } ?>
<?php } } ?>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
@ -174,6 +174,7 @@
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-6 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
@ -181,9 +182,10 @@
extend: 'csv',
text: 'CSV',
title: 'Member-List',
exportOptions: {
columns: ':not(:last-child)'
},
},{
extend: 'excel',
text: 'Excel',
title: 'Member-List',
}],
language: {
search: "_INPUT_",

View File

@ -115,7 +115,6 @@ var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
$(document).ready(function() {
console.log("document loaded");
//fetchClientPolicies();
@ -127,7 +126,6 @@ $(window).on("load", function() {
fetchClientPolicies();
});
function fetchClientPolicies() {
$('#loader').show();
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
@ -204,7 +202,6 @@ function fetchClientPolicies() {
$('#loader').hide();
}
function appendClients(data) {
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
$.each(data, function(index, item) {
@ -219,7 +216,6 @@ function appendClients(data) {
});
}
function appendBranch(data) {
$('#branch_id').empty();
@ -239,7 +235,6 @@ function appendBranch(data) {
});
}
function appendPolicies(data) {
$('#policies').empty();
@ -286,7 +281,6 @@ $(document).ready(function() {
});
});
$(document).ready(function() {
$('#branch_id').on('change', function() {
@ -321,7 +315,6 @@ function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action

View File

@ -537,6 +537,7 @@ function getPolicyData(input) {
}
}
// Salse team user list data
function selecSalsePerson(salse_person_ids) {
salse_person_ids = JSON.parse(salse_person_ids);
@ -588,7 +589,7 @@ function addHTMLInput() {
<div class="form-group col-md-3">
<label for="insurer">Insurer <span class="text-danger">*</span></label>
<select class="form-control" id="insurer_${increment}" name="insurer[]" required>
<select class="form-control" id="insurer_${increment}" name="insurer[]" onchange="insurerChange(this, ${increment})" required>
<option value="">Select Insurer</option>
<?php if (isset($insurer)) { ?>
<?php foreach ($insurer as $value) { ?>
@ -602,7 +603,7 @@ function addHTMLInput() {
<div class="form-group col-md-3">
<label for="tpa">TPA <span class="text-danger">*</span></label>
<select class="form-control" id="tpa_${increment}" name="tpa[]" required>
<select class="form-control" id="tpa_${increment}" name="tpa[]" onchange="tpaChange(this, ${increment})" required>
<option value="">Select TPA</option>
<?php if (isset($tpa)) { ?>
<?php foreach ($tpa as $value) { ?>
@ -715,7 +716,6 @@ function addHTMLInput() {
increment++; // Increment after adding the input
}
function removeHTMLInput(element)
{
const container = document.getElementById('dynamic-form-container');
@ -849,6 +849,24 @@ $('#lead_type').change(function() {
})
function insurerChange(input, unique_id) {
var lead_type = $('#lead_type').val()
if(lead_type == 2){
var val = $(input).val();
$('#proposed_insurer_'+unique_id).val(val).select2();
}
}
function tpaChange(input, unique_id) {
var lead_type = $('#lead_type').val()
if(lead_type == 2){
var val = $(input).val();
$('#proposed_tpa_'+unique_id).val(val).select2();
}
}
//-----------------------------------------------------------------------------------------------------------
function getURLParamsForReport() {
@ -866,4 +884,5 @@ function getURLParamsForReport() {
console.log('pt_id', pt_id); // Retain the log if necessary
}
</script>

View File

@ -98,6 +98,9 @@ table.dataTable tbody td {
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
</a>
</div>
</div>
</td>