From a42e4296c1a116d9ee42aa98e078e3f86e164309 Mon Sep 17 00:00:00 2001 From: Amirah22 <94591077+Amirah22@users.noreply.github.com> Date: Wed, 3 Aug 2022 11:14:14 +0800 Subject: [PATCH] migratation table tangguhlelong, laporan lelongtebus --- app/Http/Controllers/ReportController.php | 80 +++++++++ ...3_09_122631_create_tangguhlelong_table.php | 1 + resources/views/includes/sidebar.blade.php | 5 + .../views/lelong/lelongtebusindex.blade.php | 85 +++++++++ resources/views/pdf/pdflelongtebus.blade.php | 163 ++++++++++++++++++ routes/web.php | 5 +- 6 files changed, 338 insertions(+), 1 deletion(-) create mode 100644 resources/views/lelong/lelongtebusindex.blade.php create mode 100644 resources/views/pdf/pdflelongtebus.blade.php diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 4b92228d..551cd469 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -31,6 +31,8 @@ use App\Models\LelKarat; use App\Models\LelKarat_temp; use App\Models\Resit; use App\Models\Customer; +use App\Models\LelongTebus; + use Carbon\Carbon; @@ -503,6 +505,84 @@ class ReportController extends Controller } + Public function lelongtebusindex (){ + + $arraydetails = []; + + $lelongid = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id') + ->join('lelong_tebus','lelong.id','=','lelong_tebus.batch_no') + ->select('lelong.id','lelong_id','tarikh_lelong','lelong.fasa','lelong_tebus.batch_no') + ->distinct() + ->orderBy('batch_no') + ->get() + ->toArray(); + // dd($lelongid); + + foreach($lelongid as $laporan){ + + $details = CawanganLelong ::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id') + ->where('lelong_id',$laporan['id']) + ->distinct() + ->orderBy('lelong_id') + ->get() + ->toArray(); + array_push($arraydetails, ['laporan' =>$laporan,'details' =>$details]); + } + + + return view ('lelong.lelongtebusindex',compact('lelongid','arraydetails')); + + } + + + Public function lelongtebus ($lelong_id, $kodcaw){ + + $total_berat = 0; + $total_hargaasas = 0; + $total_hargalelong = 0; + $arrayinfocaw = []; + + + $info = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id') + ->join('cawangan','cawangan_lelong.caw_id','=','cawangan.id') + ->where('cawangan.caw_code',$kodcaw) + ->where('cawangan_lelong.lelong_id','=',$lelong_id) + ->select('lelong_id','tarikh_lelong','lelong.fasa') + ->groupBy('lelong_id') + ->get(); + + foreach($info as $laporancaw) + { + $cawangan = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id') + ->where('cawangan.caw_code',$kodcaw) + ->where('lelong_id',$laporancaw['lelong_id']) + ->get() + ->toArray(); + array_push($arrayinfocaw,['laporancaw' => $laporancaw,'cawangan' => $cawangan]); + } + // dd($arrayinfocaw); + + + $laporantebus = LelongTebus::where('kodcaw',$kodcaw) + ->get()->toArray(); + // dd($laporantebus); + + // foreach( $brglelpembida as $index1=>$totalbrglelpembida){ + + // $total_berat = $total_berat + $totalbrglelpembida['berat']; + // $total_hargaasas = $total_hargaasas + $totalbrglelpembida['hargaasas']; + // $total_hargalelong = $total_hargalelong + $totalbrglelpembida['hargabida']; + + // } + + + $pdf = PDF::loadView('pdf.pdflelongtebus',compact('lelong_id','info','laporantebus','total_berat','total_hargaasas','total_hargalelong','arrayinfocaw')) + ->setPaper('a4','potrait'); + + return $pdf->download('Laporan Barang Lelong Pembida.pdf'); + } + + Public function simulasireport ($simulasi_id, $cawid){ $keuntungan = 0; diff --git a/database/migrations/2022_03_09_122631_create_tangguhlelong_table.php b/database/migrations/2022_03_09_122631_create_tangguhlelong_table.php index f404a9de..c3e40e58 100644 --- a/database/migrations/2022_03_09_122631_create_tangguhlelong_table.php +++ b/database/migrations/2022_03_09_122631_create_tangguhlelong_table.php @@ -15,6 +15,7 @@ class CreateTangguhlelongTable extends Migration { Schema::create('tangguhlelong', function (Blueprint $table) { $table->id(); + $table->string('kodcaw'); $table->unsignedBigInteger('lelong_id')->unsigned(); $table->unsignedBigInteger('lelongbid_id')->unsigned(); $table->string('norujukan'); diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index 1508402e..7c28ea2c 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -258,6 +258,11 @@ Barang Lelong Pembida + {{-- end laporan --}} diff --git a/resources/views/lelong/lelongtebusindex.blade.php b/resources/views/lelong/lelongtebusindex.blade.php new file mode 100644 index 00000000..ff662eb1 --- /dev/null +++ b/resources/views/lelong/lelongtebusindex.blade.php @@ -0,0 +1,85 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

Senarai Lelong Tebus

+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @endif +
+ + + + + + + + + + {{-- --}} + + + + + @foreach ($arraydetails as $info) + + + + + + + + {{-- --}} + + @endforeach + + +
BilID LelongTarikh LelongFasaCawanganMuat Turun
{{$loop->iteration}}{{ $info['laporan']['batch_no']}}@php + $myDateTime = DateTime::createFromFormat('Y-m-d', $info['laporan']['tarikh_lelong'] ); + $t_lelong = $myDateTime->format('d-m-Y'); + echo($t_lelong); + @endphp{{ $info['laporan']['fasa'] }} + @foreach($info['details'] as $details) + + {{ $details['caw_name']}}
+ @endforeach +
+ +
+
+
+ +
+
+ + +@endsection diff --git a/resources/views/pdf/pdflelongtebus.blade.php b/resources/views/pdf/pdflelongtebus.blade.php new file mode 100644 index 00000000..3f57a145 --- /dev/null +++ b/resources/views/pdf/pdflelongtebus.blade.php @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + +

PERMODALAN KELANTAN BERHAD

LAPORAN LELONG TEBUS
+ + + +
+ + + @foreach ($info as $info) + + + + + @endforeach + @foreach ($arrayinfocaw as $laporancaw) + @foreach ($laporancaw['cawangan'] as $details) + +
ID Lelong: {{$lelong_id}}Tarikh Lelong: @php + $myDateTime = DateTime::createFromFormat('Y-m-d', $info->tarikh_lelong ); + $t_lelong = $myDateTime->format('d-m-Y'); + echo($t_lelong); + @endphpFasa: {{$info->fasa}} Cawangan : {{$details['caw_name']}} + @endforeach + @endforeach + +
+ +
+ + + + + + + + + + + + + + + + @foreach ($laporantebus as $laporan) + + + + + + + + + + + @endforeach + + + + + + + + + + + + + +
NoTarikhNo RujukanNilai Marhun(RM)Pinjaman(RM)Keuntungan (RM)Tempoh
{{ $loop->iteration }}{{ $laporan['tarikh']}}{{ $laporan['norujukan'] }}{{ number_format($laporan['nilaimarhun'], 2, '.', ',')}}{{ number_format($laporan['pinjaman'], 2, '.', ',')}}{{ number_format($laporan['upah'], 2, '.', ',')}}{{$laporan['jbg']}}
Jumlah Keseluruhan{{ number_format($total_berat, 2, '.', ',') }}{{ number_format($total_hargaasas, 2, '.', ',') }}{{ number_format($total_hargalelong, 2, '.', ',') }}
+ + + + + + + + + diff --git a/routes/web.php b/routes/web.php index 0cc6d144..dd6184bb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -363,6 +363,9 @@ Route::get('/laplelong/{lelong_id}/{kodcaw}',['as' =>'report.laplelong','uses'=> Route::get('/lapbrglelpembidaindex',['as'=>'report.lapbrglelpembidaindex','uses'=>'ReportController@lapbrglelpembidaindex']); Route::get('/lapbrglelpembida/{lelong_id}/{kodcaw}',['as'=>'report.lapbrglelpembida','uses'=>'ReportController@lapbrglelpembida']); +Route::get('/lelongtebusindex',['as'=>'report.lelongtebusindex','uses'=>'ReportController@lelongtebusindex']); +Route::get('/lelongtebus/{lelong_id}/{kodcaw}',['as'=>'report.lelongtebus','uses'=>'ReportController@lelongtebus']); + Route::get('/simulasireport/{simulasi_id}/{cawid}',['as'=>'report.simulasireport','uses'=>'ReportController@simulasireport']); @@ -370,7 +373,7 @@ Route::get('/simulasireport/{simulasi_id}/{cawid}',['as'=>'report.simulasireport }); -//Report +//Report by cawangan Route::group(['middleware' => ['permission:report'],'prefix'=>'reportcaw'], function () { Route::get('laporancawindex',['as'=>'reportcaw.laporancawindex','uses'=>'ReportCawanganController@laporancawindex']);