From afbfce017bd9c3758b38cf2c9e0f68515a6acf1c Mon Sep 17 00:00:00 2001 From: Amir Date: Thu, 8 Sep 2022 09:25:36 +0800 Subject: [PATCH] add scanmarhun, senarai terima marhun --- app/Http/Controllers/MarhunController.php | 113 ++++++++++++++- app/Models/ScanMarhun.php | 27 ++++ ...2_03_07_061858_create_pengesahan_table.php | 39 ++--- resources/views/includes/sidebar.blade.php | 9 +- resources/views/marhun/scanbarcode.blade.php | 133 +++++++++++++++++- .../views/marhun/senarailelongscan.blade.php | 73 ++++++++++ .../views/marhun/terimaserahmarhun.blade.php | 112 +++++++++++++++ routes/web.php | 5 +- 8 files changed, 486 insertions(+), 25 deletions(-) create mode 100644 app/Models/ScanMarhun.php create mode 100644 resources/views/marhun/senarailelongscan.blade.php create mode 100644 resources/views/marhun/terimaserahmarhun.blade.php diff --git a/app/Http/Controllers/MarhunController.php b/app/Http/Controllers/MarhunController.php index 9eb3a17a..10935f7f 100644 --- a/app/Http/Controllers/MarhunController.php +++ b/app/Http/Controllers/MarhunController.php @@ -22,6 +22,7 @@ use App\Models\LelKarat_temp; use App\Models\Pengesahan; use App\Models\GadaiMarhun; +use App\Models\ScanMarhun; use App\Models\TangguhLelong; use Carbon\Carbon; @@ -463,6 +464,35 @@ class MarhunController extends Controller } + public function senarailelongscan(Request $request){ + + $user = Auth::user(); + $arrayinfo = []; + + $lelong = CawanganLelong::join('lelong','cawangan_lelong.lelong_id','=','lelong.id') + ->join('cawangan','cawangan_lelong.caw_id', '=', 'cawangan.id') + ->where('cawangan.caw_code', $user->kodcaw) + ->where('sts_lelong', 0) + ->select('lelong_id','tarikh_lelong','cawangan_lelong.masatamat_lelong','harga_emas_asas','jbg','cajlelong','sts_lelong') + ->get() + ->toArray(); + + foreach($lelong as $info) + { + + $detailsinfo = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id') + ->where('lelong_id',$info['lelong_id']) + ->where('cawangan.caw_code', $user->kodcaw) + ->get() + ->toArray(); + array_push($arrayinfo,['info'=>$info, 'detailsinfo'=>$detailsinfo]); + + } + + return view('marhun.senarailelongscan',compact('lelong', 'arrayinfo')); + + } + public function semak($id, $lelong_id) { //$id => lelongbid_id @@ -1134,8 +1164,87 @@ class MarhunController extends Controller } - public function scanbarcode() { - return view('marhun.scanbarcode'); + public function terimaserahmarhun() { + $user = Auth::user(); + $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); + + return view('marhun.terimaserahmarhun'); + + } + + public function listScanBarcode($lelong_id) + { + $user = Auth::user(); + $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); + + $lelongDetail = Lelong::where('id', '=', $lelong_id)->first(); + $lelongbid = LelongBid::where('lelong_id', '=', $lelong_id) + ->where('caw_id', '=', $caw->id) + ->get(); + + $senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $lelong_id) + ->where('kodcaw', '=', $caw->caw_code) + ->orderBy('id', 'desc') + ->get(); + + return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar')); + } + + public function scanKeluarMarhun(Request $request) + { + + $user = Auth::user(); + $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); + $current = Carbon::now(); + + $lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first(); + + $scanKeluar = new ScanMarhun; + $scanKeluar->kodcaw = $lelongbidItem['kodcaw']; + $scanKeluar->lelong_id = $lelongbidItem['lelong_id']; + $scanKeluar->lelongbid_id = $lelongbidItem['id']; + $scanKeluar->norujukan = $lelongbidItem['norujukan']; + $scanKeluar->user_id = $user['id']; + $scanKeluar->tarikh_scankeluar = $current->toDateString(); + $scanKeluar->masa_scankeluar = $current->toTimeString(); + $scanKeluar->tag_scankeluar = 1; + $scanKeluar->masa_scanmasuk = $current->toTimeString(); //dummy data + $scanKeluar->tarikh_scanmasuk = $current->toDateString(); //dummy data + $scanKeluar->masa = $current->toTimeString(); //dummy data + $scanKeluar->save(); + + $lelong_id = $lelongbidItem['lelong_id']; + $lelongDetail = Lelong::where('id', '=', $lelong_id)->first(); + $lelongbid = LelongBid::where('lelong_id', '=', $lelong_id) + ->where('caw_id', '=', $caw->id) + ->get(); + + $senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $lelong_id) + ->where('kodcaw', '=', $caw->caw_code) + ->orderBy('id', 'desc') + ->get(); + + return view('marhun.scanbarcode', compact('lelong_id', 'lelongDetail', 'lelongbid', 'senaraiScanKeluar')); + } + + public function scanMasukMarhun(Request $request) + { + $user = Auth::user(); + $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); + $current = Carbon::now(); + + $lelongbidItem = LelongBid::where('norujukan', '=', $request->norujukan_barcode)->first(); + $scanMasuk = ScanMarhun::where(''); + } + + public function senaraiScanKeluar(Request $request) + { + $user = Auth::user(); + $caw = Cawangan::where('caw_code', '=', $user->kodcaw)->first(); + + $senaraiScanKeluar = ScanMarhun::where('lelong_id', '=', $request->lelong_id) + ->where('kodcaw', '=', $caw) + ->get(); } public function addPhotoMarhun(Request $request) diff --git a/app/Models/ScanMarhun.php b/app/Models/ScanMarhun.php new file mode 100644 index 00000000..af903839 --- /dev/null +++ b/app/Models/ScanMarhun.php @@ -0,0 +1,27 @@ +foreign('lelongbid_id') // ->references('id')->on('lelongbid') // ->onDelete('cascade'); - + // $table->foreign('lelongbidmarhun_id') // ->references('id')->on('lelongbidmarhun') // ->onDelete('cascade'); @@ -44,24 +44,29 @@ class CreatePengesahanTable extends Migration Schema::create('scanmarhun', function (Blueprint $table) { $table->id(); - $table->string('kodcaw')->nullable(); + $table->string('kodcaw'); $table->unsignedBigInteger('lelong_id')->unsigned(); - $table->integer('fasa'); - $table->string('norujukan')->nullable(); - $table->decimal('nilaimarhun', $precision = 9, $scale = 2); - $table->string('drp','100')->nullable(); - $table->string('kpd','20')->nullable(); - $table->decimal('bulan', $precision = 3, $scale = 0); - $table->decimal('tahun', $precision = 5, $scale = 0); - $table->integer('tag'); - $table->datetime('tarikh')->nullable(); - $table->time('masa')->nullable(); - $table->string('namateller','30')->nullable(); + $table->integer('lelongbid_id'); + $table->string('norujukan'); + $table->string('user_id', '100'); + $table->date('tarikh_scankeluar'); + $table->time('masa_scankeluar'); + $table->integer('tag_scankeluar'); + $table->date('tarikh_scanmasuk')->nullable(); + $table->time('masa_scanmasuk')->nullable(); + $table->integer('tag_scanmasuk')->nullable(); + $table->timestamps(); + }); - - $table->foreign('lelong_id') - ->references('id')->on('lelong') - ->onDelete('cascade'); + Schema::create('terimaserah_marhun', function (Blueprint $table) { + $table->id(); + $table->integer('scanmarhun_id'); + $table->string('user_id', '100'); + $table->integer('tagterima'); + $table->time('masa_terima'); + $table->integer('tagserah')->nullable(); + $table->time('masa_serah')->nullable(); + $table->timestamps(); }); } diff --git a/resources/views/includes/sidebar.blade.php b/resources/views/includes/sidebar.blade.php index 11031076..c519607e 100644 --- a/resources/views/includes/sidebar.blade.php +++ b/resources/views/includes/sidebar.blade.php @@ -54,17 +54,20 @@
  • -