Merge branch 'amirah' into 'main'

laporan simulasi and update notis

See merge request online-sistem1/lelong!66
This commit is contained in:
Nur Izzati Zulkifli
2022-06-16 03:40:23 +00:00
8 changed files with 156 additions and 195 deletions
+104 -70
View File
@@ -579,9 +579,15 @@ class SimulasiController extends Controller
public function export(Request $request)
{
$simulasi_id = $request->simulasiid;
// $simulasi = Simulasi::where('id','=',$request->simulasiid)->first();
// $cawangansim = CawanganSimulasi::where('simulasi_id','=',$request->simulasiid)->get();
// $simkarat = SimKarat::where('simulasi_id','=',$request->simulasiid)->get();
$simulasi = Simulasi::where('id','=',$request->simulasiid)->first();
$cawangansim = CawanganSimulasi::where('simulasi_id','=',$request->simulasiid)->get();
$simkarat = SimKarat::where('simulasi_id','=',$request->simulasiid)->get();
$jeniskarat = JenisKarat::all();
$arraydata = [];
$arraycaw = [];
@@ -608,15 +614,19 @@ class SimulasiController extends Controller
$total14Kp = 0;
$total14K = 0;
$total9K = 0;
$total_upahkeuntungan2 = 0;
$total_nilaimarhun = 0;
foreach($cawangansim as $cawsim)
{
$cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
$databid = SimulasiBid::where('simulasi_id','=',$simulasi_id)
->get();
$databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
->select('simulasibid.id','simulasibid.berat','simulasibid.marhun','simulasibid.cajlelong','simulasibid.baki','simulasibid.nilaimarhun',
'simulasibid.pinjaman','simulasibid.hargaasas','simulasibid.cajlelong','gadai.bakipjm','gadai.bakihargajualan','gadai.upah12',
'gadai.ansakhir','gadai.tempoh','gadai.kadarupah','gadai.tempohbayar')
->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
// ->toArray();
$packet = 0;
$berat = 0;
$nilai_marhun = 0;
@@ -626,102 +636,120 @@ class SimulasiController extends Controller
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
foreach($databid as $bid)
$keuntungan = 0;
$total_upahkeuntungan = 0;
foreach($databid as $index1=>$bid)
{
$marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)->get();
$berat = $berat + $bid->berat;
$nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
$pinjaman =$pinjaman + $bid->pinjaman;
$upah = $upah + $bid->upah;
$hargaasas = $hargaasas + $bid->hargaasas;
$cajlelong = $cajlelong + $bid->cajlelong;
$marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])->get();
$berat = $berat + $bid['berat'];
// $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
$nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
$pinjaman =$pinjaman + $bid['pinjaman'];
// $upah = $upah + $bid['upah'];
$hargaasas = $hargaasas + $bid['hargaasas'];
$cajlelong = $cajlelong + $bid['cajlelong'];
if($bid->baki > 0)
$keuntungan = $bid['bakipjm'] - ($bid['bakihargajualan'] - ($bid['upah12'] - $bid['ansakhir'])-(($bid['tempoh']-$bid['tempohbayar'])*$bid['kadarupah']/100*$bid['bakipjm']) );
$databid[$index1]['keuntungan'] = $keuntungan;
// $total_upahkeuntungan = $total_upahkeuntungan + $keuntungan;
$total_upahkeuntungan = bcdiv($total_upahkeuntungan,1,1) + bcdiv($keuntungan,1,1);
if($bid['baki'] > 0)
{
$bakilelong = $bakilelong + $bid->baki;
$bakilelong = $bakilelong + $bid['baki'];
}
else
{
$rugilelong = $rugilelong - $bid->baki;
$rugilelong = $rugilelong - $bid['baki'];
}
$total24Kgb += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','24.0Kgb')
->sum('berat');
$total24Kgb += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','24.0Kgb')
->sum('berat');
$total24K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','24.0K')
->sum('berat');
$total23k += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','23.0K')
->sum('berat');
$total22K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','22.0K')
->sum('berat');
$total21K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','21.0K')
->sum('berat');
$total20K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','20.0K')
->sum('berat');
$total18Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','18.0Kp')
->sum('berat');
$total18K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','18.0K')
->sum('berat');
$total14Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','14.0Kp')
->sum('berat');
$total14K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','14.0K')
->sum('berat');
$total9K += SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)
->where('karat','=','9.0K')
->sum('berat');
$total24K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','24.0K')
->sum('berat');
$total23k += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','23.0K')
->sum('berat');
$total22K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','22.0K')
->sum('berat');
$total21K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','21.0K')
->sum('berat');
$total20K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','20.0K')
->sum('berat');
$total18Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','18.0Kp')
->sum('berat');
$total18K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','18.0K')
->sum('berat');
$total14Kp += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','14.0Kp')
->sum('berat');
$total14K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','14.0K')
->sum('berat');
$total9K += SimulasiBidMarhun::where('simulasibid_id','=',$bid['id'])
->where('karat','=','9.0K')
->sum('berat');
}
array_push($arraycaw,[
'cawangan'=>$cawangan->caw_name,
't_lelong'=>$simulasi->tarikh_lelong,
'id_cawangan'=> $cawangan['id'],
'cawangan'=>$cawangan['caw_name'],
't_lelong'=>$simulasi['tarikh_lelong'],
'bil_marhun'=>sizeof($databid),
'berat'=>$berat,
'n_marhun'=>$nilai_marhun,
'pinjaman'=>$pinjaman,
'upah'=>0,
'upahsimpan'=>bcdiv($total_upahkeuntungan,1,1),
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
'bakilelong'=>$bakilelong,
]);
$total_marhun = $total_marhun + sizeof($databid);
$total_berat = $total_berat + $berat;
$total_nmarhun = $total_nmarhun + $nilai_marhun;
$total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
//dd($nilai_marhun);
$total_pinjaman = $total_pinjaman + $pinjaman;
$total_upah = $total_upah + 0;
$total_hargaasas = $total_hargaasas + $hargaasas;
$total_cazlelong = $total_cazlelong + $cajlelong;
$total_rugilelong = $total_rugilelong + $rugilelong;
$total_bakilelong = $total_bakilelong + $bakilelong;
$total_upahkeuntungan2 = $total_upahkeuntungan2 + $total_upahkeuntungan;
$data = Simulasi::where('simulasi.id','=',$simulasi_id)
->get();
}
@@ -750,8 +778,14 @@ class SimulasiController extends Controller
'total9K',
'simkarat',
'simulasi_id',
'jeniskarat',
'data',
'total_upahkeuntungan',
'total_nilaimarhun',
'total_upahkeuntungan2',
'databid',
'cawangan',
'simulasi_id',
'bid'))->setPaper('a4', 'potrait');
return $pdf->download('Simulasi Keseluruhan.pdf');
@@ -78,7 +78,7 @@
<td align="left">{{ $pay['nama']}}</td>
<td align="left">{{ $pay['norujukan']}}</td>
<td align="left">6{{ $pay['telefon']}}</td>
<td align="left">{{ $pay['jbg']}}</td>
<td align="left">{{ $pay['tempoh']}}</td>
<td align="left">{{ $pay['nokp']}}</td>
<td align="left">{{ $pay['pinjaman']}}</td>
<td align="left">{{ $pay['bakiupah']}}</td>
@@ -34,7 +34,7 @@
<tr>
<td> {{ $loop->iteration }} </td>
<td>{{ $notis['norujukan']}}</td>
<td>{{ $notis['jbg']}}</td>
<td>{{ $notis['tempoh']}}</td>
<td>{{ $notis['nokp']}}</td>
<td>{{ $notis['pinjaman']}}</td>
<td>{{ $notis['bakiupah']}}</td>
@@ -67,7 +67,7 @@
// // "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 15,
"pageLength": 9999999,
dom: 'Bfrtip',
buttons: [
+1 -1
View File
@@ -73,7 +73,7 @@
<tr>
<td align="left">{{ $loop->iteration }} </td>
<td align="left">{{ $pay['norujukan']}}</td>
<td align="left">{{ $pay['jbg']}}</td>
<td align="left">{{ $pay['tempoh']}}</td>
<td align="left">{{ $pay['nokp']}}</td>
<td align="left">{{ $pay['pinjaman']}}</td>
<td align="left">{{ $pay['bakiupah']}}</td>
@@ -53,10 +53,13 @@
<td width="46%">{{$caw['caw_name']}}</td>
<td width="54%" align="right">Slip Serahan</td>
</tr>
@foreach ($invois as $invois)
<tr>
<td>{{$caw['alamat1']}}</td>
{{-- <td align="right">No.Slip: {{$invois['reference_no']}}</td> --}}
<td align="right">No.Slip: {{$invois['reference_no']}}</td>
</tr>
@endforeach
<tr>
<td>{{$caw['alamat2']}}</td>
<td align="right">Tarikh: {{$lelong->tarikh_lelong}}</td>
+39 -99
View File
@@ -70,25 +70,24 @@ tr:nth-child(even) {
<body>
<table width="100%" border="0" id="sim">
<tr>
<td width="50%"><h3>PERMODALAN KELANTAN BERHAD</h3></td>
</tr>
<tr>
<td colspan="2"><u><b>LAPORAN SIMULASI SEMUA CAWANGAN</b></u></td>
</tr>
<h3><b>Laporan Simulasi Cawangan: @foreach ($arraycaw as $index=>$caw){{$caw['cawangan']}}, @endforeach</b></h3>
<br>
<h3><b>PERMODALAN KELANTAN BERHAD</b></h3>
</table>
<br><br>
<br>
<table cellspacing="" cellpadding="5" text-align="left" border="0" height="25" align="left" id="sim">
<thead>
<br>
<tr>
<td>Bilangan Lelong: {{$total_marhun}}</td>
<td>Nilai Marhun Keseluruhan: RM{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>Nilai Marhun Keseluruhan: RM{{ number_format($total_nilaimarhun, 2, '.', ',') }}</td>
<td>Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} </td>
<td>Keuntungan Keseluruhan:RM{{ number_format($total_upah, 2, '.', ',') }}</td>
<td>Keuntungan Keseluruhan:RM{{ number_format($total_upahkeuntungan2, 2, '.', ',') }}</td>
</thead>
</table>
@@ -98,93 +97,35 @@ tr:nth-child(even) {
<td>Rugi Lelong Keseluruhan: RM{{ number_format($total_rugilelong, 2, '.', ',') }}</td>
<td>Baki Lelong Keseluruhan: RM{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>Caj Lelong Keseluruhan: RM{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
@foreach ($data as $data)
<td>Tempoh: {{ $data['jbg']}}</td>
<td>Tarikh Lelong :@php
$myDateTime = DateTime::createFromFormat('Y-m-d', $data['tarikh_lelong'] );
$datez = $myDateTime->format('d-m-Y');
echo($datez);
@endphp
</td>
@endforeach
</tr>
</thead>
</table>
<br>
<br>
<table cellspacing="0" cellpadding="5" style="float:right;" border="0" width="100%" height="80" align="left" id="sim">
<thead>
<tr>
<th width="2%" align="left">No</th>
<th width="9%" align="left">Cawangan</th>
<th width="6%" align="left">Tarikh Lelong</th>
<th width="5%" align="left">No Rujukan</th>
<th width="5%" align="left">Berat(gm)</th>
<th width="9%" align="left">Nilai Marhun(RM)</th>
<th width="9%" align="left">Pembiayaan(RM)</th>
<th width="9%" align="left">Keuntungan(RM)</th>
<th width="9%" align="left">Harga Asas(RM)</th>
<th width="9%" align="left">Caj Lelong(RM)</th>
<th width="9%" align="left">Baki/Rugi Lelong(RM)</th>
{{-- <th width="9%" align="left">Rugi Lelong(RM)</th> --}}
</tr>
</thead>
@foreach ($databid as $index=>$caw)
<tr>
<td>{{$index+1}}</td>
<td>{{ $cawangan['caw_name'] }}</td>
<td>{{ ($caw['t_lelong']) }}</td>
<td>{{ ($caw['norujukan']) }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upahsimpan'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['cajlelong'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['baki'], 2, '.', ',') }}</td>
{{-- <td>{{ ($bid['bakilelong']) }}</td>
<td>{{ ($bid['rugilelong']) }}</td> --}}
</tr>
@endforeach
<tr>
<td colspan="3" align="left"><strong>Jumlah Keseluruhan</strong></td>
<td></td>
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td></td>
{{-- <td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td> --}}
</tr>
</table>
</table>
<br>
<table width="100%" border="0" id="sim">
<tr>
<td><h5>.</h5></td>
</tr>
<thead>
<tr>
<th style="text-align:center;" colspan="12"><h3><b>SIMULASI KESELURUHAN</b></h3></th>
</tr>
<thead>
<tr class="text-center">
<th>No</th>
<th>Cawangan</th>
<th>Tarikh Lelong</th>
<th>Bil Marhun (Paket)</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
<th>Pinjaman (RM)</th>
<th>Upah (RM)</th>
<th>Keuntungan (RM)</th>
<th>Harga Asas (RM)</th>
<th>Caj Lelong (RM)</th>
<th>Baki Lelong (RM)</th>
@@ -197,12 +138,11 @@ tr:nth-child(even) {
<tr>
<td>{{$index+1}}</td>
<td>{{ $caw['cawangan'] }}</td>
<td>{{ $caw['t_lelong'] }}</td>
<td>{{ $caw['bil_marhun'] }}</td>
<td>{{ number_format($caw['berat'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['n_marhun'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['pinjaman'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upah'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['upahsimpan'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['hargaasas'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['cajlelong'], 2, '.', ',') }}</td>
<td>{{ number_format($caw['bakilelong'], 2, '.', ',') }}</td>
@@ -212,31 +152,29 @@ tr:nth-child(even) {
</tbody>
<tfoot>
<tr>
<td colspan="3"><b>JUMLAH KESELURUHAN</b></td>
<td colspan="2"><b>JUMLAH KESELURUHAN</b></td>
<td>{{ $total_marhun }}</td>
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nmarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upah, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td>
<td>{{ number_format($total_berat, 2, '.', ',') }}</td>
<td>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</td>
<td>{{ number_format($total_pinjaman, 2, '.', ',') }}</td>
<td>{{ number_format($total_upahkeuntungan2, 2, '.', ',') }}</td>
<td>{{ number_format($total_hargaasas, 2, '.', ',') }}</td>
<td>{{ number_format($total_cazlelong, 2, '.', ',') }}</td>
<td>{{ number_format($total_bakilelong, 2, '.', ',') }}</td>
<td>({{ number_format($total_rugilelong, 2, '.', ',') }})</td>
</tr>
</tfoot>
</table>
<br>
<table width="100%" border="0" id="sim">
<tr>
<td><h5>.</h5></td>
</tr>
<thead>
<tr>
<th style="text-align:center;" colspan="10"><h3><b>JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN)</b></h3></th>
</tr>
</thead>
<tr>
<td colspan="1" align="left"><strong>MUTU &nbsp;</strong></td>
<td colspan="1" align="center">24Kgb</td>
@@ -261,6 +199,8 @@ tr:nth-child(even) {
<td colspan="1" align="center">{{$total14K}}</td>
<td colspan="1" align="center">{{$total9K}}</td>
</tr>
</thead>
</table>
@@ -20,11 +20,7 @@
<thead class="bg-primary text-white">
<tr>
<th>No.</th>
<!-- <th>Tarikh Lelong</th>
<th>Kod Cawangan</th>
<th>Nama Cawangan</th> -->
<th>Norujukan</th>
<th>Norujukan</th>
<th>Tempoh</th>
<th>Berat (gm)</th>
<th>Nilai Marhun (RM)</th>
@@ -40,10 +36,7 @@
<tbody>
@foreach ($marhuns as $index=> $marhun)
<tr>
<td>{{$loop->iteration}}</td>
<!-- <td>{{ $marhun['t_lelong'] }}</td>
<td class="text-center">{{ $marhun['kodcaw'] }}</td>
<td>{{ $marhun['caw_name'] }}</td> -->
<td>{{$loop->iteration}}</td>
<td>{{ $marhun['norujukan']}}</td>
<td>{{ number_format($marhun['tempoh'], 2, '.', ',') }}</td>
<td>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
@@ -210,13 +210,13 @@
</div>
<div class="modal fade" tabindex="-1" id="modalfilter">
<div class="modal-dialog modal-lg">
<div class="modal-content">
{{-- <div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Filter By</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div> --}}
<div class="modal-body">
<form action="{{ route('analisa.filter') }}" method="POST" id="formfilter">
@csrf
@@ -364,16 +364,7 @@
"pageLength": 15,
dom: 'Bfrtip',
buttons: [
// 'copy', 'excel', 'pdf'
// { text: 'copy', className: 'btn btn-primary' },
{
className: 'btn btn-outline-success pl-4 pr-4 btn-sm addsim',
text: '<i class="fas fa-filter"></i>',
titleAttr: 'Filter By',
action: function ( e, dt, node, config ) {
$('#modalfilter').modal("show");
}
},
{
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
titleAttr: 'Download to PDF',