Merge branch 'faiqahzaman' into azfar_dev
This commit is contained in:
@@ -471,22 +471,27 @@ class LelongController extends Controller
|
||||
$updatebid->save();
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
$checkdata = Resit::where('user_id', $bidder->user_id)
|
||||
->where('lelong_id', $id)
|
||||
->first();
|
||||
if(!$checkdata){
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri->id + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);;
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $bidder->user_id;
|
||||
$resit->lelong_id = $id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = '';
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit->save();
|
||||
}
|
||||
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $bidder->user_id;
|
||||
$resit->lelongbid_id = $bid->id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = $bidder->hargabida;
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit->save();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -604,6 +609,24 @@ class LelongController extends Controller
|
||||
return view('lelong.lelongtaklaku',compact('lelongtaklaku'));
|
||||
}
|
||||
|
||||
public function senaraipemenang($lelong_id){
|
||||
|
||||
$listwinner = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->select('lelongbidder.user_id'
|
||||
)
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
|
||||
$senaraiwinner = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
return view('lelong.senaraipemenang',compact('senaraiwinner','lelong_id'));
|
||||
}
|
||||
|
||||
public function senaraimarhun($lelongid, $cawid){
|
||||
// $marhun = LelongBid::->get();
|
||||
|
||||
|
||||
@@ -121,6 +121,10 @@ class PaymentController extends Controller
|
||||
|
||||
$bid_id = explode(",", $request->eachbid);
|
||||
|
||||
$resit = Resit::where('lelong_id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$total_hargabida = 0;
|
||||
foreach($bid_id as $bid){
|
||||
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
@@ -130,20 +134,17 @@ class PaymentController extends Controller
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id'
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
|
||||
$resit = Resit::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $currentdate;
|
||||
$resit->update();
|
||||
|
||||
$total_hargabida = $total_hargabida + $eachbid->hargabida;
|
||||
$payment = Payment::create([
|
||||
'user_id' => $request->user_id,
|
||||
'lelongbidder_id' => $eachbid->lelongbidder_id,
|
||||
'lelongbid_id' => $bid,
|
||||
'lelong_id' => $eachbid->lelong_id,
|
||||
'kodcaw' => $user->kodcaw,
|
||||
'status_payment_opt' => 1,
|
||||
'status' => 2,
|
||||
@@ -175,7 +176,12 @@ class PaymentController extends Controller
|
||||
$eachbid->update();
|
||||
|
||||
}
|
||||
|
||||
if($request->amaunkiraan == $total_hargabida){
|
||||
$resit->total_payment = $total_hargabida;
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $currentdate;
|
||||
$resit->update();
|
||||
}
|
||||
return redirect()->route('pembayaran.SenaraiLelongBayar')->with('success','Pembayaran Berjaya');
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class payment extends Model
|
||||
'user_id',
|
||||
'lelongbidder_id',
|
||||
'lelongbid_id',
|
||||
'lelong_id',
|
||||
'kodcaw',
|
||||
'back_acc_pembeli',
|
||||
'bank_acc_no_pembeli',
|
||||
|
||||
@@ -13,7 +13,7 @@ class resit extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'lelongbid_id',
|
||||
'lelong_id',
|
||||
'reference_no',
|
||||
'billplz_id',
|
||||
'total_payment',
|
||||
|
||||
@@ -18,6 +18,7 @@ class CreatePaymentTable extends Migration
|
||||
$table->unsignedBigInteger('user_id')->unsigned();
|
||||
$table->unsignedBigInteger('lelongbidder_id')->unsigned()->nullable();
|
||||
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
|
||||
$table->unsignedBigInteger('lelong_id')->unsigned();
|
||||
$table->string('kodcaw')->nullable();
|
||||
$table->string('back_acc_pembeli')->nullable();
|
||||
$table->string('bank_acc_no_pembeli')->nullable();
|
||||
@@ -54,12 +55,16 @@ class CreatePaymentTable extends Migration
|
||||
$table->foreign('lelongbidder_id')
|
||||
->references('id')->on('lelongbidder')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('lelong_id')
|
||||
->references('id')->on('lelong')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::create('resit', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('user_id')->unsigned();
|
||||
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
|
||||
$table->unsignedBigInteger('lelong_id')->unsigned();
|
||||
$table->string('reference_no')->nullable();
|
||||
$table->string('billplz_id');
|
||||
$table->decimal('total_payment', $precision = 9, $scale = 2);
|
||||
@@ -72,8 +77,8 @@ class CreatePaymentTable extends Migration
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('lelongbid_id')
|
||||
->references('id')->on('lelongbid')
|
||||
$table->foreign('lelong_id')
|
||||
->references('id')->on('lelong')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
@elseif ($lel->sts_lelong == 2)
|
||||
<a href="{{ route('lelong.janapemenang',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Jana Pemenang"><i class="fas fa-users-cog"></i></a>
|
||||
@elseif ($lel->sts_lelong == 3)
|
||||
<a href="{{ route('lelong.janapemenang',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Senarai Pemenang"><i class="fas fa-trophy"></i></a>
|
||||
<a href="{{ route('lelong.senaraipemenang',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Senarai Pemenang"><i class="fas fa-trophy"></i></a>
|
||||
@else
|
||||
<a class="stoplelong" href="{{ route('lelong.stop',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Tamat Lelong"><i class="fa fa-stop"></i></a>
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
@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
|
||||
<table class="table table-striped table-xl text-center" id="tablekaunter" style="width:100%">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama</th>
|
||||
<th>No Kad Pengenalan</th>
|
||||
<th>No Telefon</th>
|
||||
<th>Bilangan Surat</th>
|
||||
<th>Jumlah Bidaan(RM)</th>
|
||||
<th>Jumlah Pembayaran(RM)</th>
|
||||
<th>Penyata Bayaran</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($senaraiwinner as $winner)
|
||||
<tr>
|
||||
<td> {{ $loop->iteration }} </td>
|
||||
<td>{{ $winner['name']}}</td>
|
||||
<td>{{ $winner['nokp']}}</td>
|
||||
<td>{{ $winner['notelbimbit']}}</td>
|
||||
<td>{{ $winner['total_surat']}}</td>
|
||||
<td>{{ $winner['totalBid']}}</td>
|
||||
<td>{{ $winner['totalPay']}}</td>
|
||||
<td>
|
||||
<a href="{{ route('serahan.penyatabayaran',['user_id'=>$winner['id'],'lelong_id'=>$lelong_id]) }}" target = "blank" ><i class="fas fa-download"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
@if( $winner['totalPay'] < $winner['totalBid'] )
|
||||
<a href=" {{ route('pembayaran.SAGBidItem', ['user_id'=>$winner['id'], 'lelong_id'=>$lelong_id]) }} "><i class="far fa-edit"></i></a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var tablekaunter = $('#tablekaunter').DataTable({
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": 0,
|
||||
"orderable": false
|
||||
},
|
||||
{
|
||||
"targets": 7,
|
||||
"orderable": false
|
||||
},
|
||||
{
|
||||
"targets": 6,
|
||||
"orderable": false
|
||||
}
|
||||
],
|
||||
order: [[1, 'asc']],
|
||||
"info": false,
|
||||
"lengthChange": false,
|
||||
"pageLength": 15,
|
||||
dom: 'Bfrtip',
|
||||
// buttons: [
|
||||
// {
|
||||
// className: 'btn btn-outline-success pl-4 pr-4 btn-sm addcaw',
|
||||
// text: '<i class="fas fa-plus" id="test"></i>',
|
||||
// titleAttr: 'Tambah Cawangan',
|
||||
// action: function ( e, dt, node, config ) {
|
||||
// // alert( 'Button activated' );
|
||||
// // console.log('hye');
|
||||
|
||||
// $('#myModal').modal("show");
|
||||
// $('#myModal').on('shown.bs.modal', function () {
|
||||
// $('#rolename').trigger('focus')
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// {
|
||||
// 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();
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
});
|
||||
|
||||
// $('.addcaw').tooltip();
|
||||
// $('.export').tooltip();
|
||||
// // $( '.dt-buttons').addClass('btn-group');
|
||||
// $( '.addcaw').removeClass('dt-button');
|
||||
// $( '.export').removeClass('dt-button');
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<th>Bilangan Surat</th>
|
||||
<th>Jumlah Bidaan(RM)</th>
|
||||
<th>Jumlah Pembayaran(RM)</th>
|
||||
<th>Resit Bayaran</th>
|
||||
<th>Penyata Bayaran</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -35,7 +35,7 @@
|
||||
<td>{{ $winner['totalBid']}}</td>
|
||||
<td>{{ $winner['totalPay']}}</td>
|
||||
<td>
|
||||
<a href=" # " target = "blank" ><i class="fas fa-download"></i></a>
|
||||
<a href="{{ route('serahan.penyatabayaran',['user_id'=>$winner['details']['id'],'lelong_id'=>$lelong_id]) }}" target = "blank" ><i class="fas fa-download"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
@if( $winner['totalPay'] < $winner['totalBid'] )
|
||||
|
||||
@@ -77,6 +77,7 @@ Route::group(['prefix'=>'lelong'], function () {
|
||||
Route::group(['middleware' => ['permission:pendaftaranbatch']], function () {
|
||||
Route::get('/create/{id}',['as'=>'lelong.create','uses'=>'LelongController@create']);
|
||||
Route::get('/senarailelong',['as'=>'lelong.senarailelong','uses'=>'LelongController@index']);
|
||||
Route::get('/senaraipemenang/{lelong_id}',['as'=>'lelong.senaraipemenang','uses'=>'LelongController@senaraipemenang']);
|
||||
Route::get('/senarailelongtaklaku',['as'=>'lelong.senarailelongtaklaku','uses'=>'LelongController@senarailelongtaklaku']);
|
||||
Route::get('/lelongtaklaku/{lelong_id}',['as'=>'lelong.lelongtaklaku','uses'=>'LelongController@lelongtaklaku']);
|
||||
Route::get('/showlelong/{id}',['as'=>'lelong.show','uses'=>'LelongController@show']);
|
||||
|
||||
Reference in New Issue
Block a user