add excel by sag

This commit is contained in:
Nur Izzati Zulkifli
2023-03-01 17:17:00 +08:00
parent 99d1c80b95
commit 31edc79bff
3 changed files with 146 additions and 6 deletions
+17 -1
View File
@@ -257,7 +257,8 @@ class NotisController extends Controller
$marhun = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
->where('lelong_id','=',$lelong_id)
->where('lelongbid.kodcaw','=',$user->kodcaw);
->where('lelongbid.kodcaw','=',$user->kodcaw)
->orderBy('norujukan');
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
$datalelong = $marhun->get();
@@ -288,6 +289,14 @@ class NotisController extends Controller
// dd($marhuns[$index1]['nama']);
}
$listsaglelong = Gadai::on($datalelong[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
->get();
foreach($listsaglelong as $index2=>$sag){
$nokp = Customer::where('kpbaru','=',$sag['nokp'])
->orWhere('kplama','=',$sag['nokp'])
->first();
$listsaglelong[$index2]['nama'] = $nokp;
}
if($request->type == 'excel')
{
@@ -295,6 +304,13 @@ class NotisController extends Controller
return view('excel.listnotis_excel',compact('marhuns','lelong_id','bayaran','listsag','caw'));
}
elseif($request->type == 'excelbysag')
{
return view('excel.listnotis_excelbysag',compact('listsaglelong','lelong_id','bayaran','listsag','caw'));
}
else
{
$pdf = PDF::loadView('pdf.listnotis',compact('marhuns','lelong_id','bayaran','listsag','caw'))
@@ -0,0 +1,109 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="{{ asset('js/table2excel.js') }}"></script>
<style>
.letter{
font-family:'Times New Roman', Times, serif;
}
.row::after {
content: "";
clear: both;
display: table;
}
.first-prgph{
float: left;
width: 10%;
padding: 2px;
}
.first-prgph1{
float: left;
width: 30%;
padding-left: 50px;
}
.page-break {
page-break-before: always;
}
.name{
padding-top: 40px;
}
</style>
<body>
<div class = "letter">
{{-- <div class="row">
<div class="first-prgph">
<img src="{{ asset('img/icon_pkb.png') }}" alt="PKB LOGO" width="100" height="100">
</div> --}}
<div class="first-prgph1">
<p> {{$caw['caw_name']}}<br>
{{$caw['alamat1']}}<br>
{{$caw['alamat2']}}<br>
No Tel: {{$caw['notel']}}<br>
No Faks: {{$caw['nofaks']}}
</p><br>
</div>
<br>
</div>
<table width="100%" height="168" id="customers">
<thead>
<tr>
<th align="left">No</th>
<th align="left">No Rujukan</th>
<th align="left">Tempoh</th>
<th align="left">No KP</th>
<th align="left">Nama</th>
<th align="left">No.Telefon</th>
<th align="left">Pembiayaan(RM)</th>
<th align="left">Keuntungan 6 Bulan(RM)</th>
<th align="left">Bayaran Telah Dibuat(RM)</th>
</tr>
</thead>
@foreach($listsaglelong as $index2=> $notis)
{{-- {{dd($notis['nama']['nama'])}} --}}
<tr>
<td>{{ $loop->iteration }} </td>
<td>{{ $notis['norujukan']}}</td>
<td>{{ $notis['tempoh']}}</td>
<td>{{ $notis['nokp']}}</td>
<td>{{ $notis['nama']['nama']}}</td>
<td>6{{ $notis['nama']['telefon']}}</td>
<td>{{ $notis['bakipjm']}}</td>
<td>{{ $notis['bakiupah']}}</td>
<td>{{ number_format($bayaran, 2, '.', ',')}}<br></td>
@endforeach
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
var table2excel = new Table2Excel();
table2excel.export(document.querySelectorAll("#customers"),'senarai_notis');
setTimeout(function(){ window.close() }, 10);
});
</script>
@@ -37,9 +37,11 @@
<th>Alamat 3</th>
<th>No Rujukan</th>
<th>Tempoh</th>
<th>Pembiayaan</th>
<th>Keuntungan 6 Bulan</th>
<th>Bayaran Telah Dibuat</th>
<th>Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Bayaran Telah Dibuat (RM)</th>
{{-- <th>Baki Lelong (simulasi) (RM)</th> --}}
</tr>
</thead>
<tbody>
@@ -52,11 +54,12 @@
<td>{{ $notis['nama']->alamat2 }}</td>
<td>{{ $notis['nama']->alamat3 }}</td>
{{-- <td style='word-wrap'>{{ $notis['nama']['nama']}}</td> --}}
<td>@foreach($notis['listsag'] as $item){{ $item['norujukan']}}<br>@endforeach</td>
<td style="white-space: nowrap;">@foreach($notis['listsag'] as $item){{ $item['norujukan']}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ $item['tempoh']}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ number_format($item['pinjaman'], 2, '.', ',')}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $item){{ number_format($item['bakiupah'], 2, '.', ',')}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $index=> $bayar){{ number_format($bayar['bayaran'], 2, '.', ',')}}<br>@endforeach</td>
<td>@foreach($notis['listsag'] as $index=> $bayar){{ number_format($bayar['bayaran'], 2, '.', ',')}}<br>@endforeach</td>
{{-- <td>@foreach($notis['datalelongbid'] as $index=> $baki){{ number_format($baki['baki'], 2, '.', ',')}}<br>@endforeach</td> --}}
@endforeach
</tbody>
@@ -100,6 +103,17 @@
// window.open("_blank");
}
},
{
className: 'btn btn-outline-info pl-4 pr-4 btn-sm export',
target: "_blank",
titleAttr: 'Export to Excel by SAG',
text: '<h8><b>EXCEL By SAG</b></h8>',
action: function ( e, dt, node, config ) {
$('#typedonwload').val('excelbysag');
$("#exportpdf").submit();
// window.open("_blank");
}
},
{
className: 'btn btn-outline-danger pl-4 pr-4 btn-sm export',
titleAttr: 'Export to PDF',
@@ -108,6 +122,7 @@
$('#typedonwload').val('pdf');
$("#exportpdf").submit();
}
}