Perbaikan temuan UAT

This commit is contained in:
KhatamNugraha
2023-12-15 16:14:25 +07:00
parent 8ba9988bff
commit e9f5bc4082
6 changed files with 464 additions and 20 deletions

52
Entities/Arrangement.php Normal file
View File

@ -0,0 +1,52 @@
<?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 Arrangement extends Model
{
use HasFactory;
protected $connection = 'db2';
protected $table = 'STG_DB.AA_ARRANGEMENT';
protected $primaryKey = 'ID';
//public $incrementing = false;
protected $fillable = [
"'CUSTOMER_NO',
'LINKED_APPL_ID'
'CUSTOMER',
'CO_CODE',
'PRODUCT',
'BATCH_DATE',
'PRODUCT_LINE',
'ARR_STATUS',
'BATCH_DATE'"
];
// public function accounts(){
// return $this->hasMany('Modules\Konfirmasibank\Entities\Account');
// }
// public function accounts(): belongsTo
// {
// return $this->belongsTo('Modules\Konfirmasibank\Entities\Account', 'ACCOUNT_NUMBER');
// }
public function account(): BelongsTo
{
return $this->belongsTo(Account::class, 'ACCOUNT_NUMBER');
}
}

View File

@ -39,7 +39,7 @@ class ViewAccount extends Model
];
public function getSearchAccount($cif ,$arrAccount, $kodecabang, $startDate){
// dd($cif ,$arrAccount, $kodecabang, $startDate);
// dd($cif ,$arrAccount, $kodecabang, $startDate);
$uppercaseKodeCabang = Str::upper($kodecabang);
$data = [];

View File

@ -19,8 +19,16 @@
use Dompdf\Dompdf;
use Dompdf\Options;
use Carbon\Carbon;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\Element\Table;
use PhpOffice\PhpWord\SimpleType\TblWidth;
use PhpOffice\PhpWord\Element\Section;
use Response;
use Exception;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Storage;
use Modules\Konfirmasibank\Http\Requests\Fasilitas\StoreFasilitasRequest;
class KonfirmasiBankController extends Controller
{
@ -53,13 +61,15 @@
$pastYear = $today->subYear(3)->format('Y');
$signer = Signer::where('status',1)->get();
$company = Company::all();
$data['currentYear'] = $currentYear;
$data['pastYear'] = $pastYear;
$data['signer'] = $signer;
$data['company'] = $company;
// dd($data);
return view('konfirmasibank::pages.index',compact('data'));
return view('konfirmasibank::pages.index',compact('data','request'));
}
@ -77,7 +87,7 @@
$Account = new ViewAccount;
$arrAccount = [];
$startDate = Carbon::parse($request->startDate);
$dateCore = $startDate->subDays(2)->format('m/d/Y');
$dateCore = $startDate->subDays(2)->format('m/d/Y');
$Accounts = $Account->getSearchAccount($request->cif,$arrAccount,$request->kodecabang, $dateCore)->get();
@ -136,9 +146,10 @@
$AAID= '';
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 = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
$DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO;
$DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME;
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
@ -192,10 +203,178 @@
// Keluarkan file PDF ke browser
$dompdf->stream('"Konfirmasi_bank_"'.$data['DataCustomer']->SHORT_NAME.'"'. $currentDate.'".pdf"');
return response()->download($pdf);
return response()->download($dompdf);
}
public function exportWord2(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 = [];
$DataPinjaman = [];
$DataLimit = [];
$DataAA = [];
$listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $dateCore)->get();
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
// dd( $Arrangement);
$MaturityDate = '';
$product = '';
$AAID= '';
foreach ($listAccount as $key1 => $account) {
//$Arrangement = $ViewAccount->getAAaccount($account->CUSTOMER_NO,$account->ACCOUNT_NUMBER);
$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
$DataAccounts[$key1]['ACCOUNT_NUMBER'] = $account->ACCOUNT_NUMBER;
$DataAccounts[$key1]['COMPANY_NAME'] = $account->COMPANY_NAME;
$DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME;
// $DataAccounts[$key1]['CUSTOMER_NO'] = $account->CUSTOMER_NO;
$DataAccounts[$key1]['CURRENCY'] = $account->CURRENCY;
// $DataAccounts[$key1]['PRODUCT'] = $Arrangement->PRODUCT ?? 'NIHIL';
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
// $DataAccounts[$key1]['ARRANGEMENT_ID'] = $Arrangement->ARRANGEMENT_ID ?? 'NIHIL';
$DataAccounts[$key1]['TERM'] = $Arrangement->TERM ?? 'NIHIL';
$DataAccounts[$key1]['FIXED_RATE'] = $Arrangement->FIXED_RATE ?? 'NIHIL';
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
$DataAccounts[$key1]['MATURITY_DATE'] = $Arrangement->MATURITY_DATE ?? 'NIHIL' ;
}
$ListPinjaman =$ViewAccount->getPinjaman($request['cus_no'],$arrAccount , $dateCore )->get();
foreach ($ListPinjaman as $key2 => $pinjaman) {
//$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
$DataPinjaman[$key2]['JENIS_PINJAMAN'] = $pinjaman->PRODUCT_LINE;
$DataPinjaman[$key2]['TGL_REALISASI'] = $pinjaman->START_DATE;
$DataPinjaman[$key2]['SALDO'] = $pinjaman->WORKING_BALANCE;
$DataPinjaman[$key2]['JANGKA_WAKTU'] = $pinjaman->TERM ?? 'NIHIL';
$DataPinjaman[$key2]['FIXED_RATE'] = $pinjaman->FIXED_RATE ?? 'NIHIL';
$DataPinjaman[$key2]['MATURITY_DATE'] = $pinjaman->MATURITY_DATE ?? 'NIHIL' ;
$DataPinjaman[$key2]['KET'] = '';
}
// $ListLimits = $Viewpinjaman->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)->first();
$currentDate = Carbon::now();
$tanggalIndonesia = $currentDate->locale('id')->isoFormat('D MMMM YYYY');
//You can get xml code of your table and insert it insite template
//Create table
$document_with_table = new PhpWord();
$section = $document_with_table->addSection();
$table = $section->addTable(array('borderSize' => 12, 'fontSize' =>10, 'borderColor' => 'green', 'width' => 11200, 'unit' => TblWidth::TWIP));
//Add Tablle 1
// Add header row with custom styling Table1
$headerRow = $table->addRow();
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Rekening');
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Cabang');
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Jenis Rekening');
$headerRow->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Mata Uang');
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Saldo');
$headerRow->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Jangka Waktu');
$headerRow->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Suku Bunga');
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Tgl Realisasi');
$headerRow->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Jatuh Tempo');
// Add a row to the table
// Add data rows dynamically
foreach ($DataAccounts as $key => $rowData) {
$dataRow = $table->addRow();
foreach ($rowData as $cellData) {
$dataRow->addCell()->addText($cellData);
}
}
// Membuat tabel kedua
$section->addTextBreak(1);
// // $section->addText("");
// $table2 = $section->addTable(array('borderSize' => 12, 'fontSize' =>10, 'borderColor' => 'green', 'width' => 11200, 'unit' => TblWidth::TWIP));
// $headerRow2 = $table2->addRow();
// $headerRow2->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Rekening');
// $headerRow2->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Cabang');
// $headerRow2->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Jenis Rekening');
// $headerRow2->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Mata Uang');
// $headerRow2->addCell(2000, ['bgColor' => 'CCCCCC'])->addText('Saldo');
// $headerRow2->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Jangka Waktu');
// $headerRow2->addCell(1000, ['bgColor' => 'CCCCCC'])->addText('Suku Bunga');
// foreach ($DataPinjaman as $key2 => $rowData2) {
// $dataRow2 = $table2->addRow();
// foreach ($rowData2 as $cellData2) {
// $dataRow2->addCell()->addText($cellData2);
// }
// }
// Set border properties for the entire table
$table->getStyle()->setBorderSize(1); // Set border size in pt
$table->getStyle()->setBorderColor('000000'); // Set border color (black)
// Alternatively, you can set border properties for individual cells
foreach ($table->getRows() as $row) {
foreach ($row->getCells() as $cell) {
$cell->getStyle()->setBorderSize(1);
$cell->getStyle()->setBorderColor('000000');
}
}
// Create writer to convert document to xml
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($document_with_table, 'Word2007');
// Get all document xml code
$fullxml = $objWriter->getWriterPart('Document')->write();
// Get only table xml code
$tablexml = preg_replace('/^[\s\S]*(<w:tbl\b.*<\/w:tbl>).*/', '$1', $fullxml);
//Open template with ${table}
$template_document = new \PhpOffice\PhpWord\TemplateProcessor('konfirmasibank_template.docx');
// Replace mark by xml code of table
$template_document->setValues([
'table1'=> $tablexml,
'street'=> $GetCustomer->ADDRESS,
'address'=> $GetCustomer->STREET,
'customerName'=> $GetCustomer->SHORT_NAME,
'customerNo'=> $GetCustomer->CUSTOMER_NO,
'director'=> $signer->deputy_director_name,
'executiveOfficer'=> $signer->executive_officer_name,
'date' => $tanggalIndonesia
]);
$template_document->saveAs("Konfirmasibank_".$currentDate->format('YmdHis').".docx");
return json_encode(['status' => 'success', 'message' => ' Download Surat successfully .']);
}
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 !');
@ -211,6 +390,184 @@
}
public function exportWord(Request $request){
//ob_start();
$currentDate = Carbon::now();
$arrAccount = explode("," , $request['acc_no']);
$startDate = Carbon::parse($request['startDate']);
$dateCore = $startDate->subDays(2);
$ViewAccount = new ViewAccount;
$data = [];
$DataAccounts = [];
$DataPinjaman = [];
$DataLimit = [];
$DataAA = [];
$listAccount = $ViewAccount->getAccount($request['cus_no'],$arrAccount,$request['kode_cabang'], $dateCore)->get();
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
// dd( $Arrangement);
$MaturityDate = '';
$product = '';
$AAID= '';
foreach ($listAccount as $key1 => $account) {
//$Arrangement = $ViewAccount->getAAaccount($account->CUSTOMER_NO,$account->ACCOUNT_NUMBER);
$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
$DataAccounts[$key1]['SHORT_NAME'] = $account->SHORT_NAME;
$DataAccounts[$key1]['OPENING_DATE'] = $account->OPENING_DATE;
$DataAccounts[$key1]['WORKING_BALANCE'] = $account->WORKING_BALANCE;
$DataAccounts[$key1]['TERM'] = $Arrangement->TERM ?? 'NIHIL';
$DataAccounts[$key1]['FIXED_RATE'] = $Arrangement->FIXED_RATE ?? 'NIHIL';
$DataAccounts[$key1]['MATURITY_DATE'] = $Arrangement->MATURITY_DATE ?? 'NIHIL' ;
}
$ListPinjaman =$ViewAccount->getPinjaman($request['cus_no'],$arrAccount , $dateCore )->get();
foreach ($ListPinjaman as $key2 => $pinjaman) {
//$Arrangement = $ViewAccount->getAAaccount($request['cus_no'] , $account->ACCOUNT_NUMBER)->first();
$DataPinjaman[$key2]['JENIS_PINJAMAN'] = $pinjaman->PRODUCT_LINE;
$DataPinjaman[$key2]['TGL_REALISASI'] = $pinjaman->START_DATE;
$DataPinjaman[$key2]['SALDO'] = $pinjaman->WORKING_BALANCE;
$DataPinjaman[$key2]['JANGKA_WAKTU'] = $pinjaman->TERM ?? 'NIHIL';
$DataPinjaman[$key2]['FIXED_RATE'] = $pinjaman->FIXED_RATE ?? 'NIHIL';
$DataPinjaman[$key2]['MATURITY_DATE'] = $pinjaman->MATURITY_DATE ?? 'NIHIL' ;
$DataPinjaman[$key2]['KET'] = '';
}
$signer = Signer::where('id', $request['signer'])->where('status',1)->first();
$currentDate = Carbon::now();
$tanggalIndonesia = $currentDate->locale('id')->isoFormat('D MMMM YYYY');
$GetCustomer = $ViewAccount->getCustomer($request['cus_no'])->first();
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 2500, 'marginBottom' => 600) );
$header = array('size' => 10, 'bold' => false);
$styleTable = array('borderSize' => 2, 'borderColor' => '00000');
$styleFirstRow = array('bgColor' => 'CCCCCC','cellMargin' => 0, 'spaceBefore' => 0,'spaceAfter' => 0,'spacing' => 0);
$styleCell = array('valign' => 'center','spaceBefore' => 0,'spaceAfter' => 0,'spacing' => 0, 'bgColor' => 'CCCCCC');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
$fontStyle = array('align' => 'center', 'size' => 10, );
$section->addText(htmlspecialchars('NOMOR : --------------------------'), $fontStyle);
$section->addText(htmlspecialchars('TANGGAL : --------------------------'), $fontStyle);
$section->addTextBreak(1);
$section->addText(htmlspecialchars($GetCustomer->STREET), $fontStyle);
$section->addText(htmlspecialchars($GetCustomer->ADDRESS), $fontStyle);
$section->addText(htmlspecialchars('Sesuai dengan surat saudara Nomor --------------------------- tanggal ----------------------- dengan ini kami sampaikan data data nasabah sesuai permintaan saudara sebagai berikut :'), $fontStyle);
$section->addText(htmlspecialchars('NAMA NASABAH : '.$GetCustomer->SHORT_NAME.''), $fontStyle);
$section->addText(htmlspecialchars('NOMOR CIF : '.$GetCustomer->CUSTOMER_NO.''), $fontStyle);
$section->addTextBreak(1);
// $phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow);
$section->addText(htmlspecialchars('SIMPANAN NASABAH YANG BERSANGKUTAN PADA BANK'), $header);
$section->addText(htmlspecialchars("{$tanggalIndonesia}"), $header);
$table = $section->addTable(array('borderSize' => 6, 'fontSize' =>10, 'borderColor' => 'black', 'width' => 10500, 'unit' => TblWidth::TWIP));
$table->addRow(300);
$table->addCell(600, $styleCell)->addText(htmlspecialchars("NO"), $fontStyle, array('align' => 'center','spaceAfter'=>0));
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('JENIS REKENING'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1500, $styleCell)->addText(htmlspecialchars('TGL REALISASI'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000, $styleCell)->addText(htmlspecialchars('SALDO'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1500, $styleCell)->addText(htmlspecialchars('JANGKA WAKTU'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000, $styleCell)->addText(htmlspecialchars('SUKU BUNGA'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1500, $styleCell)->addText(htmlspecialchars('TGL JT TEMPO'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000, $styleCell)->addText(htmlspecialchars('KET'), $fontStyle,array('align' => 'center','spaceAfter'=>0));
$no = 1;
foreach ($DataAccounts as $key1 => $value1) {
$rupiah = $this->convertToRupiah($value1['WORKING_BALANCE']);
$table->addRow();
$table->addCell(600)->addText(htmlspecialchars($no++), $fontStyle, array('align' => 'center','spaceAfter'=>0));
$table->addCell(2000)->addText(htmlspecialchars(" {$value1['SHORT_NAME']}"), array('align' => 'left','spaceAfter'=>0));
$table->addCell(1500)->addText(htmlspecialchars(" {$value1['OPENING_DATE']}"), array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000)->addText(htmlspecialchars(" {$rupiah}"), array('align' => 'left','spaceAfter'=>0));
$table->addCell(1500)->addText(htmlspecialchars(" {$value1['TERM']}"), array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000)->addText(htmlspecialchars(" {$value1['FIXED_RATE']}"), array('align' => 'center','spaceAfter'=>0));
$table->addCell(1500)->addText(htmlspecialchars(" {$value1['MATURITY_DATE']}"), array('align' => 'center','spaceAfter'=>0));
$table->addCell(1000)->addText(htmlspecialchars(""), array('align' => 'center','spaceAfter'=>0));
}
// 3. Table Pinjaman
$section->addTextBreak(1);
$section->addText(htmlspecialchars('PINJAMAN YANG DIBERIKAN BANK KEPADA NASABAH'), $header);
$section->addText(htmlspecialchars("{$tanggalIndonesia}"), $header);
$table2 = $section->addTable(array('borderSize' => 6, 'fontSize' =>10, 'borderColor' => 'black', 'width' => 10500, 'unit' => TblWidth::TWIP));
$table2->addRow(300);
$table2->addCell(600, $styleCell)->addText(htmlspecialchars("NO"), $fontStyle, array('align' => 'center','spaceAfter'=>0));
$table2->addCell(2000, $styleCell)->addText(htmlspecialchars('JENIS REKENING'), $fontStyle, array('align' => 'center'));
$table2->addCell(1500, $styleCell)->addText(htmlspecialchars('TGL REALISASI'), $fontStyle, array('align' => 'center'));
$table2->addCell(1000, $styleCell)->addText(htmlspecialchars('SALDO'), $fontStyle, array('align' => 'center'));
$table2->addCell(1500, $styleCell)->addText(htmlspecialchars('JANGKA WAKTU'), $fontStyle, array('align' => 'center'));
$table2->addCell(1000, $styleCell)->addText(htmlspecialchars('SUKU BUNGA'), $fontStyle, array('align' => 'center'));
$table2->addCell(1500, $styleCell)->addText(htmlspecialchars('TGL JT TEMPO'), $fontStyle, array('align' => 'center'));
$table2->addCell(1000, $styleCell)->addText(htmlspecialchars('KET'), $fontStyle, array('align' => 'center'));
$no = 1;
foreach ($DataPinjaman as $key2 => $value2) {
$rupiah = $this->convertToRupiah($value2['SALDO']);
$table2->addRow();
$table2->addCell(600)->addText(htmlspecialchars($no++), $fontStyle, array('align' => 'center'));
$table2->addCell(1500)->addText(htmlspecialchars(" {$value2['JENIS_PINJAMAN']}"), array('align' => 'center'));
$table2->addCell(1000)->addText(htmlspecialchars(" {$value2['TGL_REALISASI']}"), array('align' => 'center'));
$table2->addCell(1500)->addText(htmlspecialchars(" {$rupiah}"), array('align' => 'right'));
$table2->addCell(1000)->addText(htmlspecialchars(" {$value2['JANGKA_WAKTU']}"), array('align' => 'center'));
$table2->addCell(1500)->addText(htmlspecialchars(" {$value2['FIXED_RATE']}"), array('align' => 'center'));
$table2->addCell(1500)->addText(htmlspecialchars(" {$value2['MATURITY_DATE']}"), array('align' => 'center'));
$table2->addCell(1000)->addText(htmlspecialchars(""));
}
//Table Signature
$section->addTextBreak(1);
$section->addText(htmlspecialchars('Demikian data ini kami sampaikan agar dapat digunakan sebagaimana mestinya'), $header);
$signatureStyle = array('size'=>10, 'align' =>'center' );
$table3 = $section->addTable(array('width' => 2000, 'unit' => 'pct', 'align' => 'left'));
$table3->addRow(1000);
$table3->addCell(2000)->addText(htmlspecialchars(''));
$table3->addCell(2000)->addText(htmlspecialchars(''), $signatureStyle);
$table3->addRow();
$table3->addCell(2000)->addText(htmlspecialchars('Frangky'), array('marginLeft' => 600,'size'=>10, ));
$table3->addCell(2000)->addText(htmlspecialchars('Sifera Officer'), $signatureStyle);
$table3->addRow();
$table3->addCell(2000)->addText(htmlspecialchars('Director'), array('marginLeft' => 600,'size'=>10, ));
$table3->addCell(2000)->addText(htmlspecialchars('Executive Officer'), $signatureStyle);
$filename = 'KonfirmasiBank_'.$currentDate->format('YmdHis').'.docx';
// Create writer to convert document to xml
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save($filename);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
flush();
readfile($filename);
unlink($filename); // deletes the temporary file
$objWriter->save($filename);
}
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')) {
@ -522,7 +879,8 @@
$signer = Signer::findOrFail($request->id);
try {
try {
$signer->status = 0;
$signer->save();
echo json_encode(['status' => 'success', 'message' => ' Signer deleted successfully.']);

View File

@ -79,11 +79,11 @@
</head>
<body>
<div class="content">
<p>Nomor &nbsp; : 577/SUBDIT.OPS/VIII/2023</p>
<p>Tanggal : {{ strtoupper($data['localDate']) }}</p><br>
<p>Nomor &nbsp; : ______________________</p>
<p>Tanggal : ______________________</p><br>
<p>Kepada Yth</p>
<P>{{$data['DataCustomer']->SHORT_NAME}}</P>
<P> ____________________</P>
<p>{{$data['DataCustomer']->STREET }}, {{str_replace(']','',$data['DataCustomer']->ADDRESS)}}</p>
<p>Sesuai dengan surat saudara Nomor <span>150/KB-SENTRA1/II/2023</span> tanggal {{ strtoupper($data['localDate']) }} dengan ini kami sampaikan data data nasabah sesuai permintaan saudara sebagai berikut : </p>
@ -92,7 +92,7 @@
<p>Nama Nasabah : {{$data['DataCustomer']->SHORT_NAME}}</p>
<p>Nomor CIF &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {{$data['DataCustomer']->CUSTOMER_NO}}</p><br>
<p style="font-size: 12px;"> SIMPAMAN NASABAH YANG BERSANGKUTAN PADA BANK</p>
<p style="font-size: 12px;"> SIMPANAN NASABAH YANG BERSANGKUTAN PADA BANK</p>
<p style="font-size: 12px;">POSISI {{ strtoupper($data['localDate']) }}</p>
<table class="space1" style="width:100%;">
<thead style="background-color: dimgrey">
@ -105,6 +105,7 @@
<th class="space1">Saldo</th>
<th class="space1">Jangka Waktu</th>
<th class="space1">Suku Bunga</th>
<th class="space1">Tgl Realisasi</th>
<th class="space1">Tgl Jatuh Tempo</th>
</tr>
</thead>
@ -121,6 +122,7 @@
<td class="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['OPENING_DATE'] }}</td>
<td class="text-center space1">{{ $val['MATURITY_DATE'] }}</td>
</tr>
@ -147,6 +149,7 @@
<th class="space1">Saldo</th>
<th class="space1">Jangka Waktu</th>
<th class="space1">Suku Bunga</th>
<th class="space1">Tgl Realisasi</th>
<th class="space1">Tgl Jatuh Tempo</th>
</tr>
</thead>
@ -164,6 +167,7 @@
<td class="space1">{{ $pinjaman->WORKING_BALANCE }}</td>
<td class="text-center space1">{{ $pinjaman->TERM }}</td>
<td class="text-center space1">{{ $pinjaman->FIXED_RATE }}</td>
<td class="center space1">{{ $pinjaman->START_DATE }}</td>
<td class="center space1">{{ $pinjaman->MATURITY_DATE }}</td>
{{-- <td class="text-center space1">{{ $i++ }}</td>
<td class="space1">{{ $pinjaman['PRODUCT_LINE'] }}</td>
@ -184,7 +188,7 @@
</tbody>
</table><br>
<p style="font-size: 12px;">FASILITAS LAIN YANG DITERIMA OLEH NASABAH</p>
{{-- <p style="font-size: 12px;">FASILITAS LAIN YANG DITERIMA OLEH NASABAH</p>
<p style="font-size: 12px;">POSISI {{ strtoupper($data['localDate']) }}</p>
<table class="space1" style="width:100%;">
<thead style="background-color: dimgrey">
@ -197,6 +201,7 @@
<th class="space1">Saldo</th>
<th class="space1">Jangka Waktu</th>
<th class="space1">Suku Bunga</th>
<th class="space1">Tgl Realisasi</th>
<th class="space1">Tgl Jatuh Tempo</th>
</tr>
</thead>
@ -218,6 +223,7 @@
<td class="space1">{{ $limit->AVAIL_AMT }}</td>
<td class="text-center space1">{{ $term }} D</td>
<td class="text-center space1">{{ $limit->LIMIT_PERCENTAGE }}</td>
<td class="text-center space1">{{ $approvalDate->format('d-m-Y') }}</td>
<td class="text-center space1">{{ $expiryDate->format('d-m-Y')}}</td>
</tr>
@endforeach
@ -249,7 +255,7 @@
@endif
</tbody>
</table><br><br>
</table><br><br> --}}
<p>Demikian data ini kami sampaikan agar dapat digunakan sebagaimana mestinya</p> <br><br>

View File

@ -7,6 +7,9 @@
<!-- CDN untuk jQuery Validation -->
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.6.0/mammoth.browser.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.6.0/mammoth.browser.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}" />
<style>
.bd-example-modal-lg .modal-dialog{
@ -38,7 +41,13 @@
<div class="row mb-3">
<label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Cabang</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm" name="kodecabang" id="kodecabang" placeholder="Nama Cabang">
{{-- <input type="text" class="form-control form-control-sm" name="kodecabang" id="kodecabang" placeholder="Nama Cabang"> --}}
<select name="kodecabang" class="form-select form-select-sm mb-2">
<option value="" @readonly(true)>-- Pilih Cabang --</option>
@foreach ($data['company'] as $item)
<option value="{{ $item->COMPANY_NAME }}" >{{ $item->COMPANY_NAME }}</option>
@endforeach
</select>
</div>
</div>
<div class="row mb-3">
@ -233,6 +242,7 @@
@push('customscript')
<script>
$(function() {
$('.mycheck').hide();
@ -409,22 +419,39 @@
$.ajax({
type: "POST",
url: "{{ route('konfirmasibank.export') }}",
url: "{{ route('konfirmasibank.exportWord') }}",
data: dataToSend, // serializes the form's elements.
xhrFields: {
responseType: 'blob'
},
success: function(response) {
console.log(response);
$('.modalSpiner').modal('hide');
var blob = new Blob([response]);
success: function(data) {
// 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);
link.download = "konfirmasibank_" + date + ".pdf";
// Set the download attribute with the desired file name
link.download = 'KonfirmasiBank_' + time +'.doc';
// 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);
toastr.success(data.message);
// location.reload();
$('.modalSpiner').modal('hide');
},
error: function(data, textStatus, errorThrown) {
$('.modalSpiner').modal('hide');
var errors = data.responseJSON.errors;
$.each(errors, function(key, value) {
toastr.error(value);

View File

@ -18,12 +18,13 @@ $module = json_decode($module);
Route::group(['middleware' => ['auth', 'verified']], function () {
Route::post('konfirmasibank/export', [KonfirmasiBankController::class, 'export'])->name('konfirmasibank.export');
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::post('konfirmasibank/postExp', [KonfirmasiBankController::class, 'postExp'])->name('konfirmasibank.postExp');
Route::post('konfirmasibank/postExp', 'KonfirmasiBankController@postExp')->name('konfirmasibank.postExp');
Route::post('konfirmasibank/postExp', 'KonfirmasiBankController@postExp')->name('konfirmasibank.postExp');
Route::get('konfirmasibank/fasilitas',[KonfirmasiBankController::class,'fasilitas'])->name('konfirmasibank.fasilitas');
Route::get('konfirmasibank/create',[KonfirmasiBankController::class,'create'])->name('konfirmasibank.create');