update sah mutu operasi

This commit is contained in:
faiqahzaman
2022-04-12 12:20:32 +08:00
parent f6490e72a5
commit 32a8b4b072
6 changed files with 81 additions and 8 deletions
+1 -1
View File
@@ -331,7 +331,7 @@ class LelongController extends Controller
$lelongbidmarhun->karat = $simbidmarhun->karat;
$lelongbidmarhun->berat = $simbidmarhun->berat;
$lelongbidmarhun->harga = $simbidmarhun->harga;
$lelongbidmarhun->nmarhun = $simbidmarhun->n_marhun;
$lelongbidmarhun->n_marhun = $simbidmarhun->n_marhun;
$lelongbidmarhun->hargaasas = $simbidmarhun->hargaasas;
$lelongbidmarhun->save();
+61 -2
View File
@@ -80,7 +80,52 @@ class MarhunController extends Controller
$bezaberat = $marhun->old_berat - $request->berat_emas;
$bezahargaasas = $marhun->old_hargaasas - $request->harga_asas;
if($request->karat < $marhun->old_karat)
if(($request->karat < $marhun->old_karat) && ($bezaberat > $ubahberatmin))
{
$marhun->marhun = $request->marhun;
$marhun->karat = $request->karat;
$marhun->berat = $request->berat_emas;
$marhun->harga = $request->harga;
$marhun->n_marhun = $request->nilai_marhun;
$marhun->hargaasas = $request->harga_asas;
$marhun->save();
$lelongbid->berat = $lelongbid->berat - ($bezaberat);
$lelongbid->hargaasas = $lelongbid->hargaasas - ($bezahargaasas);
$lelongbid->save();
$pengesahan = Pengesahan::where('lelongbidmarhun_id', $request->idmarhun)
->where('lelongbid_id', $marhun->lelongbid_id)
->get();
if(isset($pengesahan['id']))
{
$pengesahan->id = $pengesahan->id;
$pengesahan->lelong_id = $lelong->id;
$pengesahan->lelongbid_id = $lelongbid->id;
$pengesahan->lelongbidmarhun_id = $marhun->id;
$pengesahan->norujukan = $lelongbid->norujukan;
$pengesahan->diminta_oleh = $user->id;
$pengesahan->diminta_pada = $currentdate;
$pengesahan->status_ubah = 5;
$pengesahan->save();
}
else
{
$berat = new Pengesahan;
$berat->lelong_id = $lelong->id;
$berat->lelongbid_id = $lelongbid->id;
$berat->lelongbidmarhun_id = $marhun->id;
$berat->norujukan = $lelongbid->norujukan;
$berat->diminta_oleh = $user->id;
$berat->diminta_pada = $currentdate;
$berat->status_ubah = 5;
$berat->save();
}
}
else if($request->karat < $marhun->old_karat)
{
$marhun->marhun = $request->marhun;
$marhun->karat = $request->karat;
@@ -357,6 +402,18 @@ class MarhunController extends Controller
->groupBy('pengesahan.norujukan')
->get()->toArray();
foreach($mutumarhun as $index1=>$mutu)
{
$cawangan = CawanganLelong::join('cawangan', 'cawangan_lelong.caw_id', 'cawangan.id')
->join('lelongbid', 'cawangan_lelong.lelong_id', '=', 'lelongbid.lelong_id')
->where('lelongbid.lelong_id', $id)
->where('lelongbid.norujukan', $mutu['norujukan'])
->select('cawangan.caw_name')
->first();
// dd($cawangan);
$mutumarhun[$index1]['cawangan_name'] = $cawangan;
}
// foreach($mutumarhun as $index1=>$marhun)
// {
// $pengesahan = Pengesahan::where('lelong_id', $id)
@@ -367,7 +424,7 @@ class MarhunController extends Controller
// $mutumarhun[$index1]['pengesahan_id'] = $pengesahan;
// }
return view('pengesahan.perubahanmutumarhun', compact('mutumarhun', 'id', ));
return view('pengesahan.perubahanmutumarhun', compact('mutumarhun', 'id'));
}
@@ -438,6 +495,8 @@ class MarhunController extends Controller
$rugilelong = $rugilelong - $lelongbid->baki;
}
$marhuns[$index1]['harga_gadai'] = $gadaimarhun->harga;
$marhuns[$index1]['nmarhun_gadai'] = $gadaimarhun->n_marhun;
$marhuns[$index1]['old_marhun'] = $gadaimarhun->marhun;
$marhuns[$index1]['status_ubah'] = $status;
$marhuns[$index1]['pembiayaan'] = $lelongbid->pinjaman;
@@ -223,6 +223,8 @@ class CreateCawangansTable extends Migration
$table->string('nota');
$table->string('karat');
$table->decimal('berat', $precision = 7, $scale = 2);
$table->decimal('harga', $precision = 9, $scale = 2);
$table->decimal('n_marhun', $precision = 9, $scale = 2);
$table->timestamps();
// $table->foreign('norujukan')
@@ -24,7 +24,7 @@ class CreatePengesahanTable extends Migration
$table->integer('diminta_oleh');
$table->datetime('diminta_pada');
$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
$table->integer('status_ubah')->default(0); //1 = ubah mutu, 2 = tambah marhun, 3 = hapus marhun, 4 = ubah berat, 5 = ubah mutu & berat
$table->timestamps();
$table->foreign('lelong_id')
@@ -19,6 +19,7 @@
<div class="container">
<div class="row mb-2">
<div class="col-md-12 mx-auto card p-4" style="margin-top:2%; margin-bottom:2%;">
<p> <b>Norujukan : </b> {{ $lelongbid->norujukan }}</p>
<p> <b>Pembiayaan : </b> {{ $marhuns[0]['pembiayaan'] }}</p>
<p> <b>Keuntungan : </b></p>
<p> <b>Baki Lelong : </b>{{ $marhuns[0]['baki_lelong'] }}</p>
@@ -30,12 +31,13 @@
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>No Rujukan</th>
<th>Marhun</th>
<th>Karat</th>
<th>Berat</th>
<th>Harga (RM)</th>
<th>Nilai Marhun</th>
<th>Harga Gadaian (RM)</th>
<th>Harga Lelong (RM)</th>
<th>Nilai Marhun Gadaian</th>
<th>Nilai Marhun Lelong</th>
<th>Harga Asas</th>
<th>Status</th>
</tr>
@@ -44,7 +46,6 @@
@foreach($arraylelbidmarhun as $index1=>$detail)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $lelongbid->norujukan }}</td>
<td>
@if($detail[0]['old_marhun'] != $detail[0]['marhun'])
{{ $detail['old_marhun'] }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i>
@@ -63,12 +64,18 @@
@endif
{{ $detail[0]['berat'] }}
</td>
<td>
{{ $detail[0]['harga_gadai'] }}
</td>
<td>
@if($detail[0]['old_harga'] != $detail[0]['harga'])
{{ number_format($detail[0]['old_harga'], 2, '.', '') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i>
@endif
{{ $detail[0]['harga'] }}
</td>
<td>
{{ $detail[0]['nmarhun_gadai'] }}
</td>
<td>
@if($detail[0]['old_nmarhun'] != $detail[0]['n_marhun'])
{{ number_format($detail[0]['old_nmarhun'], 2, '.', '') }} <i class="btn fa fa-arrow-right" aria-hidden="true"></i>
@@ -90,6 +97,8 @@
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGHAPUSAN MARHUN</button>
@elseif($detail[0]['status_ubah'] == 4)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGURANGAN BERAT</button>
@elseif($detail[0]['status_ubah'] == 5)
<button class="btn btn-warning btn-sm hovernone-warning" disabled>PENGURANGAN MUTU & BERAT</button>
@else
@endif
@@ -14,6 +14,7 @@
<thead class="bg-primary text-white">
<tr>
<th>Bil</th>
<th>Cawangan</th>
<th>No Rujukan</th>
<th>Status</th>
<th class="text-center">Action</th>
@@ -23,6 +24,7 @@
@foreach($mutumarhun as $marhun)
<tr>
<th><input type="checkbox" aria-label="Checkbox for following text input" onclick="selectall(this)"></th>
<td>{{ $marhun['cawangan_name']['caw_name'] }}</td>
<td>{{ $marhun['norujukan'] }}</td>
<td>
@if($marhun['total'] === intval($marhun['tstat']))
@@ -41,6 +43,7 @@
</tr>
@endforeach
</tbody>
</table>
<div class="modal-footer" style="margin-top:2%;">
<a href="{{ route('pengesahan.senarailelongubahmutu') }}" class="btn btn-primary">Kembali</a>