update query export data
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user