Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2025-11-25 15:04:41 +05:30
commit 04fc0cd2af
9 changed files with 74 additions and 53 deletions

View File

@ -5689,6 +5689,7 @@ class ClientController extends AdminController
$empServiceController = new EmployeeServiceController();
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
// $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]);
@ -6033,8 +6034,8 @@ class ClientController extends AdminController
->where('employees.is_active', 1)
->where('employees.relationship', "Self")
->where('employee_polices.is_active', 1)
->whereIn('employees.emp_status', ['active'])
->whereIn('employee_polices.status', ['active'])
->whereIn('employees.emp_status', ['active', 'expired'])
->whereIn('employee_polices.status', ['active', 'expired'])
->where('employees.is_active', 1)
->where('client_policy.id', $param)
->groupBy('employees.emp_code')
@ -6147,10 +6148,10 @@ class ClientController extends AdminController
->where('insurers.is_active', 1)
->where('tpa.is_active', 1)
->where('employees.is_active', 1)
->where('employees.emp_status', "active")
->whereIn('employees.emp_status', ['active', 'expired'])
->where('employees.relationship', "Self")
->where('employee_polices.is_active', 1)
->where('employee_polices.status', "active")
->whereIn('employee_polices.status', ['active', 'expired'])
->where($field_name, $param);
if (!empty($client_id)) {

View File

@ -1387,13 +1387,16 @@ class EmployeeServiceController extends AdminController
$family = array_merge($family,$existing_famility_details);
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
// dd($family);
// $self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self'));
// $premium = (int)($self['temp']['rata_premimum'] ?? 0);
// foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium;
$self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self'));
$premium = (int)($self['temp']['rata_premimum'] ?? 0);
foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium;
}
// Kint::dump($family);
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
if($file['action'] == 'dependent_addition') {
$data = validatet_family_floter_rata_premium($data);
}
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);

View File

@ -2068,7 +2068,7 @@ class TicketController extends BaseController
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
->where('client_policy.policy_status', 1)
// ->where('client_policy.policy_status', 1)
->whereIn('client_policy.id', $policy_ids)
->findAll();

View File

@ -50,7 +50,6 @@ if (!function_exists('check_columns_name')) {
}
}
if (!function_exists('check_row_is_empty_or_null')) {
function check_row_is_empty_or_null($arr)
@ -89,7 +88,6 @@ if (!function_exists('check_excel_date_format')) {
}
}
if (!function_exists('check_relationship')) {
function check_relationship($row, $relationship, $policy_terms)
{
@ -132,7 +130,6 @@ if (!function_exists('check_relationship')) {
}
}
if (!function_exists('check_doj')) {
function check_doj($row)
@ -179,7 +176,6 @@ if (!function_exists('check_doc')) {
}
}
if (!function_exists('check_employee_band')) {
function check_employee_band($row, $policy_terms, $slab_details)
{
@ -218,7 +214,6 @@ if (!function_exists('check_employee_band')) {
}
}
if (!function_exists('check_si')) {
function check_si($row, $policy_details, $slab_details)
{
@ -326,7 +321,6 @@ if (!function_exists('check_basic_pay')) {
}
}
if (!function_exists('check_dob_diff')) {
function check_dob_diff($row, $relationships, $default_age_ratio, $policy_details)
{
@ -464,8 +458,6 @@ if (!function_exists('check_self_available_in_family')) {
}
}
if (!function_exists('name_and_empid_check_in_db')) {
function name_and_empid_check_in_db($family_data, $actionArr)
{
@ -955,7 +947,6 @@ if (!function_exists('calculate_premium_new')) {
}
}
if (!function_exists('transform_excel_data_to_db')) {
function transform_excel_data_to_db($memArr, $actionArr)
{
@ -1022,16 +1013,15 @@ if (!function_exists('transform_excel_data_to_db')) {
$result['temp']['rata_premimum'] = isset($memArr['temp']['rata_premimum']) ? $memArr['temp']['rata_premimum'] : 0;
$result['policy_details'] = $policy;
// if(isset($memArr['self_rata_premium'])){
// $result['self_rata_premium'] = $memArr['self_rata_premium'] ?? 0;
// }
if(isset($memArr['self_rata_premium'])){
$result['self_rata_premium'] = $memArr['self_rata_premium'] ?? 0;
}
return $result;
}
}
}
if (!function_exists('premium_calculation_manager_old')) {
function premium_calculation_manager_old($emp_data, $policy_terms, $slab_details, $default_si = null)
{
@ -1844,14 +1834,13 @@ if (!function_exists('premium_calculation_manager')) {
$emp_data['policy_details']['basic_cover_si'] = 0;
$emp_data['policy_details']['premium'] = 0;
// if(isset($emp_data['self_rata_premium']) && !empty($emp_data['self_rata_premium'])){
// $self_rata_premium = (int)($emp_data['self_rata_premium'] ?? 0);
// $dependent_rata_premium = (int)($emp_data['policy_details']['rata_premimum'] ?? 0);
// $actual_rata_premium = abs($dependent_rata_premium - $self_rata_premium);
// $emp_data['policy_details']['rata_premimum'] = $actual_rata_premium;
// $emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst / 100)), 2, '.', '');
// }
if(isset($emp_data['self_rata_premium']) && !empty($emp_data['self_rata_premium'])){
$self_rata_premium = (int)($emp_data['self_rata_premium'] ?? 0);
$dependent_rata_premium = (int)($emp_data['policy_details']['rata_premimum'] ?? 0);
$actual_rata_premium = abs($dependent_rata_premium - $self_rata_premium);
$emp_data['policy_details']['rata_premimum'] = $actual_rata_premium;
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst / 100)), 2, '.', '');
}
}else if(strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 1 && ($emp_data['temp']['action'] == 'I' || $emp_data['temp']['action'] == 'A' || $emp_data['temp']['action'] == 'MI')){
@ -1867,7 +1856,6 @@ if (!function_exists('premium_calculation_manager')) {
}
}
if (!function_exists('calculate_pro_rata_premimum')) {
function calculate_pro_rata_premimum($premium, $employee_policy_coverage_days, $policy_coverage_days)
{
@ -1990,7 +1978,6 @@ if (!function_exists('get_emp_policy_records_from_audit_history')) {
}
}
if (!function_exists('replace_original_data')) {
function replace_original_data(array $original_data, array $current_data)
{
@ -2062,7 +2049,6 @@ if (!function_exists('remap_default_age_ratio_into_relationship')) {
}
}
if (!function_exists('check_dup_mobileno')) {
function check_dup_mobileno(array $row, array $existing_mobilenos)
{
@ -2192,7 +2178,6 @@ if (!function_exists('convert_string_to_date')) {
}
}
if (!function_exists('transform_enrollment_row_to_inception_row')) {
function transform_enrollment_row_to_inception_row($row)
{
@ -2428,7 +2413,6 @@ if (!function_exists('check_unit')) {
}
}
if (!function_exists('transform_si_excel_row_to_calculatable_format')) {
function transform_si_excel_row_to_calculatable_format(array $employee, array $employee_policy, array $maxage_and_maxcount, array $slab_details, string $applicable_slab_name, string $augmented_si, array $grid_master)
{
@ -2888,3 +2872,36 @@ if (!function_exists('is_valid_or_empty_email')) {
}
}
if (!function_exists('validatet_family_floter_rata_premium')) {
function validatet_family_floter_rata_premium($family){
if (count($family) === 2) {
return $family; // skip if only two members
}
$dependentRataGiven = false;
foreach ($family as &$row) {
// Skip if the member is self
if (strtolower($row['relationship']) == 'self') {
continue;
}
// For dependents
if (isset($row['temp']['premium_type']) && $row['temp']['premium_type'] == 1) {
if (!$dependentRataGiven) {
// First eligible dependent keeps premium
$dependentRataGiven = true;
} else {
$row['policy_details']['rata_premimum'] = 0;
$row['policy_details']['gst'] = 0;
}
}
}
return $family;
}
}

View File

@ -90,7 +90,7 @@ class ClientModel extends Model
->join('policy_type pt','client_policy.policy_type_id = pt.id')
->where('client_policy.client_id',$client['id'])
->where('client_policy.is_active', 1)
->where('client_policy.policy_status', 1)
// ->where('client_policy.policy_status', 1)
->findAll();
$client['policies'] = $clientPolicies;

View File

@ -133,7 +133,7 @@ class ClientPolicyModel extends Model
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
->where('client_policy.client_id', $client_id)
->where('client_policy.policy_status', 1)
// ->where('client_policy.policy_status', 1)
->where('client_policy.is_active', 1)
->get()
->getResult();

View File

@ -275,8 +275,8 @@ class EmployeeModel extends Model
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', "active")
->where('employee_polices.status', "active")
->whereIn('employees.emp_status', ['active', 'expired'])
->whereIn('employee_polices.status', ['active', 'expired'])
->where('employees.emp_code', $emp_code);
if(!empty($client_id)){

View File

@ -194,7 +194,7 @@
<div class="form-row">
<!-- Example: Member welcome mail -->
<!-- <div class="form-group col-md-6 mail-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
@ -209,9 +209,9 @@
</a>
</div>
</div>
</div> -->
</div>
<!-- Example: Member reminder mail -->
<!-- <div class="form-group col-md-6 mail-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
@ -226,7 +226,7 @@
</a>
</div>
</div>
</div> -->
</div>
</div>
@ -266,7 +266,7 @@
</div>
</div>
<!-- member review and summary mail -->
<!-- <div class="form-group col-md-6 mail-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
@ -283,13 +283,13 @@
</div>
</div> -->
</div>
</div>
<div class="form-row">
<!-- Account Manager Summary Mail row-->
<!-- <div class="form-group col-md-6 mail-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
@ -304,9 +304,9 @@
</a>
</div>
</div>
</div> -->
</div>
<!-- client hr summary mail -->
<!-- <div class="form-group col-md-6 mail-row">
<div class="form-group col-md-6 mail-row">
<div class="mail-section">
<div class="left">
<label class="switch">
@ -321,7 +321,7 @@
</a>
</div>
</div>
</div> -->
</div>
</div>
<div class="form-row">

View File

@ -84,7 +84,7 @@ table.dataTable tbody td {
<th style="display: none;">Business Type</th>
<th style="display: none;">Client Type</th>
<th>Insured Name</th>
<th>Policy/<br>Endorsement</th>
<th style="text-align:center;">Policy /<br>Endorsement</th>
<th>Policy Type</th>
<th style="display: none;">BAP Group</th>
<th style="display: none;">Vehicle Number</th>
@ -100,9 +100,9 @@ table.dataTable tbody td {
<th style="display: none;">Remarks</th>
<th>BP Premium</th>
<th>TP/Ter Premium</th>
<th style="display: none;">Premium <br> (without GST)</th>
<th style="text-align:center;">Premium <br>(without GST)</th>
<!-- <th style="display: none;">GST @ 18%</th> -->
<th>Total Premium</th>
<th style="display: none;">Total Premium</th>
<th>BP%</th>
<th>TP/Ter%</th>
<th style="display: none;">Rewards</th>
@ -144,9 +144,9 @@ table.dataTable tbody td {
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
<td class="right-align-input"><?php echo $row['bp_amt'] ?: '0.00'; ?></td>
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
<td class="right-align-input" style="display: none;"><?php echo $row['premium_wo_gst']; ?></td>
<td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td>
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
<td class="right-align-input"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
<td class="right-align-input" style="display: none;"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?>%</td>
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'] ?: '0.00';?>%</td>
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>