fixing logic
This commit is contained in:
@ -171,9 +171,12 @@ class Account extends Model
|
|||||||
public function getDepo($cust, $acc, $dataCore)
|
public function getDepo($cust, $acc, $dataCore)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//DD($cust, $acc, $dataCore);
|
||||||
|
|
||||||
$timestamp = strtotime($dataCore);
|
$timestamp = strtotime($dataCore);
|
||||||
// Format the timestamp into a date format
|
// Format the timestamp into a date format
|
||||||
$date = date("m/d/Y", $timestamp);
|
$date = date("m/d/Y", $timestamp);
|
||||||
|
// dd( $date);
|
||||||
$matYear = date("Y", $timestamp);
|
$matYear = date("Y", $timestamp);
|
||||||
|
|
||||||
$data = DB::connection("db2")->table("MIS.FACT_DPK AS DPK")
|
$data = DB::connection("db2")->table("MIS.FACT_DPK AS DPK")
|
||||||
@ -191,7 +194,7 @@ class Account extends Model
|
|||||||
// ->where('CUSTOMER_NO', $cif)
|
// ->where('CUSTOMER_NO', $cif)
|
||||||
// ->where('LIMIT_REF', null)
|
// ->where('LIMIT_REF', null)
|
||||||
->where('PER.DATE', $date)
|
->where('PER.DATE', $date)
|
||||||
->whereYear('MAT.DATE', '>', $matYear)
|
//->whereYear('MAT.DATE', '>', $matYear)
|
||||||
->whereIn('DPK.NO_REK', $acc)
|
->whereIn('DPK.NO_REK', $acc)
|
||||||
//->whereIn('DPK.NO_REK', '<>',$arrExp)
|
//->whereIn('DPK.NO_REK', '<>',$arrExp)
|
||||||
// ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'CATEGORY', 'LIMIT_REF')
|
// ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'CATEGORY', 'LIMIT_REF')
|
||||||
|
@ -392,20 +392,20 @@ class KonfirmasiBankController extends Controller
|
|||||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore->format('m/d/Y'))->get();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore->format('m/d/Y'))->get();
|
||||||
|
|
||||||
if ($listAccount->isEmpty()) {
|
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();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
|
||||||
if($listAccount->isEmpty()){
|
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();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
if ($listAccount->isEmpty()) {
|
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();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
if ($listAccount->isEmpty()) {
|
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();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
if ($listAccount->isEmpty()) {
|
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();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,6 +413,8 @@ class KonfirmasiBankController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DD( $listAccount);
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
foreach ($listAccount as $key1 => $account) {
|
foreach ($listAccount as $key1 => $account) {
|
||||||
|
|
||||||
@ -437,11 +439,11 @@ class KonfirmasiBankController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$DataDepo = [];
|
$DataDepo = [];
|
||||||
$Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCore)->get();
|
$Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
|
||||||
foreach ($Deposito as $keyDep => $depo) {
|
foreach ($Deposito as $keyDep => $depo) {
|
||||||
|
|
||||||
$DataDepo[$keyDep]['ACCOUNT_NUMBER'] = $depo->NO_REK;
|
$DataDepo[$keyDep]['ACCOUNT_NUMBER'] = $depo->NO_REK;
|
||||||
|
Reference in New Issue
Block a user