perbaikan filter data customer

This commit is contained in:
KhatamNugraha
2023-08-03 13:41:52 +07:00
parent 2ec52d344f
commit 677bb83b5b
3 changed files with 96 additions and 103 deletions

View File

@ -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;