From 2419241f8e76267af4e7f3ad303eebb2f049d3e3 Mon Sep 17 00:00:00 2001 From: KhatamNugraha Date: Thu, 20 Jun 2024 12:00:38 +0700 Subject: [PATCH] fixing logic --- Entities/Account.php | 9 ++++++--- Http/Controllers/KonfirmasiBankController.php | 14 ++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Entities/Account.php b/Entities/Account.php index bef6816..85a3218 100644 --- a/Entities/Account.php +++ b/Entities/Account.php @@ -50,7 +50,7 @@ class Account extends Model // ->where('ARR_A', null) ->where('AC.BATCH_DATE', $startDate) ->whereIn(DB::raw("LEFT(CATEGORY, 3)"), ['100','600','660','101','324']) - // ->orWhere(DB::raw("LEFT(CATEGORY, 2)"),'32') + // ->orWhere(DB::raw("LEFT(CATEGORY, 2)"),'32') ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'LIMIT_REF') ->limit(100); } else { @@ -171,9 +171,12 @@ class Account extends Model public function getDepo($cust, $acc, $dataCore) { + //DD($cust, $acc, $dataCore); + $timestamp = strtotime($dataCore); // Format the timestamp into a date format $date = date("m/d/Y", $timestamp); + // dd( $date); $matYear = date("Y", $timestamp); $data = DB::connection("db2")->table("MIS.FACT_DPK AS DPK") @@ -191,7 +194,7 @@ class Account extends Model // ->where('CUSTOMER_NO', $cif) // ->where('LIMIT_REF', null) ->where('PER.DATE', $date) - ->whereYear('MAT.DATE', '>', $matYear) + //->whereYear('MAT.DATE', '>', $matYear) ->whereIn('DPK.NO_REK', $acc) //->whereIn('DPK.NO_REK', '<>',$arrExp) // ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'CATEGORY', 'LIMIT_REF') @@ -438,4 +441,4 @@ class Account extends Model -} +} \ No newline at end of file diff --git a/Http/Controllers/KonfirmasiBankController.php b/Http/Controllers/KonfirmasiBankController.php index 373ba0d..0f517b6 100644 --- a/Http/Controllers/KonfirmasiBankController.php +++ b/Http/Controllers/KonfirmasiBankController.php @@ -392,20 +392,20 @@ class KonfirmasiBankController extends Controller $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore->format('m/d/Y'))->get(); if ($listAccount->isEmpty()) { - $dateCore = $dateCore->subDays(1)->format('m/d/Y'); + $dateCore = $dateCore->addDays(1)->format('m/d/Y'); $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get(); if($listAccount->isEmpty()){ - $dateCore = $dateCore->subDays(2)->format('m/d/Y'); + $dateCore = $dateCore->addDays(2)->format('m/d/Y'); $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get(); if ($listAccount->isEmpty()) { - $dateCore = $dateCore->subDays(3)->format('m/d/Y'); + $dateCore = $dateCore->addDays(3)->format('m/d/Y'); $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get(); if ($listAccount->isEmpty()) { - $dateCore = $dateCore->subDays(4)->format('m/d/Y'); + $dateCore = $dateCore->addDays(4)->format('m/d/Y'); $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get(); if ($listAccount->isEmpty()) { - $dateCore = $dateCore->subDays(5)->format('m/d/Y'); + $dateCore = $dateCore->addDays(5)->format('m/d/Y'); $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get(); } } @@ -413,6 +413,8 @@ class KonfirmasiBankController extends Controller } } + // DD( $listAccount); + // try { foreach ($listAccount as $key1 => $account) { @@ -437,11 +439,11 @@ class KonfirmasiBankController extends Controller } - } $DataDepo = []; $Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCore)->get(); + foreach ($Deposito as $keyDep => $depo) { $DataDepo[$keyDep]['ACCOUNT_NUMBER'] = $depo->NO_REK;