From 80ecac18886dcf1f5476a3f6bfbd4b487a2d6513 Mon Sep 17 00:00:00 2001
From: Amirah22 <94591077+Amirah22@users.noreply.github.com>
Date: Thu, 16 Jun 2022 11:34:54 +0800
Subject: [PATCH] laporan simulasi and update notis
---
app/Http/Controllers/SimulasiController.php | 174 +++++++++++-------
.../views/excel/listnotis_excel.blade.php | 2 +-
.../views/jananotis/senarainotis.blade.php | 4 +-
resources/views/pdf/listnotis.blade.php | 2 +-
resources/views/pdf/resitpembayaran.blade.php | 5 +-
resources/views/pdf/simrpt2.blade.php | 138 ++++----------
.../views/simulasi/senaraimarhunlel.blade.php | 11 +-
.../views/simulasi/showsimulasi.blade.php | 15 +-
8 files changed, 156 insertions(+), 195 deletions(-)
diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php
index c39fb06a..8f8ada93 100644
--- a/app/Http/Controllers/SimulasiController.php
+++ b/app/Http/Controllers/SimulasiController.php
@@ -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');
diff --git a/resources/views/excel/listnotis_excel.blade.php b/resources/views/excel/listnotis_excel.blade.php
index 915f2b05..f9be29b1 100644
--- a/resources/views/excel/listnotis_excel.blade.php
+++ b/resources/views/excel/listnotis_excel.blade.php
@@ -78,7 +78,7 @@
{{ $pay['nama']}} |
{{ $pay['norujukan']}} |
6{{ $pay['telefon']}} |
- {{ $pay['jbg']}} |
+ {{ $pay['tempoh']}} |
{{ $pay['nokp']}} |
{{ $pay['pinjaman']}} |
{{ $pay['bakiupah']}} |
diff --git a/resources/views/jananotis/senarainotis.blade.php b/resources/views/jananotis/senarainotis.blade.php
index 89a91cc1..ab8454b4 100644
--- a/resources/views/jananotis/senarainotis.blade.php
+++ b/resources/views/jananotis/senarainotis.blade.php
@@ -34,7 +34,7 @@
| {{ $loop->iteration }} |
{{ $notis['norujukan']}} |
- {{ $notis['jbg']}} |
+ {{ $notis['tempoh']}} |
{{ $notis['nokp']}} |
{{ $notis['pinjaman']}} |
{{ $notis['bakiupah']}} |
@@ -67,7 +67,7 @@
// // "ordering": false,
"info": false,
"lengthChange": false,
- "pageLength": 15,
+ "pageLength": 9999999,
dom: 'Bfrtip',
buttons: [
diff --git a/resources/views/pdf/listnotis.blade.php b/resources/views/pdf/listnotis.blade.php
index dee527d4..b82b6384 100644
--- a/resources/views/pdf/listnotis.blade.php
+++ b/resources/views/pdf/listnotis.blade.php
@@ -73,7 +73,7 @@
| {{ $loop->iteration }} |
{{ $pay['norujukan']}} |
- {{ $pay['jbg']}} |
+ {{ $pay['tempoh']}} |
{{ $pay['nokp']}} |
{{ $pay['pinjaman']}} |
{{ $pay['bakiupah']}} |
diff --git a/resources/views/pdf/resitpembayaran.blade.php b/resources/views/pdf/resitpembayaran.blade.php
index b5c495aa..66a755a6 100644
--- a/resources/views/pdf/resitpembayaran.blade.php
+++ b/resources/views/pdf/resitpembayaran.blade.php
@@ -53,10 +53,13 @@
{{$caw['caw_name']}} |
Slip Serahan |
+ @foreach ($invois as $invois)
| {{$caw['alamat1']}} |
- {{-- No.Slip: {{$invois['reference_no']}} | --}}
+ No.Slip: {{$invois['reference_no']}} |
+ @endforeach
+
| {{$caw['alamat2']}} |
Tarikh: {{$lelong->tarikh_lelong}} |
diff --git a/resources/views/pdf/simrpt2.blade.php b/resources/views/pdf/simrpt2.blade.php
index 909ecfec..4d47e54a 100644
--- a/resources/views/pdf/simrpt2.blade.php
+++ b/resources/views/pdf/simrpt2.blade.php
@@ -70,25 +70,24 @@ tr:nth-child(even) {
-
- PERMODALAN KELANTAN BERHAD |
-
-
-
- | LAPORAN SIMULASI SEMUA CAWANGAN |
-
+
+ Laporan Simulasi Cawangan: @foreach ($arraycaw as $index=>$caw){{$caw['cawangan']}}, @endforeach
+
+ PERMODALAN KELANTAN BERHAD
+
+
-
+
| Bilangan Lelong: {{$total_marhun}} |
- Nilai Marhun Keseluruhan: RM{{ number_format($total_nmarhun, 2, '.', ',') }} |
+ Nilai Marhun Keseluruhan: RM{{ number_format($total_nilaimarhun, 2, '.', ',') }} |
Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} |
- Keuntungan Keseluruhan:RM{{ number_format($total_upah, 2, '.', ',') }} |
+ Keuntungan Keseluruhan:RM{{ number_format($total_upahkeuntungan2, 2, '.', ',') }} |
@@ -98,93 +97,35 @@ tr:nth-child(even) {
Rugi Lelong Keseluruhan: RM{{ number_format($total_rugilelong, 2, '.', ',') }} |
Baki Lelong Keseluruhan: RM{{ number_format($total_bakilelong, 2, '.', ',') }} |
Caj Lelong Keseluruhan: RM{{ number_format($total_cazlelong, 2, '.', ',') }} |
+ @foreach ($data as $data)
+ Tempoh: {{ $data['jbg']}} |
+ Tarikh Lelong :@php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $data['tarikh_lelong'] );
+ $datez = $myDateTime->format('d-m-Y');
+ echo($datez);
+ @endphp
+ |
+ @endforeach
-
-
-
-
-
-
-
-
-
-
- | No |
- Cawangan |
- Tarikh Lelong |
- No Rujukan |
- Berat(gm) |
- Nilai Marhun(RM) |
- Pembiayaan(RM) |
- Keuntungan(RM) |
- Harga Asas(RM) |
- Caj Lelong(RM) |
- Baki/Rugi Lelong(RM) |
- {{-- Rugi Lelong(RM) | --}}
-
-
-
-
-
- @foreach ($databid as $index=>$caw)
-
- | {{$index+1}} |
- {{ $cawangan['caw_name'] }} |
- {{ ($caw['t_lelong']) }} |
- {{ ($caw['norujukan']) }} |
- {{ number_format($caw['berat'], 2, '.', ',') }} |
- {{ number_format($caw['nilaimarhun'], 2, '.', ',') }} |
- {{ number_format($caw['pinjaman'], 2, '.', ',') }} |
- {{ number_format($caw['upahsimpan'], 2, '.', ',') }} |
- {{ number_format($caw['hargaasas'], 2, '.', ',') }} |
- {{ number_format($caw['cajlelong'], 2, '.', ',') }} |
- {{ number_format($caw['baki'], 2, '.', ',') }} |
-
- {{-- {{ ($bid['bakilelong']) }} |
- {{ ($bid['rugilelong']) }} | --}}
-
-
-
- @endforeach
-
-
-
- | Jumlah Keseluruhan |
- |
- {{ number_format($total_berat, 2, '.', ',') }} |
- {{ number_format($total_nmarhun, 2, '.', ',') }} |
- {{ number_format($total_pinjaman, 2, '.', ',') }} |
- {{ number_format($total_upah, 2, '.', ',') }} |
- {{ number_format($total_hargaasas, 2, '.', ',') }} |
- {{ number_format($total_cazlelong, 2, '.', ',') }} |
- |
-
-
- {{-- {{ number_format($total_bakilelong, 2, '.', ',') }} |
- ({{ number_format($total_rugilelong, 2, '.', ',') }}) | --}}
-
-
-
-
+
+
+
-
- . |
-
+
+
SIMULASI KESELURUHAN |
-
| No |
Cawangan |
- Tarikh Lelong |
Bil Marhun (Paket) |
Berat (gm) |
Nilai Marhun (RM) |
Pinjaman (RM) |
- Upah (RM) |
+ Keuntungan (RM) |
Harga Asas (RM) |
Caj Lelong (RM) |
Baki Lelong (RM) |
@@ -197,12 +138,11 @@ tr:nth-child(even) {
| {{$index+1}} |
{{ $caw['cawangan'] }} |
- {{ $caw['t_lelong'] }} |
{{ $caw['bil_marhun'] }} |
{{ number_format($caw['berat'], 2, '.', ',') }} |
{{ number_format($caw['n_marhun'], 2, '.', ',') }} |
{{ number_format($caw['pinjaman'], 2, '.', ',') }} |
- {{ number_format($caw['upah'], 2, '.', ',') }} |
+ {{ number_format($caw['upahsimpan'], 2, '.', ',') }} |
{{ number_format($caw['hargaasas'], 2, '.', ',') }} |
{{ number_format($caw['cajlelong'], 2, '.', ',') }} |
{{ number_format($caw['bakilelong'], 2, '.', ',') }} |
@@ -212,31 +152,29 @@ tr:nth-child(even) {
- | JUMLAH KESELURUHAN |
+ JUMLAH KESELURUHAN |
{{ $total_marhun }} |
- {{ number_format($total_berat, 2, '.', ',') }} |
- {{ number_format($total_nmarhun, 2, '.', ',') }} |
- {{ number_format($total_pinjaman, 2, '.', ',') }} |
- {{ number_format($total_upah, 2, '.', ',') }} |
- {{ number_format($total_hargaasas, 2, '.', ',') }} |
- {{ number_format($total_cazlelong, 2, '.', ',') }} |
- {{ number_format($total_bakilelong, 2, '.', ',') }} |
- ({{ number_format($total_rugilelong, 2, '.', ',') }}) |
+ {{ number_format($total_berat, 2, '.', ',') }} |
+ {{ number_format($total_nilaimarhun, 2, '.', ',') }} |
+ {{ number_format($total_pinjaman, 2, '.', ',') }} |
+ {{ number_format($total_upahkeuntungan2, 2, '.', ',') }} |
+ {{ number_format($total_hargaasas, 2, '.', ',') }} |
+ {{ number_format($total_cazlelong, 2, '.', ',') }} |
+ {{ number_format($total_bakilelong, 2, '.', ',') }} |
+ ({{ number_format($total_rugilelong, 2, '.', ',') }}) |
-
+
-
- . |
-
+
+
JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN) |
-
| MUTU |
24Kgb |
@@ -261,6 +199,8 @@ tr:nth-child(even) {
{{$total14K}} |
{{$total9K}} |
+
+
diff --git a/resources/views/simulasi/senaraimarhunlel.blade.php b/resources/views/simulasi/senaraimarhunlel.blade.php
index d41fdb08..0c697178 100644
--- a/resources/views/simulasi/senaraimarhunlel.blade.php
+++ b/resources/views/simulasi/senaraimarhunlel.blade.php
@@ -20,11 +20,7 @@
| No. |
-
- Norujukan |
-
+ Norujukan |
Tempoh |
Berat (gm) |
Nilai Marhun (RM) |
@@ -40,10 +36,7 @@
@foreach ($marhuns as $index=> $marhun)
- | {{$loop->iteration}} |
-
+ {{$loop->iteration}} |
{{ $marhun['norujukan']}} |
{{ number_format($marhun['tempoh'], 2, '.', ',') }} |
{{ number_format($marhun['berat'], 2, '.', ',') }} |
diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php
index 05093856..d7e5ac17 100644
--- a/resources/views/simulasi/showsimulasi.blade.php
+++ b/resources/views/simulasi/showsimulasi.blade.php
@@ -210,13 +210,13 @@