FIX_TRUNCATE_FILE_DATA

This commit is contained in:
velz 2024-04-26 14:23:38 +05:30
parent 817f06d0c6
commit 42f96e9278
3 changed files with 44 additions and 1 deletions

View File

@ -340,6 +340,8 @@ if (!function_exists('name_and_empid_check_in_db'))
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
// ->where("cp.id",$policy_id)
->where("employees.client_id",$client_id)
->where("employees.is_active",1)
->where("ep.is_active",1)
// ->where("ep.client_id",$client_id)
->where('name',$row[2])->where('emp_code',$row[1])
->findAll();
@ -634,6 +636,8 @@ if (!function_exists('transform_excel_data_to_db'))
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
$result['temp']['emp_id'] = isset($memArr['temp']['emp_id']) ? $memArr['temp']['emp_id'] : null;
$result['temp']['emp_policy_id'] = isset($memArr['temp']['emp_policy_id']) ? $memArr['temp']['emp_policy_id'] : null;
$result['temp']['policy_status'] = isset($memArr['temp']['policy_status']) ? $memArr['temp']['policy_status'] : null;
$result['temp']['emp_status'] = isset($memArr['temp']['emp_status']) ? $memArr['temp']['emp_status'] : null;
$result['policy_details'] = $policy;
return $result;
@ -650,6 +654,20 @@ if (!function_exists('premium_calculation_manager'))
// grid type
// 1 = premium => si
// dd($emp_data);
//check if the data comes from enrollment (DB) and status is draft then fetch original data of employee from
//audit history table then initiate calculation with it. so this data again get updated in emp and policy table
// if($emp_data['temp']['emp_status'] == 'draft' && $emp_data['temp']['policy_status'] == 'draft')
// {
// $original_emp_records = get_emp_records_from_audit_history($emp_data['temp']['emp_id']);
// if(is_array($original_emp_records))
// {
// print_r($original_emp_records);
// }
// }
//end of fetching data from audit history table
//gird and calculation start
$slug = \Config\Services::slug();
$grid_type = $slab_details['grid_master']['ui_type'];
@ -1004,6 +1022,8 @@ if (!function_exists('transform_db_data_to_excel'))
$row['temp']['source'] = 'db';
$row['temp']['emp_id'] = $value['emp_id'];
$row['temp']['emp_policy_id'] = $value['emp_policy_id'];
$row['temp']['emp_status'] = $value['emp_status'];
$row['temp']['policy_status'] = $value['status'];
array_push($return_data, ($row));
}
@ -1028,4 +1048,26 @@ if (!function_exists('compare_excel_cell_range'))
}
return [];
}
}
if(!function_exists('get_emp_records_from_audit_history'))
{
function get_emp_records_from_audit_history($employee_id)
{
$db = db_connect();
$query = "SELECT min(id) as id,pk,table_name,field_name,old_value FROM venbaehn_nhance.auditing_history where pk = $employee_id and table_name = 'employees'group by field_name order by id asc";
$res = $db->query($query);
// echo $db->getLastQuery();
$res = $res->getResultArray();
if(count($res))
{ $temp = [];
foreach($res as $row)
{
$temp[ $row['field_name'] ] = $row['old_value'];
}
return $temp;
}
return false;
}
}

View File

@ -81,7 +81,7 @@ class EmployeeModel extends Model
return $this->where('emp_code',$arr['emp_code'])
->where('name',$arr['name'])
->where('client_id',$arr['client_id'])
// ->where('relationship_code',$arr['relationship_code'])
->where('is_active',1)
->where('gender',$arr['gender'])
->where('dob',$arr['dob'])
->find();

View File

@ -100,6 +100,7 @@ class EmployeePolicyModel extends Model
{
return $this->where('employee_id',$arr['employee_id'])
->where('client_policy_id',$arr['client_policy_id'])
->where('is_active',1)
->find();
}