fixing account datetime
This commit is contained in:
@ -35,6 +35,7 @@ class Account extends Model
|
||||
|
||||
public function getSearchAccount($cif, $arrAccount, $kodecabang, $startDate)
|
||||
{
|
||||
// dd($startDate);
|
||||
|
||||
$uppercaseKodeCabang = Str::upper($kodecabang);
|
||||
$data = [];
|
||||
@ -42,8 +43,8 @@ class Account extends Model
|
||||
|
||||
if($arrAccount == null) {
|
||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
|
||||
->selectRaw('AC.CUSTOMER_NO, MAX(INACTIV_MARKER) as INACTIV_MARKER,AC.ACCOUNT_NUMBER,MAX(AC.BATCH_DATE) AS BATCH_DATE,MAX(AC.CURRENCY)AS CURRENCY, AC.SHORT_TITLE,MAX(AC.OPENING_DATE) AS OPENING_DATE, MAX(AC.WORKING_BALANCE) AS WORKING_BALANCE, MAX(AC.CATEGORY) AS CATEGORY,CT.SHORT_NAME,CP.COMPANY_NAME')
|
||||
->join('STG_DB.CATEGORY AS CT', 'AC.CATEGORY', '=', 'CT.ID')
|
||||
->selectRaw('AC.CUSTOMER_NO,AC.ACCOUNT_NUMBER,AC.BATCH_DATE,AC.WORKING_BALANCE,CP.COMPANY_NAME,AC.CURRENCY,CT.SHORT_NAME')
|
||||
->join('STG_DB.CATEGORY AS CT', 'AC.CATEGORY', '=', 'CT.ID')
|
||||
->join('STG_DB.COMPANY AS CP', 'AC.CO_CODE', '=', 'CP.ID')
|
||||
->where('CUSTOMER_NO', $cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
|
||||
@ -51,7 +52,7 @@ class Account extends Model
|
||||
->where('AC.BATCH_DATE', $startDate)
|
||||
->whereIn(DB::raw("LEFT(CATEGORY, 3)"), ['100','600','660','101','324'])
|
||||
// ->orWhere(DB::raw("LEFT(CATEGORY, 2)"),'32')
|
||||
->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'LIMIT_REF')
|
||||
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','AC.BATCH_DATE','WORKING_BALANCE','COMPANY_NAME','CURRENCY','SHORT_NAME')
|
||||
->limit(100);
|
||||
} else {
|
||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT")
|
||||
|
@ -129,7 +129,6 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($Accounts as $key => $value) {
|
||||
$cekProductAccount = $Account->getCekProduct($value->CUSTOMER_NO,$value->ACCOUNT_NUMBER, $value->BATCH_DATE)->first();
|
||||
if (!$cekProductAccount) {
|
||||
@ -378,7 +377,8 @@ class KonfirmasiBankController extends Controller
|
||||
$arrAccount = explode(",", $request['accNo']);
|
||||
// $startDate = Carbon::parse($request['startDate2']);
|
||||
// dd($tanggal1 );
|
||||
$dateCore = Carbon::parse($request['startDate2']);;
|
||||
$dateCoreAccount = Carbon::parse($request['startDate2']);
|
||||
$dateCoreDepo = Carbon::parse($request['startDate2']);
|
||||
// dd( $dateCore);
|
||||
$Account = new Account();
|
||||
$data = [];
|
||||
@ -389,31 +389,35 @@ class KonfirmasiBankController extends Controller
|
||||
$rekEscrow = [];
|
||||
$DataAnjak = [];
|
||||
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore->format('m/d/Y'))->get();
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount->format('m/d/Y'))->get();
|
||||
|
||||
|
||||
if ($listAccount->isEmpty()) {
|
||||
$dateCore = $dateCore->addDays(1)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
|
||||
$dateCoreDepo = $dateCoreDepo->addDays(1)->format('m/d/Y');
|
||||
$dateCoreAccount = $dateCoreAccount->subDays(1)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
|
||||
if($listAccount->isEmpty()){
|
||||
$dateCore = $dateCore->addDays(2)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
$dateCoreDepo = $dateCoreDepo->addDays(2)->format('m/d/Y');
|
||||
$dateCoreAccount = $dateCoreAccount->subDays(2)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
|
||||
if ($listAccount->isEmpty()) {
|
||||
$dateCore = $dateCore->addDays(3)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
$dateCoreDepo = $dateCoreDepo->addDays(3)->format('m/d/Y');
|
||||
$dateCoreAccount = $dateCoreAccount->subDays(3)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
|
||||
if ($listAccount->isEmpty()) {
|
||||
$dateCore = $dateCore->addDays(4)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
$dateCoreDepo = $dateCoreDepo->addDays(4)->format('m/d/Y');
|
||||
$dateCoreAccount = $dateCoreAccount->subDays(4)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
|
||||
if ($listAccount->isEmpty()) {
|
||||
$dateCore = $dateCore->addDays(5)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
$dateCoreDepo = $dateCoreDepo->addDays(5)->format('m/d/Y');
|
||||
$dateCoreAccount = $dateCoreAccount->subDays(5)->format('m/d/Y');
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DD( $listAccount);
|
||||
|
||||
// try {
|
||||
foreach ($listAccount as $key1 => $account) {
|
||||
@ -442,7 +446,7 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
$DataDepo = [];
|
||||
$Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||
$Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCoreDepo)->get();
|
||||
|
||||
foreach ($Deposito as $keyDep => $depo) {
|
||||
|
||||
@ -458,7 +462,7 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
|
||||
$Arrangement = $Account->getPinjaman($request['cusNo'], $dateCore)->get();
|
||||
$Arrangement = $Account->getPinjaman($request['cusNo'], $dateCoreAccount)->get();
|
||||
|
||||
foreach ($Arrangement as $key2 => $pinjaman) {
|
||||
$limtiCheck = $Account->getLimitCheck($pinjaman->LINKED_APPL_ID, $startDate)->first();
|
||||
@ -475,7 +479,7 @@ class KonfirmasiBankController extends Controller
|
||||
|
||||
}
|
||||
|
||||
$listAccountRK = $Account->getAccountRK($arrAccount, $dateCore)->get();
|
||||
$listAccountRK = $Account->getAccountRK($arrAccount, $dateCoreAccount)->get();
|
||||
|
||||
|
||||
foreach ($listAccountRK as $rk => $valRk) {
|
||||
@ -536,7 +540,7 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
//Get DatA Anjak
|
||||
$ListAnjak = $Account->getAccountAnjak($rekEscrow, $dateCore)->get();
|
||||
$ListAnjak = $Account->getAccountAnjak($rekEscrow, $dateCoreAccount)->get();
|
||||
$totalOutstanding = $ListAnjak->sum('OUTSTANDING') != null ? number_format(abs($ListAnjak->sum('OUTSTANDING')), 2, ',', '.') : 'NIHIL';
|
||||
|
||||
|
||||
@ -849,4 +853,4 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user