fix export
This commit is contained in:
@ -67,7 +67,7 @@ class Account extends Model
|
|||||||
public function getAccount($cif, $arrAccount, $startDate)
|
public function getAccount($cif, $arrAccount, $startDate)
|
||||||
{
|
{
|
||||||
//$uppercaseKodeCabang = Str::upper($kodecabang);
|
//$uppercaseKodeCabang = Str::upper($kodecabang);
|
||||||
$dateString = $startDate->format('m/d/Y');
|
// $dateString = $startDate->format('m/d/Y');
|
||||||
|
|
||||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
|
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
|
||||||
->selectRaw('AC.CUSTOMER_NO,AC.CATEGORY,AC.ACCOUNT_NUMBER,AC.CURRENCY, AC.SHORT_TITLE,AC.OPENING_DATE,AC.WORKING_BALANCE, AC.CATEGORY,CT.SHORT_NAME,CP.COMPANY_NAME,AC.BATCH_DATE')
|
->selectRaw('AC.CUSTOMER_NO,AC.CATEGORY,AC.ACCOUNT_NUMBER,AC.CURRENCY, AC.SHORT_TITLE,AC.OPENING_DATE,AC.WORKING_BALANCE, AC.CATEGORY,CT.SHORT_NAME,CP.COMPANY_NAME,AC.BATCH_DATE')
|
||||||
@ -75,7 +75,7 @@ class Account extends Model
|
|||||||
->join('STG_DB.COMPANY AS CP', 'AC.CO_CODE', '=', 'CP.ID')
|
->join('STG_DB.COMPANY AS CP', 'AC.CO_CODE', '=', 'CP.ID')
|
||||||
->where('CUSTOMER_NO', $cif)
|
->where('CUSTOMER_NO', $cif)
|
||||||
->where('LIMIT_REF', null)
|
->where('LIMIT_REF', null)
|
||||||
->where('AC.BATCH_DATE', $dateString)
|
->where('AC.BATCH_DATE', $startDate)
|
||||||
->whereIn('AC.ACCOUNT_NUMBER', $arrAccount)
|
->whereIn('AC.ACCOUNT_NUMBER', $arrAccount)
|
||||||
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
|
->whereIn(DB::raw("LEFT(CATEGORY, 3)"),['100','600','660','101'])
|
||||||
// ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'CATEGORY', 'LIMIT_REF')
|
// ->groupBy('CUSTOMER_NO', 'ACCOUNT_NUMBER', 'SHORT_TITLE', 'SHORT_NAME', 'COMPANY_NAME', 'CATEGORY', 'LIMIT_REF')
|
||||||
@ -129,11 +129,11 @@ class Account extends Model
|
|||||||
public function getArr($cust, $acc, $dataCore)
|
public function getArr($cust, $acc, $dataCore)
|
||||||
{
|
{
|
||||||
//$uppercaseKodeCabang = Str::upper($kodecabang);
|
//$uppercaseKodeCabang = Str::upper($kodecabang);
|
||||||
$dateString = $dataCore->format('m/d/Y');
|
//$dateString = $dataCore->format('m/d/Y');
|
||||||
// dd($dateString);
|
// dd($dateString);
|
||||||
$timestamp = strtotime($dataCore);
|
//$timestamp = strtotime($dataCore);
|
||||||
// Format the timestamp into a date format
|
// Format the timestamp into a date format
|
||||||
$Year = date("Y", $timestamp);
|
//$Year = date("Y", $timestamp);
|
||||||
|
|
||||||
$data = DB::connection("db2")->table("STG_DB.VW_AA_DETAIL")
|
$data = DB::connection("db2")->table("STG_DB.VW_AA_DETAIL")
|
||||||
->selectRaw('ARRANGEMENT_ID,CUSTOMER,LINKED_APPL_ID,PRODUCT_LINE,MATURITY_DATE,RENEWAL_DATE,START_DATE,ARR_STATUS,BATCH_DATE,BASE_DATE')
|
->selectRaw('ARRANGEMENT_ID,CUSTOMER,LINKED_APPL_ID,PRODUCT_LINE,MATURITY_DATE,RENEWAL_DATE,START_DATE,ARR_STATUS,BATCH_DATE,BASE_DATE')
|
||||||
@ -206,12 +206,14 @@ class Account extends Model
|
|||||||
|
|
||||||
public function getFixedRate($arrangementId, $startDate)
|
public function getFixedRate($arrangementId, $startDate)
|
||||||
{
|
{
|
||||||
|
$timestamp = strtotime($startDate);
|
||||||
|
$Year = date("Y", $timestamp);
|
||||||
$data = [];
|
$data = [];
|
||||||
$data = DB::connection("db2")->table("STG_DB.AA_ARR_INTEREST")
|
$data = DB::connection("db2")->table("STG_DB.AA_ARR_INTEREST")
|
||||||
->select('FIXED_RATE')
|
->select('FIXED_RATE')
|
||||||
// ->whereYear('BATCH_DATE',$startDate->format('Y'))
|
// ->whereYear('BATCH_DATE',$startDate->format('Y'))
|
||||||
->where(DB::raw("LEFT(ID, 12)"), $arrangementId)
|
->where(DB::raw("LEFT(ID, 12)"), $arrangementId)
|
||||||
->where(DB::raw("RIGHT(ID, 10)"), 'like', "%" .$startDate->format('Y') ."%")
|
->where(DB::raw("RIGHT(ID, 10)"), 'like', "%" .$Year ."%")
|
||||||
->orderBy('ID', 'DESC')
|
->orderBy('ID', 'DESC')
|
||||||
->limit(1);
|
->limit(1);
|
||||||
|
|
||||||
|
@ -101,12 +101,33 @@ class KonfirmasiBankController extends Controller
|
|||||||
$data = [];
|
$data = [];
|
||||||
$Account = new Account();
|
$Account = new Account();
|
||||||
$arrAccount = [];
|
$arrAccount = [];
|
||||||
|
$dataAccount = [];
|
||||||
$startDate = Carbon::parse($request->startDate);
|
$startDate = Carbon::parse($request->startDate);
|
||||||
|
|
||||||
$dateCore = $startDate->addDays(2)->format('m/d/Y');
|
//$dateCore = $startDate->format('m/d/Y');
|
||||||
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $dateCore)->get();
|
$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()){
|
||||||
|
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(2)->format('m/d/Y'))->get();
|
||||||
|
if ($Accounts->isEmpty()) {
|
||||||
|
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(3)->format('m/d/Y'))->get();
|
||||||
|
if ($Accounts->isEmpty()) {
|
||||||
|
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(4)->format('m/d/Y'))->get();
|
||||||
|
if ($Accounts->isEmpty()) {
|
||||||
|
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(5)->format('m/d/Y'))->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach ($Accounts as $key => $value) {
|
foreach ($Accounts as $key => $value) {
|
||||||
|
|
||||||
$data[$key]['ACCOUNT_NUMBER'] = $value->ACCOUNT_NUMBER;
|
$data[$key]['ACCOUNT_NUMBER'] = $value->ACCOUNT_NUMBER;
|
||||||
$data[$key]['COMPANY_NAME'] = $value->COMPANY_NAME;
|
$data[$key]['COMPANY_NAME'] = $value->COMPANY_NAME;
|
||||||
$data[$key]['SHORT_NAME'] = $value->SHORT_NAME;
|
$data[$key]['SHORT_NAME'] = $value->SHORT_NAME;
|
||||||
@ -346,8 +367,9 @@ class KonfirmasiBankController extends Controller
|
|||||||
public function export(Request $request)
|
public function export(Request $request)
|
||||||
{
|
{
|
||||||
$arrAccount = explode(",", $request['accNo']);
|
$arrAccount = explode(",", $request['accNo']);
|
||||||
$startDate = Carbon::parse($request['startDate2']);
|
// $startDate = Carbon::parse($request['startDate2']);
|
||||||
$dateCore = $startDate->addDays(2);
|
// dd($tanggal1 );
|
||||||
|
$dateCore = Carbon::parse($request['startDate2']);;
|
||||||
// dd( $dateCore);
|
// dd( $dateCore);
|
||||||
$Account = new Account();
|
$Account = new Account();
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -358,10 +380,31 @@ class KonfirmasiBankController extends Controller
|
|||||||
$rekEscrow = [];
|
$rekEscrow = [];
|
||||||
$DataAnjak = [];
|
$DataAnjak = [];
|
||||||
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
|
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
|
||||||
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore->format('m/d/Y'))->get();
|
||||||
// DD($listAccount);
|
|
||||||
|
|
||||||
try {
|
if ($listAccount->isEmpty()) {
|
||||||
|
$dateCore = $dateCore->subDays(1)->format('m/d/Y');
|
||||||
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
|
||||||
|
if($listAccount->isEmpty()){
|
||||||
|
$dateCore = $dateCore->subDays(2)->format('m/d/Y');
|
||||||
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
if ($listAccount->isEmpty()) {
|
||||||
|
$dateCore = $dateCore->subDays(3)->format('m/d/Y');
|
||||||
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
if ($listAccount->isEmpty()) {
|
||||||
|
$dateCore = $dateCore->subDays(4)->format('m/d/Y');
|
||||||
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
if ($listAccount->isEmpty()) {
|
||||||
|
$dateCore = $dateCore->subDays(5)->format('m/d/Y');
|
||||||
|
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCore)->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
foreach ($listAccount as $key1 => $account) {
|
foreach ($listAccount as $key1 => $account) {
|
||||||
$dataAADepo = $Account->getArr($request['cusNo'], $account->ACCOUNT_NUMBER, $dateCore)->first();
|
$dataAADepo = $Account->getArr($request['cusNo'], $account->ACCOUNT_NUMBER, $dateCore)->first();
|
||||||
|
|
||||||
@ -373,11 +416,12 @@ class KonfirmasiBankController extends Controller
|
|||||||
$tglRenewal = $tanggal_1->format('d');
|
$tglRenewal = $tanggal_1->format('d');
|
||||||
$tanggal_2 = date_create($dataAADepo->BASE_DATE);
|
$tanggal_2 = date_create($dataAADepo->BASE_DATE);
|
||||||
$tenor = date_diff($tanggal_1, $tanggal_2);
|
$tenor = date_diff($tanggal_1, $tanggal_2);
|
||||||
$batchDate = $dateCore->format('Y-m-d');
|
$batchDate = strtotime($dateCore);
|
||||||
$maturityDate = Carbon::createFromFormat('Y-m-d', $batchDate);
|
$startDate = date("Y-m-d", $batchDate); // Tanggal mulai pinjaman
|
||||||
|
$maturityDate = Carbon::createFromFormat('Y-m-d', $startDate);
|
||||||
$tenorFix = $tenor->days >= 30 ? intval($tenor->days / 30) : 1;
|
$tenorFix = $tenor->days >= 30 ? intval($tenor->days / 30) : 1;
|
||||||
|
|
||||||
$startDate = $batchDate; // Tanggal mulai pinjaman
|
$startDate = date("Y-m-d", $batchDate); // Tanggal mulai pinjaman
|
||||||
// // Konversi tanggal mulai ke objek Carbon
|
// // Konversi tanggal mulai ke objek Carbon
|
||||||
$tanggalMulai = Carbon::parse($startDate);
|
$tanggalMulai = Carbon::parse($startDate);
|
||||||
// // Hitung tanggal jatuh tempo dengan menambahkan durasi hari
|
// // Hitung tanggal jatuh tempo dengan menambahkan durasi hari
|
||||||
@ -499,9 +543,9 @@ class KonfirmasiBankController extends Controller
|
|||||||
|
|
||||||
$ListLimits = $Account->getLimit($request['cusNo'], $request['startDate2'])->get();
|
$ListLimits = $Account->getLimit($request['cusNo'], $request['startDate2'])->get();
|
||||||
$signer = Signer::where('id', $request['signerId'])->where('status', 1)->get();
|
$signer = Signer::where('id', $request['signerId'])->where('status', 1)->get();
|
||||||
$batchDateSearch = Carbon::parse($request['startDate2']);
|
$batchDate = Carbon::parse($request['startDate2']);
|
||||||
$currentDate = Carbon::now();
|
$currentDate = Carbon::now();
|
||||||
$tanggalIndonesia = strtoupper($batchDateSearch->locale('id')->isoFormat('D MMMM YYYY')); // Mengubah seluruh string menjadi huruf besar
|
$tanggalIndonesia = strtoupper($batchDate->locale('id')->isoFormat('D MMMM YYYY')); // Mengubah seluruh string menjadi huruf besar
|
||||||
$today = strtoupper($currentDate->locale('id')->isoFormat('D MMMM YYYY'));
|
$today = strtoupper($currentDate->locale('id')->isoFormat('D MMMM YYYY'));
|
||||||
$letter = new Letters();
|
$letter = new Letters();
|
||||||
$infoSuratNew = $letter->where('no_cif', $request['cusNo'])->orderBy('id', 'DESC')->first();
|
$infoSuratNew = $letter->where('no_cif', $request['cusNo'])->orderBy('id', 'DESC')->first();
|
||||||
@ -561,9 +605,9 @@ class KonfirmasiBankController extends Controller
|
|||||||
|
|
||||||
return $pdf->stream($filename);
|
return $pdf->stream($filename);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
// } catch (Exception $e) {
|
||||||
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
// echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user