add function excel untuk WTD
This commit is contained in:
@@ -2349,6 +2349,133 @@ Sekian, terima kasih.';
|
||||
->setPaper('a4', 'potrait');
|
||||
return $pdf->download('Senarai SAG WTD By Customer Dalam Proses ' . $cawanganDetail->caw_name . '.pdf');
|
||||
}
|
||||
|
||||
Public function excellistsagwtdproses ($kodcaw){
|
||||
|
||||
$wtddraft = WtdDraft::on('main')
|
||||
->where('kodcaw', $kodcaw)
|
||||
->where('batchno_serah', '0')
|
||||
->orderBy('norujukan','ASC')
|
||||
->get();
|
||||
$wtddraft_groupby_caw = $wtddraft->groupBy('kodcaw');
|
||||
$wtddraft_data_pluck_norujukan = $wtddraft->pluck('norujukan')->toArray();
|
||||
$lelong_all = LelongCawangan::on($kodcaw)->whereIn('lelong.norujukan', $wtddraft_data_pluck_norujukan)
|
||||
->join('gadai','gadai.norujukan','=','lelong.norujukan')
|
||||
->select('nokp', 'lelong.norujukan','lelong.t_jual','lelong.hargajual','lelong.gst_hj','lelong.pinjaman','lelong.bakiupah','lelong.cajlelong','lelong.gst_cl','lelong.cajlain','lelong.baki')
|
||||
->orderBy('lelong.norujukan','ASC')
|
||||
->get();
|
||||
$cawanganDetail = Cawangan::where('caw_code', $kodcaw)->first();
|
||||
|
||||
$lelong_all_pluck_nokp = $lelong_all->pluck('nokp')->unique();
|
||||
$customers = Customer::whereIn('kpbaru', $lelong_all_pluck_nokp)
|
||||
->orWhereIn('kplama', $lelong_all_pluck_nokp)
|
||||
->select('nama','kpbaru', 'kplama','alamat1','alamat2','alamat3','telefon')
|
||||
->get();
|
||||
// dd($customers->toArray());
|
||||
$customers_keyBy_noKp = $customers->keyBy(function ($item) {
|
||||
if ($item->kpbaru != '') {
|
||||
return $item->kpbaru;
|
||||
} else if ($item->kplama != '') {
|
||||
return $item->kplama;
|
||||
}
|
||||
});
|
||||
|
||||
$lelong_all_groupby_nokp = $lelong_all->groupBy('nokp');
|
||||
|
||||
$jumlahbil = sizeof($lelong_all);
|
||||
$jumlahbaki = number_format($lelong_all->SUM('baki'), 2, '.', ',');
|
||||
|
||||
foreach($lelong_all as $index1=>$bil){
|
||||
|
||||
if($customers_keyBy_noKp[$bil->nokp]){
|
||||
$lelong_all[$index1]["cust_info"] = $customers_keyBy_noKp[$bil->nokp];
|
||||
}
|
||||
// dd($customers_keyBy_noKp[$bil->nokp]);
|
||||
|
||||
}
|
||||
return view('wtd.excellistsagwtdproses',compact('lelong_all','kodcaw','cawanganDetail','jumlahbil','jumlahbaki'));
|
||||
}
|
||||
|
||||
public function excellistsagwtdprosesbycust($cawid)
|
||||
{
|
||||
$keuntungan = 0;
|
||||
|
||||
$arraylistgadai = 0;
|
||||
|
||||
$cawanganDetail = Cawangan::where('id', $cawid)->first();
|
||||
|
||||
|
||||
$wtddraft = WtdDraft::on('main')
|
||||
->where('kodcaw', $cawanganDetail->caw_code)
|
||||
->where('batchno_serah', '0')
|
||||
->orderBy('norujukan','ASC')
|
||||
->get();
|
||||
$wtddraft_groupby_caw = $wtddraft->groupBy('kodcaw');
|
||||
$wtddraft_data_pluck_norujukan = $wtddraft->pluck('norujukan')->toArray();
|
||||
|
||||
|
||||
$lelongbid_keyby_norujukan = $wtddraft->keyBy('norujukan');
|
||||
|
||||
$lelong_all = LelongCawangan::on($cawanganDetail->caw_code)->whereIn('lelong.norujukan', $wtddraft_data_pluck_norujukan)
|
||||
->join('gadai','gadai.norujukan','=','lelong.norujukan')
|
||||
->select('nokp', 'lelong.norujukan','lelong.t_jual','lelong.hargajual','lelong.gst_hj','lelong.pinjaman','lelong.bakiupah','lelong.cajlelong','lelong.gst_cl','lelong.cajlain','lelong.baki')
|
||||
->orderBy('lelong.norujukan','ASC')
|
||||
->get();
|
||||
$jumlahbil = sizeof($lelong_all);
|
||||
$jumlahbaki = number_format($lelong_all->SUM('baki'), 2, '.', ',');
|
||||
$lelong_all_groupby_norujukan = $lelong_all->groupBy('norujukan');
|
||||
$gadai_all_pluck_nokp = $lelong_all->pluck('nokp')->unique();
|
||||
$customers = Customer::whereIn('kpbaru', $gadai_all_pluck_nokp)
|
||||
->orWhereIn('kplama', $gadai_all_pluck_nokp)
|
||||
->select('nama','kpbaru', 'kplama','alamat1','alamat2','alamat3','telefon')
|
||||
->orderBy('nama','ASC')
|
||||
->get();
|
||||
|
||||
$customers_keyBy_noKp = $customers->keyBy(function ($item) {
|
||||
if ($item->kpbaru != '') {
|
||||
return $item->kpbaru;
|
||||
} else if ($item->kplama != '') {
|
||||
return $item->kplama;
|
||||
}
|
||||
});
|
||||
|
||||
// $gadai_all_groupby_nokp = $gadai_all->groupBy('nokp');
|
||||
$gadai_all_keyBy_norujukan = $lelong_all->keyBy('norujukan');
|
||||
|
||||
$gadai_all_groupby_nokp = $gadai_all_keyBy_norujukan->groupBy('nokp');
|
||||
// dd($gadai_all_groupby_nokp['961114106974']);
|
||||
|
||||
foreach($customers as $index=>$customer){
|
||||
if($customer->kpbaru != ''){
|
||||
$customers[$index]['nokp'] = $customer->kpbaru;
|
||||
}
|
||||
elseif($customer->kplama != ''){
|
||||
$customers[$index]['nokp'] = $customer->kplama;
|
||||
}
|
||||
// dd($gadai_all_groupby_nokp, $customer, $gadai_all_groupby_nokp[$customer->nokp]);
|
||||
|
||||
if($gadai_all_groupby_nokp[$customer->nokp]){
|
||||
$customers[$index]['gadai'] = $gadai_all_groupby_nokp[$customer->nokp];
|
||||
}
|
||||
// dd($customer);
|
||||
|
||||
foreach($customer['gadai'] as $index2=>$datagadai){
|
||||
// dd($datagadai);
|
||||
if($lelongbid_keyby_norujukan[$datagadai->norujukan]){
|
||||
// dd(isset($datagadai['data_transaksi']));
|
||||
|
||||
$lelongbid_true = $lelongbid_keyby_norujukan[$datagadai->norujukan];
|
||||
$pinjaman = $lelongbid_true->pinjaman;
|
||||
|
||||
$customer['gadai'][$index2]['pnjaman'] = $pinjaman;
|
||||
}
|
||||
}
|
||||
// dd($customer);
|
||||
|
||||
}
|
||||
|
||||
return view('wtd.excellistsagwtdprosesbycust',compact('customers','cawanganDetail','cawid','jumlahbil','jumlahbaki'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
<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">
|
||||
|
||||
|
||||
<table width="100%" height="168" id="customers">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th> --}}
|
||||
<th>Bil</th>
|
||||
<th>NAMA</th>
|
||||
<th>NOKP</th>
|
||||
<th>NORUJUKAN</th>
|
||||
<th>TARIKH LELONG</th>
|
||||
<th>PEMBIAYAAN (RM)</th>
|
||||
<th>BAKI (RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach ($lelong_all as $lel)
|
||||
{{-- {{dd($lel)}} --}}
|
||||
<tr>
|
||||
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $lel->id }}"></td> --}}
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td>{{$lel->cust_info->nama}}</td>
|
||||
<td align="center">'{{$lel->nokp}}</td>
|
||||
<td align="center" style='white-space:nowrap;'>{{$lel->norujukan}}</td>
|
||||
<td align="center"> @php
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $lel->t_jual );
|
||||
$datez = $myDateTime->format('d-m-Y');
|
||||
echo($datez);
|
||||
@endphp</td>
|
||||
|
||||
<td align="right">{{number_format($lel->pinjaman, 2, '.', ',')}}</td>
|
||||
<td align="right">{{number_format($lel->baki, 2, '.', ',')}}</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
<tr>
|
||||
<td colspan="6"><b>Jumlah Keseluruhan</b></td>
|
||||
<td align="right"><b>{{$jumlahbaki}}</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</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>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
<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">
|
||||
|
||||
|
||||
<table width="100%" height="168" id="customers">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
{{-- <th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th> --}}
|
||||
<th>Bil</th>
|
||||
<th>NAMA</th>
|
||||
<th>NOKP</th>
|
||||
<th>LEBIHAN(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{-- {{dd($customers)}} --}}
|
||||
@foreach ($customers as $customer)
|
||||
|
||||
<tr>
|
||||
{{-- <td><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" value="{{ $lel->id }}"></td> --}}
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td style='word-wrap' align="left">{{$customer->nama}}</td>
|
||||
<td align='center' style='word-wrap'>'{{$customer->nokp}}</td>
|
||||
<td align = 'right' style="white-space: nowrap;">
|
||||
@php $jumbaki = 0;@endphp
|
||||
@foreach($customer['gadai'] as $data)
|
||||
@php
|
||||
$jumbaki = $jumbaki + $data->baki;
|
||||
@endphp
|
||||
{{-- {{$data->baki}}<br> --}}
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumbaki, 2, '.', ',') }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<tr>
|
||||
<td colspan="3"><b>Jumlah Keseluruhan</b></td>
|
||||
<td align="right"><b>{{$jumlahbaki}}</b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</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>
|
||||
|
||||
@@ -44,11 +44,14 @@
|
||||
</td>
|
||||
<td><span class="badge badge-pill badge-info text-white" style="font-size:100%"> {{ $bid->bil[0]->bilangan}}</span></td>
|
||||
<td align="right"> <b>{{ $bid->jumlahbaki}}</b></td>
|
||||
<td align="center"><a class="btn btn-success btn-sm m-1" href="{{ route('wtd.listsagwtdproses',['kodcaw'=>$bid->cawangan_info->caw_code]) }}" data-toggle="tooltip" data-placement="top" title="Senarai Lelong"><i class="fas fa-list"></i></a>
|
||||
<td align="center">
|
||||
<a class="btn btn-success btn-sm m-1" href="{{ route('wtd.listsagwtdproses',['kodcaw'=>$bid->cawangan_info->caw_code]) }}" data-toggle="tooltip" data-placement="top" title="Senarai Lelong"><i class="fas fa-list"></i></a>
|
||||
<a class="btn btn-warning btn-sm m-1" href="{{ route('wtd.pdflistsagwtdproses',['kodcaw'=>$bid->cawangan_info->caw_code]) }}" data-toggle="tooltip" data-placement="top" title="PDF"><i class="fas fa-download"></i></a>
|
||||
<a class="btn btn-primary btn-sm m-1" href="{{ route('wtd.excellistsagwtdproses',['kodcaw'=>$bid->cawangan_info->caw_code]) }}" data-toggle="tooltip" data-placement="top" title="Excel"><i class="fas fa-download"></i></a>
|
||||
<td align="center">
|
||||
<a class="btn btn-success btn-sm m-1" href="{{ route('wtd.listsagwtdprosesbycust',['cawid'=>$bid->cawangan_info->id]) }}" data-toggle="tooltip" data-placement="top" title="PDF"><i class="fas fa-list"></i></a>
|
||||
<a class="btn btn-warning btn-sm m-1" href="{{ route('wtd.pdflistsagwtdprosesbycust',['cawid'=>$bid->cawangan_info->id]) }}" data-toggle="tooltip" data-placement="top" title="PDF"><i class="fas fa-download"></i></a></td>
|
||||
<a class="btn btn-warning btn-sm m-1" href="{{ route('wtd.pdflistsagwtdprosesbycust',['cawid'=>$bid->cawangan_info->id]) }}" data-toggle="tooltip" data-placement="top" title="PDF"><i class="fas fa-download"></i></a>
|
||||
<a class="btn btn-primary btn-sm m-1" href="{{ route('wtd.excellistsagwtdprosesbycust',['cawid'=>$bid->cawangan_info->id]) }}" data-toggle="tooltip" data-placement="top" title="Excel"><i class="fas fa-download"></i></a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<th>NAMA</th>
|
||||
<th>NOKP</th>
|
||||
<th>NORUJUKAN</th>
|
||||
<th>TARIKH JUAL</th>
|
||||
<th>TARIKH LELONG</th>
|
||||
<th>PEMBIAYAAN (RM)</th>
|
||||
<th>BAKI (RM)</th>
|
||||
</tr>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<th>NAMA</th>
|
||||
<th>NOKP</th>
|
||||
<th>NORUJUKAN</th>
|
||||
<th>TARIKH JUAL</th>
|
||||
<th>TARIKH LELONG</th>
|
||||
<th>PEMBIAYAAN (RM)</th>
|
||||
<th>BAKI (RM)</th>
|
||||
</tr>
|
||||
|
||||
@@ -184,7 +184,7 @@ tr:nth-child(even) {
|
||||
{{-- <th>NORUJUKAN</th> --}}
|
||||
{{-- <th>TARIKH JUAL</th> --}}
|
||||
{{-- <th>PEMBIAYAAN (RM)</th> --}}
|
||||
<th>BAKI (RM)</th>
|
||||
<th>LEBIHAN(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user