update controler kobank

This commit is contained in:
KhatamNugraha
2024-07-11 11:25:00 +07:00
parent f2792bb543
commit 100cb2e6c4
8 changed files with 307 additions and 269 deletions

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('fasilitas', function (Blueprint $table) {
$table->string('nomor_rekening')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('fasilitas', function (Blueprint $table) {
$table->string('nomor_rekening')->nullable()->change();
});
}
};

View File

@ -304,7 +304,6 @@ class Account extends Model
public function getAccountRK($arrCusNo, $date)
{
$data = [];
$data = DB::connection("db2")->table("MIS.COLLECTION")
->selectRaw('ACCOUNT_NUMBER,MATURITY_DATE,MAX(BATCH_DATE) AS BATCH_DATE,MAX(OUTSTANDING) AS OUTSTANDING,LOAN_CCY,PRODUCT_LOAN,PRINCIPLE_AMOUNT,CURRENT_INTEREST_RATE,TENOR,FACILITY_TYPE,LIMIT_ID')
@ -355,4 +354,4 @@ class Account extends Model
}
}

34
Entities/Dpk.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace Modules\Konfirmasibank\Entities;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class DPK extends Model
{
use HasFactory;
protected $primaryKey = 'cif';
protected $connection = 'pgsql';
protected $table = 'dpk';
//public $incrementing = false;
protected $fillable = [
"'no_rek',
'kode_cabang'
'nama_cabang',
'suku_bunga',
'jumlah_nominal',
'jenis_rekening'
'period',
'jatuh_tempo',
'kode_mata_uang'"
];
}

41
Entities/Loan.php Normal file
View File

@ -0,0 +1,41 @@
<?php
namespace Modules\Konfirmasibank\Entities;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Loan extends Model
{
use HasFactory;
protected $primaryKey = 'sk_nasabah';
protected $connection = 'pgsql';
protected $table = 'loan';
//public $incrementing = false;
protected $fillable = [
"'sk_nasabah',
'no_rek'
'kode_cabang',
'nama_cabang',
'tgl_mulai',
'jatuh_tempo',
'periode',
'outstanding',
'kode_mata_uang',
'product_loan',
'principle_amount',
'interest_rate',
'tenor',
'kode_status_lunas',
'insert_date'
"
];
}

31
Entities/Nasabah.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace Modules\Konfirmasibank\Entities;
use Spatie\Activitylog\LogOptions;
use Spatie\Activitylog\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Nasabah extends Model
{
use HasFactory;
protected $primaryKey = 'cif';
protected $connection = 'pgsql';
protected $table = 'customer';
//public $incrementing = false;
protected $fillable = [
"'nama_nasabah',
'email'
'no_hp',
'kode_cabang',
'nama_cabang',
'insert_date',"
];
}

View File

@ -26,5 +26,4 @@ class Signer extends Model
'status',"
];
}

View File

@ -6,17 +6,16 @@ use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Modules\Konfirmasibank\DataTables\ViewAccountDataTable;
use Modules\Konfirmasibank\Entities\ViewAccount;
use Modules\Konfirmasibank\Entities\LimitReference;
use Modules\Konfirmasibank\Entities\Fasilitas;
use Modules\Konfirmasibank\Entities\Signer;
use Modules\Konfirmasibank\Entities\Nasabah;
use Modules\Konfirmasibank\Entities\DPK;
use Modules\Konfirmasibank\Entities\Loan;
use Modules\Konfirmasibank\Entities\Letters;
use Modules\Konfirmasibank\Entities\Category;
use Modules\Konfirmasibank\Entities\Company;
use Modules\Konfirmasibank\Entities\Account;
use Modules\Konfirmasibank\Entities\Arrangement;
use Modules\Konfirmasibank\Entities\TermAmount;
use Modules\Konfirmasibank\Entities\Category;
use Modules\Konfirmasibank\Entities\LimitReference;
use PDF;
use Dompdf\Options;
use Carbon\Carbon;
@ -107,21 +106,49 @@ class KonfirmasiBankController extends Controller
//$dateCore = $startDate->format('m/d/Y');
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate)->get();
// $Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate)->get();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$startDate )
->get();
if ($Accounts->isEmpty()) {
$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(1)->format('m/d/Y'))->get();
// $Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(1)->format('m/d/Y'))->get();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$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();
// $Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(2)->format('m/d/Y'))->get();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$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();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$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();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$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();
}
//$Accounts = $Account->getSearchAccount($request->cif, $arrAccount, $request->kodecabang, $startDate->subDays(5)->format('m/d/Y'))->get();
$Accounts = DPK::where('cif',$request->cif)
->where('nama_cabang','like', '%'.$request->kodecabang.'%')
//->whereIn('no_rek', $arrAccount)
->whereDate('period',$startDate->subDays(5)->format('m/d/Y') )
->get();
}
}
}
}
@ -131,19 +158,15 @@ class KonfirmasiBankController extends Controller
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->OPEN_ACTUAL_BAL, 2, ',', '.') ;
}
$data[$key]['ACCOUNT_NUMBER'] = $value->no_rek;
$data[$key]['COMPANY_NAME'] = $value->nama_cabang;
$data[$key]['SHORT_NAME'] = $value->jenis_rekening;
$data[$key]['CURRENCY'] = $value->kode_mata_uang;
$data[$key]['WORKING_BALANCE'] = number_format($value->jumlah_nominal, 2, ',', '.') ;
}
return json_encode($data);
}
@ -376,7 +399,6 @@ class KonfirmasiBankController extends Controller
public function export(Request $request)
{
$arrAccount = explode(",", $request['accNo']);
// dd($tanggal1 );
$dateCoreAccount = Carbon::parse($request['startDate2']);
$dateCoreDepo = Carbon::parse($request['startDate2']);
// dd( $dateCore);
@ -388,145 +410,126 @@ class KonfirmasiBankController extends Controller
$DataRK = [];
$rekEscrow = [];
$DataAnjak = [];
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
$GetCustomer = Nasabah::where('cif',$request['cusNo'])->first();
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = $dateCoreDepo->addDays(1)->format('m/d/Y');
$dateCoreAccount = $dateCoreAccount->subDays(1)->format('m/d/Y');
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
if($listAccount->isEmpty()){
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(2)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(2)->format('m/d/Y');
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
//$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(3)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(3)->format('m/d/Y');
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
//$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(4)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(4)->format('m/d/Y');
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
if ($listAccount->isEmpty()) {
$dateCoreDepo = carbon::parse($dateCoreDepo)->addDays(5)->format('m/d/Y');
$dateCoreAccount = carbon::parse($dateCoreAccount)->subDays(5)->format('m/d/Y');
$listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
// $listAccount = $Account->getAccount($request['cusNo'], $arrAccount, $dateCoreAccount)->get();
$listAccount = DPK::where('cif',$request['cusNo'])
->whereIn('no_rek', $arrAccount)
->whereDate('period', $dateCoreAccount )
->orderBy('jenis_rekening', 'DESC')
->get();
}
}
}
}
}
// $Arrangement = $Account->getPinjaman($request['cusNo'], $dateCoreAccount)->get();
// DD($Arrangement);
// try {
foreach ($listAccount as $key1 => $account) {
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
$DataAccounts[$key1]['BATCH_DATE'] = $account->BATCH_DATE;
$DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO;
$DataAccounts[$key1]['SHORT_NAME'] = 'GIRO'; //$account->SHORT_NAME;
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
$DataAccounts[$key1]['PRODUCT'] = $account->SHORT_TITLE;
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->OPEN_ACTUAL_BAL != null ? number_format($account->OPEN_ACTUAL_BAL, 2, ',', '.') : 'NIHIL';
$DataAccounts[$key1]['MATURITY_DATE'] = '' ;
$DataAccounts[$key1]['ARRANGEMENT_ID'] = '';
$DataAccounts[$key1]['FIXED_RATE'] = '';
$DataAccounts[$key1]['TERM'] = '';
//get data anjak
if ($account->CATEGORY == '1019') {
array_push($rekEscrow, $account->ACCOUNT_NUMBER);
if ($account->jenis_rekening != 'DEPOSITO') {
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->no_rek;
$DataAccounts[$key1]['BATCH_DATE'] = $account->period;
$DataAccounts[$key1]['CUSTOMER_NO'] = $account->cif;
$DataAccounts[$key1]['SHORT_NAME'] = 'GIRO';
$DataAccounts[$key1]['CURRENCY'] = $account->kode_mata_uang;
$DataAccounts[$key1]['PRODUCT'] = $account->jenis_rekening;
$DataAccounts[$key1]['COMPANY_NAME'] = $account->nama_cabang;
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->jumlah_nominal != null ? number_format(abs($account->jumlah_nominal), 2, ',', '.') : 'NIHIL';
$DataAccounts[$key1]['MATURITY_DATE'] = '' ;
$DataAccounts[$key1]['ARRANGEMENT_ID'] = '';
$DataAccounts[$key1]['FIXED_RATE'] = '';
$DataAccounts[$key1]['TERM'] = '';
}
}
$DataDepo = [];
try {
$Deposito = $Account->getDepo($request['cusNo'], $arrAccount, $dateCoreDepo)->get();
} catch (Exception $e) {
return redirect()->route('konfirmasibank.timeout');
}
$periode = '';
foreach ($Deposito as $keyDep => $depo) {
if (substr($depo->KODE_SUB_PRODUK, -1) == 'Y') {
$periode = 'TAHUN';
} elseif (substr($depo->KODE_SUB_PRODUK, -1) == 'M') {
$periode = 'BULAN';
} else {
$periode = 'HARI';
}
$DataDepo[$keyDep]['ACCOUNT_NUMBER'] = $depo->NO_REK;
$DataDepo[$keyDep]['BATCH_DATE'] = $depo->PERIOD;
$DataDepo[$keyDep]['SHORT_NAME'] = 'DEPOSITO';
$DataDepo[$keyDep]['CURRENCY'] = $depo->KODE_MATA_UANG;
$DataDepo[$keyDep]['WORKING_BALANCE'] = number_format($depo->JUMLAH_NOMINAL, 2, ',', '.') ;
$DataDepo[$keyDep]['MATURITY_DATE'] = Carbon::parse($depo->JATUH_TEMPO)->format('d-m-Y');
$DataDepo[$keyDep]['ARRANGEMENT_ID'] = '';
$DataDepo[$keyDep]['FIXED_RATE'] = number_format($depo->SUKU_BUNGA, 2, ',', '.') ?? '';
$DataDepo[$keyDep]['TERM'] = substr($depo->KODE_SUB_PRODUK, 0, -1) .' '. $periode ;
}
// dd($Deposito);
$listAccountDepo = DPK::where('cif',$request['cusNo'])->whereIn('no_rek', $arrAccount)->whereDate('period', $dateCoreDepo )->orderBy('jenis_rekening', 'DESC')->get();
try {
$Arrangement = $Account->getPinjaman($request['cusNo'], $dateCoreAccount)->get();
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->route('konfirmasibank.timeout');
}
foreach ($Arrangement as $key2 => $pinjaman) {
$tanggalMulai = Carbon::parse($pinjaman->TGL_MULAI);
$tanggalJatuhTempo = Carbon::parse($pinjaman->JATUH_TEMPO);
$selisihHari = $tanggalMulai->diffInMonths($tanggalJatuhTempo);
$DataPinjaman[$key2]['CURRENCY'] = $pinjaman->KODE_MATA_UANG;
$DataPinjaman[$key2]['PRODUCT'] = $pinjaman->NAMA_PRODUK;
$DataPinjaman[$key2]['WORKING_BALANCE'] = $pinjaman->NOMINAL != null ? number_format(abs($pinjaman->NOMINAL), 2, ',', '.') : '';
$DataPinjaman[$key2]['TERM'] = $selisihHari;
$DataPinjaman[$key2]['FIXED_RATE'] = number_format($pinjaman->INTEREST_RATE, 2, ',', '.') ?? '';
$DataPinjaman[$key2]['MATURITY_DATE'] = date('d-m-Y', strtotime($pinjaman->JATUH_TEMPO)) ?? '';
$DataPinjaman[$key2]['ACCOUNT_NUMBER'] = $pinjaman->NO_REK;
foreach ($listAccountDepo as $keyDepo => $depo) {
$tanggalMulai = Carbon::parse($depo->tgl_mulai);
$tanggalJatuhTempo = Carbon::parse($depo->jatuh_tempo);
$selisihHari = $tanggalMulai->diffInMonths($tanggalJatuhTempo);
$DataDepo[$keyDepo]['ACCOUNT_NUMBER'] = $depo->no_rek;
$DataDepo[$keyDepo]['BATCH_DATE'] = $depo->period;
$DataDepo[$keyDepo]['CUSTOMER_NO'] = $depo->cif;
$DataDepo[$keyDepo]['SHORT_NAME'] = $depo->jenis_rekening; //$depo->SHORT_NAME;
$DataDepo[$keyDepo]['CURRENCY'] = $depo->kode_mata_uang;
$DataDepo[$keyDepo]['PRODUCT'] = $depo->jenis_rekening;
$DataDepo[$keyDepo]['COMPANY_NAME'] = $depo->nama_cabang;
$DataDepo[$keyDepo]['WORKING_BALANCE'] = $depo->jumlah_nominal != null ? number_format(abs($depo->jumlah_nominal), 2, ',', '.') : 'NIHIL';
$DataDepo[$keyDepo]['MATURITY_DATE'] = $depo->jatuh_tempo;
$DataDepo[$keyDepo]['FIXED_RATE'] = $depo->suku_bunga . ' %' ;
$DataDepo[$keyDepo]['TERM'] = $selisihHari . ' BLN';
}
try {
$listAccountRK = $Account->getAccountRK($arrAccount, $dateCoreAccount)->get();
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->route('konfirmasibank.timeout');
$loans = loan::where('sk_nasabah',$request['cusNo'])->whereDate('periode', $dateCoreAccount )->whereNot('outstanding', 0)->get();
$DataLoan = [];
foreach ($loans as $keyLon => $lon) {
$DataLoan[$keyLon]['ACCOUNT_NUMBER'] = $lon->no_rek;
$DataLoan[$keyLon]['BATCH_DATE'] = $lon->periode;
$DataLoan[$keyLon]['SHORT_NAME'] = $lon->product_loan;
$DataLoan[$keyLon]['CURRENCY'] = $lon->kode_mata_uang;
$DataLoan[$keyLon]['WORKING_BALANCE'] = number_format(abs($lon->outstanding), 2, ',', '.') ;
$DataLoan[$keyLon]['MATURITY_DATE'] = Carbon::parse($lon->jatuh_tempo)->format('d-m-Y');
$DataLoan[$keyLon]['ARRANGEMENT_ID'] = '';
$DataLoan[$keyLon]['FIXED_RATE'] = number_format($lon->interest_rate, 2, ',', '.') ?? '';
$DataLoan[$keyLon]['TERM'] = intval($lon->tenor) ;
}
foreach ($listAccountRK as $rk => $valRk) {
$DataRK[$rk]['ACCOUNT_NUMBER'] = $valRk->ACCOUNT_NUMBER;
$DataRK[$rk]['BATCH_DATE'] = $valRk->BATCH_DATE;
$DataRK[$rk]['SHORT_NAME'] = $valRk->PRODUCT_LOAN;
$DataRK[$rk]['CURRENCY'] = $valRk->LOAN_CCY;
$DataRK[$rk]['PRODUCT'] = $valRk->PRODUCT_LOAN;
$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'] = number_format($valRk->CURRENT_INTEREST_RATE, 2, ',', '.') ?? '';
$DataRK[$rk]['TERM'] = $valRk->TENOR;
}
try {
$fasilitas = Fasilitas::where('nomor_cif', $request['cusNo'])->where('status', 1)->get();
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->route('konfirmasibank.timeout');
}
// $CekDepo = Dpk::where('cif',$request['cusNo'])->whereDate('period', $dateCoreAccount )->whereNot('jumlah_nominal', 0)->where('jenis_rekening', 'DEPOSITO')->first();
$fasilitas = Fasilitas::where('nomor_cif', $request['cusNo'])->where('status', 1)->get();
foreach ($fasilitas as $key3 => $val3) {
$DataFasilitas[$key3]['jenis_fasilitas'] = $val3->jenis_fasilitas;
$DataFasilitas[$key3]['start_date'] = $val3->start_date;
@ -538,16 +541,6 @@ class KonfirmasiBankController extends Controller
$DataFasilitas[$key3]['nomor_rekening'] = $val3->nomor_rekening;
}
//Get DatA Anjak
try {
$ListAnjak = $Account->getAccountAnjak($rekEscrow, $dateCoreAccount)->get();
// dd($ListAnjak);
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->route('konfirmasibank.timeout');
}
$totalOutstanding = $ListAnjak->sum('OUTSTANDING') != null ? number_format(abs($ListAnjak->sum('OUTSTANDING')), 2, ',', '.') : 'NIHIL';
$ListLimits = $Account->getLimit($request['cusNo'], $request['startDate2'])->get();
$signer = Signer::where('id', $request['signerId'])->where('status', 1)->get();
$batchDate = Carbon::parse($request['startDate2']);
$currentDate = Carbon::now();
@ -556,19 +549,15 @@ class KonfirmasiBankController extends Controller
$letter = new Letters();
$infoSuratNew = $letter->where('no_cif', $request['cusNo'])->orderBy('id', 'DESC')->first();
$data['DataAccounts'] = $DataAccounts;
$data['DataPinjaman'] = $DataPinjaman;
$data['DataRK'] = $DataRK ;
$data['DataLimit'] = $ListLimits;
$data['DataFasilitas'] = $DataFasilitas;
$data['DataSigner'] = $signer;
$data['DataCustomer'] = $GetCustomer ?? '';
$data['localDate'] = $tanggalIndonesia;
$data['today'] = $today;
$data['DataDepo'] = $DataDepo;
$data['infoSuratNew'] = $infoSuratNew;
$data['totalOutstanding'] = $totalOutstanding;
$data['loanCcy'] = $ListAnjak->isEmpty() ? '' : $ListAnjak[0]->LOAN_CCY;
$data['DataAccounts'] = $DataAccounts;
$data['DataLoan'] = $DataLoan;
$data['DataDepo'] = $DataDepo ;
$data['DataFasilitas'] = $DataFasilitas;
$data['DataSigner'] = $signer;
$data['DataCustomer'] = $GetCustomer ?? '';
$data['localDate'] = $tanggalIndonesia;
$data['today'] = $today;
$data['infoSuratNew'] = $infoSuratNew;
$pdf = PDF::loadview('konfirmasibank::exportPdf', ['data' => $data]);
// Set page script to disable header on the first page
@ -676,7 +665,7 @@ class KonfirmasiBankController extends Controller
}
$validated = $request->validate([
'nomor_rekening' => 'required|string|max:10|unique:fasilitas,nomor_rekening',
// 'nomor_rekening' => 'max:10|unique:fasilitas,nomor_rekening',
'jenis_fasilitas' => 'required|string',
'cabang' => 'required|string',
'mata_uang' => 'required|string',
@ -761,7 +750,7 @@ class KonfirmasiBankController extends Controller
// Validation Data\
$validator = Validator::make($request->all(), [
'nomor_rekening_edit' => 'required|string',
//'nomor_rekening_edit' => 'required|string',
'cabang_edit' => 'required|string',
'jenis_fasilitas_edit' => 'required|string',
'jenis_rekening_edit' => 'required|string',
@ -860,4 +849,4 @@ class KonfirmasiBankController extends Controller
}
}
}

View File

@ -130,8 +130,8 @@
</ul><br>
<ul class="no-bullets">
<li> Sesuai dengan surat saudara Nomor {{$data['infoSuratNew']['no_req_surat']}} tanggal {{ Carbon\Carbon::parse($data['infoSuratNew']['tgl_req_surat'])->locale('id')->isoFormat('DD MMMM YYYY') }} dengan ini kami sampaikan data data nasabah sesuai permintaan saudara sebagai berikut : </li><br>
<li>Nama Nasabah : {{$data['DataCustomer']->SHORT_NAME}}</li>
<li>Nomor CIF &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {{$data['DataCustomer']->CUSTOMER_NO}}</li>
<li>Nama Nasabah : {{$data['DataCustomer']->nama_nasabah}}</li>
<li>Nomor CIF &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {{$data['DataCustomer']->cif}}</li>
</ul><br>
<ul class="no-bullets">
<li>SIMPANAN NASABAH YANG BERSANGKUTAN PADA BANK</li>
@ -159,7 +159,7 @@
@endphp
@foreach ($data['DataAccounts'] as $val)
<tr class="space1">
<tr class="space1">
<td class="text-center space1">{{ $i++ }}</td>
<td class="text-left space1">{{ $val['SHORT_NAME'] }}</td>
<td class=" text-center space1"></td>
@ -168,39 +168,31 @@
<td class="text-center space1 ">{{ $val['TERM'] }}</td>
<td class="text-center space1 ">{{ $val['FIXED_RATE'] }}</td>
<td class="text-center space1 ">{{ $val['MATURITY_DATE'] }}</td>
<td class="text-center space1">{{ $val['ACCOUNT_NUMBER'] }}</td>
<td class="text-center space1">{{ $val['ACCOUNT_NUMBER'] }} </td>
</tr>
@endforeach
@if (count( $data['DataDepo']) > 0)
@php
$noDepo = 0;
if (count( $data['DataAccounts']) > 0) {
$noDepo = count($data['DataAccounts']) + 1 ;
}else{
$noDepo = 1 ;
}
@endphp
@foreach ($data['DataDepo'] as $keyDep => $depo)
<tr class="space1">
<td class="text-center space1">{{ $noDepo++ }}</td>
<td class="space1">DEPOSITO</td>
<td class="text-center space1 "></td>
<td class="text-center space1">{{ $depo['CURRENCY'] }}</td>
<td class="text-right space1">{{$depo['WORKING_BALANCE']}}</td>
<td class="text-center space1">{{ $depo['TERM'] }}</td>
<td class="text-center space1">{{ $depo['FIXED_RATE'] }} %</td>
<td class="text-center space1">{{ $depo['MATURITY_DATE'] }}</td>
<td class="text-center space1">{{ $depo['ACCOUNT_NUMBER'] }}</td>
</tr>
@endforeach
@else
@php
@if (!$data['DataDepo'])
@php
$no= count($data['DataAccounts']);
@endphp
<tr class="space1">
<td class="text-center space1">{{ $no++ }}</td>
<td class="text-left space1">{{ $val['SHORT_NAME'] }}</td>
<td class=" text-center space1"></td>
<td class=" text-center space1">{{ $val['CURRENCY'] }}</td>
<td class=" text-right space1">{{ $val['WORKING_BALANCE'] }}</td>
<td class="text-center space1 ">{{ $val['TERM'] }}</td>
<td class="text-center space1 ">{{ $val['FIXED_RATE'] }}</td>
<td class="text-center space1 ">{{ $val['MATURITY_DATE'] }}</td>
<td class="text-center space1">{{ $val['ACCOUNT_NUMBER'] }} </td>
</tr>
@else
@php
$no= count($data['DataAccounts']);
@endphp
<tr class="space1">
<td class="text-center space1">{{ $no+1 }}</td>
<td class="text-left space1">DEPOSITO</td>
<td class=" text-center space1"></td>
@ -211,27 +203,9 @@
<td class="text-center space1 "></td>
<td class="text-center space1"></td>
</tr>
@endif
{{-- @if ($data['dataAADepo'] == null)
@php
$no= count($data['DataAccounts']);
@endphp
<tr class="space1">
<td class="text-center space1">{{ $no+1 }}</td>
<td class="text-left space1">DEPOSITO</td>
<td class=" text-center space1"></td>
<td class=" text-center space1"></td>
<td class=" text-center space1">NIHIL</td>
<td class="text-center space1 "></td>
<td class="text-center space1 "></td>
<td class="text-center space1 "></td>
<td class="text-center space1"></td>
</tr>
@endif --}}
@else
<tr class="">
<td class="space1" colspan="9" style="text-align: center;">NIHIL</td>
@ -259,15 +233,14 @@
</tr>
</thead>
<tbody style="page-break-inside: avoid;">
@if (count($data['DataPinjaman'])>0 OR count($data['DataRK'])>0 OR $data['totalOutstanding'] != 'NIHIL' )
@if (count($data['DataPinjaman'])>0)
@if (count($data['DataLoan'])>0)
@php $i=1;
$saldo = '';
@endphp
@foreach ($data['DataPinjaman'] as $key1 => $pinjaman)
@foreach ($data['DataLoan'] as $key1 => $pinjaman)
<tr class="space1">
<td class="text-center space1">{{ $i++ }}</td>
<td class="space1">{{ $pinjaman['PRODUCT'] }}</td>
<td class="space1">{{ $pinjaman['SHORT_NAME'] }}</td>
<td class="text-center space1 "></td>
<td class="text-center space1">{{ $pinjaman['CURRENCY'] }}</td>
<td class="text-right space1">{{$pinjaman['WORKING_BALANCE']}}</td>
@ -277,57 +250,6 @@
<td class="text-center space1">{{ $pinjaman['ACCOUNT_NUMBER'] }}</td>
</tr>
@endforeach
@endif
@if (count($data['DataRK']) > 0)
@php
$no = 0;
if (count( $data['DataPinjaman']) > 0) {
$no = count($data['DataPinjaman']) + 1 ;
}else{
$no = 1 ;
}
@endphp
@foreach ($data['DataRK'] as $rk => $dtRK)
<tr class="space1">
<td class="text-center space1">{{ $no++ }}</td>
<td class="space1">{{ $dtRK['SHORT_NAME'] }}</td>
<td class="text-center space1 "></td>
<td class="text-center space1">{{ $dtRK['CURRENCY'] }}</td>
<td class="text-right space1">{{$dtRK['WORKING_BALANCE']}}</td>
<td class="text-center space1">{{$dtRK['TERM']}} BLN</td>
<td class="text-center space1">{{$dtRK['FIXED_RATE']}} %</td>
<td class="text-center space1">{{$dtRK['MATURITY_DATE']}}</td>
<td class="text-center space1">{{ $dtRK['ACCOUNT_NUMBER'] }}</td>
</tr>
@endforeach
@endif
@if ($data['totalOutstanding'] != 'NIHIL')
@php
$no = 0;
if (count( $data['DataPinjaman']) > 0) {
$no = count($data['DataPinjaman']) + 1 ;
}else if(count( $data['DataRK']) > 0){
$no = count($data['DataRK']) + 1 ;
}else{
$no = 1;
}
@endphp
<tr class="space1">
<td class="text-center space1">{{ $no++ }}</td>
<td class="space1">ANJAK PIUTANG</td>
<td class="text-center space1 "></td>
<td class="text-center space1">{{$data['loanCcy']}}</td>
<td class="text-right space1">{{$data['totalOutstanding']}}</td>
<td class="text-center space1"></td>
<td class="text-center space1"></td>
<td class="text-center space1"></td>
<td class="text-center space1"></td>
</tr>
@endif
@else
<tr class="space1">
<td class="space1" colspan="9" style="text-align: center;">NIHIL</td>
@ -356,17 +278,12 @@
<tbody style="page-break-inside: avoid;">
@if (count($data['DataFasilitas']) > 0 )
@php
$no = 0;
if (count( $data['DataLimit']) > 0) {
$no = count($data['DataLimit']) + 1 ;
}else{
$no = 1 ;
}
$nos = 1;
@endphp
@foreach ($data['DataFasilitas'] as $fasilitas)
<tr class="space1">
<td class="text-center space1">{{ $no++ }}</td>
<td class="text-center space1">{{ $nos++ }}</td>
<td class="space1">{{ $fasilitas['jenis_fasilitas'] }}</td>
<td class="text-center space1"></td>
{{-- <td class="text-center space1">{{ \Carbon\Carbon::parse($fasilitas->start_date)->format('d-m-Y') }}</td> --}}