Merge branch 'atie' into 'main'

update simulasi (hapus simulasi)

See merge request online-sistem1/lelong!123
This commit is contained in:
Nur Izzati Zulkifli
2022-07-20 14:44:58 +00:00
7 changed files with 292 additions and 15 deletions
+52 -1
View File
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Auth;
use App\Models\Lelong;
use App\Models\CawanganLelong;
use App\Models\Pengesahan;
use Carbon\Carbon;
class HomeController extends Controller
@@ -54,7 +55,30 @@ class HomeController extends Controller
}//dd($detailsinfo);
return view('home',compact('lelong', 'arrayinfo'));
$arrayinfomutu = [];
//HOME KELULUSAN MUTU MARHUN
$lelongmutu = pengesahan::join('lelong','lelong.id','=','pengesahan.lelong_id')
// ->where('sts_lelong', 0)
->whereIn('pengesahan.status_ubah', [1,2,3,4,5])
->where('disahkan_oleh','=', NULL)
->select('pengesahan.lelong_id','lelong.id','lelong.tarikh_lelong','lelong.masatamat_lelong','lelong.harga_emas_asas','lelong.jbg','lelong.cajlelong','sts_lelong')
// ->groupBy('pengesahan.lelong_id')
->distinct()
->get()
->toArray();
// dd($lelong);
foreach($lelongmutu as $infomutu)
{
$detailsinfo = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('lelong_id',$infomutu['lelong_id'])
->get()
->toArray();
array_push($arrayinfomutu,['info'=>$infomutu, 'detailsinfo'=>$detailsinfo]);
}
return view('home',compact('lelongmutu', 'arrayinfomutu'));
}
public function about()
@@ -63,4 +87,31 @@ class HomeController extends Controller
// $user->assignRole('admin');
return view('about');
}
public function senarailelongubahmutu()
{
$arrayinfo = [];
$lelong = pengesahan::join('lelong','lelong.id','=','pengesahan.lelong_id')
// ->where('sts_lelong', 0)
->whereIn('pengesahan.status_ubah', [1,2,3,4,5])
->select('pengesahan.lelong_id','lelong.id','lelong.tarikh_lelong','lelong.masatamat_lelong','lelong.harga_emas_asas','lelong.jbg','lelong.cajlelong','sts_lelong')
// ->groupBy('pengesahan.lelong_id')
->distinct()
->get()
->toArray();
dd($lelong);
foreach($lelong as $info)
{
$detailsinfo = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
->where('lelong_id',$info['lelong_id'])
->get()
->toArray();
array_push($arrayinfo,['info'=>$info, 'detailsinfo'=>$detailsinfo]);
}
return view('home',compact('lelong', 'arrayinfo'));
}
}
+1 -1
View File
@@ -669,7 +669,7 @@ class MarhunController extends Controller
'lelongbid.bakiupah',
'lelongbid.cajlelong',
'lelongbid.baki',
'lelongbid.percent',
'lelongbid.percent'
// 'gadaimarhun.harga',
// 'gadaimarhun.id as idgadaimarhun'
)
+42 -4
View File
@@ -867,13 +867,35 @@ class SimulasiController extends Controller
public function deletemarhunlel(Request $request){
// dd($request->checkboxdata);
$user = Auth::user();
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateTimeString();
$data = $request->checkboxdata;
foreach($data as $index=>$norujukan)
{
{
$cawangan = Cawangan::where('id','=',$request->cawid)->first();
// dd($cawangan->caw_code);
$marhun = SimulasiBid::where('norujukan','=',$norujukan)->first();
$marhun->delete();
$updategadai = Http::withOptions(['verify' => config('app.api_verify')])
->post(config('app.api_url').'taglel/revert',[
'kodcaw'=>$cawangan->caw_code,
'norujukan'=>$norujukan
])
->json();
//insert loguser
$loguser = new LogUser;
$loguser->user_id = $user->id;
$loguser->date = $currentdate;
$loguser->username = $user->username;
$loguser->nama_user = $user->name;
$loguser->norujukan = $norujukan;
$loguser->nota = $request->simulasi_id.' Hapus Simulasi' ;
$loguser->save();
}
return redirect()->route('analisa.senaraimarhunlel',['simulasi_id'=>$request->simulasi_id,'cawid'=>$request->cawid])
@@ -1056,8 +1078,23 @@ class SimulasiController extends Controller
$senarai = Gadai::on($details)
->where('norujukan', $surats['norujukan'])
->get();
//dd($senarai);
// dd($surats['tempoh']);
$total_untung_rebet = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('keuntungan_rebet');
$total_untung_asal = TransaksiKeuntungan::on('main')->where('norujukan','=',$surats['norujukan'])->sum('bayaran_keuntungan');
$beza_keuntungan = $total_untung_asal - $total_untung_rebet;
// dd($beza_keuntungan);
$keuntungan = bcdiv(($surats['tempoh']-$surats['tempohbayar'])*$surats['kadarupah']/100*$surats['bakipjm'],1,1)-$beza_keuntungan;
// dd($surats['hargajualan']);
$ktlhbyr = $surats['hargajualan']-$surats['bakihargajualan'];
// dd($ktlhbyr);
$getsurat[$index1]['list_norujukan'] = $senarai;
$getsurat[$index1]['keuntungan'] = $keuntungan;
$getsurat[$index1]['ktlhbyr'] = $ktlhbyr;
}
// $keuntungantlhbyr = TransaksiKeuntungan::on('mysql2')
@@ -1066,8 +1103,9 @@ class SimulasiController extends Controller
return view('simulasi.tempbycawsimulasi', compact( 'getsurat',
'details',
'senarai',
't_gadais'
'keuntungan',
't_gadais',
'ktlhbyr'
));
}
+61 -2
View File
@@ -13,7 +13,7 @@
</div>
@endif
{{ __('Selamat Datang!') }}
<!-- {{ __('Selamat Datang!') }} -->
@hasrole('admin')
I am a admin!
@endhasrole
@@ -119,7 +119,66 @@
</table>
@endhasrole
@hasrole('operasi')
I am a operasi!
<!-- I am a operasi! -->
@php
@empty($arrayinfomutu)
@endphp
KELULUSAN UBAH MARHUN
<table class="table table-striped table-xl text-center" id="tablelelong" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>ID Lelong</th>
<th>Cawangan</th>
<th>Tarikh Lelong</th>
<th>Harga Emas Asas</th>
<th>Tempoh</th>
<th>Caj Lelong</th>
<th>Status Lelong</th>
<th class="text-center">Pengesahan</th>
<th class="text-center">Telah Sah</th>
</tr>
</thead>
<tbody>
@foreach($arrayinfomutu as $lel)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $lel['info']['lelong_id'] }}</td>
<td align = 'left'>
@foreach($lel['detailsinfo'] as $details)
<span class="m-2">{{$details['caw_name']}}</span><br>
@endforeach
</td>
<td> @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $lel['info']['tarikh_lelong']);
$datez = $myDateTime->format('d-m-Y');
echo($datez);
@endphp</td>
<td>{{ number_format($lel['info']['harga_emas_asas'], 2, '.', ',')}}</td>
<td>{{ $lel['info']['jbg'] }}</td>
<td>{{ $lel['info']['cajlelong'] }}</td>
<td>
@if($lel['info']['sts_lelong'] == 0)
<button class="btn btn-warning btn-sm" disabled>LELONG BELUM BERMULA</button>
@endif
</td>
<td>
<a href="{{ route('pengesahan.perubahanmutumarhun', ['id'=>$lel['info']['lelong_id']]) }}" data-toggle="tooltip" data-placement="top" title="Butiran" class="text-center" ><i class="far fa-edit"></i></a>
</td>
<td>
<a href="{{ route('pengesahan.listperubahanmutumarhun', ['id'=>$lel['info']['lelong_id']]) }}" data-toggle="tooltip" data-placement="top" title="Butiran" class="text-center" ><i class="far fa-user"></i></a>
</td>
</tr>
@endforeach
</tbody>
</table>
@php
@endphp
@endhasrole
@hasrole('account')
I am a account!
@@ -0,0 +1,127 @@
@extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row ">
<div class="col-md-11 mx-auto card p-4">
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<form id="exportform" action="" method="POST">
<input type="hidden" name="type" value="User">
<table class="table table-striped table-xl text-center" id="tablelelong" style="width:100%">
<thead class="bg-primary text-white">
<tr>
<th>No</th>
<th>ID Lelong</th>
<th>Cawangan</th>
<th>Tarikh Lelong</th>
<th>Harga Emas Asas</th>
<th>Tempoh</th>
<th>Caj Lelong</th>
<th>Status Lelong</th>
<th class="text-center">Pengesahan</th>
<th class="text-center">Telah Sah</th>
</tr>
</thead>
<tbody>
@foreach($arrayinfo as $lel)
<tr>
<td>{{$loop->iteration}}</td>
<td>{{ $lel['info']['lelong_id'] }}</td>
<td align = 'left'>
@foreach($lel['detailsinfo'] as $details)
<span class="m-2">{{$details['caw_name']}}</span><br>
@endforeach
</td>
<td> @php
$myDateTime = DateTime::createFromFormat('Y-m-d', $lel['info']['tarikh_lelong']);
$datez = $myDateTime->format('d-m-Y');
echo($datez);
@endphp</td>
<td>{{ number_format($lel['info']['harga_emas_asas'], 2, '.', ',')}}</td>
<td>{{ $lel['info']['jbg'] }}</td>
<td>{{ $lel['info']['cajlelong'] }}</td>
<td>
@if($lel['info']['sts_lelong'] == 0)
<button class="btn btn-warning btn-sm" disabled>LELONG BELUM BERMULA</button>
@endif
</td>
<td>
<a href="{{ route('pengesahan.perubahanmutumarhun', ['id'=>$lel['info']['lelong_id']]) }}" data-toggle="tooltip" data-placement="top" title="Butiran" class="text-center" ><i class="far fa-edit"></i></a>
</td>
<td>
<a href="{{ route('pengesahan.listperubahanmutumarhun', ['id'=>$lel['info']['lelong_id']]) }}" data-toggle="tooltip" data-placement="top" title="Butiran" class="text-center" ><i class="far fa-user"></i></a>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
//Enable tooltips everywhere
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
var tablelelong = $('#tablelelong').DataTable( {
"columnDefs": [
{
"targets": 0,
"orderable": false
},
{
"targets": 7,
"orderable": false
}
],
order: [[1, 'asc']],
// "ordering": false,
"info": false,
"lengthChange": false,
"pageLength": 15,
dom: 'Bfrtip',
// buttons: [
// // 'copy', 'excel', 'pdf'
// // { text: 'copy', className: 'btn btn-primary' },
// {
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addsim',
// text: '<i class="fas fa-plus" id="test"></i>',
// titleAttr: 'Tambah Simulasi',
// action: function ( e, dt, node, config ) {
// alert( 'Button activated' );
// }
// },
// {
// className: 'btn btn-outline-secondary pl-4 pr-4 btn-sm export',
// titleAttr: 'Export to CSV',
// text: '<i class="fas fa-download"></i>',
// action: function ( e, dt, node, config ) {
// $("#exportform").submit();
// }
// }
// ]
});
$('.addsim').tooltip();
$('.export').tooltip();
// $( '.dt-buttons').addClass('btn-group');
$( '.addsim').removeClass('dt-button');
$( '.export').removeClass('dt-button');
function selectall(cb) {
tablelelong.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
$(this).prop('checked', cb.checked);
})
}
</script>
@endsection
@@ -86,7 +86,7 @@
</div>
</div>
<script>
$("#btndelete").prop("disabled", true);
$("#btndelete").prop("enabled", true);
function btnDelete(e) {
var count = 0;
tablemarhun.rows().nodes().to$().find('input[type="checkbox"]').each(function(){
@@ -28,6 +28,7 @@
<th>Baki Pembiayaan (RM)</th>
<th>Keuntungan 6 Bulan (RM)</th>
<th>Keuntungan Telah Bayar (RM)</th>
<th>Keuntungan Semasa (RM)</th>
<th>Nilai Marhun (RM)</th>
<th>Tamat Kontrak</th>
@@ -40,12 +41,13 @@
<td>{{ $surat['list_norujukan'][0]['norujukan'] }}</td>
<td>{{ $surat['list_norujukan'][0]['nokp'] }}</td>
<td>{{ $surat['list_norujukan'][0]['tempoh'] }}</td>
<td>{{ $surat['list_norujukan'][0]['berat'] }}</td>
<td>{{ $surat['list_norujukan'][0]['pinjaman'] }}</td>
<td>{{ $surat['list_norujukan'][0]['bakipjm'] }}</td>
<td>{{ $surat['list_norujukan'][0]['bakiupah'] }}</td>
<td>{{ $surat['list_norujukan'][0]['ansakhir'] }}</td>
<td>{{ $surat['list_norujukan'][0]['nilaimarhun'] }}</td>
<td>{{ number_format($surat['list_norujukan'][0]['berat'] , 2, '.', ',') }}</td>
<td>{{ number_format($surat['list_norujukan'][0]['pinjaman'] , 2, '.', ',') }}</td>
<td>{{ number_format($surat['list_norujukan'][0]['bakipjm'] , 2, '.', ',') }}</td>
<td>{{ number_format($surat['list_norujukan'][0]['bakiupah'], 2, '.', ',') }}</td>
<td>{{ number_format($surat['ktlhbyr'] , 2, '.', ',')}}</td>
<td>{{ number_format($surat['keuntungan'] , 2, '.', ',') }}</td>
<td>{{ number_format($surat['list_norujukan'][0]['nilaimarhun'], 2, '.', ',') }}</td>
<td>{{ $surat['list_norujukan'][0]['t_matang1'] }}</td>
</tr>
@endforeach