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'))
+
+ @endif
+
+
+
+
+
+
+
+@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 |
+
+
+
+
+
+
+
+
+ | ID Lelong: {{$lelong_id}} |
+ @foreach ($info as $info)
+
+ Tarikh Lelong: @php
+ $myDateTime = DateTime::createFromFormat('Y-m-d', $info->tarikh_lelong );
+ $t_lelong = $myDateTime->format('d-m-Y');
+ echo($t_lelong);
+ @endphp |
+ Fasa: {{$info->fasa}} |
+
+ @endforeach
+ @foreach ($arrayinfocaw as $laporancaw)
+ @foreach ($laporancaw['cawangan'] as $details)
+ Cawangan : {{$details['caw_name']}}
+ @endforeach
+ @endforeach
+
+ |
+
+
+
+
+
+
+
+
+ | No |
+ Tarikh |
+ No Rujukan |
+ Nilai Marhun(RM) |
+ Pinjaman(RM) |
+ Keuntungan (RM) |
+ Tempoh |
+
+
+
+ @foreach ($laporantebus as $laporan)
+
+ | {{ $loop->iteration }} |
+ {{ $laporan['tarikh']}} |
+ {{ $laporan['norujukan'] }} |
+ {{ number_format($laporan['nilaimarhun'], 2, '.', ',')}} |
+ {{ number_format($laporan['pinjaman'], 2, '.', ',')}} |
+ {{ number_format($laporan['upah'], 2, '.', ',')}} |
+ {{$laporan['jbg']}} |
+
+
+ @endforeach
+
+
+
+
+ | 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']);