fixing table pinjaman

This commit is contained in:
KhatamNugraha
2024-04-05 15:47:48 +07:00
parent 9f8b6f6d5f
commit ece4805fc5
3 changed files with 209 additions and 138 deletions

View File

@ -52,10 +52,10 @@ class Account extends Model
->join('STG_DB.COMPANY AS CP', 'AC.CO_CODE', '=', 'CP.ID')
->where('CUSTOMER_NO',$cif)
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
// ->where('INACTIV_MARKER', NULL)
->where('LIMIT_REF', NULL)
->where('AC.BATCH_DATE',$startDate)
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_TITLE','SHORT_NAME','COMPANY_NAME')
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_TITLE','SHORT_NAME','COMPANY_NAME','LIMIT_REF')
->limit(100);
}else{
$data = DB::connection("db2")->table("STG_DB.ACCOUNT")
@ -78,11 +78,11 @@ class Account extends Model
->join('STG_DB.COMPANY AS CP', 'AC.CO_CODE', '=', 'CP.ID')
->where('CUSTOMER_NO',$cif)
// ->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
// ->where('INACTIV_MARKER', NULL)
->where('LIMIT_REF', NULL)
->where('AC.BATCH_DATE',$startDate)
->whereIn('AC.ACCOUNT_NUMBER', $arrAccount)
//->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_TITLE','SHORT_NAME','COMPANY_NAME','CATEGORY')
->groupBy('CUSTOMER_NO','ACCOUNT_NUMBER','SHORT_TITLE','SHORT_NAME','COMPANY_NAME','CATEGORY','LIMIT_REF')
->orderBy('SHORT_NAME', 'ASC')
->limit(100);
return $data;
@ -208,6 +208,19 @@ class Account extends Model
return $data;
}
public function getAccountRK($cusNo,$date){
$data = [];
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
->select('AC.ACCOUNT_NUMBER','AC.CUSTOMER_NO','CT.SHORT_NAME','AC.WORKING_BALANCE','AC.CURRENCY','AC.SHORT_TITLE','AC.OPENING_DATE','AC.BATCH_DATE','AC.CATEGORY')
->join('STG_DB.CATEGORY AS CT', 'AC.CATEGORY', '=', 'CT.ID')
->where('AC.CUSTOMER_NO',$cusNo)
->where('AC.BATCH_DATE',$date)
->where('AC.LIMIT_REF', '<>' , 'NULL' )
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
->limit(100);
return $data;
}
public function getLimit($cus_id,$periode){
$timestamp = strtotime($periode);
// Format the timestamp into a date format