diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index ab9d386a..a64a2858 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -138,30 +138,9 @@ class MarhunController extends Controller // dd($lelkarat); return view('marhun.marhun',compact('marhun','lelongbid','karatall','emasall','lelkarat')); } - - public function exportmarhundetails(Request $request) - { - $lelongbid = LelongBid::where('id','=',$request->lelongbid)->first(); - $marhun = LelongBidMarhun::where('lelongbid_id','=',$request->lelongbid)->get(); - - $karatall = JenisKarat::all(); - $emasall = JenisEmas::all(); - - $pdf = PDF::loadView('pdf.marhundetails',compact('marhun', - 'lelongbid', - 'karatall', - - 'emasall'))->setPaper('a4', 'landscape'); - - return $pdf->download('Senarai Lelong Details.pdf'); - - - } - - public function senarailelongmarhun(Request $request) - { + public function senarailelongmarhun(Request $request){ $user = Auth::user(); @@ -189,6 +168,58 @@ class MarhunController extends Controller } //Operasi + + + public function exportmarhundetails($lelong_id) + { + $lelongs= LelongBid::where('lelong_id','=',$lelong_id)->get()->toArray(); + + $arraycaw= []; + + $total_berat = 0; + $berat = 0; + + $total_harga = 0; + $harga = 0; + + $total_nmarhun = 0; + $nilai_marhun = 0; + + $total_hargaasas = 0; + $hargaasas = 0; + + foreach($lelongs as $index1=>$lelong){ + + $marhun= LelongBidMarhun::where('lelongbid_id','=',$lelong['id'])->get(); + $total_berat = $total_berat + ($marhun->sum('berat')); + $total_harga = $total_harga + ($marhun->sum('harga')); + $total_nmarhun = $total_nmarhun + ($marhun->sum('n_marhun')); + $total_hargaasas = $total_hargaasas + ($marhun->sum('hargaasas')); + + $lelongs[$index1]['detailmarhun']=$marhun; + + } + + array_push($arraycaw,[ + 'berat'=>$berat, + 'harga'=>$harga, + 'n_marhun'=>$nilai_marhun, + 'hargaasas'=>$hargaasas + + ]); + + + + + $pdf = PDF::loadView('pdf.marhundetails',compact('lelongs','arraycaw','total_nmarhun','total_berat','total_harga','total_hargaasas' + ))->setPaper('a4', 'potrait'); + + return $pdf->download('Senarai Marhun.pdf'); + + + } + + public function sahubahmutu(Request $request) { // dd($request->all()); @@ -288,6 +319,7 @@ class MarhunController extends Controller return redirect()->route('pengesahan.perubahanmutumarhun')->with('success','Pengesahan Mutu Marhun Berjaya'); } + } \ No newline at end of file diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php index 59e6958b..a835a75f 100644 --- a/app/Http/Controllers/SimulasiController.php +++ b/app/Http/Controllers/SimulasiController.php @@ -646,6 +646,20 @@ class SimulasiController extends Controller } + 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); diff --git a/resources/views/marhun/senarailelongmarhun.blade.php b/resources/views/marhun/senarailelongmarhun.blade.php index a59bfac0..120a756e 100644 --- a/resources/views/marhun/senarailelongmarhun.blade.php +++ b/resources/views/marhun/senarailelongmarhun.blade.php @@ -25,7 +25,8 @@
| No | -No Rujukan | -Jenis Marhun | -Karat | -Berat(gm) | -Harga(RM) | -Nilai Marhun(RM) | -Harga Asas(RM) | -Nota | +No | +No Rujukan | +Jenis Marhun | +Karat | +Berat(gm) | +Harga(RM) | +Nilai Marhun(RM) | +Harga Asas(RM) | +Nota |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{$index+1}} | -{{ $lelongbid->norujukan }} | -{{ $item->marhun }} | -{{ $item->karat }} | -{{ $item->berat }} | -{{ $item->harga }} | -{{ $item->n_marhun }} | -{{ $item->hargaasas }} | -{{ $item->nota }} | -|||||||||
| Jumlah Keseluruhan | -- | {{$total_berat}} | -{{$total_harga}} | -{{$total_nilaimarhun}} | -{{$total_hargaasas}} | -- | |||||||||||
| No | @@ -132,13 +133,13 @@ tr:nth-child(even) {{{ $cawangan['caw_name'] }} | {{ ($caw['t_lelong']) }} | {{ ($caw['norujukan']) }} | -{{ ($caw['berat']) }} | -{{ ($caw['nilaimarhun']) }} | -{{ ($caw['pinjaman']) }} | -{{ ($caw['upahsimpan']) }} | -{{ ($caw['hargaasas']) }} | -{{ ($caw['cajlelong']) }} | -{{ ($caw['baki']) }} | +{{ 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']) }} | --}} @@ -158,14 +159,74 @@ tr:nth-child(even) {{{ 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) | +Harga Asas (RM) | +Caj Lelong (RM) | +Baki Lelong (RM) | +Rugi Lelong (RM) | +
| {{$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, '.', ',') }}) | +
| 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, '.', ',') }}) | +||