From b2ae4a63c4f638b55361bc2056ae3c709c53e9a8 Mon Sep 17 00:00:00 2001 From: Tb Fajri Date: Thu, 27 Jul 2023 10:45:19 +0700 Subject: [PATCH] update plan id --- .../Internal/Services/MemberEnrollmentService.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Modules/Internal/Services/MemberEnrollmentService.php b/Modules/Internal/Services/MemberEnrollmentService.php index 2b12a7ab..cffc32d2 100644 --- a/Modules/Internal/Services/MemberEnrollmentService.php +++ b/Modules/Internal/Services/MemberEnrollmentService.php @@ -565,6 +565,7 @@ class MemberEnrollmentService "policy_in_force" => $row['policy_in_force'] ?? null, "start_no_claim" => $row['start_no_claim'] ?? null, "end_no_claim" => $row['end_no_claim'] ?? null, + "plan_id" => $row['plan_id'] ?? null, "members_effective_date" => $row['member_effective_date'] ?? null, "members_expire_date" => $row['member_expiry_date'] ?? null, @@ -575,14 +576,13 @@ class MemberEnrollmentService "telephone_res" => $row['telephone_res'] ?? null, "telephone_office" => $row['telephone_office'] ?? null, ]; - // $this->validateRow($row); if (!isset($corporate->currentPolicy) || $corporate->currentPolicy->code != $row['policy_number']) { throw new ImportRowException(__('enrollment.POLICY_NUMBER_NOT_MATCH', [ 'policy_id' => $row['policy_number'] ]), 0, null, $row); } - + // validasi member efektif date range date in periode date coroporate $member_effective_date = date("Y-m-d", strtotime($row['member_effective_date'])); $date_terminated = date("Y-m-d", strtotime($row['date_terminated'])); @@ -648,6 +648,7 @@ class MemberEnrollmentService 'start' => $corporate->currentPolicy->start ]), 0, null, $row); } + if ($members_expire_date >= $corporate->currentPolicy->end && ($members_expire_date != $corporate->currentPolicy->end)) { throw new ImportRowException(__('enrollment.LESS_THAN', [ 'date_param' => 'Member Expired Date', @@ -656,6 +657,7 @@ class MemberEnrollmentService 'end' => $corporate->currentPolicy->end ]), 0, null, $row); } + if ($members_expire_date <= $member_effective_date && ($members_expire_date != $member_effective_date)) { throw new ImportRowException(__('enrollment.MORE_THAN', [ @@ -665,14 +667,14 @@ class MemberEnrollmentService 'start' => $member_effective_date ]), 0, null, $row); } - + if($corporate->code != $row['corporate_id']){ throw new ImportRowException(__('enrollment.CORPORATE_CODE_NOT_MATCH', [ 'corporate_id' => $row['corporate_id'] ]), 0, null, $row); } - + switch ($row['record_mode']) { case "1": // New Member $this->validateRow($row); @@ -794,7 +796,7 @@ class MemberEnrollmentService $member = Member::query() ->where('member_id', $row['member_id']) ->first(); - + // Validate If Exist Member if (!$member) { throw new ImportRowException(__('enrollment.MEMBER_NOT_FOUND', [