Merge branch 'atie' into 'main'
update function edit rugi lelong dan caj lelong See merge request online-sistem1/lelong!407
This commit is contained in:
@@ -6266,7 +6266,7 @@ class LelongController extends Controller
|
||||
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
||||
$total_nilaimarhun = $total_nilaimarhun + $cal['nilaimarhun'];
|
||||
$total_bakiupah = $total_bakiupah + $cal['bakiupah'];
|
||||
$total_cazlelong = $total_cazlelong + $cal['bakiupah'];
|
||||
$total_cazlelong = $total_cazlelong + $cal['cajlelong'];
|
||||
$total_hargajual = $total_hargajual + $cal['hargajual'];
|
||||
}
|
||||
|
||||
@@ -7033,6 +7033,234 @@ class LelongController extends Controller
|
||||
->with('success','Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function ubahrugilelong($lelongid, $cawid){
|
||||
$total_berat = 0;
|
||||
$total_pinjaman = 0;
|
||||
$total_upah = 0;
|
||||
$total_hargaasas = 0;
|
||||
$total_bakiupah = 0;
|
||||
$total_nilaimarhun = 0;
|
||||
$keuntungan = 0;
|
||||
$bakilelong = 0;
|
||||
$total_cazlelong = 0;
|
||||
$total_hargajual = 0;
|
||||
// dd($cawid);
|
||||
|
||||
$lelonglel = Lelong::with('cawangan')->find($lelongid);
|
||||
|
||||
$cawanganDetail = $lelonglel->cawangan->find($cawid);
|
||||
|
||||
$marhuns = LelongBid::where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', '=', $lelongid)
|
||||
->where('status_jual', '=', 1)
|
||||
->where('baki', '<', 0.00)
|
||||
->get();
|
||||
// dd($marhuns);
|
||||
$arraymarhun = [];
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
array_push($arraymarhun,[
|
||||
'norujukan' => $cal['norujukan'],
|
||||
'tempoh' => $cal['jbg'],
|
||||
'berat' => $cal['berat'],
|
||||
'nilaimarhun' => $cal['nilaimarhun'],
|
||||
'hargaasas' => $cal['hargaasas'],
|
||||
'hargajual' => $cal['hargajual'],
|
||||
'pinjaman' => $cal['pinjaman'],
|
||||
'bakiupah' => $cal['bakiupah'],
|
||||
'cajlelong' => $cal['cajlelong'],
|
||||
'baki' => $cal['baki'],
|
||||
]);
|
||||
$total_berat = $total_berat + $cal['berat'];
|
||||
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
||||
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
||||
$total_nilaimarhun = $total_nilaimarhun + $cal['nilaimarhun'];
|
||||
$total_bakiupah = $total_bakiupah + $cal['bakiupah'];
|
||||
$total_cazlelong = $total_cazlelong + $cal['cajlelong'];
|
||||
$total_hargajual = $total_hargajual + $cal['hargajual'];
|
||||
}
|
||||
|
||||
$arrayinfo = [];
|
||||
|
||||
$lelong_id = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->where('cawangan_lelong.lelong_id','=',$lelongid)
|
||||
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
||||
->groupBy('lelong_id')
|
||||
->get()->toArray();
|
||||
|
||||
|
||||
foreach($lelong_id as $laporan)
|
||||
{
|
||||
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporan['lelong_id'])
|
||||
->where('caw_id',$cawid)
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
return view('lelong.senaraiubahrugilelong',compact('arraymarhun','marhuns','lelongid','cawid','arrayinfo','total_berat',
|
||||
'total_pinjaman',
|
||||
'total_upah',
|
||||
'total_hargaasas',
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun',
|
||||
'lelonglel',
|
||||
'cawanganDetail',
|
||||
'total_cazlelong',
|
||||
'total_hargajual'));
|
||||
}
|
||||
|
||||
public function cajrugilelong(Request $request){
|
||||
$total_berat = 0;
|
||||
$total_pinjaman = 0;
|
||||
$total_upah = 0;
|
||||
$total_hargaasas = 0;
|
||||
$total_bakiupah = 0;
|
||||
$total_nilaimarhun = 0;
|
||||
$keuntungan = 0;
|
||||
$bakilelong = 0;
|
||||
$total_cazlelong = 0;
|
||||
$total_bakilelong = 0;
|
||||
$total_hargajual = 0;
|
||||
$total_cajlelnew = 0;
|
||||
$total_rugilelongnew = 0;
|
||||
$newcajlel= 0;
|
||||
$newbaki = 0;
|
||||
$lelongid = $request->lelongid;
|
||||
$cawid = $request->cawid;
|
||||
$cajlelong = $request->cajlelong;
|
||||
// dd($cajlelong);
|
||||
|
||||
$lelonglel = Lelong::with('cawangan')->find($lelongid);
|
||||
|
||||
$cawanganDetail = $lelonglel->cawangan->find($cawid);
|
||||
|
||||
$marhuns = LelongBid::where('caw_id', '=', $cawid)
|
||||
->where('lelong_id', '=', $lelongid)
|
||||
->where('status_jual', '=', 1)
|
||||
->where('baki', '<', 0.00)
|
||||
->get();
|
||||
// dd($marhuns);
|
||||
$arraymarhun = [];
|
||||
foreach ($marhuns as $index1=> $cal) {
|
||||
$cajlel = $cal['hargajual'] * ($cajlelong/100) ;
|
||||
$cajlelnew = round($cajlel, 1, 1);
|
||||
// dd($cajlelnew);
|
||||
$rugilelongnew = $cal['hargajual'] - $cal['pinjaman'] - $cal['bakiupah'] - $cajlelnew;
|
||||
// dd($rugilelongnew);
|
||||
//cajlelong baru
|
||||
if($rugilelongnew < 0){
|
||||
$newbaki = $cajlelnew + $rugilelongnew;
|
||||
if($newbaki > 0)
|
||||
{
|
||||
$newcajlel = $newbaki;
|
||||
$newbaki = 0;
|
||||
}
|
||||
else {
|
||||
$newcajlel = 0;
|
||||
// $newbaki = 0;
|
||||
}
|
||||
}elseif($rugilelongnew > 0){
|
||||
$newcajlel = $cajlelnew;
|
||||
$newbaki = $rugilelongnew;
|
||||
}
|
||||
|
||||
array_push($arraymarhun,[
|
||||
'norujukan' => $cal['norujukan'],
|
||||
'lelongbid_id' => $cal['id'],
|
||||
'tempoh' => $cal['jbg'],
|
||||
'berat' => $cal['berat'],
|
||||
'nilaimarhun' => $cal['nilaimarhun'],
|
||||
'hargaasas' => $cal['hargaasas'],
|
||||
'hargajual' => $cal['hargajual'],
|
||||
'pinjaman' => $cal['pinjaman'],
|
||||
'bakiupah' => $cal['bakiupah'],
|
||||
'cajlelong' => $cajlelnew,
|
||||
'baki' => $rugilelongnew,
|
||||
'cajlelongnew' => $newcajlel,
|
||||
'rugilelongnew' => $newbaki,
|
||||
]);
|
||||
$total_berat = $total_berat + $cal['berat'];
|
||||
$total_pinjaman = $total_pinjaman + $cal['pinjaman'];
|
||||
$total_hargaasas = $total_hargaasas + $cal['hargaasas'];
|
||||
$total_nilaimarhun = $total_nilaimarhun + $cal['nilaimarhun'];
|
||||
$total_bakiupah = $total_bakiupah + $cal['bakiupah'];
|
||||
$total_cazlelong = $total_cazlelong + $cajlelnew;
|
||||
$total_bakilelong = $total_bakilelong + $rugilelongnew;
|
||||
$total_hargajual = $total_hargajual + $cal['hargajual'];
|
||||
$total_cajlelnew = $total_cajlelnew + $newcajlel;
|
||||
$total_rugilelongnew = $total_rugilelongnew + $newbaki;
|
||||
|
||||
}
|
||||
|
||||
$arrayinfo = [];
|
||||
|
||||
$lelong_id = Lelong::join('cawangan_lelong','lelong.id','=','cawangan_lelong.lelong_id')
|
||||
->where('cawangan_lelong.lelong_id','=',$lelongid)
|
||||
->select('lelong_id','tarikh_lelong','lelong.fasa')
|
||||
->groupBy('lelong_id')
|
||||
->get()->toArray();
|
||||
|
||||
|
||||
foreach($lelong_id as $laporan)
|
||||
{
|
||||
$details = CawanganLelong::join('cawangan','cawangan_lelong.caw_id','=','cawangan.id')
|
||||
->where('lelong_id',$laporan['lelong_id'])
|
||||
->where('caw_id',$cawid)
|
||||
->get()
|
||||
->toArray();
|
||||
array_push($arrayinfo,['laporan' => $laporan,'details' => $details]);
|
||||
}
|
||||
return view('lelong.senaraiubahrugilelongnew',compact('arraymarhun','marhuns','lelongid','cawid','arrayinfo','total_berat',
|
||||
'total_pinjaman',
|
||||
'total_upah',
|
||||
'total_hargaasas',
|
||||
'total_bakiupah',
|
||||
'total_nilaimarhun',
|
||||
'lelonglel',
|
||||
'cawanganDetail',
|
||||
'total_cazlelong',
|
||||
'total_bakilelong',
|
||||
'total_hargajual',
|
||||
'total_cajlelnew',
|
||||
'total_rugilelongnew','cajlelong'));
|
||||
}
|
||||
|
||||
public function editcajrugilelong(Request $request){
|
||||
$lelongbid_id = $request->lelongbid_id;
|
||||
$norujukan = $request->norujukan;
|
||||
$cajlelongnew = $request->cajlelongnew;
|
||||
$rugilelongnew = $request->rugilelongnew;
|
||||
$lelongid = $request->lelongid;
|
||||
$cawid = $request->cawid;
|
||||
$cajlelong = $request->cajlelong;
|
||||
$user = Auth::user();
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
for($i=0; $i<count($lelongbid_id); $i++)
|
||||
{
|
||||
if($lelongbid_id[$i])
|
||||
{
|
||||
$updatecajrugilelong = LelongBid::where('id', $lelongbid_id[$i])->first();
|
||||
$updatecajrugilelong->baki = $rugilelongnew[$i];
|
||||
$updatecajrugilelong->cajlelong = $cajlelongnew[$i];
|
||||
$updatecajrugilelong->update();
|
||||
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = $user->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = $user->username;
|
||||
$loguser->nama_user = $user->name;
|
||||
$loguser->norujukan = $norujukan[$i];
|
||||
$loguser->nota = 'Ubah Rugi Lelong: Caj '.$cajlelong.'%';
|
||||
$loguser->save();
|
||||
}
|
||||
}
|
||||
return redirect()->route('lelong.senaraimarhundone',['lelongid'=>$lelongid,'cawid'=>$cawid])
|
||||
->with('success','Kemaskini Rugi Lelong Berjaya');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -54,10 +54,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="mb-3">
|
||||
<a href=" {{ route('report.lelongreport',[$lelongid,$cawid]) }}" class="btn btn-outline-success">Muat Turun PDF</a>
|
||||
<a href="{{ route('lelong.listsagbycust',[$lelongid,'cawid'=>$cawid]) }}" class="btn btn-primary">Senarai Mengikut Nama Pelanggan</a>
|
||||
</div> --}}
|
||||
<div class="mb-3">
|
||||
{{-- <a href=" {{ route('report.lelongreport',[$lelongid,$cawid]) }}" class="btn btn-outline-success">Muat Turun PDF</a> --}}
|
||||
<a href="{{ route('lelong.ubahrugilelong',[$lelongid,'cawid'=>$cawid]) }}" class="btn btn-primary">Ubah Rugi Lelong</a>
|
||||
</div>
|
||||
<form id="deletesag" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="lelongid" value="{{$lelongid}}">
|
||||
@@ -115,6 +115,8 @@
|
||||
{{number_format($marhun['baki'], 2, '.', ',')}}
|
||||
@elseif($marhun['baki'] < 0 )
|
||||
({{number_format(-($marhun['baki']), 2, '.', ',')}})
|
||||
@else
|
||||
0.00
|
||||
@endif
|
||||
</td>
|
||||
|
||||
@@ -137,8 +139,11 @@
|
||||
<td align = 'right'><b>{{ number_format($total_hargajual, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>@if($bakilelong > 0)
|
||||
{{ number_format($bakilelong, 2, '.', ',') }}
|
||||
@else
|
||||
@elseif($bakilelong < 0)
|
||||
({{number_format(-($bakilelong), 2, '.', ',')}})
|
||||
@else
|
||||
0.00
|
||||
@endif
|
||||
@endif</b></td>
|
||||
{{-- <td align = 'right'></td> --}}
|
||||
</tr>
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row ">
|
||||
<div class="col mx-auto p-4">
|
||||
<div class="card">
|
||||
<div class="card-header header-style">
|
||||
<a href="{{ route('lelong.showlelongdone',$lelongid) }}" class="header-style-icon">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<div class="header-style-title">
|
||||
senarai Sag : {{ $cawanganDetail->caw_name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@endif
|
||||
@php
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $lelonglel->tarikh_lelong );
|
||||
$t_lelong = $myDateTime->format('d-m-Y');
|
||||
@endphp
|
||||
<form id="cariansag" action="{{route('lelong.cajrugilelong')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="lelongid" value="{{$lelongid}}">
|
||||
<input type="hidden" name="cawid" value="{{$cawid}}">
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Tarikh Lelong</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{$t_lelong}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">JBG</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{$lelonglel->jbg}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Bil SAG Cawangan</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{sizeof($arraymarhun)}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Caj Lelong (%)</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="radio" value='0' id="cajlelong0" name="cajlelong">
|
||||
<label for="0">0</label>
|
||||
<input type="radio" value='1' id="cajlelong1" name="cajlelong">
|
||||
<label for="1">1</label>
|
||||
<input type="radio" value='2' id="cajlelong2" name="cajlelong">
|
||||
<label for="2">2</label>
|
||||
<input type="radio" value='3' id="cajlelong3" name="cajlelong" checked>
|
||||
<label for="3">3</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left"></label>
|
||||
<div class="col-6">
|
||||
<button type="submit" class="btn btn-success">Carian</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<table class="table text-right table-bordered" id="marhun" style="width:100%">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>No Rujukan</th>
|
||||
{{-- <th>Nama Pelanggan</th> --}}
|
||||
<th>Tempoh</th>
|
||||
<th>Berat (gm)</th>
|
||||
<th>Nilai Marhun Asal (RM)</th>
|
||||
<th>Pembiayaan (RM)</th>
|
||||
<th>Keuntungan (RM)</th>
|
||||
<th>Caj Lelong (RM)</th>
|
||||
<th>Harga Asas (RM)</th>
|
||||
<th>Harga Jual (RM)</th>
|
||||
<th>Baki Lelong (RM)</th>
|
||||
{{-- <th>Tindakan</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
@endphp
|
||||
@foreach ($marhuns as $index=> $marhun)
|
||||
<tr>
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td align = 'left' style="white-space: nowrap;">{{ $marhun['norujukan']}}</td>
|
||||
{{-- <td align = 'left' style="white-space: nowrap;">{{ $marhun['nama']['nama']}}</td> --}}
|
||||
<td>{{ number_format($marhun['jbg'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['pinjaman'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['bakiupah'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['cajlelong'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['hargaasas'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['hargajual'], 2, '.', ',') }}</td>
|
||||
@php
|
||||
$rugi = 0;
|
||||
$baki = 0;
|
||||
if(strpos($marhun['baki'], '-') !== false)
|
||||
{
|
||||
$baki = -$marhun['baki'];
|
||||
$bakilelong += $marhun['baki'];
|
||||
}
|
||||
else {
|
||||
$baki = $marhun['baki'];
|
||||
$bakilelong += $marhun['baki'];
|
||||
}
|
||||
@endphp
|
||||
<td align = 'right'>@if($marhun['baki'] > 0)
|
||||
{{number_format($marhun['baki'], 2, '.', ',')}}
|
||||
@elseif($marhun['baki'] < 0 )
|
||||
({{number_format(-($marhun['baki']), 2, '.', ',')}})
|
||||
@endif
|
||||
</td>
|
||||
|
||||
{{-- <td class="text-center">
|
||||
<input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata[]" name="checkboxdata[]" value="{{ $marhun['norujukan'] }}">
|
||||
</td> --}}
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3"><b>JUMLAH KESELURUHAN</b></td>
|
||||
<td align = 'right'><b><b>{{ number_format($total_berat, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_pinjaman, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_bakiupah, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_cazlelong, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_hargaasas, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_hargajual, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>@if($bakilelong > 0)
|
||||
{{ number_format($bakilelong, 2, '.', ',') }}
|
||||
@else
|
||||
({{number_format(-($bakilelong), 2, '.', ',')}})
|
||||
@endif</b></td>
|
||||
{{-- <td align = 'right'></td> --}}
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
{{-- <a href="{{url('lelong/senarailelong')}}" class="btn btn-primary">Kembali</a> --}}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function confirm() {
|
||||
$.confirm({
|
||||
title: 'Ubah % Caj Dan Rugi Lelong',
|
||||
content: 'Anda pasti?',
|
||||
type: 'red',
|
||||
typeAnimated: true,
|
||||
buttons: {
|
||||
Hapus: {
|
||||
btnClass: 'btn-danger',
|
||||
action: function() {
|
||||
$("#cariansag").submit();
|
||||
}
|
||||
},
|
||||
Batal: {
|
||||
btnClass: 'btn-default',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var tablemarhun = $('#marhun').DataTable({
|
||||
"info": false,
|
||||
"lengthChange": false,
|
||||
"pageLength": 999999,
|
||||
dom: 'Bfrtip',
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -0,0 +1,250 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row ">
|
||||
<div class="col mx-auto p-4">
|
||||
<div class="card">
|
||||
<div class="card-header header-style">
|
||||
<a href="{{ route('lelong.showlelongdone',$lelongid) }}" class="header-style-icon">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<div class="header-style-title">
|
||||
senarai Sags : {{ $cawanganDetail->caw_name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert alert-success">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@endif
|
||||
@php
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $lelonglel->tarikh_lelong );
|
||||
$t_lelong = $myDateTime->format('d-m-Y');
|
||||
@endphp
|
||||
<form id="cariansag" action="{{route('lelong.cajrugilelong')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="lelongid" value="{{$lelongid}}">
|
||||
<input type="hidden" name="cawid" value="{{$cawid}}">
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Tarikh Lelong</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{$t_lelong}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">JBG</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{$lelonglel->jbg}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Bil SAG Cawangan</label>
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<input type="text" readonly class="form-control bg-light" value="{{sizeof($arraymarhun)}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left">Caj Lelong (%)</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="radio" value='0' id="cajlelong0" name="cajlelong" {{$cajlelong == 0 ? 'checked': '' }}>
|
||||
<label for="0">0</label>
|
||||
<input type="radio" value='1' id="cajlelong1" name="cajlelong" {{$cajlelong == 1 ? 'checked': '' }}>
|
||||
<label for="1">1</label>
|
||||
<input type="radio" value='2' id="cajlelong2" name="cajlelong" {{$cajlelong == 2 ? 'checked': '' }}>
|
||||
<label for="2">2</label>
|
||||
<input type="radio" value='3' id="cajlelong3" name="cajlelong" {{$cajlelong == 3 ? 'checked': '' }}>
|
||||
<label for="3">3</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-left"></label>
|
||||
<div class="col-6">
|
||||
<button type="submit" class="btn btn-info">Carian</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<label class="col-6 col-form-label text-left"><b>Caj Lelong : {{$cajlelong}}%</b></label>
|
||||
<form id="editrugilelong" action="{{route('lelong.editcajrugilelong')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="lelongid" value="{{$lelongid}}">
|
||||
<input type="hidden" name="cawid" value="{{$cawid}}">
|
||||
<input type="hidden" name="cajlelong" value="{{$cajlelong}}">
|
||||
<table class="table text-right table-bordered" style="width:100%" data-toggle="table" data-show-export="true">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>No Rujukan</th>
|
||||
{{-- <th>Nama Pelanggan</th> --}}
|
||||
<th>Tempoh</th>
|
||||
<th>Berat (gm)</th>
|
||||
<th>Nilai Marhun Asal (RM)</th>
|
||||
<th>Pembiayaan (RM)</th>
|
||||
<th>Keuntungan (RM)</th>
|
||||
<th style="background-color: crimson">Caj Lelong (RM)</th>
|
||||
<th>Harga Asas (RM)</th>
|
||||
<th>Harga Jual (RM)</th>
|
||||
<th style="background-color: crimson">Rugi Lelong (RM)</th>
|
||||
<th style="background-color: rgb(20, 220, 20)">Caj Lelong Baru (RM)</th>
|
||||
<th style="background-color: rgb(20, 220, 20)">Rugi Lelong Baru (RM)</th>
|
||||
{{-- <th>Tindakan</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$rugilelong = 0;
|
||||
$bakilelong = 0;
|
||||
@endphp
|
||||
@foreach ($arraymarhun as $index=> $marhun)
|
||||
<tr>
|
||||
<td>{{$loop->iteration}}</td>
|
||||
<td align = 'left' style="white-space: nowrap;"> <input type="hidden" name="lelongbid_id[]" value="{{ $marhun['lelongbid_id']}}"><input type="hidden" name="norujukan[]" value="{{ $marhun['norujukan']}}">{{ $marhun['norujukan']}}</td>
|
||||
{{-- <td align = 'left' style="white-space: nowrap;">{{ $marhun['nama']['nama']}}</td> --}}
|
||||
<td>{{ number_format($marhun['tempoh'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['berat'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['nilaimarhun'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['pinjaman'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['bakiupah'], 2, '.', ',') }}</td>
|
||||
{{-- <td align = 'right'>{{ number_format($marhun['cajlelong'], 2, '.', ',') }}</td> --}}
|
||||
<td align = 'right'><b>{{ number_format($marhun['cajlelong'], 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'>{{ number_format($marhun['hargaasas'], 2, '.', ',') }}</td>
|
||||
<td align = 'right'>{{ number_format($marhun['hargajual'], 2, '.', ',') }}</td>
|
||||
@php
|
||||
$rugi = 0;
|
||||
$baki = 0;
|
||||
if(strpos($marhun['baki'], '-') !== false)
|
||||
{
|
||||
$baki = -$marhun['baki'];
|
||||
$bakilelong += $marhun['baki'];
|
||||
}
|
||||
else {
|
||||
$baki = $marhun['baki'];
|
||||
$bakilelong += $marhun['baki'];
|
||||
}
|
||||
@endphp
|
||||
<td align = 'right'><b>@if($marhun['baki'] > 0)
|
||||
{{number_format($marhun['baki'], 2, '.', ',')}}
|
||||
@elseif($marhun['baki'] < 0 )
|
||||
({{number_format(-($marhun['baki']), 2, '.', ',')}})
|
||||
@endif</b>
|
||||
|
||||
</td>
|
||||
|
||||
|
||||
<td align = 'right'><b><input type="hidden" name="cajlelongnew[]" value="{{ $marhun['cajlelongnew']}}">{{ number_format($marhun['cajlelongnew'], 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>@if($marhun['rugilelongnew'] > 0)
|
||||
<input type="hidden" name="rugilelongnew[]" value="{{ $marhun['rugilelongnew']}}">
|
||||
{{ number_format($marhun['rugilelongnew'], 2, '.', ',') }}
|
||||
@else
|
||||
<input type="hidden" name="rugilelongnew[]" value="{{$marhun['rugilelongnew']}}">
|
||||
({{number_format(-($marhun['rugilelongnew']), 2, '.', ',')}})
|
||||
@endif</b></td>
|
||||
{{-- <td class="text-center">
|
||||
<input type="checkbox" aria-label="Checkbox for following text input" id="checkboxdata[]" name="checkboxdata[]" value="{{ $marhun['norujukan'] }}">
|
||||
</td> --}}
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3"><b>JUMLAH KESELURUHAN</b></td>
|
||||
<td align = 'right'><b><b>{{ number_format($total_berat, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_nilaimarhun, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_pinjaman, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_bakiupah, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_cazlelong, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_hargaasas, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>{{ number_format($total_hargajual, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>@if($total_bakilelong > 0)
|
||||
{{ number_format($total_bakilelong, 2, '.', ',') }}
|
||||
@else
|
||||
({{number_format(-($total_bakilelong), 2, '.', ',')}})
|
||||
@endif</b></td>
|
||||
{{-- <td align = 'right'><b>@if($bakilelong > 0)
|
||||
{{ number_format($bakilelong, 2, '.', ',') }}
|
||||
@else
|
||||
({{number_format(-($bakilelong), 2, '.', ',')}})
|
||||
@endif</b></td> --}}
|
||||
<td align = 'right'><b>{{ number_format($total_cajlelnew, 2, '.', ',') }}</b></td>
|
||||
<td align = 'right'><b>@if($total_rugilelongnew > 0)
|
||||
{{ number_format($total_rugilelongnew, 2, '.', ',') }}
|
||||
@else
|
||||
({{number_format(-($total_rugilelongnew), 2, '.', ',')}})
|
||||
@endif</b></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
||||
</table>
|
||||
<div class="form-group row">
|
||||
<label class="col-6 col-form-label text-right"></label>
|
||||
<div class="col-12" align = "right">
|
||||
<button type="submit" class="btn btn-success">Kemaskini</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{{-- <a href="{{url('lelong/senarailelong')}}" class="btn btn-primary">Kembali</a> --}}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function confirm() {
|
||||
$.confirm({
|
||||
title: 'Ubah % Caj Dan Rugi Lelong',
|
||||
content: 'Anda pasti?',
|
||||
type: 'red',
|
||||
typeAnimated: true,
|
||||
buttons: {
|
||||
Hapus: {
|
||||
btnClass: 'btn-danger',
|
||||
action: function() {
|
||||
$("#cariansag").submit();
|
||||
}
|
||||
},
|
||||
Batal: {
|
||||
btnClass: 'btn-default',
|
||||
action: function() {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var tablemarhun = $('#marhun').DataTable({
|
||||
"info": false,
|
||||
"lengthChange": true,
|
||||
"pageLength": 999999,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@@ -143,7 +143,7 @@
|
||||
<th>Cawangan</th>
|
||||
<th>Bil SAG</th>
|
||||
<th>Berat (gm)</th>
|
||||
<th>Nilai Marhun Asal(RM)</th>
|
||||
<th>Nilai Marhun Asal (RM)</th>
|
||||
<th>Pembiayaan (RM)</th>
|
||||
<th>Keuntungan (RM)</th>
|
||||
<th>Caj (RM)</th>
|
||||
|
||||
@@ -182,6 +182,9 @@ Route::group(['prefix'=>'lelong'], function () {
|
||||
|
||||
Route::get('/exporthargaemas/{lelong_id}',['as'=>'lelong.exporthargaemas','uses'=>'LelongController@exporthargaemas']);
|
||||
Route::get('/senaraimarhundone/{lelongid}/{cawid}', ['as'=>'lelong.senaraimarhundone','uses'=>'LelongController@senaraimarhundone']);
|
||||
Route::get('/ubahrugilelong/{lelongid}/{cawid}', ['as'=>'lelong.ubahrugilelong','uses'=>'LelongController@ubahrugilelong']);
|
||||
Route::post('/cajrugilelong', ['as'=>'lelong.cajrugilelong','uses'=>'LelongController@cajrugilelong']);
|
||||
Route::post('/editcajrugilelong', ['as'=>'lelong.editcajrugilelong','uses'=>'LelongController@editcajrugilelong']);
|
||||
|
||||
});
|
||||
Route::get('/showsimulasi/{id}',['as'=>'lelong.showsimulasi','uses'=>'LelongController@showsimulasi']);
|
||||
|
||||
Reference in New Issue
Block a user