(PDF) Senarai simulasi mengikut pelanggan
This commit is contained in:
@@ -33,6 +33,7 @@ use App\Models\Resit;
|
||||
use App\Models\Customer;
|
||||
use App\Models\LelongTebus;
|
||||
use App\Models\Pengesahan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
@@ -649,10 +650,63 @@ class ReportController extends Controller
|
||||
->setPaper('a4','potrait');
|
||||
|
||||
return $pdf->download('Laporan Simulasi Cawangan.pdf');
|
||||
|
||||
}
|
||||
|
||||
public function simulasireportbycust($simulasi_id, $cawid)
|
||||
{
|
||||
$keuntungan = 0;
|
||||
$arraylistgadai = 0;
|
||||
|
||||
$simulasilel = Simulasi::with('cawangan')->find($simulasi_id);
|
||||
|
||||
$cawname = Cawangan::where('id','=',$cawid)->first();
|
||||
|
||||
$cawanganDetail = $simulasilel->cawangan->find($cawid);
|
||||
|
||||
$marhun = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
|
||||
->where('simulasi_id','=',$simulasi_id)
|
||||
->where('caw_id','=',$cawid);
|
||||
|
||||
$arraynorujukan = $marhun->pluck('norujukan')->toArray();
|
||||
$datasimulasi = $marhun->get();
|
||||
$marhuns = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->select('nokp')
|
||||
->groupBy('nokp')->get();
|
||||
// dd($datagadai);
|
||||
$arraysag = [];
|
||||
|
||||
foreach($marhuns as $index1=>$cal)
|
||||
{
|
||||
$customer = Customer::where('kpbaru','=',$cal['nokp'])
|
||||
->orWhere('kplama','=',$cal['nokp'])
|
||||
->first();
|
||||
// dd($customer);
|
||||
|
||||
$listsag = Gadai::on($datasimulasi[0]['kodcaw'])->whereIn('norujukan', $arraynorujukan)
|
||||
->where('nokp','=',$cal['nokp'])
|
||||
->get();
|
||||
// dd($listgadai);
|
||||
foreach($listsag as $index=>$listing){
|
||||
$ktlhbyr = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
// dd($ktlhbyr);
|
||||
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('keuntungan_rebet');
|
||||
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$listing['norujukan'])->sum('bayaran_keuntungan');
|
||||
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
|
||||
$keuntungan = bcdiv(($listing['tempoh']-$listing['tempohbayar'])*$listing['kadarupah']/100*$listing['bakipjm'],1,1)-$beza_keuntungan;
|
||||
// dd($keuntungan);
|
||||
$listsag[$index]['ktlhbyr'] = $ktlhbyr;
|
||||
$listsag[$index]['keuntungan'] = $keuntungan;
|
||||
}
|
||||
$marhuns[$index1]['nama'] = $customer;
|
||||
$marhuns[$index1]['listsag'] = $listsag;
|
||||
|
||||
}
|
||||
|
||||
$pdf = PDF::loadView('pdf.simulasireportbycust',compact('simulasilel','cawanganDetail','marhuns','simulasi_id','cawid','ktlhbyr','cawname'))
|
||||
->setPaper('a4','potrait');
|
||||
|
||||
return $pdf->download('Laporan Simulasi Cawangan by Pelanggan.pdf');
|
||||
|
||||
}
|
||||
|
||||
public function lelongreport ($lelongid, $cawid){
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<style>
|
||||
#sim {
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
font-size:10px;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#sim td {padding:3px 5px 3px 5px; padding-right:10px;}, #sim th {
|
||||
border: 0px solid;
|
||||
padding: 1px;
|
||||
text-align: left;
|
||||
|
||||
}
|
||||
|
||||
#sim tr:nth-child(even){}
|
||||
|
||||
#sim tr:hover {}
|
||||
|
||||
#sim th {
|
||||
text-align: center;
|
||||
border: 0px solid;
|
||||
table-layout:auto;
|
||||
color: black;
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-right:-5px;
|
||||
margin-right:-5px;
|
||||
}
|
||||
|
||||
.column {
|
||||
float: right;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
/* Clearfix (clear floats) */
|
||||
.row::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
width: 200%;
|
||||
border: 0px solid #ddd;
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: right;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
th{
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/** Define now the real margins of every page in the PDF **/
|
||||
body {
|
||||
margin-top: 1cm;
|
||||
/* margin-left: 2cm; */
|
||||
/* margin-right: 2cm; */
|
||||
margin-bottom: 2cm;
|
||||
}
|
||||
|
||||
/** Define the header rules **/
|
||||
header {
|
||||
position: fixed;
|
||||
top: -1cm;
|
||||
left: 0cm;
|
||||
right: 0cm;
|
||||
height: 0cm;
|
||||
/** Extra personal styles **/
|
||||
/* background-color: #eaeaea; */
|
||||
color: black;
|
||||
text-align: center;
|
||||
line-height: 1.5cm;
|
||||
}
|
||||
|
||||
/** Define the footer rules **/
|
||||
footer {
|
||||
position: fixed;
|
||||
bottom: 0cm;
|
||||
left: 0cm;
|
||||
right: 0cm;
|
||||
height: 2cm;
|
||||
|
||||
/** Extra personal styles **/
|
||||
/* background-color: #eaeaea; */
|
||||
color: black;
|
||||
text-align: center;
|
||||
line-height: 1.5cm;
|
||||
}
|
||||
footer .pagenum:before {
|
||||
content: counter(page);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<u><b><h5>LAPORAN SIMULASI CAWANGAN by PELANGGAN: {{$cawname['caw_name']}}</h5></b></u>
|
||||
</header>
|
||||
|
||||
<footer>
|
||||
<div class="pagenum-container"><span class="pagenum"></span></div>
|
||||
</footer>
|
||||
|
||||
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Pelanggan</th>
|
||||
<th>No.KP</th>
|
||||
<th>No.Rujukan</th>
|
||||
<th>Tempoh</th>
|
||||
<th>Berat(gm)</th>
|
||||
<th>Keuntungan Telah Bayar (RM)</th>
|
||||
<th>Keuntungan 6 Bulan (RM)</th>
|
||||
<th>Keuntungan Semasa (RM)</th>
|
||||
<th>Pembiayaan Asal (RM)</th>
|
||||
<th>Baki Pembiayaan (RM)</th>
|
||||
<th>Nilai Marhun (RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
@foreach ($marhuns as $index=> $marhun)
|
||||
<tr>
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td style='word-wrap' align="left">{{ $marhun['nama']['nama']}}</td>
|
||||
<td style='word-wrap'>{{ $marhun['nokp']}}</td>
|
||||
<td style='white-space:nowrap;'>@foreach ($marhun['listsag'] as $item)
|
||||
{{-- {{$loop->iteration}}.{{ $item['norujukan'] }}<br> --}}
|
||||
{{ $item['norujukan'] }}<br>
|
||||
@endforeach</td>
|
||||
<td>@foreach ($marhun['listsag'] as $item)
|
||||
{{ $item['tempoh'] }}<br>
|
||||
@endforeach</td>
|
||||
<td align = 'right'>
|
||||
@php $jumberat = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumberat = $jumberat + $item['berat'];
|
||||
@endphp
|
||||
{{ number_format($item['berat'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumberat, 2, '.', ',') }}</strong>
|
||||
</td>
|
||||
<td align = 'right'>
|
||||
@php $jumktlhbyr = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumktlhbyr = $jumktlhbyr + $item['ktlhbyr'];
|
||||
@endphp
|
||||
{{ number_format($item['ktlhbyr'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumktlhbyr, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
<td align = 'right'>
|
||||
@php $jum6bulan = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jum6bulan = $jum6bulan + $item['bakiupah'];
|
||||
@endphp
|
||||
{{ number_format($item['bakiupah'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jum6bulan, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
<td align = 'right'>
|
||||
@php $jum6bulan = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jum6bulan = $jum6bulan + $item['keuntungan'];
|
||||
@endphp
|
||||
{{ number_format($item['keuntungan'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jum6bulan, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
<td align = 'right'>
|
||||
@php $jumpinjasal = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumpinjasal = $jumpinjasal + $item['pinjaman'];
|
||||
@endphp
|
||||
{{ number_format($item['pinjaman'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumpinjasal, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
<td align = 'right'>
|
||||
@php $jumpinjaman = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumpinjaman = $jumpinjaman + $item['bakipjm'];
|
||||
@endphp
|
||||
{{ number_format($item['bakipjm'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumpinjaman, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td align = 'right'>
|
||||
@php $jumnilaimarhun = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumnilaimarhun = $jumnilaimarhun + $item['nilaimarhun'];
|
||||
@endphp
|
||||
{{ number_format($item['nilaimarhun'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumnilaimarhun, 2, '.', ',') }}</strong>
|
||||
|
||||
</td>
|
||||
<!-- <td align = 'right'>
|
||||
@php $jumhargaasas = 0;@endphp
|
||||
@foreach ($marhun['listsag'] as $item)
|
||||
@php
|
||||
$jumhargaasas = $jumhargaasas + $item['hargaasas'];
|
||||
@endphp
|
||||
{{ number_format($item['hargaasas'], 2, '.', ',') }}<br>
|
||||
@endforeach
|
||||
<strong>{{ number_format($jumhargaasas, 2, '.', ',') }}</strong>
|
||||
|
||||
</td> -->
|
||||
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
|
||||
{{--
|
||||
<tr>
|
||||
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
|
||||
<td><strong>{{ number_format($total_berat, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_hargaasas, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_pinjaman, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_bakiupah, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_cajlelong, 2, '.', ',') }}</strong></td>
|
||||
<td><strong>{{ number_format($total_bakilelong, 2, '.', ',') }}</strong></td>
|
||||
</tr> --}}
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
{{--<div class="text-left pt-4">
|
||||
<a href="{{ route('analisa.senaraimarhunlel',[$simulasi_id,$cawid]) }}" class="btn btn-success">Simulasi Lelong</a>
|
||||
<a href="{{ route('analisa.listsagbycust',[$simulasi_id,'cawid'=>$cawid]) }}" class="btn btn-success">Senarai Mengikut Nama Pelangan</a>
|
||||
</div>--}}
|
||||
<div class="mb-3">
|
||||
<a href=" {{ route('report.simulasireportbycust',[$simulasi_id,$cawid]) }}" class="btn btn-outline-success">Muat Turun PDF</a>
|
||||
<!-- <a href="{{ route('analisa.senaraimarhunlel',[$simulasi_id,$cawid]) }}" class="btn btn-success">Simulasi Lelong</a> -->
|
||||
</div>
|
||||
<form id="deletesag" action="{{route('analisa.deletemarhunlel')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="simulasi_id" value="{{$simulasi_id}}">
|
||||
|
||||
@@ -491,6 +491,8 @@ Route::get('/lelongtebusindex',['as'=>'report.lelongtebusindex','uses'=>'ReportC
|
||||
Route::get('/lelongtebus/{lelong_id}/{kodcaw}',['as'=>'report.lelongtebus','uses'=>'ReportController@lelongtebus']);
|
||||
|
||||
Route::get('/simulasireport/{simulasi_id}/{cawid}',['as'=>'report.simulasireport','uses'=>'ReportController@simulasireport']);
|
||||
Route::get('/simulasireportbycust/{simulasi_id}/{cawid}',['as'=>'report.simulasireportbycust','uses'=>'ReportController@simulasireportbycust']);
|
||||
|
||||
|
||||
Route::get('/lelongreport/{lelongid}/{cawid}',['as'=>'report.lelongreport','uses'=>'ReportController@lelongreport']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user