fix error export pdf
This commit is contained in:
@ -9,6 +9,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Account extends Model
|
||||
{
|
||||
@ -33,6 +36,160 @@ class Account extends Model
|
||||
return $this->belongsTo(Arrangement::class, 'LINKED_APPL_ID');
|
||||
}
|
||||
|
||||
public function getSearchAccount($cif ,$arrAccount, $kodecabang, $startDate){
|
||||
|
||||
|
||||
// dd($cif ,$arrAccount, $kodecabang, $startDate);
|
||||
$uppercaseKodeCabang = Str::upper($kodecabang);
|
||||
$data = [];
|
||||
|
||||
|
||||
if($arrAccount == null){
|
||||
|
||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
|
||||
->selectRaw('AC.CUSTOMER_NO, MAX(INACTIV_MARKER) as INACTIV_MARKER,AC.ACCOUNT_NUMBER,MAX(AC.BATCH_DATE) AS BATCH_DATE,MAX(AC.CURRENCY)AS CURRENCY, AC.SHORT_TITLE,MAX(AC.OPENING_DATE) AS OPENING_DATE, MAX(AC.WORKING_BALANCE) AS WORKING_BALANCE, MAX(AC.CATEGORY) AS CATEGORY,CT.SHORT_NAME,CP.COMPANY_NAME')
|
||||
->join('STG_DB.CATEGORY AS CT', 'AC.CATEGORY', '=', 'CT.ID')
|
||||
->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('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')
|
||||
->limit(100);
|
||||
}else{
|
||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT")
|
||||
->select('*')
|
||||
->where('CUSTOMER_NO',$cif)
|
||||
->where('COMPANY_NAME', 'like', "%" .$uppercaseKodeCabang."%")
|
||||
->whereIn('ACCOUNT_NUMBER', $arrAccount)
|
||||
->where('OPENING_DATE', $startDate);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getAccount($cif, $startDate){
|
||||
// $uppercaseKodeCabang = Str::upper($kodecabang);
|
||||
|
||||
$data = DB::connection("db2")->table("STG_DB.ACCOUNT AS AC")
|
||||
->selectRaw('AC.CUSTOMER_NO, MAX(INACTIV_MARKER) as INACTIV_MARKER,AC.ACCOUNT_NUMBER,MAX(AC.BATCH_DATE) AS BATCH_DATE,MAX(AC.CURRENCY)AS CURRENCY, AC.SHORT_TITLE,MAX(AC.OPENING_DATE) AS OPENING_DATE, MAX(AC.WORKING_BALANCE) AS WORKING_BALANCE, MAX(AC.CATEGORY) AS CATEGORY,CT.SHORT_NAME,CP.COMPANY_NAME')
|
||||
->join('STG_DB.CATEGORY AS CT', 'AC.CATEGORY', '=', 'CT.ID')
|
||||
->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('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')
|
||||
->limit(100);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCustomer($cus_no){
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.CUSTOMER")->select('CUSTOMER_NO','STREET','RESIDENCE','ADDRESS','SHORT_NAME')->where('CUSTOMER_NO', $cus_no);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getAAaccount($cust, $acc){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_AA_ACCOUNT")->select('MATURITY_DATE','PRODUCT','TERM')
|
||||
// ->where('CUSTOMER', $cif)
|
||||
->where('CUSTOMER', $cust)
|
||||
->where('LINKED_APPL_ID', $acc)
|
||||
->limit(100);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getPinjaman($cus_no, $dateCore){
|
||||
//dd($cus_no, $accNo, $dateCore);
|
||||
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.AA_ARRANGEMENT")
|
||||
->select('ARRANGEMENT_ID','PRODUCT_LINE','CO_CODE','START_DATE','CURRENCY','PRODUCT_LINE','LINKED_APPL_ID')
|
||||
// ->join('STG_DB.ACCOUNT AS AC', 'AA.LINKED_APPL_ID', '=', 'AC.ACCOUNT_NUMBER')
|
||||
->where('CUSTOMER',$cus_no)
|
||||
->where('ARR_STATUS' , 'CURRENT')
|
||||
// ->orderBy('TERM','DESC');
|
||||
->where('BATCH_DATE', $dateCore)
|
||||
//->where('LINKED_APPL_ID', $accNo)
|
||||
->limit(100);;
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getFixedRate($arrangementId, $startDate){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.AA_ARR_INTEREST")
|
||||
->select('FIXED_RATE')
|
||||
->where('BATCH_DATE', $startDate)
|
||||
->where(DB::raw("LEFT(ID, 12)"),$arrangementId);
|
||||
// ->orderBy('TERM','DESC');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getMaturityDate($arrangementId){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.AA_ACCOUNT_DETAILS")
|
||||
->select('MATURITY_DATE')
|
||||
->where('ID' ,$arrangementId)
|
||||
->limit(100);
|
||||
// ->orderBy('TERM','DESC');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTermAmount($arrangementId){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.AA_ARR_TERM_AMOUNT")
|
||||
->select('TERM')
|
||||
->where(DB::raw("LEFT(ID, 12)"),$arrangementId);
|
||||
// ->orderBy('TERM','DESC');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCategory($category){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.CATEGORY")
|
||||
->select('SHORT_NAME')
|
||||
->where('ID',$category);
|
||||
// ->orderBy('TERM','DESC');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCompany($co_code){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.COMPANY")
|
||||
->select('COMPANY_NAME')
|
||||
->where('ID',$co_code);
|
||||
// ->orderBy('TERM','DESC');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getLimit($cus_id,$periode){
|
||||
$timestamp = strtotime($periode);
|
||||
// Format the timestamp into a date format
|
||||
$Year = date("Y", $timestamp);
|
||||
// dd($periode);
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.LIMIT AS LM")
|
||||
->select('*')
|
||||
->join('STG_DB.LIMIT_REFERENCE AS LR', 'LM.LIMIT_PRODUCT', '=', 'LR.ID')
|
||||
->join('STG_DB.COMPANY AS CP', 'LM.CO_CODE', '=', 'CP.ID')
|
||||
->join('STG_DB.CATEGORY AS CT', 'LM.LIMIT_PRODUCT', '=', 'CT.ID')
|
||||
->select('LM.ACCOUNT','LM.LIMIT_CURRENCY','LM.APPROVAL_DATE','LM.EXPIRY_DATE','LM.AVAIL_AMT','LM.BATCH_DATE','LM.EXPIRY_DATE','LR.SHORT_NAME','LR.LIMIT_PERCENTAGE','CP.COMPANY_NAME','CT.SHORT_NAME AS ACCOUNT_TYPE')
|
||||
->where(DB::raw("LEFT(LM.@ID, 10)"),$cus_id)
|
||||
->whereYear('LM.BATCH_DATE', $Year);
|
||||
//->where('BATCH_DATE', $periode);
|
||||
// ->orderBy('LM.@ID','DESC')->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -17,8 +17,9 @@
|
||||
use Modules\Konfirmasibank\Entities\Account;
|
||||
use Modules\Konfirmasibank\Entities\Arrangement;
|
||||
use Modules\Konfirmasibank\Entities\TermAmount;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
//use Dompdf\Dompdf;
|
||||
use PDF;
|
||||
//use Dompdf\Options;
|
||||
use Carbon\Carbon;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\IOFactory;
|
||||
@ -96,12 +97,10 @@
|
||||
|
||||
|
||||
$data = [];
|
||||
$Account = new ViewAccount;
|
||||
$Account = new Account;
|
||||
$arrAccount = [];
|
||||
$startDate = Carbon::parse($request->startDate);
|
||||
$dateCore = $startDate->subDays(2)->format('m/d/Y');
|
||||
|
||||
|
||||
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get();
|
||||
return json_encode($Accounts );
|
||||
}
|
||||
@ -109,381 +108,73 @@
|
||||
/*
|
||||
----- export pdf -----
|
||||
*/
|
||||
public function export2(Request $request) {
|
||||
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.report')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
||||
}
|
||||
|
||||
$arrAccount = explode("," , $request['acc_no']);
|
||||
$startDate = Carbon::parse($request['startDate']);
|
||||
$dateCore = $startDate->subDays(2);
|
||||
|
||||
|
||||
|
||||
|
||||
$ViewAccount = new ViewAccount;
|
||||
$data = [];
|
||||
$DataAccounts = [];
|
||||
$ListPinjaman = [];
|
||||
$ListLimits = [];
|
||||
$DataAA = [];
|
||||
$fasilitas = [];
|
||||
|
||||
//get No Surat
|
||||
$noSurat = $this->generateNomorSurat();
|
||||
$this->postInfoSurat($request ,$noSurat);
|
||||
$listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $dateCore)->get();
|
||||
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
|
||||
foreach ($listAccount as $key1 => $account) {
|
||||
//$Arrangement = $ViewAccount->getAAaccount($account->CUSTOMER_NO,$account->ACCOUNT_NUMBER);
|
||||
$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
|
||||
|
||||
$months = '';
|
||||
|
||||
if($Arrangement != null && $Arrangement->TERM != null){
|
||||
$arrTerm = substr($Arrangement->TERM,-1);
|
||||
if($arrTerm[1] = 'Y'){
|
||||
$monthsInYear = 12;
|
||||
$months = int($arrTerm[0]) * $monthsInYear;
|
||||
// $term = $days;
|
||||
}elseif ($arrTerm[1] = 'D') {
|
||||
$averageDaysInMonth = 30.44;
|
||||
$months = int($arrTerm[0]) / $averageDaysInMonth;
|
||||
// return $days;
|
||||
}
|
||||
}
|
||||
|
||||
$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'] = $account->SHORT_NAME;
|
||||
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
|
||||
$DataAccounts[$key1]['PRODUCT'] = $Arrangement->PRODUCT ?? '';
|
||||
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
|
||||
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
|
||||
$DataAccounts[$key1]['MATURITY_DATE'] = $Arrangement->MATURITY_DATE ?? '' ;
|
||||
$DataAccounts[$key1]['ARRANGEMENT_ID'] = $Arrangement->ARRANGEMENT_ID ?? '';
|
||||
$DataAccounts[$key1]['FIXED_RATE'] = $Arrangement->FIXED_RATE ?? '';
|
||||
$DataAccounts[$key1]['TERM'] = $months;
|
||||
}
|
||||
|
||||
|
||||
$ListPinjaman =$ViewAccount->getPinjaman($request['cus_no'],$arrAccount , $dateCore )->get();
|
||||
|
||||
$ListLimits = $ViewAccount->getLimit($request['cus_no'],$request['periode']);
|
||||
$fasilitas = Fasilitas::where('nomor_cif',$request['cus_no'] )->where('status',1)->get();
|
||||
|
||||
$signer = Signer::where('id', $request['signer'])->where('status',1)->get();
|
||||
$currentDate = Carbon::now();
|
||||
$tanggalIndonesia = $currentDate->locale('id')->isoFormat('D MMMM YYYY');
|
||||
$letter = new Letters;
|
||||
$infoSuratNew = $letter->where('no_cif',$request['cus_no'])->orderBy('created_at','desc')->first();
|
||||
$infoSuratOld = $letter->where('no_cif',$request['cus_no'])->orderBy('created_at','asc')->first();
|
||||
|
||||
$data['DataAccounts'] = $DataAccounts;
|
||||
$data['DataPinjaman'] = $ListPinjaman;
|
||||
$data['DataLimit'] = $ListLimits;
|
||||
$data['DataFasilitas'] = $fasilitas;
|
||||
$data['DataSigner'] = $signer;
|
||||
$data['DataCustomer'] = $GetCustomer ?? '';
|
||||
$data['localDate'] = $tanggalIndonesia;
|
||||
$data['infoSuratOld'] = $infoSuratOld;
|
||||
$data['infoSuratNew'] = $infoSuratNew;
|
||||
|
||||
//Inisialisasi DOMPDF
|
||||
$options = new Options();
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isPhpEnabled', true);
|
||||
$options->set(['padding-top' => 39, 'padding-right' => 10, 'padding-bottom' => 20, 'padding-left' => 15]);
|
||||
$dompdf = new Dompdf($options);
|
||||
$html = View::make('konfirmasibank::exportPdf', ['data' => $data])->render();
|
||||
// Konfigurasi DOMPDF
|
||||
|
||||
$dompdf->loadHtml($html);
|
||||
|
||||
// Mengatur jenis kertas
|
||||
$dompdf->setPaper('f4', 'portrait')->set_option('defaultFont', 'Arial');
|
||||
|
||||
|
||||
// Render HTML menjadi PDF
|
||||
$dompdf->render();
|
||||
|
||||
|
||||
// Keluarkan file PDF ke browser
|
||||
$dompdf->stream('"Konfirmasi_bank_".pdf"');
|
||||
|
||||
return response()->download($dompdf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function postInfoSurat($request, $noSurat){
|
||||
|
||||
|
||||
// $request->validate([
|
||||
// 'signer' => ['required'],
|
||||
// 'no_req_surat' => ['required', 'max:100'],
|
||||
// 'tgl_req_surat' => ['required'],
|
||||
// 'email' => ['email'],
|
||||
// 'tlp' => ['numeric', 'max:10'],
|
||||
// 'nama_tujuan' => ['required'],
|
||||
// 'alamat' => ['required']
|
||||
// ]);
|
||||
|
||||
$currentDate = Carbon::now();
|
||||
$tglSurat = $currentDate->format('Y-m-d');
|
||||
$letter = new Letters();
|
||||
$letter->no_cif = $request->cus_no;
|
||||
$letter->no_surat = $noSurat;
|
||||
$letter->tgl_surat = $tglSurat;
|
||||
$letter->no_req_surat = $request->no_req_surat;
|
||||
$letter->tgl_req_surat = $request->tgl_req_surat;
|
||||
$letter->email = $request->email ;
|
||||
$letter->tlp = $request->tlp ;
|
||||
$letter->nama_tujuan = $request->nama_tujuan ;
|
||||
$letter->alamat = $request->alamat ;
|
||||
$letter->created_at = $currentDate;
|
||||
$letter->status = 1;
|
||||
$letter->save();
|
||||
|
||||
}
|
||||
|
||||
private function generateNomorSurat(){
|
||||
$latesNoSurat = '';
|
||||
$latestRecord = letters::latest('no_surat')->select('no_surat')->first();
|
||||
$tanggal = now();
|
||||
$tahun = $tanggal->format('Y');
|
||||
// Fungsi untuk mengonversi angka bulan menjadi romawi
|
||||
$bulanRomawi = $this->numberToRoman($tanggal->format('n'));
|
||||
|
||||
if($latestRecord){
|
||||
$squence = substr($latestRecord['no_surat'], 0, 3);
|
||||
$latesNoSurat = str_pad(intval($squence), 3, '0', STR_PAD_LEFT);
|
||||
$NoUrut = str_pad(intval($latesNoSurat + 1), 3, '0', STR_PAD_LEFT);
|
||||
$noSurat = " $NoUrut/SUBDIT.OPS/$bulanRomawi/$tahun";
|
||||
return $noSurat;
|
||||
}else {
|
||||
$noSurat = "001/SUBDIT.OPS/$bulanRomawi/$tahun";
|
||||
return $noSurat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function numberToRoman($num)
|
||||
{
|
||||
// Be sure to convert the given parameter into an integer
|
||||
$n = intval($num);
|
||||
$result = '';
|
||||
|
||||
// Declare a lookup array that we will use to traverse the number:
|
||||
$lookup = array(
|
||||
'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400,
|
||||
'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40,
|
||||
'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1
|
||||
);
|
||||
|
||||
foreach ($lookup as $roman => $value)
|
||||
{
|
||||
// Look for number of matches
|
||||
$matches = intval($n / $value);
|
||||
|
||||
// Concatenate characters
|
||||
$result .= str_repeat($roman, $matches);
|
||||
|
||||
// Substract that from the number
|
||||
$n = $n % $value;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function signer(Request $request){
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.create')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
||||
}
|
||||
|
||||
$data = [];
|
||||
// $signer = Signer::paginate(10);
|
||||
$signer = Signer::where('status',1)->paginate(10);
|
||||
$data['signer'] = $signer;
|
||||
// dd( $data['signer']);
|
||||
|
||||
return view('konfirmasibank::pages.index_signer',compact('data'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function convertToRupiah($amount)
|
||||
{
|
||||
$formattedAmount = number_format($amount, 0, ',', '.');
|
||||
return $formattedAmount;
|
||||
}
|
||||
|
||||
public function postSigner(Request $request){
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.create')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to create any konfirmasibank.create !');
|
||||
}
|
||||
|
||||
|
||||
$currentDate = Carbon::now();
|
||||
$validated = $request->validate([
|
||||
'deputy_director' => 'required|string',
|
||||
'executive_officer' => 'required|string',
|
||||
'signer_type' => 'required|string'
|
||||
]);
|
||||
|
||||
if ($validated) {
|
||||
try {
|
||||
// Create New User
|
||||
$signer = new Signer();
|
||||
$signer->deputy_director_name = $request->deputy_director;
|
||||
$signer->executive_officer_name = $request->executive_officer;
|
||||
$signer->signer_type = $request->signer_type;
|
||||
$signer->created_at = $currentDate;
|
||||
$signer->status = 1;
|
||||
$signer->save();
|
||||
// return redirect()->route('konfirmasibank.addFasilitas')->with('success', 'Data berhasil ditambahkan');
|
||||
echo json_encode(['status' => 'success', 'message' => ' Add signer successfully .']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
return json_encode([
|
||||
'status' => 'error',
|
||||
'message' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function editSigner(Request $request)
|
||||
{
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.update')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
|
||||
}
|
||||
|
||||
$signer = Signer::find($request->id);
|
||||
|
||||
return json_encode( $signer);
|
||||
}
|
||||
|
||||
|
||||
public function fasilitas(Request $request){
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.create')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$fasilitas = Fasilitas::where('status',1)->where('nomor_cif',$request->query()['cus_no_fasilitas'])->paginate(10)->appends($request->query()['cus_no_fasilitas'],$request->query()['company_name'],$request->query()['startDateFasilitas']);
|
||||
|
||||
$Category = Category::all();
|
||||
$Company = Company::all();
|
||||
// dd($fasilitas);
|
||||
$limitReference = LimitReference::all();
|
||||
$data['queryParam'] = $request->query();
|
||||
$data['fasilitas'] = $fasilitas;
|
||||
$data['limitReference'] = $limitReference;
|
||||
$data['Category'] = $Category;
|
||||
$data['Company'] = $Company;
|
||||
|
||||
return view('konfirmasibank::pages.index_fasilitas',compact('data'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function updateSigner(Request $request)
|
||||
{
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.update')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to edit any role !');
|
||||
}
|
||||
|
||||
$today = Carbon::now();
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'deputy_director' => 'required|string',
|
||||
'executive_officer' => 'required|string',
|
||||
'signer_type' => 'required|string'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['errors' => $validator->errors()], 422); // Return validation errors as JSON
|
||||
}
|
||||
|
||||
|
||||
if ($validator) {
|
||||
try {
|
||||
$signer = Signer::findOrFail($request->id);
|
||||
$signer->deputy_director_name = $request->deputy_director;
|
||||
$signer->executive_officer_name = $request->executive_officer;
|
||||
$signer->signer_type = $request->signer_type;
|
||||
$signer->updated_at = $today;
|
||||
$signer->save();
|
||||
|
||||
echo json_encode(['status' => 'success', 'message' => ' signer updated successfully.']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['status' => 'error', 'message' => ' signer updated failed.']);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
echo json_encode(['status' => 'error', 'message' => ' signer updated failed.']);
|
||||
}
|
||||
|
||||
public function export(Request $request){
|
||||
$arrAccount = explode("," , $request['acc_no']);
|
||||
$startDate = Carbon::parse($request['startDate']);
|
||||
$arrAccount = explode("," , $request['accNo']);
|
||||
$startDate = Carbon::parse($request['startDate2']);
|
||||
$dateCore = $startDate->subDays(2);
|
||||
$ViewAccount = new ViewAccount;
|
||||
$listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $dateCore)->get();
|
||||
$Account = new Account;
|
||||
$data = [];
|
||||
$DataAccounts = [];
|
||||
$DataPinjaman = [];
|
||||
|
||||
// dd($listAccount);
|
||||
$GetCustomer = $Account->getCustomer($request['cusNo'])->first();
|
||||
$listAccount = $Account->getAccount($request['cusNo'], $dateCore )->get();
|
||||
// $Arrangement = $Account->getPinjaman($request['cusNo'],$startDate)->get();
|
||||
foreach ($listAccount as $key1 => $account) {
|
||||
//$Arrangement = $ViewAccount->getAAaccount($account->CUSTOMER_NO,$account->ACCOUNT_NUMBER);
|
||||
$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
|
||||
$Arrangement = $Account->getPinjaman($request['cusNo'],$startDate)->get();
|
||||
//dd($Arrangement);
|
||||
$months = '';
|
||||
$PRODUCTFIXED_RATE = '' ;
|
||||
$MATURITY_DATE ='';
|
||||
$PRODUCT = '' ;
|
||||
$ARRANGEMENT_ID ='' ;
|
||||
if($Arrangement){
|
||||
foreach ($Arrangement as $key2 => $pinjaman) {
|
||||
$MaturityDate = $Account->getMaturityDate($pinjaman->ARRANGEMENT_ID, $startDate )->first();
|
||||
$TermAmount = $Account->getTermAmount($pinjaman->ARRANGEMENT_ID,$startDate)->first();
|
||||
$FixedRate = $Account->getFixedRate($pinjaman->ARRANGEMENT_ID,$startDate)->first();
|
||||
// String asli
|
||||
$StringTerm = $TermAmount->TERM;
|
||||
// Panjang string
|
||||
$panjang_string = strlen($StringTerm);
|
||||
// Panjang bagian yang ingin dihapus dari kanan
|
||||
$panjang_hapus = 1;
|
||||
// Menghapus bagian dari kanan string
|
||||
$string_baru = substr($StringTerm, 0, $panjang_string - $panjang_hapus);
|
||||
$Term1 = substr($TermAmount->TERM, -1);
|
||||
if($TermAmount){
|
||||
if( $Term1 = 'Y'){
|
||||
$monthsInYear = 12;
|
||||
$months = intval( $string_baru) * $monthsInYear;
|
||||
$PRODUCTFIXED_RATE = $FixedRate ? $FixedRate->FIXED_RATE : '';
|
||||
$PRODUCT = $pinjaman->PRODUCT_LINE ;
|
||||
$MATURITY_DATE = $MaturityDate ? $MaturityDate->MATURITY_DATE : '';
|
||||
$ARRANGEMENT_ID = $pinjaman->ARRANGEMENT_ID ;
|
||||
// $term = $days;
|
||||
}elseif($Term1 = 'M') {
|
||||
$averageDaysInMonth = 30.44;
|
||||
$months = intval($string_baru) / $averageDaysInMonth;
|
||||
// return $days;
|
||||
}else{
|
||||
$months = $TermAmount->TERM;
|
||||
}
|
||||
}
|
||||
|
||||
$DataPinjaman[$key2]['ARRANGEMENT_ID'] = $pinjaman->ARRANGEMENT_ID;
|
||||
$DataPinjaman[$key2]['START_DATE'] = $pinjaman->START_DATE;
|
||||
$DataPinjaman[$key2]['CURRENCY'] = $pinjaman->CURRENCY;
|
||||
$DataPinjaman[$key2]['PRODUCT_LINE'] = $pinjaman->PRODUCT_LINE;
|
||||
$DataPinjaman[$key2]['WORKING_BALANCE'] = number_format($account->WORKING_BALANCE, 2, ',', '.') ?? '';
|
||||
$DataPinjaman[$key2]['TERM'] = $months . ' D';
|
||||
$DataPinjaman[$key2]['FIXED_RATE'] = $FixedRate ? $FixedRate->FIXED_RATE : '';
|
||||
$DataPinjaman[$key2]['MATURITY_DATE'] = $MaturityDate ? $MaturityDate->MATURITY_DATE : '' ;
|
||||
$DataPinjaman[$key2]['ACCOUNT_NUMBER'] = $pinjaman->LINKED_APPL_ID;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$months = '';
|
||||
$PRODUCTFIXED_RATE = '' ;
|
||||
$PRODUCT = '' ;
|
||||
$MATURITY_DATE = '' ;
|
||||
$ARRANGEMENT_ID ='' ;
|
||||
|
||||
if($Arrangement != null && $Arrangement->TERM != null){
|
||||
//$arrTerm = substr($Arrangement->TERM,-1);
|
||||
$PRODUCTFIXED_RATE = $Arrangement->PRODUCTFIXED_RATE ;
|
||||
$PRODUCT = $Arrangement->PRODUCT ;
|
||||
$MATURITY_DATE = $Arrangement->MATURITY_DATE ;
|
||||
$ARRANGEMENT_ID = $Arrangement->ARRANGEMENT_ID ;
|
||||
// if($arrTerm[1] = 'Y'){
|
||||
// $monthsInYear = 12;
|
||||
// $months = int($arrTerm[0]) * $monthsInYear;
|
||||
// // $term = $days;
|
||||
// }elseif ($arrTerm[1] = 'D') {
|
||||
// $averageDaysInMonth = 30.44;
|
||||
// $months = int($arrTerm[0]) / $averageDaysInMonth;
|
||||
// // return $days;
|
||||
// }
|
||||
}
|
||||
|
||||
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
|
||||
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
|
||||
@ -493,39 +184,37 @@
|
||||
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
|
||||
$DataAccounts[$key1]['PRODUCT'] = $PRODUCT;
|
||||
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
|
||||
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
|
||||
$DataAccounts[$key1]['MATURITY_DATE'] = $MATURITY_DATE;
|
||||
$DataAccounts[$key1]['ARRANGEMENT_ID'] = $ARRANGEMENT_ID;
|
||||
$DataAccounts[$key1]['FIXED_RATE'] = $PRODUCTFIXED_RATE;
|
||||
$DataAccounts[$key1]['TERM'] = '';
|
||||
$DataAccounts[$key1]['WORKING_BALANCE'] = number_format($account->WORKING_BALANCE, 2, ',', '.');
|
||||
$DataAccounts[$key1]['MATURITY_DATE'] = '';
|
||||
$DataAccounts[$key1]['ARRANGEMENT_ID'] = '';
|
||||
$DataAccounts[$key1]['FIXED_RATE'] = '';
|
||||
$DataAccounts[$key1]['TERM'] = '' ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$ListLimits = $Account->getLimit($request['cusNo'],$request['startDate2'])->get();
|
||||
$fasilitas = Fasilitas::where('nomor_cif',$request['cusNo'] )->where('status',1)->get();
|
||||
$signer = Signer::where('id', $request['signerId'])->where('status',1)->get();
|
||||
$currentDate = Carbon::now();
|
||||
$tanggalIndonesia = $currentDate->locale('id')->isoFormat('D MMMM YYYY');
|
||||
$letter = new Letters;
|
||||
$infoSuratNew = $letter->where('no_cif',$request['cusNo'])->orderBy('id','DESC')->first();
|
||||
$infoSuratOld = $letter->where('no_cif',$request['cusNo'])->orderBy('id','ASC')->first();
|
||||
|
||||
$data['DataAccounts'] = $DataAccounts;
|
||||
$data['DataPinjaman'] = $DataPinjaman;
|
||||
|
||||
//Inisialisasi DOMPDF
|
||||
$options = new Options();
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isPhpEnabled', true);
|
||||
$options->set(['padding-top' => 39, 'padding-right' => 10, 'padding-bottom' => 20, 'padding-left' => 15]);
|
||||
$dompdf = new Dompdf($options);
|
||||
$html = View::make('konfirmasibank::exportPdf', ['data' => $data])->render();
|
||||
// Konfigurasi DOMPDF
|
||||
|
||||
$dompdf->loadHtml($html);
|
||||
|
||||
// Mengatur jenis kertas
|
||||
$dompdf->setPaper('f4', 'portrait')->set_option('defaultFont', 'Arial');
|
||||
|
||||
|
||||
// Render HTML menjadi PDF
|
||||
$dompdf->render();
|
||||
|
||||
|
||||
// Keluarkan file PDF ke browser
|
||||
$dompdf->stream('"Konfirmasi_bank_".pdf"');
|
||||
|
||||
return response()->download($dompdf);
|
||||
$data['DataLimit'] = $ListLimits;
|
||||
$data['DataFasilitas'] = $fasilitas;
|
||||
$data['DataSigner'] = $signer;
|
||||
$data['DataCustomer'] = $GetCustomer ?? '';
|
||||
$data['localDate'] = $tanggalIndonesia;
|
||||
$data['infoSuratOld'] = $infoSuratOld;
|
||||
$data['infoSuratNew'] = $infoSuratNew;
|
||||
|
||||
$pdf = PDF::loadview('konfirmasibank::exportPdf',['data'=>$data]);
|
||||
return $pdf->stream();
|
||||
|
||||
}
|
||||
|
||||
@ -533,7 +222,6 @@
|
||||
|
||||
public function postFasilitas(Request $request){
|
||||
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('konfirmasibank.create')) {
|
||||
abort(403, 'Sorry !! You are Unauthorized to create any konfirmasibank.create !');
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Table with 9 Columns</title>
|
||||
<title>KonfrimasiBank</title>
|
||||
<style>
|
||||
@page {
|
||||
margin-top: 3.5cm;
|
||||
@ -30,7 +30,7 @@
|
||||
},
|
||||
|
||||
|
||||
table {
|
||||
/* table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border: 1px solid #ddd;
|
||||
@ -38,7 +38,6 @@
|
||||
th, td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 3px;
|
||||
/* text-align: center; */
|
||||
font-size: 12px;
|
||||
}
|
||||
th {
|
||||
@ -47,28 +46,83 @@
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
} */
|
||||
|
||||
.text-center{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
ul.no-bullets {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px; /* Ukuran font dalam piksel */
|
||||
}
|
||||
|
||||
p{
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px; /* Ukuran font dalam piksel */
|
||||
}
|
||||
|
||||
.no-border-table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.no-border-table,
|
||||
.no-border-table th,
|
||||
.no-border-table td,
|
||||
.no-border-table tr {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.space1 {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table style="width:100%;">
|
||||
<thead style="background-color: dimgrey">
|
||||
<ul class="no-bullets">
|
||||
<li>Nomor : {{$data['infoSuratOld']['no_surat']}}</li>
|
||||
<li>Tanggal : {{ Carbon\Carbon::parse($data['infoSuratOld']['tgl_surat'])->format('d-m-Y') }}</li>
|
||||
</ul><br>
|
||||
<ul class="no-bullets">
|
||||
<li>Kepada Yth</li>
|
||||
<li>{{$data['infoSuratNew']['nama_tujuan']}}</li>
|
||||
<li>{{$data['infoSuratNew']['alamat']}}</li>
|
||||
<li>Email : {{$data['infoSuratNew']['email']}}</li>
|
||||
<li>Telp : {{$data['infoSuratNew']['tlp']}}</li>
|
||||
</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'])->format('d-m-Y') }} 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 : {{$data['DataCustomer']->CUSTOMER_NO}}</li>
|
||||
</ul><br>
|
||||
<ul class="no-bullets">
|
||||
<li>SIMPANAN NASABAH YANG BERSANGKUTAN PADA BANK</li>
|
||||
<li>POSISI : {{ Carbon\Carbon::parse($data['infoSuratNew']['tgl_req_surat'])->format('d-m-Y') }} </li>
|
||||
</ul>
|
||||
|
||||
<table style="width:100%;" class="space1" >
|
||||
<thead style="background-color: dimgrey" class="class="space1"">
|
||||
<tr>
|
||||
<th class="text-center " style="width:5%">No</th>
|
||||
<th class="text-center" style="width:21%">Jenis Rekening</th>
|
||||
<th class="text-center" style="width:12%">Tgl Realisasi</th>
|
||||
<th class="text-center" style="width:7%">Mata Uang</th>
|
||||
<th class="text-center" style="width:15%">Saldo</th>
|
||||
<th class="text-center" style="width:10%">Jangka Waktu</th>
|
||||
<th class="text-center" style="width:8%">Suku Bunga</th>
|
||||
<th class="text-center" style="width:12%">Tgl Jatuh Tempo</th>
|
||||
<th class="text-center" style="width:10%">Keterangan</th>
|
||||
<th class="text-center space1" style="width:5%">No</th>
|
||||
<th class="text-center space1" style="width:21%">Jenis Rekening</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Realisasi</th>
|
||||
<th class="text-center space1" style="width:7%">Mata Uang</th>
|
||||
<th class="text-center space1" style="width:15%">Saldo</th>
|
||||
<th class="text-center space1" style="width:10%">Jangka Waktu</th>
|
||||
<th class="text-center space1" style="width:8%">Suku Bunga</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Jatuh Tempo</th>
|
||||
<th class="text-center space1" style="width:10%">Keterangan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -76,30 +130,180 @@
|
||||
@php $i=1
|
||||
@endphp
|
||||
@foreach ($data['DataAccounts'] as $val)
|
||||
|
||||
|
||||
|
||||
<tr class="">
|
||||
<td class="text-center ">{{ $i++ }}</td>
|
||||
<td class="text-left">{{ $val['SHORT_NAME'] }}</td>
|
||||
<td class=" text-center">{{ $val['OPENING_DATE'] }}</td>
|
||||
<td class=" text-center">{{ $val['CURRENCY'] }}</td>
|
||||
<td class=" text-left"></td>
|
||||
<td class="text-center "></td>
|
||||
<td class="text-center "></td>
|
||||
<td class="text-center ">{{ $val['MATURITY_DATE'] }}</td>
|
||||
<td class="text-center ">{{ $val['ACCOUNT_NUMBER'] }}</td>
|
||||
<tr class="space1">
|
||||
<td class="text-center space1">{{ $i++ }}</td>
|
||||
<td class="text-left space1">{{ $val['SHORT_NAME'] }}</td>
|
||||
<td class=" text-center space1">{{ $val['OPENING_DATE'] }}</td>
|
||||
<td class=" text-center space1">{{ $val['CURRENCY'] }}</td>
|
||||
<td class=" text-left 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>
|
||||
@endforeach
|
||||
@else
|
||||
<tr class="">
|
||||
<td class="" colspan="9" style="text-align: center;">Tidak Ada Data Yang Ditampilkan</td>
|
||||
<td class="space1" colspan="9" style="text-align: center;">Tidak Ada Data Yang Ditampilkan</td>
|
||||
</tr>
|
||||
@endif
|
||||
<!-- Add more rows here if needed -->
|
||||
</tbody>
|
||||
</table>
|
||||
</table><br>
|
||||
|
||||
<ul class="no-bullets">
|
||||
<li>PINJAMAN YANG DIBERIKAN OLEH BANK KEPADA NASABAH</li>
|
||||
<li>POSISI : {{ Carbon\Carbon::parse($data['infoSuratNew']['tgl_req_surat'])->format('d-m-Y') }} </li>
|
||||
</ul>
|
||||
<table class="space1" style="width:100%;">
|
||||
<thead style="background-color: dimgrey">
|
||||
<tr class="space1">
|
||||
<th class="text-center space1" style="width:5%">No</th>
|
||||
<th class="text-center space1" style="width:21%">Jenis Rekening</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Realisasi</th>
|
||||
<th class="text-center space1" style="width:7%">Mata Uang</th>
|
||||
<th class="text-center space1" style="width:15%">Saldo</th>
|
||||
<th class="text-center" style="width:10%">Jangka Waktu</th>
|
||||
<th class="text-center space1" style="width:8%">Suku Bunga</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Jatuh Tempo</th>
|
||||
<th class="text-center space1" style="width:10%">Keterangan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (count($data['DataPinjaman'])>0)
|
||||
@php $i=1;
|
||||
$saldo = '';
|
||||
@endphp
|
||||
@foreach ($data['DataPinjaman'] as $key1 => $pinjaman)
|
||||
<tr class="space1">
|
||||
<td class="text-center space1">{{ $i++ }}</td>
|
||||
<td class="space1">{{ $pinjaman['PRODUCT_LINE'] }}</td>
|
||||
<td class="text-center space1 ">{{$pinjaman['START_DATE']}}</td>
|
||||
<td class="text-center space1">{{ $pinjaman['CURRENCY'] }}</td>
|
||||
<td class="text-center space1">{{$pinjaman['WORKING_BALANCE']}}</td>
|
||||
<td class="text-center space1">{{ $pinjaman['TERM'] }}</td>
|
||||
<td class="text-center space1">{{ $pinjaman['FIXED_RATE'] }} %</td>
|
||||
<td class="text-center space1">{{ $pinjaman['MATURITY_DATE'] }}</td>
|
||||
<td class="text-center space1">{{ $pinjaman['ACCOUNT_NUMBER'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr class="space1">
|
||||
<td class="space1" colspan="9" style="text-align: center;">Tidak Ada Data Pinjaman Yang Ditampilkan</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table><br>
|
||||
|
||||
<ul class="no-bullets">
|
||||
<li>FASILITAS LAIN YANG DITERIMA OLEH NASABAH</li>
|
||||
<li>POSISI : {{ Carbon\Carbon::parse($data['infoSuratNew']['tgl_req_surat'])->format('d-m-Y') }} </li>
|
||||
</ul>
|
||||
<table class="space1" style="width:100%;">
|
||||
<thead style="background-color: dimgrey">
|
||||
<tr class="space1">
|
||||
<th class="text-center space1" style="width:5%">No</th>
|
||||
<th class="text-center space1" style="width:21%">Jenis Rekening</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Realisasi</th>
|
||||
<th class="text-center space1" style="width:7%">Mata Uang</th>
|
||||
<th class="text-center space1" style="width:15%">Saldo</th>
|
||||
<th class="text-center space1" style="width:10%">Jangka Waktu</th>
|
||||
<th class="text-center space1" style="width:8%">Suku Bunga</th>
|
||||
<th class="text-center space1" style="width:12%">Tgl Jatuh Tempo</th>
|
||||
<th class="text-center space1" style="width:10%">Keterangan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (count($data['DataLimit']) > 0 OR count($data['DataFasilitas']) > 0 )
|
||||
@if (count($data['DataLimit']) > 0)
|
||||
@php $i=1 @endphp
|
||||
@foreach ($data['DataLimit'] as $limit)
|
||||
@php
|
||||
$approvalDate = \Carbon\Carbon::parse($limit->APPROVAL_DATE);
|
||||
$expiryDate = \Carbon\Carbon::parse($limit->EXPIRY_DATE);
|
||||
$term = $expiryDate->diffInMonths($approvalDate);
|
||||
$limitPecent = intval($limit->LIMIT_PERCENTAGE) / 100 ;
|
||||
$noRek = explode(']', $limit->ACCOUNT);
|
||||
@endphp
|
||||
<tr class="space1">
|
||||
|
||||
<td class="text-center space1">{{ $i++ }}</td>
|
||||
<td class="space1">{{ $limit->SHORT_NAME }}</td>
|
||||
<td class="text-center space1">{{ $approvalDate->format('d-m-Y') }}</td>
|
||||
<td class="text-center space1">{{ $limit->LIMIT_CURRENCY }}</td>
|
||||
<td class="space1">
|
||||
{{ ($limit->AVAIL_AMT != 0.00) ? number_format($limit->AVAIL_AMT,2,',','.') : 'NIHIL'}}</td>
|
||||
<td class="text-center space1">{{ $term }} D </td>
|
||||
<td class="text-center space1">{{ $limitPecent }} %</td>
|
||||
<td class="text-center space1">{{ $expiryDate->format('d-m-Y')}}</td>
|
||||
<td class="text-center space1">
|
||||
@if(count($noRek) > 1)
|
||||
<ul class="no-bullets">
|
||||
@foreach ($noRek as $item)
|
||||
<li style=" font-family: Times New Roman,Times, sans-serif;font-size:12px">{{$item}}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@else
|
||||
{{ $limit->ACCOUNT}}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if (count($data['DataFasilitas']) > 0)
|
||||
@php
|
||||
$no = 0;
|
||||
if (count( $data['DataLimit']) > 0) {
|
||||
$no = count($data['DataLimit']) + 1 ;
|
||||
}else{
|
||||
$no = 1 ;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@foreach ($data['DataFasilitas'] as $fasilitas)
|
||||
<tr class="space1" style="background-color: antiquewhite">
|
||||
<td class="text-center space1">{{ $no++ }}</td>
|
||||
<td class="space1">{{ $fasilitas->jenis_fasilitas }}</td>
|
||||
<td class="text-center space1">{{ \Carbon\Carbon::parse($fasilitas->start_date)->format('d-m-Y') }}</td>
|
||||
<td class="text-center space1">{{ $fasilitas->mata_uang }}</td>
|
||||
<td class="space1">{{ $fasilitas->saldo }}</td>
|
||||
<td class="text-center space1 ">{{ $fasilitas->jangka_waktu }}</td>
|
||||
<td class="text-center space1">{{ $fasilitas->fixed_rate }} %</td>
|
||||
<td class="text-center space1">{{ \Carbon\Carbon::parse($fasilitas->due_date)->format('d-m-Y') }}</td>
|
||||
<td class="text-center space1">{{ $fasilitas->nomor_rekening }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
@else
|
||||
<tr class="space1">
|
||||
<td class="space1" colspan="9" style="text-align: center;">Tidak Ada Fasilitas </td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table><br>
|
||||
|
||||
<p>Demikian data ini kami sampaikan agar dapat digunakan sebagaimana mestinya</p> <br><br><br><br>
|
||||
|
||||
<div style="width:300px" class>
|
||||
<table style="width:100%;" class="">
|
||||
<table style="width:100%;" class=" no-border-table">
|
||||
<td class="space1" style="width:20%;font-size:12px;border:none">
|
||||
<ul class="no-bullets">
|
||||
<li>{{$data['DataSigner'][0]['deputy_director_name']}}</li>
|
||||
<li>Deputy Director</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="space1" style="width:20%;font-size:12px;border:none">
|
||||
<ul class="no-bullets">
|
||||
<li>{{$data['DataSigner'][0]['executive_officer_name']}}</li>
|
||||
<li>Executive Officer</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div class="card-body pt-6">
|
||||
<div class="container">
|
||||
<div class="row" >
|
||||
<div class="col-md-3"></div>
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-6" style="border: 1px solid grey;padding: 20px;background-color:#f4f4f4">
|
||||
<form id="myForm">
|
||||
<div class="row mb-3">
|
||||
@ -79,7 +79,8 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-3 d-flex justify-content-end">
|
||||
<div class="col-md-4 d-flex justify-content-end">
|
||||
|
||||
<form class="form_customer2" id="exportForm">
|
||||
@csrf
|
||||
|
||||
@ -90,27 +91,36 @@
|
||||
<input type="hidden" style="margin-bottom: 5px" name="periode" /> --}}
|
||||
<div class="text-right ">
|
||||
<div class="d-flex justify-content-end ">
|
||||
<button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonExport1">
|
||||
{{-- <button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonExport1">
|
||||
<i class="ki-duotone ki-exit-down fs-2"><span class="path1"></span><span
|
||||
class="path2"></span></i>
|
||||
Export Report
|
||||
Export
|
||||
</button> --}}
|
||||
<button type="button" class="btn btn-light-primary btn-sm exportPdf" style="display:none" id="buttonPostInfoSurat">
|
||||
<i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span
|
||||
class="path2"></span></i>
|
||||
Surat
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form class="formFasilitas" action="{{ route($route[0].'.fasilitas') }}" >
|
||||
@csrf
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cus_no_fasilitas" id="cus_no_fasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="startDateFasilitas" id="startDateFasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="endDateFasilitas" id="endDateFasilitas" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="company_name" id="company_name" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="status" value="1" />
|
||||
<button type="submit" class="btn btn-light-info btn-sm fasilitasButton " style="margin-left:5px;display:none">
|
||||
<form class="fasilitas">
|
||||
<button type="submit" class="btn btn-light-info btn-sm " style="margin-left:5px;">
|
||||
<i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span class="path2"></span></i>
|
||||
Fasilitas
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ route($route[0].'.export') }}" target="_blank" >
|
||||
@csrf
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cusNo" id="cusNo" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="accNo" id="accNo" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="cabang" id="cabang" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="signerId" id="signerId" />
|
||||
<input type="hidden" style="margin-bottom: 5px" name="startDate2" id="startDate2" />
|
||||
<button type="submit" class="btn btn-light-info btn-sm exportButton" style="margin-left:5px;display:none" ><i class="ki-duotone ki-plus fs-2"><span class="path1"></span><span class="path2"></span></i>
|
||||
Export</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -276,7 +286,7 @@
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-sm closeButtonSigner"
|
||||
data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="submitSigner">Submit</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" id="submitInfoSurat">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -306,22 +316,6 @@
|
||||
$('.mycheck').hide();
|
||||
$('#cif_null').hide();
|
||||
|
||||
// $("#phoneNumber").on("input", function () {
|
||||
// validatePhoneNumber($(this).val());
|
||||
// });
|
||||
|
||||
// function validatePhoneNumber(phoneNumber) {
|
||||
// var regex = /^\d{12}$/;
|
||||
// if (regex.test(phoneNumber)) {
|
||||
// $("#phoneNumber").css("border", "1px solid green");
|
||||
// $("#error-message").text("");
|
||||
// } else {
|
||||
// $("#phoneNumber").css("border", "1px solid red");
|
||||
// $("#error-message").text("Invalid phone number. Please enter a valid 10-digit number.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$("#myForm").submit(function (event) {
|
||||
event.preventDefault(); // Prevent the form from submitting normally
|
||||
if ($("#cif").val() === "") {
|
||||
@ -365,12 +359,15 @@
|
||||
$('.loading1').hide();
|
||||
let dateString ='';
|
||||
$.each(items, function(i, index) {
|
||||
var reverse = items[i]['WORKING_BALANCE'].toString().split('').reverse().join(''),
|
||||
rp = reverse.match(/\d{1,3}/g);
|
||||
rp = rp.join('.').split('').reverse().join('');
|
||||
$('#dataBody').append('<tr class="secondrow"><td>' + (
|
||||
no++) +
|
||||
'</td><td>' + items[i]['ACCOUNT_NUMBER'] +
|
||||
'</td><td>' + items[i]['COMPANY_NAME'] +
|
||||
'</td><td>' + items[i]['SHORT_NAME'] +
|
||||
'</td><td>' + items[i]['WORKING_BALANCE'] +
|
||||
'</td><td>' + rp +
|
||||
// '</td><td>' + items[i]['PRODUCT'] +
|
||||
'</td><td>' + items[i]['CURRENCY'] + '</td>'+
|
||||
'<td class="tes">'+
|
||||
@ -387,6 +384,14 @@
|
||||
$("input[name=endDateFasilitas]").val(endDate);
|
||||
$(".selected-values").val('');
|
||||
|
||||
$('#cusNo').val();
|
||||
$('#accNo').val();
|
||||
$('#cabang').val();
|
||||
|
||||
$('.exportButton').hide();
|
||||
$('#buttonPostInfoSurat').hide();
|
||||
$('#selectAll').prop('checked', false);;
|
||||
|
||||
},
|
||||
error: function (error) {
|
||||
console.error("Form submission failed!");
|
||||
@ -400,14 +405,6 @@
|
||||
var selectedValues = [];
|
||||
$('#table4 tbody').on('change', 'tr td.tes input[type=checkbox]', function() {
|
||||
$('.exportPdf').show();
|
||||
// if ($(this).is(':checked')) {
|
||||
// // Do something...
|
||||
// acc_no.push($(this).val());
|
||||
// $("input[name=acc_no]").val(acc_no)
|
||||
// }else{
|
||||
// acc_no.push($(this).val());
|
||||
// $("input[name=acc_no]").val(acc_no)
|
||||
// };
|
||||
|
||||
var value = $(this).val();
|
||||
|
||||
@ -461,13 +458,19 @@
|
||||
});
|
||||
|
||||
//submit signer
|
||||
$("#buttonExport1").click(function(){
|
||||
$("#buttonPostInfoSurat").click(function(){
|
||||
$("#signerModal").modal('show');
|
||||
|
||||
})
|
||||
|
||||
//submit signer
|
||||
// $("#exportButton").click(function(){
|
||||
// $("#signerModal").modal('show');
|
||||
|
||||
// })
|
||||
|
||||
// Handle form submission when the "Submit" button inside the modal is clicked
|
||||
$("#submitSigner").click(function(e) {
|
||||
$("#submitInfoSurat").click(function(e) {
|
||||
e.preventDefault();
|
||||
var cif = $('input[name="cus_no"]').val();
|
||||
var cabang = $('input[name="kode_cabang"]').val();
|
||||
@ -482,7 +485,7 @@
|
||||
var alamat = $.trim($("#alamat").val());
|
||||
var signer = $("#signer-select").find('option:selected').val();
|
||||
$("#signerModal").modal('hide');
|
||||
$('.modalSpiner').modal('show');
|
||||
// $('.modalSpiner').modal('show');
|
||||
var dt = new Date();
|
||||
var date = dt.getYear() + ":" + dt.getDate() + ":" + dt.getHours();
|
||||
|
||||
@ -507,36 +510,22 @@
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{ route('konfirmasibank.export') }}",
|
||||
url: "{{ route('konfirmasibank.postInfoSurat') }}",
|
||||
data: dataToSend, // serializes the form's elements.
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
dataType: 'json', // Mengatur tipe data yang diharapkan dari respons
|
||||
success: function(data) {
|
||||
|
||||
// $('.modalSpiner').modal('hide');
|
||||
// Create a Blob from the response data
|
||||
var blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' });
|
||||
var dt = new Date();
|
||||
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
|
||||
|
||||
// Create a link element
|
||||
var link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
|
||||
// Set the download attribute with the desired file name
|
||||
link.download = 'KonfirmasiBank_' + time +'.pdf';
|
||||
|
||||
// Append the link to the document body
|
||||
document.body.appendChild(link);
|
||||
|
||||
// Programmatically click the link to trigger the download
|
||||
link.click();
|
||||
|
||||
// Remove the link from the document
|
||||
document.body.removeChild(link);
|
||||
$('#cusNo').val(cif);
|
||||
$('input[name="email"]').val();
|
||||
$('#accNo').val(acc_no);
|
||||
$('#cabang').val(cabang);
|
||||
$('#startDate2').val(startDate);
|
||||
$('#signerId').val(signer);
|
||||
// location.reload();
|
||||
$('.exportButton').show();
|
||||
$('#signerModal')[0].reset();
|
||||
toastr.success(data.message);
|
||||
// location.reload();
|
||||
$('.modalSpiner').modal('hide');
|
||||
},
|
||||
error: function(data, textStatus, errorThrown) {
|
||||
$('.modalSpiner').modal('hide');
|
||||
|
@ -18,10 +18,11 @@ $module = json_decode($module);
|
||||
|
||||
Route::group(['middleware' => ['auth', 'verified']], function () {
|
||||
Route::post('konfirmasibank/export', [KonfirmasiBankController::class, 'export'])->name('konfirmasibank.export');
|
||||
Route::post('konfirmasibank/postInfoSurat', [KonfirmasiBankController::class, 'postInfoSurat'])->name('konfirmasibank.postInfoSurat');
|
||||
Route::post('konfirmasibank/exportWord', [KonfirmasiBankController::class, 'exportWord'])->name('konfirmasibank.exportWord');
|
||||
Route::get('konfirmasibank', 'KonfirmasiBankController@index')->name('konfirmasibank.index');
|
||||
Route::get('konfirmasibank/fasilitas', 'KonfirmasiBankController@fasilitas')->name('konfirmasibank.fasilitas');
|
||||
Route::get('konfirmasibank/getData',array('as'=>'getData','uses'=>'KonfirmasiBankController@getData'));
|
||||
Route::get('konfirmasibank/fasilitas', 'KonfirmasiBankController@fasilitas')->name('konfirmasibank.fasilitas');
|
||||
Route::get('konfirmasibank/getData',array('as'=>'getData','uses'=>'KonfirmasiBankController@getData'));
|
||||
|
||||
// Route::post('konfirmasibank/postExp', [KonfirmasiBankController::class, 'postExp'])->name('konfirmasibank.postExp');
|
||||
Route::post('konfirmasibank/postExp', 'KonfirmasiBankController@postExp')->name('konfirmasibank.postExp');
|
||||
@ -37,4 +38,5 @@ Route::group(['middleware' => ['auth', 'verified']], function () {
|
||||
Route::post('konfirmasibank/editSigner','KonfirmasiBankController@editSigner')->name('konfirmasibank.editSigner');
|
||||
Route::post('konfirmasibank/updateSigner','KonfirmasiBankController@updateSigner')->name('konfirmasibank.updateSigner');
|
||||
Route::post('konfirmasibank/destroySigner','KonfirmasiBankController@destroySigner')->name('konfirmasibank.destroySigner');
|
||||
|
||||
});
|
Reference in New Issue
Block a user