fixing logic

This commit is contained in:
KhatamNugraha
2024-06-20 12:00:38 +07:00
parent 0e2242d89f
commit 2419241f8e
2 changed files with 14 additions and 9 deletions

View File

@ -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
}
}

View File

@ -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;