diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 471a76cb..4aa01c2c 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -1581,21 +1581,22 @@ class MarhunController extends Controller $lelongDetail = Lelong::where('id', '=', $lelong_id)->first(); $lelongbid = LelongBid::where('lelong_id', '=', $lelong_id) ->where('caw_id', '=', $caw->id) - ->get(); + ->select('id') + ->get() + ->keyBy('id'); $senaraiScanKeluar = ScanSemak::where('lelong_id', '=', $lelong_id) ->where('kodcaw', '=', $caw->caw_code) ->whereNull('scan_masuk') - ->orderBy('id', 'desc') ->get(); - $senaraiScanMasuk = ScanSemak::where('lelong_id', '=', $lelong_id) - ->where('kodcaw', '=', $caw->caw_code) - ->whereNotNull('scan_masuk') - ->orderBy('id', 'desc') - ->get(); + $pluckLelongBid = $lelongbid->pluck('id')->toArray(); + $pluckScanKeluar = $senaraiScanKeluar->pluck('lelongbid_id')->toArray(); + $diff_lelong_bid = array_diff($pluckLelongBid, $pluckScanKeluar); - return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar', 'senaraiScanMasuk')); + $new_lelong_bid = LelongBid::with('scanSemakSelesai')->whereIn('id', $diff_lelong_bid)->get(); + + return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'new_lelong_bid', 'senaraiScanKeluar')); } public function scanKeluarMarhun(Request $request) diff --git a/app/Models/LelongBid.php b/app/Models/LelongBid.php index ffc71a37..8eeeb9f0 100644 --- a/app/Models/LelongBid.php +++ b/app/Models/LelongBid.php @@ -66,4 +66,9 @@ class LelongBid extends Model { return $this->hasMany(LelongBidMarhun::class, 'lelongbid_id', 'id'); } + + public function scanSemakSelesai() + { + return $this->hasMany(ScanSemak::class, 'lelongbid_id', 'id')->whereNotNull('scan_masuk'); + } } diff --git a/resources/views/marhun/scanbarcode.blade.php b/resources/views/marhun/scanbarcode.blade.php index 23d3bcd7..729602be 100644 --- a/resources/views/marhun/scanbarcode.blade.php +++ b/resources/views/marhun/scanbarcode.blade.php @@ -9,15 +9,15 @@
@if ($message = Session::get('success'))
-

{{ $message }}

+ {{ $message }}
@elseif ($message = Session::get('failed'))
-

{{ $message }}

+ {{ $message }}
@endif Kembali - +

Tarikh Lelong: @php $myDateTime = DateTime::createFromFormat('Y-m-d', $lelongDetail['tarikh_lelong'] ); @@ -28,69 +28,44 @@

-
- - - - - - - - - - - - @foreach($lelongbid as $index) - - - - - - - - @endforeach - -
BilNo RujukanMarhunN. MarhunBerat
{{$loop->iteration}}{{$index->norujukan}}{{$index->marhun}}{{ number_format($index->nilaimarhun, 2, '.', ',')}}{{$index->berat}}
-
-
+
@csrf - +
Scan Barcode Marhun Yang Dibawa Keluar Dari Peti Besi
-
Laporan Keluar Peti Besi semasa
+
Laporan Keluar Peti Besi semasa
- - + + + - @foreach ($senaraiScanKeluar as $index) + @foreach($new_lelong_bid as $index) - - + + + @endforeach @@ -107,7 +82,7 @@ -
Laporan Masuk Peti Besi semasa
+
Laporan Masuk Peti Besi semasa
Bil No RujukanTarikh/Masa Scan KeluarStatusN. MarhunBeratBilangan Keluar
{{$loop->iteration}} {{$index->norujukan}}{{$index->scan_keluar}}Berada Di Luar Peti Besi{{ number_format($index->nilaimarhun, 2, '.', ',')}}{{$index->berat}}{{ $index->scanSemakSelesai->count() }}
@@ -117,25 +92,23 @@ - - @foreach ($senaraiScanMasuk as $index) + @foreach ($senaraiScanKeluar as $index) + - - @endforeach - +
Tarikh/Masa Scan Keluar Tarikh/Masa Terima Marhun Tarikh/Masa Serah MarhunTarikh/Masa Scan Masuk
{{$loop->iteration}} {{$index->norujukan}}Berada Di Luar Peti Besi {{$index->scan_keluar}} {{$index->terima_marhun}} {{$index->serah_marhun}}{{$index->scan_masuk}}Berada Di Dalam Peti Besi
- +
@@ -145,7 +118,6 @@