perbaikan filter data customer
This commit is contained in:
@ -38,25 +38,27 @@ class ViewAccount extends Model
|
||||
|
||||
public function getSearchAccount($cif , $kodecabang, $periode){
|
||||
// $store = DB::connection('oracle');
|
||||
$currentDate = Carbon::now();
|
||||
$formattedDate = $currentDate->format('Y');
|
||||
$today = Carbon::now();
|
||||
$currentYear = $today->format("Y");
|
||||
$pastYear = $today->subYear(3)->format('Y');
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($cif != null && $kodecabang == null && $periode == null) {
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('BATCH_DATE','LIKE','%'.$formattedDate.'%');
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('BATCH_DATE','LIKE','%'.$pastYear.'%');
|
||||
} elseif ($cif != null && $kodecabang != null && $periode == null) {
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$kodecabang."%")
|
||||
->where('BATCH_DATE','LIKE','%'.$formattedDate.'%');
|
||||
dd('tess2');
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$kodecabang."%")
|
||||
->where('BATCH_DATE','LIKE','%'.$pastYear.'%');
|
||||
}else {
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$kodecabang."%")
|
||||
->where('BATCH_DATE','LIKE','%'.$periode.'%');
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$kodecabang."%")
|
||||
->where('BATCH_DATE','LIKE','%'.$periode.'%');
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
Reference in New Issue
Block a user