@@ -253,7 +254,7 @@
},
{
className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
- titleAttr: 'Export to CSV',
+ titleAttr: 'Download to PDF',
text: '
',
action: function ( e, dt, node, config ) {
$("#exportform").submit();
diff --git a/routes/web.php b/routes/web.php
index 3d56d08e..938f3404 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -54,6 +54,7 @@ Route::group(['middleware' => ['permission:analisa'],'prefix'=>'analisa'], funct
Route::get('/deletesimulasi/{id}',['as'=>'analisa.delete','uses'=>'SimulasiController@delete']);
Route::post('/filter',['as'=>'analisa.filter','uses'=>'SimulasiController@filter']);
+ Route::post('/export',['as'=>'analisa.export','uses'=>'SimulasiController@export']);
});
Route::group(['middleware' => ['permission:sistem'],'prefix'=>'sistem'], function () {
From eefc3e803ae7528b9ec00dc8a31416693f61a764 Mon Sep 17 00:00:00 2001
From: Amirah22 <94591077+Amirah22@users.noreply.github.com>
Date: Wed, 26 Jan 2022 14:46:24 +0800
Subject: [PATCH 2/5] export to pdf
simulasi keseluruhan
notis lelong
---
app/Http/Controllers/LelongController.php | 13 +
app/Http/Controllers/SimulasiController.php | 178 ++++++++++-
.../views/lelong/senarailelong.blade.php | 2 +-
resources/views/pdf/marhundetails.blade.php | 199 +++++++++++++
resources/views/pdf/notislelong.blade.php | 106 +++++++
resources/views/pdf/simrpt2.blade.php | 281 ++++++++++--------
.../views/simulasi/showsimulasi.blade.php | 1 +
routes/web.php | 2 +
8 files changed, 653 insertions(+), 129 deletions(-)
create mode 100644 resources/views/pdf/marhundetails.blade.php
create mode 100644 resources/views/pdf/notislelong.blade.php
diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php
index ceab41cf..6f05d1a3 100644
--- a/app/Http/Controllers/LelongController.php
+++ b/app/Http/Controllers/LelongController.php
@@ -26,6 +26,7 @@ use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
use App\Models\LelKarat_temp;
+use Carbon\Carbon;
class LelongController extends Controller
{
@@ -321,6 +322,18 @@ class LelongController extends Controller
->with('success','Create Lelong Berjaya');
}
+ public function exportnotis($id)
+ {
+ $currentdate = Carbon::now();
+ $currentdate = $currentdate->toDateString();
+
+ $lelong = Lelong::where('id','=',$id)->first();
+ $lelongbid = LelongBid::where('lelong_id','=',$lelong->id)->get();
+ // return view('pdf.notislelong',compact('currentdate','lelongbid')); //page for editing
+
+ $pdf = PDF::loadView('pdf.notislelong',compact('currentdate','lelongbid'));
+ return $pdf->download('Notis Lelong.pdf');
+ }
public function delete($id)
{
diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php
index d3e600d2..aa431ee1 100644
--- a/app/Http/Controllers/SimulasiController.php
+++ b/app/Http/Controllers/SimulasiController.php
@@ -27,6 +27,11 @@ use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
+
+
+
+
+
class SimulasiController extends Controller
{
/**
@@ -463,11 +468,180 @@ class SimulasiController extends Controller
}
+
+ // PDF SIMULASI KESELURUHAN SEMUA CAWANGAN
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();
+
+ $arraydata = [];
+ $arraycaw = [];
+ $data = [];
+
+ $total_marhun = 0;
+ $total_berat = 0;
+ $total_nmarhun = 0;
+ $total_pinjaman = 0;
+ $total_upah = 0;
+ $total_hargaasas = 0;
+ $total_cazlelong = 0;
+ $total_rugilelong = 0;
+ $total_bakilelong = 0;
+
+ $total24Kgb = 0;
+ $total24K = 0;
+ $total23k = 0;
+ $total22K = 0;
+ $total21K = 0;
+ $total20K = 0;
+ $total18Kp = 0;
+ $total18K = 0;
+ $total14Kp = 0;
+ $total14K = 0;
+ $total9K = 0;
+
+ foreach($cawangansim as $cawsim)
+ {
+ $cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
+ $databid = SimulasiBid::where('simulasi_id','=',$simulasi_id)->get();
+
+
+
+ $packet = 0;
+ $berat = 0;
+ $nilai_marhun = 0;
+ $pinjaman =0;
+ $upah = 0;
+ $hargaasas = 0;
+ $cajlelong = 0;
+ $rugilelong = 0;
+ $bakilelong = 0;
+
+ foreach($databid as $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;
+
+
+ if($bid->baki > 0)
+ {
+ $bakilelong = $bakilelong + $bid->baki;
+ }
+ else
+ {
+ $rugilelong = $rugilelong - $bid->baki;
+ }
+
+
+ $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');
+
+
+
+ }
+ array_push($arraycaw,[
+ 'cawangan'=>$cawangan->caw_name,
+ 't_lelong'=>$simulasi->tarikh_lelong,
+ 'bil_marhun'=>sizeof($databid),
+ 'berat'=>$berat,
+ 'n_marhun'=>$nilai_marhun,
+ 'pinjaman'=>$pinjaman,
+ 'upah'=>0,
+ '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_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;
+ }
+
+
+
+ $pdf = PDF::loadView('pdf.simrpt2',compact('arraycaw',
+ 'total_marhun',
+ 'total_berat',
+ 'total_nmarhun',
+ 'total_pinjaman',
+ 'total_upah',
+ 'total_hargaasas',
+ 'total_cazlelong',
+ 'total_rugilelong',
+ 'total_bakilelong',
+ 'total24Kgb',
+ 'total24K',
+ 'total23k',
+ 'total22K',
+ 'total21K',
+ 'total20K',
+ 'total18Kp',
+ 'total18K',
+ 'total14Kp',
+ 'total14K',
+ 'total9K',
+ 'simkarat',
+ 'simulasi_id',
+ 'databid'))->setPaper('a4', 'landscape');
+ return $pdf->download('Simulasi Keseluruhan.pdf');
+
- $pdf = PDF::loadView('pdf.simrpt2');
- return $pdf->download('Taraf.pdf');
}
}
diff --git a/resources/views/lelong/senarailelong.blade.php b/resources/views/lelong/senarailelong.blade.php
index 49b66163..04137887 100644
--- a/resources/views/lelong/senarailelong.blade.php
+++ b/resources/views/lelong/senarailelong.blade.php
@@ -45,7 +45,7 @@
@endhasrole
-
+
diff --git a/resources/views/pdf/marhundetails.blade.php b/resources/views/pdf/marhundetails.blade.php
new file mode 100644
index 00000000..b2074986
--- /dev/null
+++ b/resources/views/pdf/marhundetails.blade.php
@@ -0,0 +1,199 @@
+
+
+
+
+
+
+
+
+ PERMODALAN KELANTAN BERHAD |
+
+
+
+ | LAPORAN SIMULASI SEMUA CAWANGAN |
+
+
+
+
+
+
+
+
+
+ | Bilangan Lelong: {{$total_marhun}} |
+ Nilai Marhun Keseluruhan: RM{{ number_format($total_nmarhun, 2, '.', ',') }} |
+ Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} |
+ Keuntungan Keseluruhan:RM{{ number_format($total_upah, 2, '.', ',') }} |
+
+
+
+
+
+
+ | 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, '.', ',') }} |
+
+
+
+
+
+
+
+
+
+
+
+ | No |
+ Cawangan |
+ Tarikh Lelong |
+ Bil Marhun (Paket) |
+ Berat(gm) |
+ Nilai Marhun(RM) |
+ Pembiayaan(RM) |
+ Keuntungan(RM) |
+ Harga Asas(RM) |
+ Caj Lelong(RM) |
+ Baki Lelong(RM) |
+ Rugi Lelong(RM) |
+
+
+
+
+
+ @foreach ($arraycaw as $index=>$caw)
+
+ | {{$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['hargaasas'], 2, '.', ',') }} |
+ {{ number_format($caw['cajlelong'], 2, '.', ',') }} |
+ {{ number_format($caw['bakilelong'], 2, '.', ',') }} |
+ ({{ number_format($caw['rugilelong'], 2, '.', ',') }}) |
+
+ @endforeach
+
+
+
+ | 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, '.', ',') }}) |
+
+
+
+
+
+
+
+
+
+
+
+
+ JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN) |
+
+
+
+ | MUTU |
+ 24Kgb |
+ 24K |
+ 23K |
+ 22K |
+ 21K |
+ 20K |
+ 18K |
+ 14K |
+ 9K |
+
+
+ | BERAT(gm) |
+ {{$total24Kgb}} |
+ {{$total24K}} |
+ {{$total23k}} |
+ {{$total22K}} |
+ {{$total21K}} |
+ {{$total20K}} |
+ {{$total18Kp}} |
+ {{$total14K}} |
+ {{$total9K}} |
+
+
+
+
diff --git a/resources/views/pdf/notislelong.blade.php b/resources/views/pdf/notislelong.blade.php
new file mode 100644
index 00000000..97eda0ce
--- /dev/null
+++ b/resources/views/pdf/notislelong.blade.php
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+ {{-- @foreach($lelongbid as $surat) --}}
+
+
+
+
+
+

+
+
+
+
AR- RAHN (NAMA CAWANGAN)
+ Lot (alamat caw)
+ No Tel: xxxx
+ No Faks: xxx
+
+
+
+
+
+
Tarikh Cetak: {{$currentdate}}
+ {{-- No Rujukan: {{$surat['norujukan']}}
--}}
+ No Rujukan:
+ Kepada:
+ No Telefon:
+ No K/P:
+
+
+
Tuan/Puan,
+ LELONGAN BARANGAN GADAIAN SECARA TENDER PADA (TARIKH)
+
+
Dengan hormatnya kami ingin memaklumkan bahawa barang-barang cagaran tuan/puan yang digadai di cawangan seperti di atas akan dilelong.
+
+
Butiran lelongan adalah seperti berikut :-
+
+
Tarikh:
+ Cawangan:
+ Waktu:
+
+
+
Tuan/Puan adalah dikehendaki untuk membuat urusan berikut pada atau sebelum (tarikh):-
+
+
1. Tebus sepenuhnya
+ 2. Tebus gadai semula
+
+
Pelanggan hanya perlu menjelaskan upah simpan sehingga sembilan (9) bulan sahaja.
+ *Permohonan tangguh lelong adalah tidak dibenarkan.
+
+
Notis:
+ Sila bawa bersama Surat Akuan Gadai(SAG) untuk sebarang urusan.
+ Sila abaikan notis ini sekiranya penebusan telah dibuat.
+
Surat ini adalah cetakan komputer dan tiada tandatangan diperlukan
+
+
+ {{--
--}}
+ {{-- @endforeach --}}
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/pdf/simrpt2.blade.php b/resources/views/pdf/simrpt2.blade.php
index b8b266af..b2074986 100644
--- a/resources/views/pdf/simrpt2.blade.php
+++ b/resources/views/pdf/simrpt2.blade.php
@@ -1,31 +1,75 @@
-
+
+
+
+
PERMODALAN KELANTAN BERHAD |
@@ -35,136 +79,121 @@
-
-
-
- | Tarikh Lelong: |
- | Jbg: |
- | Caj Lelong: |
- | Harga Emas Asas: |
-
-
-
+
+
+
- | Bilangan Lelong: |
- Nilai Marhun Keseluruhan: |
- Pembiayaan Keseluruhan: |
- Keuntungan Keseluruhan: |
- Rugi Lelong Keseluruhan: |
- Baki Lelong Keseluruhan: |
- Caj Lelong Keseluruhan: |
-
+ Bilangan Lelong: {{$total_marhun}} |
+ Nilai Marhun Keseluruhan: RM{{ number_format($total_nmarhun, 2, '.', ',') }} |
+ Pembiayaan Keseluruhan: RM{{ number_format($total_pinjaman, 2, '.', ',') }} |
+ Keuntungan Keseluruhan:RM{{ number_format($total_upah, 2, '.', ',') }} |
+
+
+
+ | 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, '.', ',') }} |
+
+
+
+
+
+
-
-
-
- | No. |
-
- Cawangan |
- Bil Marhun(paket) |
- No Rujukan |
- Berat(gm) |
- Margin Pinjaman |
- Harga Asas(RM)
- | Nilai Marhun(RM) |
- Pembiayaan(RM) |
- Keuntungan(RM) |
- Baki Lelong(RM) |
- Rugi Lelong(RM) |
- Caj Lelong(RM) |
-
-
+
+
+
+ | No |
+ Cawangan |
+ Tarikh Lelong |
+ Bil Marhun (Paket) |
+ Berat(gm) |
+ Nilai Marhun(RM) |
+ Pembiayaan(RM) |
+ Keuntungan(RM) |
+ Harga Asas(RM) |
+ Caj Lelong(RM) |
+ Baki Lelong(RM) |
+ Rugi Lelong(RM) |
+
+
-
+
-
- | |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
- | Jumlah Keseluruhan |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN) |
-
-
-
-
-
+ @foreach ($arraycaw as $index=>$caw)
+
+ | {{$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['hargaasas'], 2, '.', ',') }} |
+ {{ number_format($caw['cajlelong'], 2, '.', ',') }} |
+ {{ number_format($caw['bakilelong'], 2, '.', ',') }} |
+ ({{ number_format($caw['rugilelong'], 2, '.', ',') }}) |
+
+ @endforeach
-
- | MUTU |
- 24Kgb |
- 24K |
- 23K |
- 22K |
- 21K |
- 20K |
- 18K |
- 14K |
- 9K |
-
-
- | BERAT(gm) |
- |
- |
- |
- |
- |
- |
- |
- |
+
+ | 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, '.', ',') }}) |
+
+
+
-
+
+
+
+
+
+
+
+ JUMLAH BERAT MENGIKUT MUTU (KESELURUHAN) |
+
+
+
+ | MUTU |
+ 24Kgb |
+ 24K |
+ 23K |
+ 22K |
+ 21K |
+ 20K |
+ 18K |
+ 14K |
+ 9K |
+
+
+ | BERAT(gm) |
+ {{$total24Kgb}} |
+ {{$total24K}} |
+ {{$total23k}} |
+ {{$total22K}} |
+ {{$total21K}} |
+ {{$total20K}} |
+ {{$total18Kp}} |
+ {{$total14K}} |
+ {{$total9K}} |
+
+
-
-
-
-
\ No newline at end of file
+
diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php
index c8b22245..28db6c3d 100644
--- a/resources/views/simulasi/showsimulasi.blade.php
+++ b/resources/views/simulasi/showsimulasi.blade.php
@@ -16,6 +16,7 @@