Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
f2e79abfe7
@ -5673,7 +5673,7 @@ class ClientController extends AdminController
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 726]);
|
||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||
// $res = $empServiceController->employeesEnrollmentInsert(['file_id' => 836]);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '978']);
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '1131']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '1681']);
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '2033']);
|
||||
// $res = $empServiceController->compareMemberDataAndInceptionData(['file_id' => '1126']);
|
||||
@ -5737,8 +5737,8 @@ class ClientController extends AdminController
|
||||
// $res = $EmpDataServiceController->generateExcelForCorrection($batch_data);
|
||||
// $res = $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die;
|
||||
// $res = $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 387]); //for live
|
||||
// $res = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 387]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live
|
||||
// $res = $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 310]); dd($res);//for live
|
||||
// $res = $EmpDataServiceController->getInceptionBasePremium(["13332","13333","13334","13335","13336"]); dd($res);//for live
|
||||
|
||||
@ -3202,6 +3202,7 @@ class EmpDataServiceController extends BaseController
|
||||
$empData['rata_premimum'] = $value[16];
|
||||
$empData['gst'] = $value[17];
|
||||
$empData['created_by'] = $user_id;
|
||||
$empData['old_basic_cover_si'] = $value[9];
|
||||
|
||||
$emp_details[] = $empData;
|
||||
}
|
||||
@ -3222,11 +3223,41 @@ class EmpDataServiceController extends BaseController
|
||||
// $insertedIds[] = $startId + $i;
|
||||
// }
|
||||
|
||||
// $insertedIds = [];
|
||||
// foreach ($emp_details as $emp) {
|
||||
|
||||
// $old_si_value = $emp['old_basic_cover_si'];
|
||||
// $new_si_value = $emp['basic_cover_si'];
|
||||
|
||||
// if($old_si_value < $new_si_value){
|
||||
// $insertedIds['si_adjustment'] = 2;
|
||||
// }else{
|
||||
// $insertedIds['si_adjustment'] = 1;
|
||||
// }
|
||||
|
||||
// unset($emp['old_basic_cover_si']);
|
||||
// $insertedIds['pk'] = $this->employeePolicyModel->insert($emp);
|
||||
// }
|
||||
|
||||
$insertedIds = [];
|
||||
foreach ($emp_details as $emp) {
|
||||
$insertedIds[] = $this->employeePolicyModel->insert($emp);
|
||||
}
|
||||
|
||||
$old_si_value = $emp['old_basic_cover_si'];
|
||||
$new_si_value = $emp['basic_cover_si'];
|
||||
|
||||
// Determine SI adjustment type
|
||||
$si_adjustment = ($old_si_value < $new_si_value) ? 1 : 2;
|
||||
|
||||
unset($emp['old_basic_cover_si']);
|
||||
|
||||
// Insert and store PK with adjustment info
|
||||
$pk = $this->employeePolicyModel->insert($emp);
|
||||
|
||||
$insertedIds[] = [
|
||||
'pk' => $pk,
|
||||
'si_adjustment' => $si_adjustment
|
||||
];
|
||||
}
|
||||
// dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
@ -3241,7 +3272,6 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => $rounded_totals,
|
||||
]);
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Employee count : {data}', ['data' => $emp_count]);
|
||||
$this->myLogger->logme('error', 'SI Enhancement Update Endorsement ID -- Batch File status : {data}', ['data' => $status_val]);
|
||||
|
||||
@ -4278,60 +4308,164 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
// public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||
// {
|
||||
// // return $arrayData;
|
||||
|
||||
// if (!empty($arrayData)) {
|
||||
|
||||
// $client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
|
||||
// $units = json_decode($client_branch_data['units']);
|
||||
|
||||
// foreach($units as $unit)
|
||||
// {
|
||||
|
||||
// $amount = $this->employeePolicyModel->query("
|
||||
// SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
// FROM employee_polices
|
||||
// JOIN employees ON employees.id = employee_polices.employee_id
|
||||
// WHERE employees.unit = '$unit'
|
||||
// AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
// ")->getRow();
|
||||
|
||||
// if($amount){
|
||||
|
||||
// $insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
// $description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
// $data = [
|
||||
|
||||
// 'amount' => $amount->total_sum,
|
||||
// 'sub_type_id' => 4,
|
||||
// 'client_id' => $arrayData['client_id'],
|
||||
// 'client_policy_id' => $arrayData['client_policy_id'],
|
||||
// 'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
// 'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
// 'insurer_id' => $insurer_id['insurer_id'],
|
||||
// 'unit' => $unit,
|
||||
// 'description' => $description,
|
||||
// 'transaction_type' => 'Debit',
|
||||
// 'updated_by' => $arrayData['user_id'],
|
||||
// 'event_name' => $arrayData['event_name'],
|
||||
// 'is_active' => 1,
|
||||
// 'cd_ac_pk' => $insurer_id['cd_ac_pk']
|
||||
// ];
|
||||
|
||||
// $response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
// }
|
||||
// }
|
||||
|
||||
// $msg = "SI Enhancement Cash Deposite Updated Successfully ";
|
||||
// return [$msg];
|
||||
|
||||
// // print_r($response);
|
||||
// // $query = $this->employeePolicyModel->getLastQuery();
|
||||
// // echo $query . "<br>";
|
||||
|
||||
// } else {
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||
{
|
||||
// return $arrayData;
|
||||
|
||||
if (!empty($arrayData)) {
|
||||
|
||||
$client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
|
||||
$units = json_decode($client_branch_data['units']);
|
||||
|
||||
foreach($units as $unit)
|
||||
{
|
||||
foreach ($units as $unit) {
|
||||
|
||||
$amount = $this->employeePolicyModel->query("
|
||||
$si_enhance_amt = 0;
|
||||
$si_decrease_amt = 0;
|
||||
|
||||
foreach ($arrayData['employeeIds'] as $value) {
|
||||
|
||||
// If $value is an array, get its elements; otherwise, assign defaults
|
||||
$pk = is_array($value) ? ($value['pk'] ?? null) : $value;
|
||||
$si_adjustment = is_array($value) ? ($value['si_adjustment'] ?? null) : $value;
|
||||
|
||||
$query = "
|
||||
SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
WHERE employees.unit = '{$unit}'
|
||||
AND employee_polices.id = '{$pk}'
|
||||
";
|
||||
|
||||
if($amount){
|
||||
$amount = $this->employeePolicyModel->query($query)->getRow();
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
if ($amount && $amount->total_sum > 0) {
|
||||
if ($si_adjustment == 2) {
|
||||
$si_decrease_amt += $amount->total_sum;
|
||||
} else {
|
||||
$si_enhance_amt += $amount->total_sum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Save Enhancement amount
|
||||
if ($si_enhance_amt > 0) {
|
||||
$policy_data = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
|
||||
$description = 'An amount of ' . round($si_enhance_amt, 2) .
|
||||
' has been debited for ' . $arrayData['count'] . ' employees under ' .
|
||||
remove_underscore_capitalize_first_letter($arrayData['event_name']) .
|
||||
' in ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
|
||||
'amount' => $amount->total_sum,
|
||||
'amount' => round($si_enhance_amt, 2),
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $insurer_id['insurer_id'],
|
||||
'insurer_id' => $policy_data['insurer_id'],
|
||||
'unit' => $unit,
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Debit',
|
||||
'updated_by' => $arrayData['user_id'],
|
||||
'event_name' => $arrayData['event_name'],
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $insurer_id['cd_ac_pk']
|
||||
'cd_ac_pk' => $policy_data['cd_ac_pk']
|
||||
];
|
||||
|
||||
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
}
|
||||
|
||||
// Save Decrease amount
|
||||
if ($si_decrease_amt > 0) {
|
||||
|
||||
$policy_data = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||
|
||||
$description = 'An amount of ' . round($si_decrease_amt, 2) .
|
||||
' has been credited for ' . $arrayData['count'] . ' employees due to a decrease in Sum Insured (SI) under ' .
|
||||
remove_underscore_capitalize_first_letter($arrayData['event_name']) .
|
||||
' in ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||
|
||||
$data = [
|
||||
'amount' => round($si_decrease_amt, 2),
|
||||
'sub_type_id' => 4,
|
||||
'client_id' => $arrayData['client_id'],
|
||||
'client_policy_id' => $arrayData['client_policy_id'],
|
||||
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
|
||||
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
|
||||
'insurer_id' => $policy_data['insurer_id'],
|
||||
'unit' => $unit,
|
||||
'description' => $description,
|
||||
'transaction_type' => 'Credit',
|
||||
'updated_by' => $arrayData['user_id'],
|
||||
'event_name' => $arrayData['event_name'],
|
||||
'is_active' => 1,
|
||||
'cd_ac_pk' => $policy_data['cd_ac_pk']
|
||||
];
|
||||
|
||||
DepositHelper::saveDeposit($data, $arrayData['user_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$msg = "SI Enhancement Cash Deposite Updated Successfully ";
|
||||
$msg = "SI Adjustment Cash Deposit Updated Successfully.";
|
||||
return [$msg];
|
||||
|
||||
// print_r($response);
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2172,6 +2172,7 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id', $employee['id'])
|
||||
->where('client_policy_id', $file['policy_id'])
|
||||
@ -2186,8 +2187,11 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
->where('emp_code', $employee['emp_code'])
|
||||
->where('name', $employee['name'])
|
||||
->where('field_name', 'basic_cover_si')
|
||||
->where('is_active', 1)
|
||||
->where('status !=', 'truncated')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
|
||||
//make entry in endorsement table
|
||||
if (!count($existing_endorsements)) {
|
||||
//transform data to send
|
||||
@ -2235,6 +2239,8 @@ class EmployeeMultiEventServiceController extends BaseController
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'basic_cover_si', 'old_value' => $employee_policy['basic_cover_si'], 'new_value' => $row[3], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'premium', 'old_value' => $employee_policy['premium'], 'new_value' => $calculated_data['policy_details']['premium'], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'si_enhancement_date', 'old_value' => null, 'new_value' => change_date_format($row[4], 'd-M-Y', 'Y-m-d'), 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
}else {
|
||||
$this->myLogger->logme("error", 'Endorsement already exists for this employee ' . json_encode(['file_id' => $file_id, 'emp_code' => $employee['emp_code'], 'emp_name' => $employee['name']]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1684,6 +1684,7 @@ class EmployeeServiceController extends AdminController
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/excel/" . $file['file_name'];
|
||||
|
||||
@ -1702,10 +1703,8 @@ class EmployeeServiceController extends AdminController
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'], $file['client_id']);
|
||||
//iterate each row
|
||||
// dd($slab_details);
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
{
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
foreach ($excel_data as $col_key => $row) {
|
||||
if (check_row_is_empty_or_null($row)) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1720,6 +1719,7 @@ class EmployeeServiceController extends AdminController
|
||||
->where('emp_status', 'active')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->where('employee_id', $employee['id'])
|
||||
->where('client_policy_id', $file['policy_id'])
|
||||
@ -1734,21 +1734,21 @@ class EmployeeServiceController extends AdminController
|
||||
->where('emp_code', $employee['emp_code'])
|
||||
->where('name', $employee['name'])
|
||||
->where('field_name', 'basic_cover_si')
|
||||
->where('is_active', 1)
|
||||
->where('status !=', 'truncated')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
if (!count($existing_endorsements)) {
|
||||
//transform data to send
|
||||
|
||||
//get applicable slab rate for current member relation
|
||||
$pre_rack_rate_name = '';
|
||||
$applicable_rack_rate_name = '';
|
||||
$applicable_rack_rate_master = [];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||
{
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value) {
|
||||
if ($pre_rack_rate_name != $slab_value['rack_rate_name']) {
|
||||
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$rack_rate_json = json_decode($slab_value['additional_relationship'], true);
|
||||
$relationship_array_key = strtolower(trim($employee['relationship']));
|
||||
@ -1761,8 +1761,7 @@ class EmployeeServiceController extends AdminController
|
||||
$relationship_array_key = 'parents-in-law';
|
||||
}
|
||||
|
||||
if(array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[$relationship_array_key] != 0 && $rack_rate_json[$relationship_array_key] != 'NA')
|
||||
{
|
||||
if (array_key_exists($relationship_array_key, $rack_rate_json) && $rack_rate_json[$relationship_array_key] != 0 && $rack_rate_json[$relationship_array_key] != 'NA') {
|
||||
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||
break;
|
||||
@ -1787,17 +1786,14 @@ class EmployeeServiceController extends AdminController
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'basic_cover_si', 'old_value' => $employee_policy['basic_cover_si'], 'new_value' => $row[3], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'premium', 'old_value' => $employee_policy['premium'], 'new_value' => $calculated_data['policy_details']['premium'], 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'], 'emp_code' => $employee['emp_code'], 'table_name' => 'employee_polices', 'actions' => 'si', 'name' => $employee['name'], 'field_name' => 'si_enhancement_date', 'old_value' => null, 'new_value' => change_date_format($row[4], 'd-M-Y', 'Y-m-d'), 'created_by' => $file['created_by'], 'remarks' => 'general si enhancement', 'group_key' => $group_key, 'file_id' => $file['id'], 'status' => 'pending']);
|
||||
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme("error", 'Endorsement already exists for this employee ' . json_encode(['file_id' => $file_id, 'emp_code' => $employee['emp_code'], 'emp_name' => $employee['name']]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
|
||||
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
||||
|
||||
//set success msg to pull notifications
|
||||
$this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
|
||||
return true;
|
||||
|
||||
@ -611,6 +611,36 @@ class EmployeePolicyModel extends Model
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
|
||||
/*
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
ROUND(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||
2
|
||||
) AS pro_rata_premium,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
) AS gst,
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
ROUND(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
),
|
||||
2
|
||||
) AS total
|
||||
*/
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id AS endorsement_primarykey,
|
||||
@ -643,33 +673,40 @@ class EmployeePolicyModel extends Model
|
||||
sidata.old_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
|
||||
ROUND(ABS(sidata.new_si_premium - sidata.old_si_premium), 2) AS difference_premium,
|
||||
ROUND(
|
||||
ABS(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365,
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
),
|
||||
2
|
||||
) AS pro_rata_premium,
|
||||
ROUND(
|
||||
ABS(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
) * 0.18
|
||||
),
|
||||
2
|
||||
) AS gst,
|
||||
ROUND(
|
||||
ABS(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) +
|
||||
ROUND(
|
||||
(
|
||||
(
|
||||
(sidata.new_si_premium - sidata.old_si_premium) *
|
||||
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365
|
||||
) * 0.18,
|
||||
2
|
||||
) * 0.18
|
||||
)
|
||||
),
|
||||
2
|
||||
) AS total
|
||||
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN employees ON employees.emp_code = a.emp_code
|
||||
|
||||
Loading…
Reference in New Issue
Block a user