diff --git a/app/Http/Controllers/LelongController.php b/app/Http/Controllers/LelongController.php index 2903a88b..de48022c 100644 --- a/app/Http/Controllers/LelongController.php +++ b/app/Http/Controllers/LelongController.php @@ -709,7 +709,7 @@ class LelongController extends Controller $lelongbidmarhun->old_marhun = $simbidmarhun->marhun; $lelongbidmarhun->old_karat = $simbidmarhun->karat; $lelongbidmarhun->old_berat = $simbidmarhun->berat; - $lelongbidmarhun->old_harga = $simbidmarhun->harga; + $lelongbidmarhun->old_harga = $simbidmarhun->old_harga; $lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun; $lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas; $lelongbidmarhun->karat = $simbidmarhun->karat; diff --git a/app/Http/Controllers/LelongUjrahController.php b/app/Http/Controllers/LelongUjrahController.php index 3e5a11da..13fda146 100644 --- a/app/Http/Controllers/LelongUjrahController.php +++ b/app/Http/Controllers/LelongUjrahController.php @@ -143,7 +143,7 @@ class LelongUjrahController extends Controller $lelongbidmarhun->old_marhun = $simbidmarhun->marhun; $lelongbidmarhun->old_karat = $simbidmarhun->karat; $lelongbidmarhun->old_berat = $simbidmarhun->berat; - $lelongbidmarhun->old_harga = $simbidmarhun->harga; + $lelongbidmarhun->old_harga = $simbidmarhun->old_harga; $lelongbidmarhun->old_nmarhun = $simbidmarhun->n_marhun; $lelongbidmarhun->old_hargaasas = $simbidmarhun->hargaasas; $lelongbidmarhun->karat = $simbidmarhun->karat; diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 6603d1e8..7ac1d92a 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -1006,49 +1006,56 @@ class ReportController extends Controller } - public function lapubahmarhunlelongindex ($lelong_id, $kodcaw){ - - $cawangan = Pengesahan::join('lelongbid','lelongbid.norujukan','=','pengesahan.norujukan') + public function lapubahmarhunlelongindex($lelong_id, $kodcaw) +{ + $cawangan = Pengesahan::join('lelongbid', 'lelongbid.norujukan', '=', 'pengesahan.norujukan') ->where('pengesahan.lelong_id', $lelong_id) ->where('pengesahan.status', 1) - ->where('pengesahan.norujukan', 'LIKE', '%'.$kodcaw.'%') + ->where('pengesahan.norujukan', 'LIKE', '%' . $kodcaw . '%') ->whereNotNull('pengesahan.disahkan_oleh') - ->select('pengesahan.lelongbid_id','pengesahan.lelongbidmarhun_id','pengesahan.diminta_oleh','pengesahan.disahkan_oleh', 'pengesahan.disahkan_pada', 'pengesahan.norujukan', 'pengesahan.lelong_id') - ->orderBy('pengesahan.lelongbid_id') + ->select( + 'pengesahan.lelongbid_id', + 'pengesahan.lelongbidmarhun_id', + 'pengesahan.diminta_oleh', + 'pengesahan.disahkan_oleh', + 'pengesahan.disahkan_pada', + 'pengesahan.norujukan', + 'pengesahan.lelong_id' + ) + ->groupBy('pengesahan.norujukan') // Group by norujukan to ensure uniqueness ->distinct() ->get(); - foreach($cawangan as $index1=>$caw) - { - - $getpengesahan = Cawangan::where('caw_code', $kodcaw)->first(); - - $getdisahkanoleh = User::where('id', $caw['disahkan_oleh'])->first(); - $getdimintaoleh = User::where('id', $caw['diminta_oleh'])->first(); - - $status = Pengesahan::where('lelongbid_id', $caw['lelongbid_id']) - ->select('id as sahid','status_ubah', 'request_karat', 'request_berat', 'request_marhun') - ->orderBy('pengesahan.lelongbidmarhun_id','asc') - ->get(); - - - $marhuns = LelongBidMarhun::join('pengesahan','pengesahan.lelongbidmarhun_id','=','lelongbidmarhun.id') - ->where('pengesahan.lelongbid_id', $caw['lelongbid_id']) - ->orderBy('pengesahan.lelongbidmarhun_id','asc') - ->get() - ->toArray(); - $cawangan[$index1]['namacaw'] = $getpengesahan['caw_name']; - $cawangan[$index1]['disahkan_oleh'] = $getdisahkanoleh['name']; - $cawangan[$index1]['diminta_oleh'] = $getdimintaoleh['name']; - $cawangan[$index1]['detailmarhun']=$status; - $cawangan[$index1]['detail']=$marhuns; - } - + foreach ($cawangan as $index1 => $caw) { $getpengesahan = Cawangan::where('caw_code', $kodcaw)->first(); + $getdisahkanoleh = User::where('id', $caw['disahkan_oleh'])->first(); + $getdimintaoleh = User::where('id', $caw['diminta_oleh'])->first(); - return view('marhun.ubahmarhun', compact('cawangan','lelong_id','getpengesahan')); + $status = Pengesahan::where('lelongbid_id', $caw['lelongbid_id']) + ->select('id as sahid', 'status_ubah', 'request_karat', 'request_berat', 'request_marhun') + ->orderBy('pengesahan.lelongbidmarhun_id', 'asc') + ->get(); + + $marhuns = LelongBidMarhun::join('pengesahan', 'pengesahan.lelongbidmarhun_id', '=', 'lelongbidmarhun.id') + ->where('pengesahan.lelongbid_id', $caw['lelongbid_id']) + ->orderBy('pengesahan.lelongbidmarhun_id', 'asc') + ->get() + ->toArray(); + + $cawangan[$index1]['namacaw'] = $getpengesahan['caw_name']; + $cawangan[$index1]['disahkan_oleh'] = $getdisahkanoleh['name']; + $cawangan[$index1]['diminta_oleh'] = $getdimintaoleh['name']; + $cawangan[$index1]['detailmarhun'] = $status; + $cawangan[$index1]['detail'] = $marhuns; } + $getpengesahan = Cawangan::where('caw_code', $kodcaw)->first(); + + return view('marhun.ubahmarhun', compact('cawangan', 'lelong_id', 'getpengesahan')); +} + + + public function exportubahmarhun (){ @@ -1266,16 +1273,25 @@ class ReportController extends Controller public function lapubahmarhunlelongindexpdf ($lelong_id, $kodcaw, $t_lelong){ - $cawangan = Pengesahan::join('lelongbid','lelongbid.norujukan','=','pengesahan.norujukan') + $cawangan = Pengesahan::join('lelongbid', 'lelongbid.norujukan', '=', 'pengesahan.norujukan') ->where('pengesahan.lelong_id', $lelong_id) ->where('pengesahan.status', 1) - ->where('pengesahan.norujukan', 'LIKE', '%'.$kodcaw.'%') + ->where('pengesahan.norujukan', 'LIKE', '%' . $kodcaw . '%') ->whereNotNull('pengesahan.disahkan_oleh') - ->select('pengesahan.lelongbid_id','pengesahan.lelongbidmarhun_id','pengesahan.diminta_oleh','pengesahan.disahkan_oleh', 'pengesahan.disahkan_pada', 'pengesahan.norujukan', 'pengesahan.lelong_id') - ->orderBy('pengesahan.lelongbid_id') + ->select( + 'pengesahan.lelongbid_id', + 'pengesahan.lelongbidmarhun_id', + 'pengesahan.diminta_oleh', + 'pengesahan.disahkan_oleh', + 'pengesahan.disahkan_pada', + 'pengesahan.norujukan', + 'pengesahan.lelong_id' + ) + ->groupBy('pengesahan.norujukan') // Group by norujukan to ensure uniqueness ->distinct() ->get(); + foreach($cawangan as $index1=>$caw) { diff --git a/app/Http/Controllers/SimulasiController.php b/app/Http/Controllers/SimulasiController.php index 518f05bc..2623402a 100644 --- a/app/Http/Controllers/SimulasiController.php +++ b/app/Http/Controllers/SimulasiController.php @@ -390,6 +390,7 @@ class SimulasiController extends Controller $simmarhun->nota = $marhun->nota; $simmarhun->karat = $marhun->karat; $simmarhun->berat = $marhun->berat; + $simmarhun->old_harga = $marhun->harga; $simmarhun->harga = $simkarattemp[$marhun->karat]->harga; $simmarhun->n_marhun = $marhun->n_marhun; $simmarhun->hargaasas = $val; diff --git a/app/Http/Controllers/SimulasiUjrahController.php b/app/Http/Controllers/SimulasiUjrahController.php index 757d7469..7b12db4a 100644 --- a/app/Http/Controllers/SimulasiUjrahController.php +++ b/app/Http/Controllers/SimulasiUjrahController.php @@ -329,6 +329,7 @@ class SimulasiUjrahController extends Controller $simmarhun->nota = $marhun->nota; $simmarhun->karat = $marhun->karat; $simmarhun->berat = $marhun->berat; + $simmarhun->old_harga = $marhun->harga; $simmarhun->harga = $simkarattemp[$marhun->karat]->harga; $simmarhun->n_marhun = $marhun->n_marhun; $simmarhun->hargaasas = $val; diff --git a/database/migrations/2025_01_20_162907_add_old_harga_column_to_simulasibidmarhun.php b/database/migrations/2025_01_20_162907_add_old_harga_column_to_simulasibidmarhun.php new file mode 100644 index 00000000..d37c8f3c --- /dev/null +++ b/database/migrations/2025_01_20_162907_add_old_harga_column_to_simulasibidmarhun.php @@ -0,0 +1,34 @@ +decimal('old_harga', $precision = 9, $scale = 2)->nullable(); + // + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('simulasibidmarhun', function (Blueprint $table) { + $table->dropColumn('old_harga'); + // + }); + } +} diff --git a/resources/views/marhun/ubahmarhun.blade.php b/resources/views/marhun/ubahmarhun.blade.php index 07db5462..7b39d821 100644 --- a/resources/views/marhun/ubahmarhun.blade.php +++ b/resources/views/marhun/ubahmarhun.blade.php @@ -14,164 +14,144 @@
- @if ($message = Session::get('success')) -
-

{{ $message }}

+ @if ($message = Session::get('success')) +
+

{{ $message }}

+
+ @endif +
+ + + + + + + + + + + + + + + + + + + + + @forelse($cawangan as $marhun) + + + + + + + + + + + + + + + + + @empty + + + + @endforelse + +
BilNo RujukanPerubahanMarhun AsalMarhun BaruMutu AsalMutu BaruHarga AsalHarga BaruBerat Asal (gm)Berat Baru (gm)Diminta OlehDisahkan OlehStatus
{{ $loop->iteration }}{{ $marhun['norujukan'] }} + @foreach ($marhun['detailmarhun'] as $index => $item) + {{ $index + 1 }}. {{ statusUbahText($item['status_ubah']) }}
+ @endforeach +
+ @foreach ($marhun['detail'] as $item) + {{ $item['old_marhun'] }}
+ @endforeach +
+ @foreach ($marhun['detailmarhun'] as $item) + @if ($item['request_marhun']) + + {{ $item['request_marhun'] }} + @endif +
+ @endforeach +
+ @foreach ($marhun['detail'] as $item) + {{ $item['old_karat'] }}
+ @endforeach +
+ @foreach ($marhun['detailmarhun'] as $item) + @if ($item['request_karat']) + + {{ $item['request_karat'] }} + @endif +
+ @endforeach +
+ @foreach ($marhun['detail'] as $item) + {{ $item['old_harga'] }}
+ @endforeach +
+ @foreach ($marhun['detail'] as $item) + {{ $item['harga'] }}
+ @endforeach +
+ @foreach ($marhun['detail'] as $item) + {{ $item['old_berat'] }}
+ @endforeach +
+ @foreach ($marhun['detailmarhun'] as $item) + @if ($item['request_berat']) + + {{ $item['request_berat'] }} + @endif +
+ @endforeach +
{{ $marhun['diminta_oleh'] }}{{ $marhun['disahkan_oleh'] }} + +
No Data
+
- @endif - - - - - - - - - - - - - - - - - - - - @forelse($cawangan as $marhun) - - - - - - - - - - - - - - - - - @empty - - - - - @endforelse - - -
BilNo RujukanPerubahanMarhun AsalMarhun BaruMutu AsalMutu BaruBerat Asal (gm)Berat Baru (gm)Diminta OlehDisahkan OlehStatus
{{ $loop->iteration }}{{ $marhun['norujukan'] }} - @php - $count = 1; - @endphp - @foreach ($marhun['detailmarhun'] as $item) - {{ $count++ }}. - @if($item['status_ubah'] == 1) - Mutu - @elseif($item['status_ubah'] == 2) - Tambah Marhun - @elseif($item['status_ubah'] == 3) - Hapus Marhun - @elseif($item['status_ubah'] == 4) - Berat - @elseif($item['status_ubah'] == 5) - Mutu & Berat - @elseif($item['status_ubah'] == 7) - Marhun - @elseif($item['status_ubah'] == 8) - Mutu, Berat & Marhun - @elseif($item['status_ubah'] == 9) - Mutu & Marhun - @elseif($item['status_ubah'] == 10) - Berat & Marhun - @endif -
- @endforeach
@foreach ($marhun['detail'] as $item) - {{$item['old_marhun']}}
- @endforeach
@foreach ($marhun['detailmarhun'] as $item) - @if($item['request_marhun'] == null) - @else - - @endif {{$item['request_marhun']}}
- @endforeach
@foreach ($marhun['detail'] as $item) - {{$item['old_karat']}}
- @endforeach
@foreach ($marhun['detailmarhun'] as $item) - @if($item['request_karat'] == null) - @else - - @endif{{$item['request_karat']}}
- @endforeach
@foreach ($marhun['detail'] as $item) - {{$item['old_berat']}}
- @endforeach
@foreach ($marhun['detailmarhun'] as $item) - @if($item['request_berat'] == null) - @else - - @endif{{$item['request_berat']}}
- @endforeach
{{ $marhun['diminta_oleh'] }}{{ $marhun['disahkan_oleh'] }}
No Data
-
+@php +function statusUbahText($statusUbah) { + switch ($statusUbah) { + case 1: return 'Mutu'; + case 2: return 'Tambah Marhun'; + case 3: return 'Hapus Marhun'; + case 4: return 'Berat'; + case 5: return 'Mutu & Berat'; + case 7: return 'Marhun'; + case 8: return 'Mutu, Berat & Marhun'; + case 9: return 'Mutu & Marhun'; + case 10: return 'Berat & Marhun'; + default: return ''; + } +} +@endphp + - @endsection diff --git a/resources/views/pdf/laporanubahmarhun.blade.php b/resources/views/pdf/laporanubahmarhun.blade.php index 5615d121..0dcd93cd 100644 --- a/resources/views/pdf/laporanubahmarhun.blade.php +++ b/resources/views/pdf/laporanubahmarhun.blade.php @@ -124,6 +124,8 @@ tr:nth-child(even) { Marhun Baru Mutu Asal Mutu Baru + Harga Asal + Harga Baru Berat Asal (gm) Berat Baru (gm) Diminta Oleh @@ -177,6 +179,16 @@ tr:nth-child(even) { @endif{{$item['request_karat']}}
@endforeach + + @foreach ($marhun['detail'] as $item) + {{ $item['old_harga'] }}
+ @endforeach + + + @foreach ($marhun['detail'] as $item) + {{ $item['harga'] }}
+ @endforeach + @foreach ($marhun['detail'] as $item) {{$item['old_berat']}}
@endforeach