update query export data

This commit is contained in:
KhatamNugraha
2023-09-25 13:35:45 +07:00
parent b46a69efb9
commit 62b908a314
3 changed files with 26 additions and 44 deletions

View File

@ -53,7 +53,7 @@ class ViewAccount extends Model
if($arrAccount == null){
//dd('1');
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT")
->select( 'CUSTOMER_NO', 'ACCOUNT_NUMBER','SHORT_NAME','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE',DB::raw('MAX(WORKING_BALANCE) AS WORKING_BALANCE'))
->select( 'CUSTOMER_NO', 'ACCOUNT_NUMBER','SHORT_NAME','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE',DB::raw('MAX(WORKING_BALANCE) AS WORKING_BALANCE'),DB::raw('MAX(CATEGORY) AS CATEGORY'))
->where('CUSTOMER_NO',$cif)
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
->whereBetween('OPENING_DATE', [$startDate, $endDate])
@ -78,14 +78,21 @@ class ViewAccount extends Model
public function getAccount($cus_no,$account,$kodecabang,$periode){
public function getAccount($cif ,$arrAccount, $kodecabang, $startDate, $endDate){
$data = [];
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
->select( 'ACCOUNT_NUMBER','CUSTOMER_NO','CURRENCY',DB::raw('MAX(CATEGORY) AS CATEGORY'),'SHORT_TITLE',DB::raw('MAX(BATCH_DATE) AS BATCH_DATE'),'PRODUCT','COMPANY_NAME','ARRANGEMENT_ID','MATURITY_DATE',DB::raw('MAX(WORKING_BALANCE) AS WORKING_BALANCE'))
->where('CUSTOMER_NO',$cus_no)->whereIn('ACCOUNT_NUMBER',$account)
->groupBy('ACCOUNT_NUMBER' , 'CUSTOMER_NO','CURRENCY','SHORT_TITLE','PRODUCT','COMPANY_NAME','ARRANGEMENT_ID','MATURITY_DATE')
->get();
$today = Carbon::now();
$currentYear = $today->format("Y");
$pastYear = $today->subYear(3)->format('Y');
$uppercaseKodeCabang = Str::upper($kodecabang);
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNT")
->select( 'CUSTOMER_NO', 'ACCOUNT_NUMBER','SHORT_NAME','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE',DB::raw('MAX(WORKING_BALANCE) AS WORKING_BALANCE'),DB::raw('MAX(CATEGORY) AS CATEGORY'))
->where('CUSTOMER_NO',$cif)
->whereIn('ACCOUNT_NUMBER', $arrAccount)
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
->whereBetween('OPENING_DATE', [$startDate, $endDate])
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660'])
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_NAME','SHORT_TITLE','CURRENCY','COMPANY_NAME','OPENING_DATE');
return $data;
}

View File

@ -77,6 +77,7 @@
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang,$request->startDate,$request->endDate)->get();
foreach ($Accounts as $key => $account) {
$Arrangement = $Account->getAAaccount($account->CUSTOMER_NO,$account->ACCOUNT_NUMBER);
@ -120,13 +121,15 @@
$arrAccount = explode("," , $request['acc_no']);
$ViewAccount = new ViewAccount;
$data = [];
$DataAccounts = [];
$DataPinjaman = [];
$DataLimit = [];
$DataAA = [];
$ListAccount = $ViewAccount->getSearchAccount($request['cus_no'],$arrAccount,$request['kode_cabang'],$request->startDate,$request->endDate)->get();
$ListAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'],$request->startDate,$request->endDate)->get();
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
@ -141,7 +144,7 @@
}
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
$DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO;
// $DataAccounts[$key1]['STREET'] = $account->STREET;
$DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME;
// $DataAccounts[$key1]['RESIDENCE'] = $account->RESIDENCE;
//$DataAccounts[$key1]['ADDRESS'] = $account->ADDRESS;
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
@ -150,8 +153,8 @@
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
// $DataAccounts[$key1]['BATCH_DATE'] = $account->BATCH_DATE;
$DataAccounts[$key1]['MATURITY_DATE'] = $MaturityDate ?? '-';
$DataAccounts[$key1]['ARRANGEMENT_ID'] = $AAID ?? '-';
$DataAccounts[$key1]['MATURITY_DATE'] = $MaturityDate ?? 'NIHIL';
$DataAccounts[$key1]['ARRANGEMENT_ID'] = $AAID ?? 'NIHIL';
$ListBunga =$ViewAccount->getInterest($AAID ?? '');
$ListTenor =$ViewAccount->getTerm($AAID ?? '');
foreach ($ListBunga as $bunga) {
@ -173,44 +176,18 @@
$pinjaman = [];
foreach ($ListPinjaman as $key => $item) {
// $ListTenor =$ViewAccount->getTerm($item->ARRANGEMENT_ID);
// $ListBunga =$ViewAccount->getInterest($item->ARRANGEMENT_ID);
// $ListCategory =$ViewAccount->getCategory($item->CATEGORY);
// $pinjaman[$key]['CUSTOMER'] = $item->CUSTOMER;
// $pinjaman[$key]['SHORT_NAME'] = $item->SHORT_NAME;
// $pinjaman[$key]['STREET'] = $item->STREET;
// $pinjaman[$key]['ADDRESS'] = $item->ADDRESS;
$pinjaman[$key]['COMPANY_NAME'] = $item->COMPANY_NAME;
$pinjaman[$key]['CURRENCY'] = $item->CURRENCY;
$pinjaman[$key]['PRODUCT_LINE'] = $item->PRODUCT_LINE;
$pinjaman[$key]['PRODUCT'] = $item->PRODUCT;
$pinjaman[$key]['WORKING_BALANCE'] = $item->WORKING_BALANCE;
// $pinjaman[$key]['BATCH_DATE'] = $item->OPENING_DATE;
$pinjaman[$key]['MATURITY_DATE'] = $item->MATURITY_DATE;
$pinjaman[$key]['ARRANGEMENT_ID'] = $item->ARRANGEMENT_ID;
$pinjaman[$key]['FIXED_RATE'] = $item->FIXED_RATE;
$pinjaman[$key]['TERM'] = $item->TERM;
$pinjaman[$key]['CATEGORY'] = $item->CATEGORY;
// foreach ($ListBunga as $bunga) {
// if (strpos($bunga->ID ,$item->ARRANGEMENT_ID) !== false) {
// $pinjaman[$key]['FIXED_RATE'] = $bunga->FIXED_RATE;
// }
// }
// foreach ($ListTenor as $tenor) {
// if (strpos($tenor->ID ,$item->ARRANGEMENT_ID) !== false) {
// $pinjaman[$key]['TERM'] = $tenor->TERM;
// }
// }
// foreach ($ListCategory as $category) {
// if ($category->ID == $item->CATEGORY) {
// $pinjaman[$key]['CATEGORY'] = $category->SHORT_NAME;
// }
// }
}
// dd($pinjaman);
$ListLimits = $ViewAccount->getLimit($request['cus_no'],$request['periode']);
$fasilitas = Fasilitas::where('nomor_cif',$request['cus_no'] )->where('status',1)->get();
@ -226,8 +203,6 @@
$data['DataSigner'] = $signer;
$data['DataCustomer'] = $GetCustomer ?? '';
$data['localDate'] = $tanggalIndonesia;
//DD($data);
// DD($data);
$html = View::make('konfirmasibank::exportPdf', ['data' => $data])->render();
$pdf = new Dompdf();

View File

@ -12,7 +12,7 @@
.content {
padding: 2rem;
padding-top:120px
padding-top:150px
}
.space1 {
@ -91,9 +91,9 @@
@foreach ($data['DataAccounts'] as $val)
<tr class="space1">
<td class="text-center space1">{{ $i++ }}</td>
<td class="text-center space1">{{ $val['ACCOUNT_NUMBER'] }}</td>
<td class="space1">{{ $val['ACCOUNT_NUMBER'] }}</td>
<td class="space1">{{ $val['COMPANY_NAME'] }}</td>
<td class="space1">{{ $val['PRODUCT'] }}</td>
<td class="space1">{{ $val['SHORT_NAME'] }}</td>
<td class="text-center space1 texet-center">{{ $val['CURRENCY'] }}</td>
<td class="space1">{{ $val['WORKING_BALANCE'] }}</td>
<td class="text-center space1">{{ $val['TERM'] }}</td>
@ -180,7 +180,7 @@
<td class="space1">{{ $limit->SHORT_NAME }}</td>
<td class="space1">{{ $limit->COMPANY_NAME }}</td>
<td class="space1">{{ $limit->ACCOUNT_TYPE }}</td>
<td class="space1 texet-center">{{ $limit->LIMIT_CURRENCY }}</td>
<td class="text-center space1">{{ $limit->LIMIT_CURRENCY }}</td>
<td class="space1">{{ $limit->AVAIL_AMT }}</td>
<td class="text-center space1">{{ $term }} D</td>
<td class="text-center space1">{{ $limit->LIMIT_PERCENTAGE }}</td>