FIX_LIVE_ISSUES

This commit is contained in:
VENKATESHWARAN 2024-10-23 12:06:22 +05:30
parent 0134426046
commit 5637583448
8 changed files with 90 additions and 67 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

@ -182,6 +182,10 @@
extend: 'csv',
text: 'CSV',
title: 'Member-List',
},{
extend: 'excel',
text: 'Excel',
title: 'Member-List',
}],
language: {
search: "_INPUT_",

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>