query update

This commit is contained in:
KhatamNugraha
2024-03-19 13:43:41 +07:00
parent 35729dd584
commit 6d293f42c8
5 changed files with 86 additions and 101 deletions

View File

@ -59,13 +59,12 @@
$today = Carbon::now();
// Menambahkan 1 tahun ke tanggal saat ini
$currentYear = $today->format("Y");
$currentYear = $today->format("d-m-Y");
//get month in roman
// Menambahkan 5 tahun ke tanggal saat ini
$pastYear = $today->subYear(3)->format('d-m-Y');
$dateRoman = $this->numberToRoman($today->format('n'));
// Menambahkan 5 tahun ke tanggal saat ini
$pastYear = $today->subYear(3)->format('Y');
$signer = Signer::where('status',1)->get();
$company = Company::all();
$infoSurat = Letters::orderBy('created_at','desc')->first();
@ -96,13 +95,21 @@
{
$data = [];
$Account = new Account;
$arrAccount = [];
$startDate = Carbon::parse($request->startDate);
$dateCore = $startDate->subDays(2)->format('m/d/Y');
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get();
return json_encode($Accounts );
$data = [];
$Account = new Account;
$arrAccount = [];
$startDate = Carbon::parse($request->startDate);
$dateCore = $startDate->subDays(2)->format('m/d/Y');
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get();
foreach ($Accounts as $key => $value) {
$data[$key]['ACCOUNT_NUMBER'] = $value->ACCOUNT_NUMBER;
$data[$key]['COMPANY_NAME'] = $value->COMPANY_NAME;
$data[$key]['SHORT_NAME'] = $value->SHORT_NAME;
$data[$key]['CURRENCY'] = $value->CURRENCY;
$data[$key]['WORKING_BALANCE'] = number_format($value->WORKING_BALANCE, 2, ',', '.') ;
}
return json_encode($data );
}
@ -348,6 +355,7 @@
$arrAccount = explode("," , $request['accNo']);
$startDate = Carbon::parse($request['startDate2']);
$dateCore = $startDate->subDays(2);
$Account = new Account;
$data = [];
$DataAccounts = [];
@ -355,7 +363,8 @@
// dd($listAccount);
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore )->get();
$Arrangement = $Account->getPinjaman($request['cusNo'], $startDate)->get();
$Arrangement = $Account->getPinjaman($request['cusNo'], $dateCore)->get();
foreach ($listAccount as $key1 => $account) {
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
@ -374,7 +383,7 @@
}
foreach ($Arrangement as $key2 => $pinjaman) {
$MaturityDate = $Account->getMaturityDate($pinjaman->ARRANGEMENT_ID, $startDate )->first();
// $MaturityDate = $Account->getMaturityDate($pinjaman->ARRANGEMENT_ID, $startDate )->first();
$TermAmount = $Account->getTermAmount($pinjaman->ARRANGEMENT_ID,$startDate)->first();
$FixedRate = $Account->getFixedRate($pinjaman->ARRANGEMENT_ID,$startDate)->first();
$balance = $Account->getSingleAccount($pinjaman->LINKED_APPL_ID,$startDate)->first();
@ -384,14 +393,13 @@
$DataPinjaman[$key2]['START_DATE'] = $pinjaman->START_DATE;
$DataPinjaman[$key2]['CURRENCY'] = $pinjaman->CURRENCY;
$DataPinjaman[$key2]['PRODUCT'] = $pinjaman->PRODUCT_LINE;
$DataPinjaman[$key2]['WORKING_BALANCE'] = $balance->WORKING_BALANCE != null ? number_format( $balance->WORKING_BALANCE, 2, ',', '.') : 'NIHIL';
$DataPinjaman[$key2]['WORKING_BALANCE'] = $balance != null ? number_format( $balance->WORKING_BALANCE, 2, ',', '.') : 'NIHIL';
$DataPinjaman[$key2]['TERM'] = $TermAmount ? $TermAmount->TERM : '' ;
$DataPinjaman[$key2]['FIXED_RATE'] = $FixedRate ? $FixedRate->FIXED_RATE : '';
$DataPinjaman[$key2]['MATURITY_DATE'] = $MaturityDate ? $MaturityDate->MATURITY_DATE : '' ;
$DataPinjaman[$key2]['MATURITY_DATE'] = $pinjaman->MATURITY_DATE;
$DataPinjaman[$key2]['ACCOUNT_NUMBER'] = $pinjaman->LINKED_APPL_ID;
}
// dd( $DataPinjaman);
$ListLimits = $Account->getLimit($request['cusNo'],$request['startDate2'])->get();