update bugs fix record mode 2

This commit is contained in:
2024-01-05 16:48:03 +07:00
parent 7d729f295b
commit e45a4b6f7b
3 changed files with 282 additions and 213 deletions

View File

@@ -337,7 +337,13 @@ class MemberEnrollmentService
} }
public function dateParser($date_from_row) { public function dateParser($date_from_row) {
return is_string($date_from_row) ? Carbon::parse(strtotime($date_from_row)) : Carbon::parse($date_from_row);
if ($date_from_row instanceof DateTime) {
return $date_from_row->format('Y-m-d');
} else {
return date('Y-m-d', strtotime($date_from_row));
}
} }
public function validateDate($dateString, $dateFormat = 'Ymd'){ public function validateDate($dateString, $dateFormat = 'Ymd'){
@@ -372,6 +378,10 @@ class MemberEnrollmentService
throw new ImportRowException(__('enrollment.MEMBER_ID_REQUIRED'), 0, null, $row); throw new ImportRowException(__('enrollment.MEMBER_ID_REQUIRED'), 0, null, $row);
} }
if (empty($row['plan_id'])) {
throw new ImportRowException(__('Plan ID Required'), 0, null, $row);
}
if ($row['record_type'] == 'P') { if ($row['record_type'] == 'P') {
if (!empty($row['principal_id'])) { if (!empty($row['principal_id'])) {
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_REQUIRED'), 0, null, $row); throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_REQUIRED'), 0, null, $row);
@@ -391,21 +401,21 @@ class MemberEnrollmentService
->first(); ->first();
if(empty($member)){ if(empty($member)){
throw new ImportRowException(__('enrollment.PRINCIPAL_NOT_IN_MEMBER_ID'), 0, null, $row); // throw new ImportRowException(__('enrollment.PRINCIPAL_NOT_IN_MEMBER_ID'), 0, null, $row);
} else { } else {
if ($member['record_type'] != 'P'){ // if ($member['record_type'] != 'P'){
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_SAME_MEMBER_ID'), 0, null, $row); // throw new ImportRowException(__('enrollment.PRINCIPAL_ID_NOT_SAME_MEMBER_ID'), 0, null, $row);
} // }
} }
if (empty($row['principal_id'])) { if (empty($row['principal_id'])) {
throw new ImportRowException(__('enrollment.PRINCIPAL_ID_REQUIRED'), 0, null, $row); throw new ImportRowException(__('enrollment.PRINCIPAL_ID_REQUIRED'), 0, null, $row);
} }
if (empty($row['relationship_with_principal'])){ // if (empty($row['relationship_with_principal'])){
throw new ImportRowException(__('enrollment.RELATIONSHIP_WITH_PRICIPAL_REQUIRED'), 0, null, $row); // throw new ImportRowException(__('enrollment.RELATIONSHIP_WITH_PRICIPAL_REQUIRED'), 0, null, $row);
} // }
if (!empty($row['relationship_with_principal']) && !in_array($row['relationship_with_principal'], ['H', 'W', 'D', 'S'])){ // if (!empty($row['relationship_with_principal']) && !in_array($row['relationship_with_principal'], ['H', 'W', 'D', 'S'])){
throw new ImportRowException(__('enrollment.RELATIONSHIP_WITH_PRICIPAL_NOT_VALID'), 0, null, $row); // throw new ImportRowException(__('enrollment.RELATIONSHIP_WITH_PRICIPAL_NOT_VALID'), 0, null, $row);
} // }
} }
@@ -420,25 +430,25 @@ class MemberEnrollmentService
// throw new ImportRowException(__('enrollment.BRANCH_CODE_NOT_REQUIRED'), 0, null, $row); // throw new ImportRowException(__('enrollment.BRANCH_CODE_NOT_REQUIRED'), 0, null, $row);
// } // }
if (!empty($row['language']) && !in_array($row['language'], ['M', 'E', 'C', 'I', 'O'])) { // if (!empty($row['language']) && !in_array($row['language'], ['M', 'E', 'C', 'I', 'O'])) {
throw new ImportRowException(__('enrollment.INVALID_LANGUAGE'), 0, null, $row); // throw new ImportRowException(__('enrollment.INVALID_LANGUAGE'), 0, null, $row);
} // }
if (!empty($row['type_of_work']) && !in_array($row['type_of_work'], ['0', '1', '2', '3'])) { // if (!empty($row['type_of_work']) && !in_array($row['type_of_work'], ['0', '1', '2', '3'])) {
throw new ImportRowException(__('enrollment.INVALID_TYPE_OF_WORK'), 0, null, $row); // throw new ImportRowException(__('enrollment.INVALID_TYPE_OF_WORK'), 0, null, $row);
} // }
if (!empty($row['race']) && !in_array($row['race'], ['M', 'C', 'I', 'O'])) { // if (!empty($row['race']) && !in_array($row['race'], ['M', 'C', 'I', 'O'])) {
throw new ImportRowException(__('enrollment.INVALID_RACE'), 0, null, $row); // throw new ImportRowException(__('enrollment.INVALID_RACE'), 0, null, $row);
} // }
if (empty($row['policy_number'])) { if (empty($row['policy_number'])) {
throw new ImportRowException(__('enrollment.POLICY_NUMBER_REQUIRED'), 0, null, $row); throw new ImportRowException(__('enrollment.POLICY_NUMBER_REQUIRED'), 0, null, $row);
} }
if (!empty($row['marital_status']) && !in_array($row['marital_status'], ['S', 'M', 'D'])) { // if (!empty($row['marital_status']) && !in_array($row['marital_status'], ['S', 'M', 'D'])) {
throw new ImportRowException(__('enrollment.INVALID_MARITAL_STATUS'), 0, null, $row); // throw new ImportRowException(__('enrollment.INVALID_MARITAL_STATUS'), 0, null, $row);
} // }
// TODO EFFECTIVE DATE VALIDATION // TODO EFFECTIVE DATE VALIDATION
if (empty($row['member_effective_date'])) { if (empty($row['member_effective_date'])) {
@@ -473,35 +483,35 @@ class MemberEnrollmentService
// TODO FKTP VALIDATION // TODO FKTP VALIDATION
// TODO FKRTL VALIDATION // TODO FKRTL VALIDATION
if (!empty($row['marital_status']) && !in_array($row['marital_status'], ['S', 'M', 'D'])) { // if (!empty($row['marital_status']) && !in_array($row['marital_status'], ['S', 'M', 'D'])) {
throw new ImportRowException(__('enrollment.INVALID_MARITAL_STATUS'), 0, null, $row); // throw new ImportRowException(__('enrollment.INVALID_MARITAL_STATUS'), 0, null, $row);
} // }
if (empty($row['name'])) { if (empty($row['name'])) {
throw new ImportRowException(__('enrollment.NAME_REQUIRED'), 0, null, $row); throw new ImportRowException(__('enrollment.NAME_REQUIRED'), 0, null, $row);
} }
if (!Helper::validatePhoneNumber($row['telephone_mobile'])){ // if (!Helper::validatePhoneNumber($row['telephone_mobile'])){
throw new ImportRowException(__('enrollment.PHONE_INVALID'), 0, null, $row); // throw new ImportRowException(__('enrollment.PHONE_INVALID'), 0, null, $row);
} // }
if ( // if (
!empty($row['telephone_mobile']) // !empty($row['telephone_mobile'])
&& !(substr($row['telephone_mobile'], 0, 4) == '+628' || substr($row['telephone_mobile'], 0, 3) == '628') // && !(substr($row['telephone_mobile'], 0, 4) == '+628' || substr($row['telephone_mobile'], 0, 3) == '628')
) { // ) {
throw new ImportRowException(__('enrollment.PHONE_INVALID'), 0, null, $row); // throw new ImportRowException(__('enrollment.PHONE_INVALID'), 0, null, $row);
} // }
if ( // if (
!empty($row['email']) // !empty($row['email'])
&& !filter_var($row['email'], FILTER_VALIDATE_EMAIL) // && !filter_var($row['email'], FILTER_VALIDATE_EMAIL)
) { // ) {
throw new ImportRowException(__('enrollment.EMAIL_INVALID'), 0, null, $row); // throw new ImportRowException(__('enrollment.EMAIL_INVALID'), 0, null, $row);
} // }
if (empty($row['date_of_birth'])) { // if (empty($row['date_of_birth'])) {
throw new ImportRowException(__('enrollment.DATE_OF_BIRTH_REQUIRED'), 0, null, $row); // throw new ImportRowException(__('enrollment.DATE_OF_BIRTH_REQUIRED'), 0, null, $row);
} // }
// if(!$this->validateDate($row['date_of_birth'])){ // if(!$this->validateDate($row['date_of_birth'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [ // throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['date_of_birth'] // 'title' => $title['date_of_birth']
@@ -520,13 +530,13 @@ class MemberEnrollmentService
// } // }
// TODO DOB FORMAT VALIDATION // TODO DOB FORMAT VALIDATION
if (empty($row['sex'])) { // if (empty($row['sex'])) {
throw new ImportRowException(__('enrollment.SEX_REQUIRED'), 0, null, $row); // throw new ImportRowException(__('enrollment.SEX_REQUIRED'), 0, null, $row);
} // }
if (!in_array($row['sex'], ['F', 'M'])){ // if (!in_array($row['sex'], ['F', 'M'])){
throw new ImportRowException(__('enrollment.SEX_CODE_NOT_VALID'), 0, null, $row); // throw new ImportRowException(__('enrollment.SEX_CODE_NOT_VALID'), 0, null, $row);
} // }
} }
@@ -541,12 +551,14 @@ class MemberEnrollmentService
if(!empty($row['date_terminated'])){ if(!empty($row['date_terminated'])){
$date_terminated = $row['date_terminated']; $date_terminated = $row['date_terminated'];
} }
$member_data = [ $member_data = [
"name" => $row['name'] ?? null, "name" => $row['name'] ?? null,
"member_id" => $row['member_id'] ?? null, "member_id" => $row['member_id'] ?? null,
"payor_id" => $row['payor_id'] ?? null, "payor_id" => $row['payor_id'] ?? null,
"nik" => $row['nik'] ?? null, "nik" => $row['nik'] ?? null,
"birth_date" => $row['date_of_birth'], // "birth_date" => $row['date_of_birth'] ? date("Y-m-d",$row['date_of_birth']) : null,
"birth_date" => $this->dateParser($row['date_of_birth']),
"gender" => Helper::genderNormalization($row['sex']), "gender" => Helper::genderNormalization($row['sex']),
"language" => $row['language'] ?? null, "language" => $row['language'] ?? null,
"race" => $row['race'] ?? null, "race" => $row['race'] ?? null,
@@ -588,6 +600,10 @@ class MemberEnrollmentService
"telephone_res" => $row['telephone_res'] ?? null, "telephone_res" => $row['telephone_res'] ?? null,
"telephone_office" => $row['telephone_office'] ?? null, "telephone_office" => $row['telephone_office'] ?? null,
"suspended" => $row['member_suspended'] ?? null, "suspended" => $row['member_suspended'] ?? null,
"active" => $row['employment_status'] == 'INACTIVE' ? 0 : 1,
"employee_status" => $row['employment_status']
]; ];
// $this->validateRow($row); // $this->validateRow($row);
if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->code != $row['policy_number']) { if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->code != $row['policy_number']) {
@@ -597,91 +613,96 @@ class MemberEnrollmentService
} }
// validasi member efektif date range date in periode date coroporate // validasi member efektif date range date in periode date coroporate
$member_effective_date = date("Y-m-d", strtotime($row['member_effective_date'])); // $member_effective_date = date("Y-m-d", strtotime($row['member_effective_date']));
$date_terminated = date("Y-m-d", strtotime($row['date_terminated'])); // $date_terminated = date("Y-m-d", strtotime($row['date_terminated']));
$member_effective_date = $this->dateParser($row['member_effective_date']);
$date_terminated = $this->dateParser($row['date_terminated']);
if(!empty($row['activation_date'])){ if(!empty($row['activation_date'])){
$activation_date = date("Y-m-d", strtotime($row['activation_date'])); // $activation_date = date("Y-m-d", strtotime($row['activation_date']));
if (($activation_date == $date_terminated) && ($activation_date == $member_effective_date)) { // if (($activation_date == $date_terminated) && ($activation_date == $member_effective_date)) {
throw new ImportRowException(__('enrollment.MORE_THAN', [ // throw new ImportRowException(__('enrollment.MORE_THAN', [
'date_param' => 'Activation Date', // 'date_param' => 'Activation Date',
'date' => $activation_date, // 'date' => $activation_date,
'date_param2' => 'Member Effective Date', // 'date_param2' => 'Member Effective Date',
'start' => $activation_date // 'start' => $activation_date
]), 0, null, $row); // ]), 0, null, $row);
} // }
} }
if (!empty($row['date_terminated'])){ if (!empty($row['date_terminated'])){
$date_terminated = date("Y-m-d", strtotime($row['date_terminated'])); // $date_terminated = date("Y-m-d", strtotime($row['date_terminated']));
if($date_terminated){ // if($date_terminated){
if ($date_terminated <= $member_effective_date && ($date_terminated != $member_effective_date)) { // if ($date_terminated <= $member_effective_date && ($date_terminated != $member_effective_date)) {
throw new ImportRowException(__('enrollment.MORE_THAN', [ // throw new ImportRowException(__('enrollment.MORE_THAN', [
'date_param' => 'Date Terminated Date', // 'date_param' => 'Date Terminated Date',
'date' => $date_terminated, // 'date' => $date_terminated,
'date_param2' => 'Member Effective Date', // 'date_param2' => 'Member Effective Date',
'start' => $member_effective_date // 'start' => $member_effective_date
]), 0, null, $row); // ]), 0, null, $row);
} // }
} // }
} }
// validasi member expried date range date in periode date coroporate // validasi member expried date range date in periode date coroporate
$members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date'])); // $members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date']));
// validasi member expried date must less date member effective // validasi member expried date must less date member effective
$members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date'])); // $members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date']));
$members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date'])); // $members_expire_date = date("Y-m-d", strtotime($row['member_expiry_date']));
if ($member_effective_date <= $corporate->currentPolicy->start && ($member_effective_date != $corporate->currentPolicy->start)) { // if ($member_effective_date <= $corporate->currentPolicy->start && ($member_effective_date != $corporate->currentPolicy->start)) {
throw new ImportRowException(__('enrollment.MORE_THAN', [ // throw new ImportRowException(__('enrollment.MORE_THAN', [
'date_param' => 'Member Effective Date', // 'date_param' => 'Member Effective Date',
'date' => $member_effective_date, // 'date' => $member_effective_date,
'date_param2' => 'Start Period Date', // 'date_param2' => 'Start Period Date',
'start' => $corporate->currentPolicy->start // 'start' => $corporate->currentPolicy->start
]), 0, null, $row); // ]), 0, null, $row);
} // }
if ($member_effective_date >= $corporate->currentPolicy->end && ($member_effective_date != $corporate->currentPolicy->end)) { // if ($member_effective_date >= $corporate->currentPolicy->end && ($member_effective_date != $corporate->currentPolicy->end)) {
throw new ImportRowException(__('enrollment.LESS_THAN', [ // throw new ImportRowException(__('enrollment.LESS_THAN', [
'date_param' => 'Member Effective Date', // 'date_param' => 'Member Effective Date',
'date' => $member_effective_date, // 'date' => $member_effective_date,
'date_param2' => 'End Period Date', // 'date_param2' => 'End Period Date',
'end' => $corporate->currentPolicy->end // 'end' => $corporate->currentPolicy->end
]), 0, null, $row); // ]), 0, null, $row);
} // }
if ($member_effective_date >= $corporate->currentPolicy->end && ($member_effective_date != $corporate->currentPolicy->end)) { // if ($member_effective_date >= $corporate->currentPolicy->end && ($member_effective_date != $corporate->currentPolicy->end)) {
throw new ImportRowException(__('enrollment.LESS_THAN', [ // throw new ImportRowException(__('enrollment.LESS_THAN', [
'date_param' => 'Member Effective Date', // 'date_param' => 'Member Effective Date',
'date' => $member_effective_date, // 'date' => $member_effective_date,
'date_param2' => 'End Period Date', // 'date_param2' => 'End Period Date',
'end' => $corporate->currentPolicy->end // 'end' => $corporate->currentPolicy->end
]), 0, null, $row); // ]), 0, null, $row);
} // }
if ($members_expire_date <= $corporate->currentPolicy->start && ($members_expire_date != $corporate->currentPolicy->start) ) { // if ($members_expire_date <= $corporate->currentPolicy->start && ($members_expire_date != $corporate->currentPolicy->start) ) {
throw new ImportRowException(__('enrollment.MORE_THAN', [ // throw new ImportRowException(__('enrollment.MORE_THAN', [
'date_param' => 'Member Expired Date', // 'date_param' => 'Member Expired Date',
'date' => $members_expire_date, // 'date' => $members_expire_date,
'date_param2' => 'Start Period Date', // 'date_param2' => 'Start Period Date',
'start' => $corporate->currentPolicy->start // 'start' => $corporate->currentPolicy->start
]), 0, null, $row); // ]), 0, null, $row);
} // }
if ($members_expire_date >= $corporate->currentPolicy->end && ($members_expire_date != $corporate->currentPolicy->end)) { // if ($members_expire_date >= $corporate->currentPolicy->end && ($members_expire_date != $corporate->currentPolicy->end)) {
throw new ImportRowException(__('enrollment.LESS_THAN', [ // throw new ImportRowException(__('enrollment.LESS_THAN', [
'date_param' => 'Member Expired Date', // 'date_param' => 'Member Expired Date',
'date' => $members_expire_date, // 'date' => $members_expire_date,
'date_param2' => 'END Period Date', // 'date_param2' => 'END Period Date',
'end' => $corporate->currentPolicy->end // 'end' => $corporate->currentPolicy->end
]), 0, null, $row); // ]), 0, null, $row);
} // }
if ($members_expire_date <= $member_effective_date && ($members_expire_date != $member_effective_date)) { // if ($members_expire_date <= $member_effective_date && ($members_expire_date != $member_effective_date)) {
throw new ImportRowException(__('enrollment.MORE_THAN', [ // throw new ImportRowException(__('enrollment.MORE_THAN', [
'date_param' => 'Member Expired Date', // 'date_param' => 'Member Expired Date',
'date' => $members_expire_date, // 'date' => $members_expire_date,
'date_param2' => 'Member Effective Date', // 'date_param2' => 'Member Effective Date',
'start' => $member_effective_date // 'start' => $member_effective_date
]), 0, null, $row); // ]), 0, null, $row);
} // }
if($corporate->code != $row['corporate_id']){ if($corporate->code != $row['corporate_id']){
@@ -699,7 +720,6 @@ class MemberEnrollmentService
// $query->where('corporate_id', $corporate->id); // $query->where('corporate_id', $corporate->id);
// }) // })
->first(); ->first();
// Validate If Exist Member // Validate If Exist Member
if ($member) { if ($member) {
$person = Person::updateOrCreate( $person = Person::updateOrCreate(
@@ -708,9 +728,8 @@ class MemberEnrollmentService
], ],
[ [
'name' => $row['name'] ?? null, 'name' => $row['name'] ?? null,
// 'birth_date' => $this->dateParser($row['date_of_birth']), 'birth_date' => $this->dateParser($row['date_of_birth']),
'birth_date' => $row['date_of_birth'], 'gender' => Helper::genderNormalization($row['sex']),
'gender' => Helper::genderPerson($row['sex']),
'language' => $row['language'] ?? null, 'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null, 'race' => $row['race'] ?? null,
'phone' => $row['telephone_mobile'] ?? null 'phone' => $row['telephone_mobile'] ?? null
@@ -764,15 +783,15 @@ class MemberEnrollmentService
DB::beginTransaction(); DB::beginTransaction();
$member->fill($member_data); $member->fill($member_data);
if ($member->save()) { if ($member->save()) {
$person = Person::create([ $person = Person::create([
'name' => $row['name'], 'name' => $row['name'],
'birth_date' => $row['date_of_birth'], 'birth_date' => $this->dateParser($row['date_of_birth']),
'gender' => Helper::genderPerson($row['sex']), 'gender' => Helper::genderNormalization($row['sex']) ?? '-',
'language' => $row['language'] ?? null, 'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null, 'race' => $row['race'] ?? null,
'phone' => $row['telephone_mobile'], 'phone' => $row['telephone_mobile'],
]); ]);
$member->person_id = $person->id; $member->person_id = $person->id;
$member->save(); $member->save();
@@ -784,6 +803,7 @@ class MemberEnrollmentService
'end' => $this->dateParser($row['member_expiry_date']), 'end' => $this->dateParser($row['member_expiry_date']),
'status' => 'active' 'status' => 'active'
]); ]);
$memberPolicy->save(); $memberPolicy->save();
if (!empty($row['division_name'])) { if (!empty($row['division_name'])) {
@@ -851,7 +871,7 @@ class MemberEnrollmentService
break; break;
case "2": // Member Information Update (Without Replacement Card) case "2": // Member Information Update (Without Replacement Card)
// $this->validateRow($row); $this->validateRow($row);
$member = Member::query() $member = Member::query()
->where('member_id', $row['member_id']) ->where('member_id', $row['member_id'])
->first(); ->first();
@@ -871,8 +891,7 @@ class MemberEnrollmentService
], ],
[ [
'name' => $row['name'] ?? null, 'name' => $row['name'] ?? null,
// 'birth_date' => $this->dateParser($row['date_of_birth']), 'birth_date' => $this->dateParser($row['date_of_birth']),
'birth_date' => $row['date_of_birth'],
'gender' => Helper::genderPerson($row['sex']), 'gender' => Helper::genderPerson($row['sex']),
'language' => $row['language'] ?? null, 'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null, 'race' => $row['race'] ?? null,
@@ -881,6 +900,13 @@ class MemberEnrollmentService
); );
$member->person_id = $person->id; $member->person_id = $person->id;
$member->name = $row['name'];
$member->employee_status = $row['employment_status'];
$member->gender = Helper::genderPerson($row['sex']);
$member->relation_with_principal = $row['relationship_with_principal'];
$member->marital_status = $row['marital_status'];
$member->save(); $member->save();
try { try {
$memberPolicy = MemberPolicy::query() $memberPolicy = MemberPolicy::query()
@@ -888,6 +914,17 @@ class MemberEnrollmentService
->where('member_id', $row['member_id']) ->where('member_id', $row['member_id'])
->with('member') ->with('member')
->first(); ->first();
// Pengecekan jika ada perubahan di plan
$plan = Plan::query()
->where('code', $row['plan_id'])
->first();
if ($plan){
$memberPlan = MemberPlan::query()
->where('member_id', $member->id)
->first();
$memberPlan->plan_id = $plan->id;
$memberPlan->save();
}
// // Pengecekan jika ada perubahan di plan // // Pengecekan jika ada perubahan di plan
// $plan = Plan::query() // $plan = Plan::query()
@@ -901,52 +938,50 @@ class MemberEnrollmentService
// $memberPlan->save(); // $memberPlan->save();
// } // }
// Update plan //Update plan
// $plans = explode(",",$row['plan_id']); $plans = explode(",",$row['plan_id']);
// if (count($plans) > 0) { if (count($plans) > 0) {
// foreach($plans as $d){ foreach($plans as $d){
// $plan = Plan::query() $plan = Plan::query()
// ->where('code', $d) ->where('code', $d)
// ->where('corporate_id', $corporate->id) ->where('corporate_id', $corporate->id)
// ->first(); ->first();
// if (!$plan) { if (!$plan) {
// throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row); throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
// } }
// $member->memberPlans()->updateOrCreate([ $member->memberPlans()->updateOrCreate([
// 'member_id' => $member->id, 'member_id' => $member->id,
// 'plan_id' => $plan->id, 'plan_id' => $plan->id,
// ], ],
// [ [
// 'plan_id' => $plan->id, 'plan_id' => $plan->id,
// 'status' => 'active', 'status' => 'active',
// 'start' => $this->dateParser($row['member_effective_date']), 'start' => $this->dateParser($row['member_effective_date']),
// 'end' => $this->dateParser($row['member_expiry_date']), 'end' => $this->dateParser($row['member_expiry_date']),
// ]); ]);
// } }
// } else { } else {
// $plan = Plan::query() $plan = Plan::query()
// ->where('code', $row['plan_id']) ->where('code', $row['plan_id'])
// ->where('corporate_id', $corporate->id) ->where('corporate_id', $corporate->id)
// ->first(); ->first();
// if (!$plan) { if (!$plan) {
// throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row); throw new ImportRowException(__('enrollment.PLAN_NOT_FOUND'), 0, null, $row);
// } }
// $member->memberPlans()->updateOrCreate([ $member->memberPlans()->updateOrCreate([
// 'member_id' => $member->id, 'member_id' => $member->id,
// 'plan_id' => $plan->id, 'plan_id' => $plan->id,
// ], ],
// [ [
// 'plan_id' => $plan->id, 'plan_id' => $plan->id,
// 'status' => 'active', 'status' => 'active',
// 'start' => $this->dateParser($row['member_effective_date']), 'start' => $this->dateParser($row['member_effective_date']),
// 'end' => $this->dateParser($row['member_expiry_date']), 'end' => $this->dateParser($row['member_expiry_date']),
// ]); ]);
// } }
// end update plan // end update plan
// Update jika ada perubahaan di ASO maka akan teriflek ke LMS juga\ // Update jika ada perubahaan di ASO maka akan teriflek ke LMS juga
$userInsuranceLms = UserInsurance::query() $userInsuranceLms = UserInsurance::query()
->where('sNoPolis', $row['member_id']) ->where('sNoPolis', $row['member_id'])
->first(); ->first();
@@ -1021,7 +1056,8 @@ class MemberEnrollmentService
], ],
[ [
'nIDUser' => $nIDUser, 'nIDUser' => $nIDUser,
'dTanggalLahir' => $row['date_of_birth'], // 'dTanggalLahir' => $row['date_of_birth'],
'dTanggalLahir' => $this->dateParser($row['date_of_birth']),
'dCreateOn' => date('Y-m-d H:i:s'), 'dCreateOn' => date('Y-m-d H:i:s'),
'sMartialStatus' => $sMartialStatus != 0 ? $sMartialStatus : null, 'sMartialStatus' => $sMartialStatus != 0 ? $sMartialStatus : null,
'nIDJenisKelamin' => $nIDJenisKelamin, 'nIDJenisKelamin' => $nIDJenisKelamin,

View File

@@ -57,6 +57,7 @@ class Member extends Model
"endorsement_date", "endorsement_date",
"members_effective_date", "members_effective_date",
"members_expire_date", "members_expire_date",
"employee_status",
"activation_date", "activation_date",
"terminated_date", "terminated_date",
"remarks", "remarks",

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('members', function (Blueprint $table) {
$table->string('employee_status')->after('terminated_date')->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('members', function (Blueprint $table) {
$table->dropColumn('employee_status');
});
}
};