update controller konfirmasibank

This commit is contained in:
KhatamNugraha
2023-10-03 16:04:18 +07:00
parent 909e89a6f8
commit 800d8dc293
3 changed files with 17 additions and 27 deletions

View File

@ -39,27 +39,21 @@ class ViewAccount extends Model
]; ];
public function getSearchAccount($cif ,$arrAccount, $kodecabang, $startDate){ public function getSearchAccount($cif ,$arrAccount, $kodecabang, $startDate){
// dd($cif ,$arrAccount, $kodecabang, $startDate);
// dd($cif ,$arrAccount, $kodecabang, $startDate);
$today = Carbon::now();
$currentYear = $today->format("Y");
$pastYear = $today->subYear(3)->format('Y');
$uppercaseKodeCabang = Str::upper($kodecabang); $uppercaseKodeCabang = Str::upper($kodecabang);
$data = []; $data = [];
// dd($arrAccount);
if($arrAccount == null){ if($arrAccount == null){
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT")
->select('*') ->select('*')
->where('CUSTOMER_NO',$cif) ->where('CUSTOMER_NO',$cif)
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%") ->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
->where('INACTIV_MARKER', NULL) ->where('INACTIV_MARKER', NULL)
->where('BATCH_DATE', $startDate) ->where('BATCH_DATE', $startDate)
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660']); ->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101']);
// ->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_NAME','BATCH_DATE','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE','INACTIV_MARKER'); // ->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_NAME','BATCH_DATE','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE','INACTIV_MARKER');
}else{ }else{
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT") $data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT")
@ -78,13 +72,13 @@ class ViewAccount extends Model
public function getAccount($cif ,$arrAccount, $kodecabang, $startDate){ public function getAccount($cif ,$arrAccount, $kodecabang, $startDate){
$uppercaseKodeCabang = Str::upper($kodecabang); $uppercaseKodeCabang = Str::upper($kodecabang);
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS") $data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT")
->select('*') ->select('*')
->where('CUSTOMER_NO',$cif) ->where('CUSTOMER_NO',$cif)
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%") ->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
->where('INACTIV_MARKER', NULL) ->where('INACTIV_MARKER', NULL)
->where('BATCH_DATE', 'like', "%" .$startDate."%") ->where('BATCH_DATE', $startDate)
//->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660']) ->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
->whereIn('ACCOUNT_NUMBER', $arrAccount); ->whereIn('ACCOUNT_NUMBER', $arrAccount);
return $data; return $data;
} }
@ -99,13 +93,13 @@ class ViewAccount extends Model
} }
public function getPinjaman($cus_no,$arrAccount){ public function getPinjaman($cus_no,$arrAccount, $dateCore){
$data = []; $data = [];
$data = DB::connection("db2")->table("STG_DB.VW_AA_ARR") $data = DB::connection("db2")->table("STG_DB.VW_AA_ARR")
->select('*') ->select('*')
->where('CUSTOMER',$cus_no) ->where('CUSTOMER',$cus_no)
->where('CATEGORY' , 3) ->where('CATEGORY' , 3)
->whereIn('ACCOUNT_NUMBER', $arrAccount); ->where('BATCH_DATE', $dateCore);
return $data; return $data;

View File

@ -42,11 +42,8 @@
} }
// dd($request); // dd($request);
$data = []; $data = [];
// Tanggal awal
// Contoh tanggal saat ini // Contoh tanggal saat ini
$today = Carbon::now(); $today = Carbon::now();
// dd( $today->format());
// Menambahkan 1 tahun ke tanggal saat ini // Menambahkan 1 tahun ke tanggal saat ini
$currentYear = $today->format("Y"); $currentYear = $today->format("Y");
@ -78,15 +75,13 @@
$Account = new ViewAccount; $Account = new ViewAccount;
$arrAccount = []; $arrAccount = [];
$startDate = Carbon::parse($request->startDate); $startDate = Carbon::parse($request->startDate);
$dateCore = $startDate->subDays(2); $dateCore = $startDate->subDays(2)->format('d/m/Y');
// dd($dateCore);
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get(); $Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get();
// $Arrangement = $Account->getAAaccount($request->cif)->get();
$maturityDate = '';
$aaID= '';
$product = ''; $product = '';
foreach ($Accounts as $key => $account) { foreach ($Accounts as $key => $account) {
$Arrangement = $Account->getAAaccount($request->cif , $account->ACCOUNT_NUMBER)->first(); $Arrangement = $Account->getAAaccount($request->cif , $account->ACCOUNT_NUMBER)->first();
@ -118,6 +113,8 @@
} }
$arrAccount = explode("," , $request['acc_no']); $arrAccount = explode("," , $request['acc_no']);
$startDate = Carbon::parse($request['startDate']);
$dateCore = $startDate->subDays(2)->format('d/m/Y');
$ViewAccount = new ViewAccount; $ViewAccount = new ViewAccount;
$data = []; $data = [];
@ -126,7 +123,7 @@
$DataLimit = []; $DataLimit = [];
$DataAA = []; $DataAA = [];
$listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $request['startDate'])->get(); $listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $dateCore)->get();
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first(); $GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
@ -143,7 +140,7 @@
$DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO; $DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO;
$DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME; $DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME;
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY; $DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
$DataAccounts[$key1]['PRODUCT'] = $Arrangement->PRODUCT; $DataAccounts[$key1]['PRODUCT'] = $Arrangement->PRODUCT ?? 'NIHIL';
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME; $DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE; $DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
$DataAccounts[$key1]['MATURITY_DATE'] = $Arrangement->MATURITY_DATE ?? 'NIHIL' ; $DataAccounts[$key1]['MATURITY_DATE'] = $Arrangement->MATURITY_DATE ?? 'NIHIL' ;
@ -154,8 +151,7 @@
$ListPinjaman =$ViewAccount->getPinjaman($request['cus_no'],$arrAccount )->get(); $ListPinjaman =$ViewAccount->getPinjaman($request['cus_no'],$arrAccount , $dateCore )->get();
$ListLimits = $ViewAccount->getLimit($request['cus_no'],$request['periode']); $ListLimits = $ViewAccount->getLimit($request['cus_no'],$request['periode']);
$fasilitas = Fasilitas::where('nomor_cif',$request['cus_no'] )->where('status',1)->get(); $fasilitas = Fasilitas::where('nomor_cif',$request['cus_no'] )->where('status',1)->get();

View File

@ -157,7 +157,7 @@
<td class="text-center space1">{{ $i++ }}</td> <td class="text-center space1">{{ $i++ }}</td>
<td class="space1">{{ $pinjaman->PRODUCT_LINE }}</td> <td class="space1">{{ $pinjaman->PRODUCT_LINE }}</td>
<td class="space1">{{ $pinjaman->COMPANY_NAME }}</td> <td class="space1">{{ $pinjaman->COMPANY_NAME }}</td>
<td class="space1">{{ $pinjaman->CATEGORY }}</td> <td class="space1">{{ $pinjaman->CATEGORY_NAME }}</td>
<td class="text-center space1 texet-center">{{ $pinjaman->CURRENCY }}</td> <td class="text-center space1 texet-center">{{ $pinjaman->CURRENCY }}</td>
<td class="space1">{{ $pinjaman->WORKING_BALANCE }}</td> <td class="space1">{{ $pinjaman->WORKING_BALANCE }}</td>
<td class="text-center space1">{{ $pinjaman->TERM }}</td> <td class="text-center space1">{{ $pinjaman->TERM }}</td>