Fixing outsanding
This commit is contained in:
@ -47,9 +47,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('LIMIT_REF', null)
|
||||
// ->where('ARR_A', null)
|
||||
->where('AC.BATCH_DATE', $startDate)
|
||||
->whereIn(DB::raw("LEFT(CATEGORY, 3)"), ['100','600','660','101'])
|
||||
->whereIn(DB::raw("LEFT(CATEGORY, 3)"), ['100','600','660','101','324'])
|
||||
// ->orWhere(DB::raw("LEFT(CATEGORY, 2)"),'32')
|
||||
->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'LIMIT_REF')
|
||||
->limit(100);
|
||||
} else {
|
||||
@ -64,6 +65,22 @@ class Account extends Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCekProduct($cust ,$acc, $startDate){
|
||||
// dd($cust, $arrAccount, $startDate);
|
||||
$timestamp = strtotime($startDate);
|
||||
// Format the timestamp into a date format
|
||||
$Year = date("Y", $timestamp);
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.AA_ARRANGEMENT")->select('*')
|
||||
->where('CUSTOMER', $cust)
|
||||
->where('LINKED_APPL_ID', $acc)
|
||||
// ->whereYear('BATCH_DATE', $Year)
|
||||
->where('ARR_STATUS','EXPIRED')
|
||||
->limit(1);
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getAccount($cif, $arrAccount, $startDate)
|
||||
{
|
||||
//$uppercaseKodeCabang = Str::upper($kodecabang);
|
||||
|
@ -105,8 +105,11 @@ class KonfirmasiBankController extends Controller
|
||||
$startDate = Carbon::parse($request->startDate);
|
||||
|
||||
//$dateCore = $startDate->format('m/d/Y');
|
||||
|
||||
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate)->get();
|
||||
|
||||
|
||||
|
||||
if ($Accounts->isEmpty()) {
|
||||
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(1)->format('m/d/Y'))->get();
|
||||
if($Accounts->isEmpty()){
|
||||
@ -126,13 +129,19 @@ class KonfirmasiBankController extends Controller
|
||||
}
|
||||
|
||||
|
||||
foreach ($Accounts as $key => $value) {
|
||||
|
||||
$data[$key]['ACCOUNT_NUMBER'] = $value->ACCOUNT_NUMBER;
|
||||
$data[$key]['COMPANY_NAME'] = $value->COMPANY_NAME;
|
||||
$data[$key]['SHORT_NAME'] = $value->SHORT_NAME;
|
||||
$data[$key]['CURRENCY'] = $value->CURRENCY;
|
||||
$data[$key]['WORKING_BALANCE'] = number_format($value->WORKING_BALANCE, 2, ',', '.') ;
|
||||
foreach ($Accounts as $key => $value) {
|
||||
$cekProductAccount = $Account->getCekProduct($value->CUSTOMER_NO,$value->ACCOUNT_NUMBER, $value->BATCH_DATE)->first();
|
||||
if (!$cekProductAccount) {
|
||||
$data[$key]['ACCOUNT_NUMBER'] = $value->ACCOUNT_NUMBER;
|
||||
$data[$key]['COMPANY_NAME'] = $value->COMPANY_NAME;
|
||||
$data[$key]['SHORT_NAME'] = $value->SHORT_NAME;
|
||||
$data[$key]['CURRENCY'] = $value->CURRENCY;
|
||||
$data[$key]['WORKING_BALANCE'] = number_format($value->WORKING_BALANCE, 2, ',', '.') ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return json_encode($data);
|
||||
@ -475,7 +484,7 @@ class KonfirmasiBankController extends Controller
|
||||
$DataRK[$rk]['SHORT_NAME'] = $valRk->PRODUCT_LOAN;
|
||||
$DataRK[$rk]['CURRENCY'] = $valRk->LOAN_CCY;
|
||||
$DataRK[$rk]['PRODUCT'] = $valRk->PRODUCT_LOAN;
|
||||
$DataRK[$rk]['WORKING_BALANCE'] = $valRk->PRINCIPLE_AMOUNT != null ? number_format($valRk->PRINCIPLE_AMOUNT, 2, ',', '.') : 'NIHIL';
|
||||
$DataRK[$rk]['WORKING_BALANCE'] = $valRk->OUTSTANDING != null ? number_format(abs($valRk->OUTSTANDING), 2, ',', '.') : 'NIHIL';
|
||||
$DataRK[$rk]['MATURITY_DATE'] = date('d-m-Y', strtotime($valRk->MATURITY_DATE)) ?? '';
|
||||
$DataRK[$rk]['ARRANGEMENT_ID'] = '';
|
||||
$DataRK[$rk]['FIXED_RATE'] = $valRk->CURRENT_INTEREST_RATE;
|
||||
|
Reference in New Issue
Block a user