Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
b2f23208f4
@ -121,16 +121,17 @@ class EmpDataServiceController extends BaseController
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if ($insert) {
|
||||
foreach ($objects as $value) {
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
$this->batchListModel->insert($batch_list_data);
|
||||
}
|
||||
}
|
||||
// if ($insert) {
|
||||
// foreach ($objects as $value) {
|
||||
// $batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
// $batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
// $batch_list_data['created_by'] = get_session_userid();
|
||||
// $this->batchListModel->insert($batch_list_data);
|
||||
// }
|
||||
// }
|
||||
|
||||
return true;
|
||||
return $insert;
|
||||
// return true;
|
||||
}
|
||||
|
||||
|
||||
@ -526,8 +527,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
|
||||
|
||||
|
||||
// If batch operation is successful
|
||||
@ -640,7 +641,13 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -794,13 +801,21 @@ class EmpDataServiceController extends BaseController
|
||||
$success = generate_excel($excel_data_info['header'], $excel_data_info['data'], $tempFile);
|
||||
|
||||
if ($success) {
|
||||
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if ($return) {
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -914,7 +929,11 @@ class EmpDataServiceController extends BaseController
|
||||
foreach ($ids as $key => $id) {
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,12 +1021,12 @@ class EmpDataServiceController extends BaseController
|
||||
return 5;
|
||||
}
|
||||
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
$cash_balance = $this->clientDepositModel
|
||||
->where('cd_ac_pk', $policy_details['cd_ac_pk'])
|
||||
// ->where('cd_ac_no', $policy_details['cd_ac_no'])
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'DESC')
|
||||
->first();
|
||||
|
||||
if ($cash_balance == null) {
|
||||
$balance = $this->CDMasterModel
|
||||
@ -1028,7 +1047,7 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = round($totals, 2);
|
||||
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
@ -1112,6 +1131,7 @@ class EmpDataServiceController extends BaseController
|
||||
$export_data['batch_code'] = session()->get('batch_code');
|
||||
$export_data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = null;
|
||||
if($value == 'addition'){
|
||||
|
||||
if(!empty($additionData) && $additionData != null){
|
||||
@ -1125,8 +1145,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $additionData]]);
|
||||
|
||||
}
|
||||
|
||||
@ -1143,8 +1163,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $inceptionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'dependent_addition'){
|
||||
@ -1160,8 +1180,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $dependentAdditionData]]);
|
||||
}
|
||||
}else if($value == 'deletion'){
|
||||
|
||||
@ -1176,8 +1196,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $deletionData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'si_enhancement'){
|
||||
@ -1193,8 +1213,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $enhancementData]]);
|
||||
}
|
||||
|
||||
}else if($value == 'correction'){
|
||||
@ -1210,11 +1230,43 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $correctionData]]);
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array($value, ['deletion', 'si_enhancement', 'correction']) && $insert){
|
||||
|
||||
$endorsement_data_for_update = [];
|
||||
|
||||
if($value == 'deletion'){
|
||||
$endorsement_data_for_update = $deletionData;
|
||||
}else if($value == 'si_enhancement') {
|
||||
$endorsement_data_for_update = $enhancementData;
|
||||
}else if($value == 'correction') {
|
||||
$endorsement_data_for_update = $correctionData;
|
||||
}
|
||||
|
||||
foreach ($endorsement_data_for_update as $key => $edata) {
|
||||
|
||||
$id = $edata->id ?? $edata->endorsement_primarykey ?? null;
|
||||
|
||||
if($id){
|
||||
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||
if ($group_key) {
|
||||
|
||||
$endorsement_update_data['status'] = 'inprogress';
|
||||
if( $export_data['insurer_or_tpa'] == 'tpa'){
|
||||
$endorsement_update_data['is_tpa_export'] = $return ?? generate_random_string(4);
|
||||
}
|
||||
|
||||
$this->empEndorsementModel->where('group_key', $group_key)->set($endorsement_update_data)->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->remove('batch_code');
|
||||
@ -3173,7 +3225,8 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$emp_policy_ids[] = array('id' => $result['emp_policy_id'], 'is_active' => 0);
|
||||
$employeeIds[] = $result['emp_policy_id'];
|
||||
$endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
// $endorsement_details[] = array('id' => $result['id'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
$endorsement_details[] = array('group_key' => $result['group_key'], 'endorsement_id' => $value[19], 'status' => 'complete');
|
||||
if (strtolower($result['relationship']) == 'self') {
|
||||
$no_of_insured[] = ['emp_id' => $result['emp_id'], 'emp_code' => $result['emp_code'], 'emp_name' => $result['emp_name'] ];
|
||||
}else{
|
||||
@ -3258,10 +3311,12 @@ class EmpDataServiceController extends BaseController
|
||||
'pk' => $pk,
|
||||
'si_adjustment' => $si_adjustment
|
||||
];
|
||||
}
|
||||
// dd($insertedIds);
|
||||
} // dd($insertedIds);
|
||||
|
||||
$this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details);
|
||||
// update si enhancement endorsement complete
|
||||
$this->empEndorsementModel->updateBatch($endorsement_details, 'group_key');
|
||||
|
||||
// $this->employeePolicyModel->bulkUpdateForEndorsement($endorsement_details); // do not remove this
|
||||
$this->storeEndorsementNumber($file_id, $endorsement_id, $enrollment_file_id);
|
||||
}
|
||||
|
||||
@ -5084,6 +5139,7 @@ class EmpDataServiceController extends BaseController
|
||||
'tpa_id' => $filedata['tpa_id'],
|
||||
'endorsement_no' => $endorsement_no,
|
||||
'file_id' => $enrollment_file_id,
|
||||
'batch_file_id' => $file_id,
|
||||
'endorsement_type' => $filedata['event_type'],
|
||||
'created_by' => $filedata['created_by'],
|
||||
]);
|
||||
|
||||
@ -668,6 +668,11 @@ class EmployeeController extends AdminController
|
||||
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
if($insurer_or_tpa == "tpa" && in_array($event_type, ['correction', 'deletion', 'si_enhancement'])){
|
||||
session()->setFlashdata('error', "TPA upload is not applicable for this event.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
|
||||
@ -26,7 +26,8 @@ class EmpEndorsementModel extends Model
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"remarks",
|
||||
"file_id"
|
||||
"file_id",
|
||||
"is_tpa_export",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -607,9 +607,11 @@ class EmployeePolicyModel extends Model
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
// $endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
// $subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NOT NULL OR endorsement_id != '')" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NULL OR a.is_tpa_export IS NULL)" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
$subquery_endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "WHERE (endorsement_id IS NULL OR is_tpa_export IS NULL)" : "WHERE (endorsement_id IS NULL OR endorsement_id = '')";
|
||||
|
||||
/*
|
||||
ROUND(sidata.new_si_premium - sidata.old_si_premium, 2) AS difference_premium,
|
||||
|
||||
@ -25,7 +25,8 @@ class EndorsementModel extends Model
|
||||
'updated_by',
|
||||
'updated_at',
|
||||
'file_id',
|
||||
'is_active'
|
||||
'is_active',
|
||||
'batch_file_id',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user