update migration for scan_semak

This commit is contained in:
Amir
2022-09-25 09:50:03 +08:00
parent e11c511208
commit 17c44d093a
5 changed files with 142 additions and 132 deletions
+24 -26
View File
@@ -19,10 +19,9 @@ use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\LelKarat;
use App\Models\LelKarat_temp;
use App\Models\Pengesahan;
use App\Models\GadaiMarhun;
use App\Models\ScanMarhun;
use App\Models\ScanSemak;
use App\Models\TangguhLelong;
use Carbon\Carbon;
@@ -1212,20 +1211,21 @@ class MarhunController extends Controller
$user = Auth::user();
$caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first();
$senaraiScanKeluar = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
$senaraiScanKeluar = ScanSemak::where('kodcaw', '=', $caw->caw_code)
->where('lelong_id', $lelong_id)
->whereNull('masa_terima')
->whereNull('terima_marhun')
->orderBy('id', 'desc')
->get();
$sedangDinilai = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
->whereNull('masa_serah')
$sedangDinilai = ScanSemak::where('kodcaw', '=', $caw->caw_code)
->whereNotNull('terima_marhun')
->whereNull('serah_marhun')
->where('lelong_id', $lelong_id)
->orderBy('id', 'desc')
->get();
$sudahSerah = ScanMarhun::where('kodcaw', '=', $caw->caw_code)
->whereNotNull('masa_serah')
$sudahSerah = ScanSemak::where('kodcaw', '=', $caw->caw_code)
->whereNotNull('serah_marhun')
->where('lelong_id', $lelong_id)
->orderBy('id', 'desc')
->get();
@@ -1243,9 +1243,9 @@ class MarhunController extends Controller
$current = Carbon::now();
foreach ($request->scanKeluar_id as $index) {
$terimaMarhun = ScanMarhun::where('id', '=', $index)->first();
$terimaMarhun = ScanSemak::where('id', '=', $index)->first();
$terimaMarhun->penilai_id = $user->id;
$terimaMarhun->masa_terima = $current->toTimeString();
$terimaMarhun->terima_marhun = $current->toDateTimeString();
$terimaMarhun->update();
}
return redirect()->route('marhun.terimaserahmarhun', $terimaMarhun->lelong_id)->with('success', 'Terima Marhun Berjaya Direkodkan');
@@ -1257,8 +1257,8 @@ class MarhunController extends Controller
$current = Carbon::now();
foreach ($request->sedangDinilai_id as $index) {
$serahMarhun = ScanMarhun::where('id', '=', $index)->first();
$serahMarhun->masa_serah = $current->toTimeString();
$serahMarhun = ScanSemak::where('id', '=', $index)->first();
$serahMarhun->serah_marhun = $current->toDateTimeString();
$serahMarhun->update();
}
return redirect()->route('marhun.terimaserahmarhun', $serahMarhun->lelong_id)->with('success', 'Serah Marhun Berjaya Direkodkan');
@@ -1274,15 +1274,15 @@ class MarhunController extends Controller
->where('caw_id', '=', $caw->id)
->get();
$senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $lelong_id)
$senaraiScanKeluar = ScanSemak::where('lelong_id', '=', $lelong_id)
->where('kodcaw', '=', $caw->caw_code)
->whereNull('masa_scanmasuk')
->whereNull('scan_masuk')
->orderBy('id', 'desc')
->get();
$senaraiScanMasuk = ScanMarhun::where('lelong_id', '=', $lelong_id)
$senaraiScanMasuk = ScanSemak::where('lelong_id', '=', $lelong_id)
->where('kodcaw', '=', $caw->caw_code)
->whereNotNull('masa_scanmasuk')
->whereNotNull('scan_masuk')
->orderBy('id', 'desc')
->get();
@@ -1295,21 +1295,20 @@ class MarhunController extends Controller
$user = Auth::user();
$current = Carbon::now();
$checkExisting = ScanMarhun::where('norujukan', '=', $request->norujukan_barcode)
->whereNull('masa_scanmasuk')
$checkExisting = ScanSemak::where('norujukan', '=', $request->norujukan_barcode)
->whereNull('scan_masuk')
->get();
if ($checkExisting->isEmpty()) {
$lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first();
$scanKeluar = new ScanMarhun;
$scanKeluar = new ScanSemak();
$scanKeluar->kodcaw = $lelongbidItem['kodcaw'];
$scanKeluar->lelong_id = $lelongbidItem['lelong_id'];
$scanKeluar->lelongbid_id = $lelongbidItem['id'];
$scanKeluar->norujukan = $lelongbidItem['norujukan'];
$scanKeluar->khazanah_id = $user['id'];
$scanKeluar->tarikh_scankeluar = $current->toDateString();
$scanKeluar->masa_scankeluar = $current->toTimeString();
$scanKeluar->scan_keluar = $current->toDateTimeString();
$scanKeluar->save();
return redirect()->route('marhun.scanbarcode', $request->lelong_id)
@@ -1325,19 +1324,18 @@ class MarhunController extends Controller
$user = Auth::user();
$current = Carbon::now();
$scanMasuk = ScanMarhun::where('norujukan', '=', $request->norujukan_barcode)
->whereNull('masa_scanmasuk')
$scanMasuk = ScanSemak::where('norujukan', '=', $request->norujukan_barcode)
->whereNotNull('serah_marhun')
->first();
if ($scanMasuk) {
$scanMasuk->tarikh_scanmasuk = $current->toDateString();
$scanMasuk->masa_scanmasuk = $current->toTimeString();
$scanMasuk->scan_masuk = $current->toDateTimeString();
$scanMasuk->update();
return redirect()->route('marhun.scanbarcode', $request->lelong_id)
->with('success', 'Marhun Berjaya Di Scan Masuk Ke Peti Besi.');
} else {
return redirect()->route('marhun.scanbarcode', $request->lelong_id)
->with('failed', 'Marhun Gagal Di Scan Masuk Ke Peti Besi.');
->with('failed', 'Gagal Scan, Marhun Belum Diserah Oleh Penilai.');
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ScanSemak extends Model
{
use HasFactory;
protected $table = 'scan_semak';
protected $fillable = [
'kodcaw',
'lelong_id',
'lelongbid_id',
'norujukan',
'khazanah_id',
'penilai_id',
'scan_keluar',
'terima_marhun',
'serah_marhun',
'scan_masuk',
];
}
@@ -26,36 +26,26 @@ class CreatePengesahanTable extends Migration
$table->integer('status')->default(0); //1 = terima, 2 = tangguh lelong
$table->integer('status_ubah')->default(0); //1 = ubah mutu, 2 = tambah marhun, 3 = hapus marhun, 4 = ubah berat, 5 = ubah mutu & berat, 6 = tangguh lelong pc
$table->timestamps();
// $table->foreign('lelong_id')
// ->references('id')->on('lelong')
// ->onDelete('cascade');
// $table->foreign('lelongbid_id')
// ->references('id')->on('lelongbid')
// ->onDelete('cascade');
// $table->foreign('lelongbidmarhun_id')
// ->references('id')->on('lelongbidmarhun')
// ->onDelete('cascade');
});
Schema::create('scanmarhun', function (Blueprint $table) {
Schema::create('scan_semak', function (Blueprint $table) {
$table->id();
$table->string('kodcaw');
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->integer('lelongbid_id');
$table->string('norujukan');
$table->string('khazanah_id', '100');
$table->date('tarikh_scankeluar');
$table->time('masa_scankeluar');
$table->string('penilai_id', '100')->nullable();
$table->time('masa_terima')->nullable();
$table->time('masa_serah')->nullable();
$table->date('tarikh_scanmasuk')->nullable();
$table->time('masa_scanmasuk')->nullable();
$table->datetime('scan_keluar');
$table->datetime('terima_marhun')->nullable();
$table->datetime('serah_marhun')->nullable();
$table->datetime('scan_masuk')->nullable();
$table->timestamps();
});
Schema::create('scan_jual', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
@@ -69,5 +59,7 @@ class CreatePengesahanTable extends Migration
public function down()
{
Schema::dropIfExists('pengesahan');
Schema::dropIfExists('scan_semak');
Schema::dropIfExists('scan_jual');
}
}
+68 -76
View File
@@ -38,30 +38,28 @@
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="senarai" role="tabpanel" aria-labelledby="senarai-tab">
<div style="overflow-x: auto;">
<table class='table table-bordered table-hover' id='table-senarai'>
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Marhun</th>
<th>N. Marhun</th>
<th>Berat</th>
</tr>
</thead>
<tbody>
@foreach($lelongbid as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->marhun}}</td>
<td>{{ number_format($index->nilaimarhun, 2, '.', ',')}}</td>
<td>{{$index->berat}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<table class='table table-bordered table-hover' id='table-senarai'>
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Marhun</th>
<th>N. Marhun</th>
<th>Berat</th>
</tr>
</thead>
<tbody>
@foreach($lelongbid as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->marhun}}</td>
<td>{{ number_format($index->nilaimarhun, 2, '.', ',')}}</td>
<td>{{$index->berat}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="tab-pane fade" id="scan-keluar" role="tabpanel" aria-labelledby="scan-keluar-tab">
<div class="row justify-content-center mb-4">
@@ -74,30 +72,26 @@
</form>
</div>
</div>
<div style="overflow-x: auto;">
<table class='table table-bordered table-hover' id='table-scan-keluar'>
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Status</th>
<th>Tarikh Scan Keluar</th>
<th>Masa Scan Keluar</th>
</tr>
</thead>
<tbody>
@foreach ($senaraiScanKeluar as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td><span class="badge badge-pill badge-danger">Berada Di Luar Peti Besi</span></td>
<td>{{$index->tarikh_scankeluar}}</td>
<td>{{$index->masa_scankeluar}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<table class='table table-bordered table-hover' id='table-scan-keluar'>
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh/Masa Scan Keluar</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($senaraiScanKeluar as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->scan_keluar}}</td>
<td><span class="badge badge-pill badge-danger">Berada Di Luar Peti Besi</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="tab-pane fade" id="scan-masuk" role="tabpanel" aria-labelledby="scan-masuk-tab">
<div class="row justify-content-center mb-4">
@@ -110,34 +104,32 @@
</form>
</div>
</div>
<div style="overflow-x: auto;">
<table class="table table-bordered table-hover" id="table-scan-masuk" style="width: 100%;">
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Status</th>
<th>Tarikh Scan Keluar</th>
<th>Masa Scan Keluar</th>
<th>Tarikh Scan Masuk</th>
<th>Masa Scan Masuk</th>
</tr>
</thead>
<tbody>
@foreach ($senaraiScanMasuk as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td><span class="badge badge-pill badge-success">Berada Di Dalam Peti Besi</span></td>
<td>{{$index->tarikh_scankeluar}}</td>
<td>{{$index->masa_scankeluar}}</td>
<td>{{$index->tarikh_scanmasuk}}</td>
<td>{{$index->masa_scanmasuk}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<table class="table table-bordered table-hover" id="table-scan-masuk" style="width: 100%;">
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Status</th>
<th>Tarikh/Masa Scan Keluar</th>
<th>Tarikh/Masa Terima Marhun</th>
<th>Tarikh/Masa Serah Marhun</th>
<th>Tarikh/Masa Scan Masuk</th>
</tr>
</thead>
<tbody>
@foreach ($senaraiScanMasuk as $index)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->scan_keluar}}</td>
<td>{{$index->terima_marhun}}</td>
<td>{{$index->serah_marhun}}</td>
<td>{{$index->scan_masuk}}</td>
<td><span class="badge badge-pill badge-success">Berada Di Dalam Peti Besi</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@@ -38,8 +38,7 @@
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Tarikh Scan Keluar</th>
<th>Masa Scan Keluar</th>
<th>Tarikh/Masa Scan Keluar</th>
<th>Status</th>
</tr>
</thead>
@@ -49,8 +48,7 @@
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->tarikh_scankeluar}}</td>
<td>{{$index->masa_scankeluar}}</td>
<td>{{$index->scan_keluar}}</td>
<td><span class="badge badge-pill badge-danger">Belum Terima</span></td>
</tr>
@endforeach
@@ -71,7 +69,8 @@
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Masa Terima</th>
<th>Tarikh/Masa Scan Keluar</th>
<th>Tarikh/Masa Terima Marhun</th>
<th>Status</th>
</tr>
</thead>
@@ -81,7 +80,8 @@
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->masa_terima}}</td>
<td>{{$index->scan_keluar}}</td>
<td>{{$index->terima_marhun}}</td>
<td><span class="badge badge-pill badge-success">Sedang Dinilai</span></td>
</tr>
@endforeach
@@ -99,8 +99,9 @@
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Masa Terima</th>
<th>Masa Serah</th>
<th>Tarikh/Masa Scan Keluar</th>
<th>Tarikh/Masa Terima Marhun</th>
<th>Tarikh/Masa Serah Marhun</th>
<th>Status</th>
</tr>
</thead>
@@ -109,8 +110,9 @@
<tr>
<td>{{$loop->iteration}}</td>
<td>{{$index->norujukan}}</td>
<td>{{$index->masa_terima}}</td>
<td>{{$index->masa_serah}}</td>
<td>{{$index->scan_keluar}}</td>
<td>{{$index->terima_marhun}}</td>
<td>{{$index->serah_marhun}}</td>
<td><span class="badge badge-pill badge-success">Sudah Serah</span></td>
</tr>
@endforeach