From 63b5123972859b4b44cd0115153d680ca74f5dfe Mon Sep 17 00:00:00 2001
From: Amirah22 <94591077+Amirah22@users.noreply.github.com>
Date: Mon, 18 Apr 2022 15:37:31 +0800
Subject: [PATCH 1/3] update tempoh (simulasi,lelong)
---
app/Http/Controllers/LelongController.php | 16 +++++++---------
app/Http/Controllers/SimulasiController.php | 9 ++++++++-
resources/views/lelong/senaraimarhun.blade.php | 2 ++
resources/views/lelong/showlelong.blade.php | 5 +++++
.../views/simulasi/senaraimarhunlel.blade.php | 2 ++
resources/views/simulasi/showsimulasi.blade.php | 5 +++++
6 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php
index 59d46330..366e13b1 100644
--- a/app/Http/Controllers/LelongController.php
+++ b/app/Http/Controllers/LelongController.php
@@ -51,14 +51,7 @@ class LelongController extends Controller
*/
public function index()
{
- // $lelong = Lelong::all();
-
- // foreach($lelong as $lel)
- // {
- // $caw_lelong = CawanganLelong::join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
- // ->where('lelong_id', $lel['id'])
- // ->get()->toArray();
- // }
+
$arrayinfo = [];
$lelong = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
@@ -222,6 +215,9 @@ class LelongController extends Controller
$total_cazlelong = $total_cazlelong + $cajlelong;
$total_rugilelong = $total_rugilelong + $rugilelong;
$total_bakilelong = $total_bakilelong + $bakilelong;
+
+ $data = Lelong::where('lelong.id','=',$lelong_id)
+ ->get();
}
@@ -249,7 +245,8 @@ class LelongController extends Controller
'total9K',
'lelkarat',
'lelong_id',
- 'jeniskarat'));
+ 'jeniskarat',
+ 'data'));
}
public function create($id)
@@ -806,6 +803,7 @@ class LelongController extends Controller
'lelongbid.cajlelong',
'lelongbid.baki',
'lelongbid.status_jual',
+ 'lelongbid.jbg'
)
->get();
diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php
index 81ad2daf..886eddf1 100644
--- a/app/Http/Controllers/SimulasiController.php
+++ b/app/Http/Controllers/SimulasiController.php
@@ -350,6 +350,8 @@ class SimulasiController extends Controller
$rugilelong = 0;
$bakilelong = 0;
+
+
foreach($databid as $bid)
{
$marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)->get();
@@ -442,6 +444,9 @@ class SimulasiController extends Controller
$total_cazlelong = $total_cazlelong + $cajlelong;
$total_rugilelong = $total_rugilelong + $rugilelong;
$total_bakilelong = $total_bakilelong + $bakilelong;
+
+ $data = Simulasi::where('simulasi.id','=',$simulasi_id)
+ ->get();
}
@@ -470,7 +475,8 @@ class SimulasiController extends Controller
'total9K',
'simkarat',
'simulasi_id',
- 'jeniskarat'));
+ 'jeniskarat',
+ 'data'));
}
public function delete($id)
@@ -748,6 +754,7 @@ class SimulasiController extends Controller
'simulasibid.cajlelong',
'simulasibid.baki',
'simulasibid.status_jual',
+ 'simulasibid.jbg'
)
->get();
diff --git a/resources/views/lelong/senaraimarhun.blade.php b/resources/views/lelong/senaraimarhun.blade.php
index 7188949c..f3184b2c 100644
--- a/resources/views/lelong/senaraimarhun.blade.php
+++ b/resources/views/lelong/senaraimarhun.blade.php
@@ -24,6 +24,7 @@
Nama Cawangan |
Norujukan |
Pinjaman (RM) |
+ Tempoh |
Berat (gm) |
Nilai Marhun (RM) |
Harga Asas (RM) |
@@ -43,6 +44,7 @@
{{ $marhun->caw_name }} |
{{ $marhun->norujukan}} |
{{ $marhun->pinjaman }} |
+ {{ $marhun->jbg}} |
{{ $marhun->berat }} |
{{ $marhun->nilaimarhun }} |
{{ $marhun->hargaasas }} |
diff --git a/resources/views/lelong/showlelong.blade.php b/resources/views/lelong/showlelong.blade.php
index a8ced8f0..a2274d69 100644
--- a/resources/views/lelong/showlelong.blade.php
+++ b/resources/views/lelong/showlelong.blade.php
@@ -49,6 +49,11 @@
| Caj Lelong Keseluruhan : RM{{ number_format($total_cazlelong, 2, '.', ',') }} |
+
+ @foreach($data as $data)
+ | Tempoh: {{$data['jbg'] }} |
+ @endforeach
+
diff --git a/resources/views/simulasi/senaraimarhunlel.blade.php b/resources/views/simulasi/senaraimarhunlel.blade.php
index f9d92378..3bec70c3 100644
--- a/resources/views/simulasi/senaraimarhunlel.blade.php
+++ b/resources/views/simulasi/senaraimarhunlel.blade.php
@@ -24,6 +24,7 @@
Nama Cawangan |
Norujukan |
Pinjaman (RM) |
+ Tempoh |
Berat (gm) |
Nilai Marhun (RM) |
Harga Asas (RM) |
@@ -43,6 +44,7 @@
{{ $marhun->caw_name }} |
{{ $marhun->norujukan}} |
{{ $marhun->pinjaman }} |
+ {{ $marhun->jbg }} |
{{ $marhun->berat }} |
{{ $marhun->nilaimarhun }} |
{{ $marhun->hargaasas }} |
diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php
index c2d5683b..f55681a0 100644
--- a/resources/views/simulasi/showsimulasi.blade.php
+++ b/resources/views/simulasi/showsimulasi.blade.php
@@ -46,6 +46,11 @@
| Caj Lelong Keseluruhan : RM{{ number_format($total_cazlelong, 2, '.', ',') }} |
+
+ @foreach ($data as $data)
+ | Tempoh: {{ $data['jbg']}} |
+ @endforeach
+
From 6c7dd9d4cc593e9e54ea3dab23e68fa1f4c8f28d Mon Sep 17 00:00:00 2001
From: Amirah22 <94591077+Amirah22@users.noreply.github.com>
Date: Wed, 20 Apr 2022 11:38:55 +0800
Subject: [PATCH 2/3] calculation keuntungan(simulasi)
---
app/Http/Controllers/SimulasiController.php | 165 +++++++++++-------
.../views/simulasi/senaraimarhunlel.blade.php | 42 ++---
.../views/simulasi/showsimulasi.blade.php | 4 +-
3 files changed, 121 insertions(+), 90 deletions(-)
diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php
index 886eddf1..fc62df67 100644
--- a/app/Http/Controllers/SimulasiController.php
+++ b/app/Http/Controllers/SimulasiController.php
@@ -338,7 +338,8 @@ class SimulasiController extends Controller
foreach($cawangansim as $cawsim)
{
$cawangan = Cawangan::where('id','=',$cawsim->caw_id)->first();
- $databid = SimulasiBid::where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get();
+ $databid = SimulasiBid::join('gadai','simulasibid.norujukan','=','gadai.norujukan')
+ ->where('caw_id','=',$cawsim->caw_id)->where('simulasi_id','=',$simulasi_id)->get()->toArray();
$packet = 0;
$berat = 0;
@@ -349,97 +350,107 @@ class SimulasiController extends Controller
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
+
+ $keuntungan = 0;
+ $total_upahkeuntungan = 0;
-
- foreach($databid as $bid)
+
+
+ foreach($databid as $index1=>$bid)
{
- $marhun = SimulasiBidMarhun::where('simulasibid_id','=',$bid->id)->get();
- $berat = $berat + $bid->berat;
+ $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;
+ $pinjaman =$pinjaman + $bid['pinjaman'];
+ $upah = $upah + $bid['upahsimpan'];
+ $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;
+
+
+ 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,[
- 'id_cawangan'=> $cawangan->id,
- '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'=>$total_upahkeuntungan,
'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;
@@ -449,7 +460,6 @@ class SimulasiController extends Controller
->get();
}
-
return view('simulasi.showsimulasi',compact(
'arraycaw',
@@ -476,7 +486,8 @@ class SimulasiController extends Controller
'simkarat',
'simulasi_id',
'jeniskarat',
- 'data'));
+ 'data',
+ 'total_upahkeuntungan'));
}
public function delete($id)
@@ -738,7 +749,10 @@ class SimulasiController extends Controller
public function senaraimarhunlel($simulasi_id, $cawid)
{
+ $keuntungan = 0;
+
$marhuns = SimulasiBid::join('cawangan', 'simulasibid.caw_id', '=', 'cawangan.id')
+ ->join('gadai','simulasibid.norujukan','=','gadai.norujukan')
->where('simulasi_id','=',$simulasi_id)
->where('caw_id','=',$cawid)
->select(
@@ -754,11 +768,28 @@ class SimulasiController extends Controller
'simulasibid.cajlelong',
'simulasibid.baki',
'simulasibid.status_jual',
- 'simulasibid.jbg'
+ 'simulasibid.jbg',
+ 'gadai.bakipjm',
+ 'gadai.bakihargajualan',
+ 'gadai.upah12',
+ 'gadai.ansakhir',
+ 'gadai.tempoh',
+ 'gadai.tempohbayar',
+ 'gadai.kadarupah'
+
)
- ->get();
+ ->get()->toArray();
+
+ foreach($marhuns as $index1=>$cal){
+
+
+ $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
+ $marhuns[$index1]['keuntungan'] = $keuntungan;
+
+
+ }
- return view('simulasi.senaraimarhunlel',compact('marhuns','simulasi_id','cawid'));
+ return view('simulasi.senaraimarhunlel',compact('marhuns','simulasi_id','cawid','keuntungan','cal'));
}
public function deletemarhunlel(Request $request){
diff --git a/resources/views/simulasi/senaraimarhunlel.blade.php b/resources/views/simulasi/senaraimarhunlel.blade.php
index 3bec70c3..9a0882a4 100644
--- a/resources/views/simulasi/senaraimarhunlel.blade.php
+++ b/resources/views/simulasi/senaraimarhunlel.blade.php
@@ -28,7 +28,7 @@
Berat (gm) |
Nilai Marhun (RM) |
Harga Asas (RM) |
- Upah Simpan (RM) |
+ Keuntungan (RM) |
Caj Lelong (%) |
Rugi Lelong (RM) |
Baki Lelong (RM) |
@@ -38,34 +38,34 @@
@foreach ($marhuns as $index=> $marhun)
- | {{$index+1}} |
- {{ $marhun->t_lelong }} |
- {{ $marhun->kodcaw }} |
- {{ $marhun->caw_name }} |
- {{ $marhun->norujukan}} |
- {{ $marhun->pinjaman }} |
- {{ $marhun->jbg }} |
- {{ $marhun->berat }} |
- {{ $marhun->nilaimarhun }} |
- {{ $marhun->hargaasas }} |
- {{ $marhun->upahsimpan }} |
- {{ $marhun->cajlelong }} |
+ {{$loop->iteration}} |
+ {{ $marhun['t_lelong'] }} |
+ {{ $marhun['kodcaw'] }} |
+ {{ $marhun['caw_name'] }} |
+ {{ $marhun['norujukan']}} |
+ {{ number_format($marhun['pinjaman'], 2, '.', ',') }} |
+ {{ number_format($marhun['jbg'], 2, '.', ',') }} |
+ {{ number_format($marhun['berat'], 2, '.', ',') }} |
+ {{ number_format($marhun['nilaimarhun'], 2, '.', ',') }} |
+ {{ number_format($marhun['hargaasas'], 2, '.', ',') }} |
+ {{ number_format($marhun['keuntungan'], 2, '.', ',') }} |
+ {{ number_format($marhun['cajlelong'], 2, '.', ',') }} |
baki, '-') !== false)
+ $rugi = 0;
+ $baki = 0;
+ if(strpos($marhun['baki'], '-') !== false)
{
- $rugi = $marhun->baki;
+ $rugi = $marhun['baki'];
}
else {
- $baki = $marhun->baki;
+ $baki = $marhun['baki'];
}
?>
- {{$rugi}} |
- {{$baki}} |
+ {{number_format($rugi, 2, '.', ',')}} |
+ {{number_format($baki, 2, '.', ',')}} |
-
+
|
diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php
index f55681a0..0bef4f3d 100644
--- a/resources/views/simulasi/showsimulasi.blade.php
+++ b/resources/views/simulasi/showsimulasi.blade.php
@@ -84,7 +84,7 @@
{{ 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, '.', ',') }} |
@@ -99,7 +99,7 @@
{{ number_format($total_berat, 2, '.', ',') }} |
{{ number_format($total_nmarhun, 2, '.', ',') }} |
{{ number_format($total_pinjaman, 2, '.', ',') }} |
- {{ number_format($total_upah, 2, '.', ',') }} |
+ {{ number_format($total_upahkeuntungan, 2, '.', ',') }} |
{{ number_format($total_hargaasas, 2, '.', ',') }} |
{{ number_format($total_cazlelong, 2, '.', ',') }} |
{{ number_format($total_bakilelong, 2, '.', ',') }} |
From ff37edd4bb54aa1130cc8e70b508bad2b6e8f0d5 Mon Sep 17 00:00:00 2001
From: Amirah22 <94591077+Amirah22@users.noreply.github.com>
Date: Wed, 20 Apr 2022 14:07:29 +0800
Subject: [PATCH 3/3] update keuntungan (lelong) + update nilai marhun
(lelong,simulasi)
---
app/Http/Controllers/LelongController.php | 97 +++++++++++++------
app/Http/Controllers/SimulasiController.php | 11 ++-
.../views/lelong/senaraimarhun.blade.php | 38 ++++----
resources/views/lelong/showlelong.blade.php | 4 +-
.../views/simulasi/showsimulasi.blade.php | 2 +-
5 files changed, 95 insertions(+), 57 deletions(-)
diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php
index 366e13b1..5eb15738 100644
--- a/app/Http/Controllers/LelongController.php
+++ b/app/Http/Controllers/LelongController.php
@@ -108,10 +108,14 @@ class LelongController extends Controller
$total14K = 0;
$total9K = 0;
+ $keuntungan = 0;
+ $total_upahkeuntungan = 0;
+
foreach($cawanganlel as $cawlel)
{
$cawangan = Cawangan::where('id','=',$cawlel->caw_id)->first();
- $databid = LelongBid::where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$id)->get();
+ $databid = LelongBid::join('gadai','lelongbid.norujukan','=','gadai.norujukan')
+ ->where('caw_id','=',$cawlel->caw_id)->where('lelong_id','=',$id)->get();
$packet = 0;
$berat = 0;
@@ -122,69 +126,76 @@ class LelongController extends Controller
$cajlelong = 0;
$rugilelong = 0;
$bakilelong = 0;
+ $total_nilaimarhun = 0;
- foreach($databid as $bid)
+ foreach($databid as $index1=>$bid)
{
- $marhun = LelongBidMarhun::where('lelongbid_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 = LelongBidMarhun::where('lelongbid_id','=',$bid['id'])->get();
+ $berat = $berat + $bid['berat'];
+ $nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
+ $pinjaman =$pinjaman + $bid['pinjaman'];
+ $upah = $upah + $bid['upah'];
+ $hargaasas = $hargaasas + $bid['hargaasas'];
+ $cajlelong = $cajlelong + $bid['cajlelong'];
+
+
+ $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;
- if($bid->baki > 0)
+ if($bid['baki'] > 0)
{
- $bakilelong = $bakilelong + $bid->baki;
+ $bakilelong = $bakilelong + $bid['baki'];
}
else
{
- $rugilelong = $rugilelong - $bid->baki;
+ $rugilelong = $rugilelong - $bid['baki'];
}
- $total24Kgb += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total24Kgb += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','24.0Kgb')
->sum('berat');
- $total24K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total24K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','24.0K')
->sum('berat');
- $total23k += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total23k += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','23.0K')
->sum('berat');
- $total22K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total22K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','22.0K')
->sum('berat');
- $total21K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total21K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','21.0K')
->sum('berat');
- $total20K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total20K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','20.0K')
->sum('berat');
- $total18Kp += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total18Kp += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','18.0Kp')
->sum('berat');
- $total18K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total18K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','18.0K')
->sum('berat');
- $total14Kp += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total14Kp += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','14.0Kp')
->sum('berat');
- $total14K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total14K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','14.0K')
->sum('berat');
- $total9K += LelongBidMarhun::where('lelongbid_id','=',$bid->id)
+ $total9K += LelongBidMarhun::where('lelongbid_id','=',$bid['id'])
->where('karat','=','9.0K')
->sum('berat');
@@ -192,14 +203,14 @@ class LelongController extends Controller
}
array_push($arraycaw,[
- 'id_cawangan'=> $cawangan->id,
- 'cawangan'=>$cawangan->caw_name,
- 't_lelong'=>$lelong->tarikh_lelong,
+ 'id_cawangan'=> $cawangan['id'],
+ 'cawangan'=>$cawangan['caw_name'],
+ 't_lelong'=>$lelong['tarikh_lelong'],
'bil_marhun'=>sizeof($databid),
'berat'=>$berat,
'n_marhun'=>$nilai_marhun,
'pinjaman'=>$pinjaman,
- 'upah'=>0,
+ 'upah'=>$total_upahkeuntungan,
'hargaasas'=>$hargaasas,
'cajlelong'=>$cajlelong,
'rugilelong'=>$rugilelong,
@@ -208,13 +219,14 @@ class LelongController extends Controller
$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;
+ $total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
+
$data = Lelong::where('lelong.id','=',$lelong_id)
->get();
@@ -246,7 +258,9 @@ class LelongController extends Controller
'lelkarat',
'lelong_id',
'jeniskarat',
- 'data'));
+ 'data',
+ 'total_upahkeuntungan',
+ 'total_nilaimarhun'));
}
public function create($id)
@@ -788,7 +802,11 @@ class LelongController extends Controller
public function senaraimarhun($lelongid, $cawid){
// $marhun = LelongBid::->get();
+ $keuntungan = 0;
+
+
$marhuns = LelongBid::join('cawangan', 'lelongbid.caw_id', '=', 'cawangan.id')
+ ->join('gadai','lelongbid.norujukan','=','gadai.norujukan')
->where('lelong_id','=',$lelongid)->where('caw_id','=',$cawid)
->select(
'lelongbid.t_lelong',
@@ -803,9 +821,26 @@ class LelongController extends Controller
'lelongbid.cajlelong',
'lelongbid.baki',
'lelongbid.status_jual',
- 'lelongbid.jbg'
+ 'lelongbid.jbg',
+ 'gadai.bakipjm',
+ 'gadai.bakihargajualan',
+ 'gadai.upah12',
+ 'gadai.ansakhir',
+ 'gadai.tempoh',
+ 'gadai.tempohbayar',
+ 'gadai.kadarupah'
)
- ->get();
+ ->get()->toArray();
+
+ foreach ($marhuns as $index1=> $cal) {
+
+ $keuntungan = $cal['bakipjm'] - ($cal['bakihargajualan'] - ($cal['upah12'] - $cal['ansakhir'])-(($cal['tempoh']-$cal['tempohbayar'])*$cal['kadarupah']/100*$cal['bakipjm']) );
+ $marhuns[$index1]['keuntungan'] = $keuntungan;
+ }
+
+
+
+
return view('lelong.senaraimarhun',compact('marhuns','lelongid','cawid'));
}
diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php
index fc62df67..ac6ca11d 100644
--- a/app/Http/Controllers/SimulasiController.php
+++ b/app/Http/Controllers/SimulasiController.php
@@ -354,14 +354,16 @@ class SimulasiController extends Controller
$keuntungan = 0;
$total_upahkeuntungan = 0;
-
+ $total_nilaimarhun = 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'));
+ // $nilai_marhun = $nilai_marhun + ($marhun->sum('n_marhun'));
+ $nilai_marhun = $nilai_marhun + $bid['nilaimarhun'];
$pinjaman =$pinjaman + $bid['pinjaman'];
$upah = $upah + $bid['upahsimpan'];
$hargaasas = $hargaasas + $bid['hargaasas'];
@@ -449,7 +451,7 @@ class SimulasiController extends Controller
$total_marhun = $total_marhun + sizeof($databid);
$total_berat = $total_berat + $berat;
- $total_nmarhun = $total_nmarhun + $nilai_marhun;
+ $total_nilaimarhun = $total_nilaimarhun + $nilai_marhun;
$total_pinjaman = $total_pinjaman + $pinjaman;
$total_hargaasas = $total_hargaasas + $hargaasas;
$total_cazlelong = $total_cazlelong + $cajlelong;
@@ -487,7 +489,8 @@ class SimulasiController extends Controller
'simulasi_id',
'jeniskarat',
'data',
- 'total_upahkeuntungan'));
+ 'total_upahkeuntungan',
+ 'total_nilaimarhun'));
}
public function delete($id)
diff --git a/resources/views/lelong/senaraimarhun.blade.php b/resources/views/lelong/senaraimarhun.blade.php
index f3184b2c..4c0372d6 100644
--- a/resources/views/lelong/senaraimarhun.blade.php
+++ b/resources/views/lelong/senaraimarhun.blade.php
@@ -28,7 +28,7 @@
Berat (gm) |
Nilai Marhun (RM) |
Harga Asas (RM) |
- Upah Simpan (RM) |
+ Keuntungan (RM) |
Caj Lelong (%) |
Rugi Lelong (RM) |
Baki Lelong (RM) |
@@ -38,34 +38,34 @@
@foreach ($marhuns as $index=> $marhun)
- | {{$index+1}} |
- {{ $marhun->t_lelong }} |
- {{ $marhun->kodcaw }} |
- {{ $marhun->caw_name }} |
- {{ $marhun->norujukan}} |
- {{ $marhun->pinjaman }} |
- {{ $marhun->jbg}} |
- {{ $marhun->berat }} |
- {{ $marhun->nilaimarhun }} |
- {{ $marhun->hargaasas }} |
- {{ $marhun->upahsimpan }} |
- {{ $marhun->cajlelong }} |
+ {{$loop->iteration}} |
+ {{ $marhun['t_lelong'] }} |
+ {{ $marhun['kodcaw'] }} |
+ {{ $marhun['caw_name'] }} |
+ {{ $marhun['norujukan']}} |
+ {{ $marhun['pinjaman'] }} |
+ {{ $marhun['jbg']}} |
+ {{ $marhun['berat'] }} |
+ {{ $marhun['nilaimarhun'] }} |
+ {{ $marhun['hargaasas'] }} |
+ {{ $marhun['keuntungan'] }} |
+ {{ $marhun['cajlelong'] }} |
baki, '-') !== false)
+ $rugi = 0;
+ $baki = 0;
+ if(strpos($marhun['baki'], '-') !== false)
{
- $rugi = $marhun->baki;
+ $rugi = $marhun['baki'];
}
else {
- $baki = $marhun->baki;
+ $baki = $marhun['baki'];
}
?>
{{$rugi}} |
{{$baki}} |
-
+
|
diff --git a/resources/views/lelong/showlelong.blade.php b/resources/views/lelong/showlelong.blade.php
index a2274d69..8046e733 100644
--- a/resources/views/lelong/showlelong.blade.php
+++ b/resources/views/lelong/showlelong.blade.php
@@ -100,9 +100,9 @@
JUMLAH KESELURUHAN |
{{ $total_marhun }} |
{{ number_format($total_berat, 2, '.', ',') }} |
- {{ number_format($total_nmarhun, 2, '.', ',') }} |
+ {{ number_format($total_nilaimarhun, 2, '.', ',') }} |
{{ number_format($total_pinjaman, 2, '.', ',') }} |
- {{ number_format($total_upah, 2, '.', ',') }} |
+ {{ number_format($total_upahkeuntungan, 2, '.', ',') }} |
{{ number_format($total_hargaasas, 2, '.', ',') }} |
{{ number_format($total_cazlelong, 2, '.', ',') }} |
{{ number_format($total_bakilelong, 2, '.', ',') }} |
diff --git a/resources/views/simulasi/showsimulasi.blade.php b/resources/views/simulasi/showsimulasi.blade.php
index 0bef4f3d..dd60f631 100644
--- a/resources/views/simulasi/showsimulasi.blade.php
+++ b/resources/views/simulasi/showsimulasi.blade.php
@@ -97,7 +97,7 @@
JUMLAH KESELURUHAN |
{{ $total_marhun }} |
{{ number_format($total_berat, 2, '.', ',') }} |
- {{ number_format($total_nmarhun, 2, '.', ',') }} |
+ {{ number_format($total_nilaimarhun, 2, '.', ',') }} |
{{ number_format($total_pinjaman, 2, '.', ',') }} |
{{ number_format($total_upahkeuntungan, 2, '.', ',') }} |
{{ number_format($total_hargaasas, 2, '.', ',') }} |