fixing filter cabang

This commit is contained in:
KhatamNugraha
2024-07-15 10:15:15 +07:00
parent 7a6ec1e4bb
commit 7adf05e50f
2 changed files with 14 additions and 15 deletions

View File

@ -401,7 +401,7 @@ class KonfirmasiBankController extends Controller
$arrAccount = explode(",", $request['accNo']);
$dateCoreAccount = Carbon::parse($request['startDate2']);
$dateCoreDepo = Carbon::parse($request['startDate2']);
// dd( $dateCore);
$cabang = $request['cabang'];
$Account = new Account();
$data = [];
$DataAccounts = [];
@ -412,56 +412,56 @@ class KonfirmasiBankController extends Controller
$DataDepo = [];
$GetCustomer = Nasabah::where('cif',$request['cusNo'])->first();
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = $dateCoreDepo->addDays(1)->format('m/d/Y');
$dateCoreAccount = $dateCoreAccount->subDays(1)->format('m/d/Y');
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
if($listAccount->isEmpty()){
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(2)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(2)->format('m/d/Y');
//$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(3)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(3)->format('m/d/Y');
//$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(4)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(4)->format('m/d/Y');
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(5)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(5)->format('m/d/Y');
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->where('nama_cabang','like', '%'.$cabang.'%')
->orderBy('jenis_rekening', 'DESC')
->get();
}
@ -508,7 +508,7 @@ class KonfirmasiBankController extends Controller
}
$loans = loan::where('sk_nasabah',$request['cusNo'])->whereDate('periode', $dateCoreAccount )->whereNot('outstanding', 0)->get();
$loans = loan::where('sk_nasabah',$request['cusNo'])->whereDate('periode', $dateCoreAccount )->whereNot('outstanding', 0)->where('nama_cabang','like', '%'.$cabang.'%')->get();
$DataLoan = [];
foreach ($loans as $keyLon => $lon) {
$DataLoan[$keyLon]['ACCOUNT_NUMBER'] = $lon->no_rek;
@ -523,7 +523,6 @@ class KonfirmasiBankController extends Controller
}
// $CekDepo = Dpk::where('cif',$request['cusNo'])->whereDate('period', $dateCoreAccount )->whereNot('jumlah_nominal', 0)->where('jenis_rekening', 'DEPOSITO')->first();
$fasilitas = Fasilitas::where('nomor_cif', $request['cusNo'])->where('status', 1)->get();
foreach ($fasilitas as $key3 => $val3) {
$DataFasilitas[$key3]['jenis_fasilitas'] = $val3->jenis_fasilitas;
@ -846,4 +845,4 @@ class KonfirmasiBankController extends Controller
}
}
}