Merge branch 'faiqahzaman' into azfar_dev
This commit is contained in:
@@ -27,6 +27,7 @@ use App\Models\LelongBidder;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
@@ -436,6 +437,13 @@ class LelongController extends Controller
|
||||
|
||||
public function janapemenang($id){
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
|
||||
$lelong = Lelong::where('id','=',$id)->first();
|
||||
$lelongbid = LelongBid::where('lelong_id','=',$id)->get();
|
||||
foreach($lelongbid as $bid)
|
||||
@@ -461,6 +469,24 @@ class LelongController extends Controller
|
||||
$updatebid->nopembeli = $bidder->user_id;
|
||||
$updatebid->status_jual = 1;
|
||||
$updatebid->save();
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
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->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
|
||||
{
|
||||
|
||||
@@ -41,18 +41,34 @@ class PaymentController extends Controller
|
||||
)
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get()->toArray();
|
||||
// dd($listwinner);
|
||||
|
||||
foreach($listwinner as $index1=>$winner){
|
||||
|
||||
$userdetails = User::where('id', $winner['user_id'])->first();
|
||||
// dd($userdetails);
|
||||
$SAGWin = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
// ->join('payment', 'lelongbidder.lelongbid_id', '=', 'payment.lelongbid_id')
|
||||
->where('user_id', $winner['user_id'])
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->get();
|
||||
|
||||
$total_payment = 0;
|
||||
foreach($SAGWin as $SAG){
|
||||
$payment = Payment::where('lelongbid_id', $SAG->lelongbid_id)
|
||||
->first();
|
||||
// dd($payment->total_payment);
|
||||
|
||||
if($payment){
|
||||
$total_payment = $total_payment + $payment->total_payment;
|
||||
}
|
||||
}
|
||||
|
||||
$listwinner[$index1]['details'] = $userdetails;
|
||||
$listwinner[$index1]['total_surat'] = sizeof($SAGWin);
|
||||
$listwinner[$index1]['totalBid'] = $SAGWin->sum('hargabida');
|
||||
$listwinner[$index1]['totalPay'] = $total_payment;
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +91,7 @@ class PaymentController extends Controller
|
||||
)
|
||||
->first();
|
||||
|
||||
foreach($SAGBidItem as $eachbid){
|
||||
// foreach($SAGBidItem as $eachbid){
|
||||
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
@@ -85,11 +101,12 @@ class PaymentController extends Controller
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id'
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
return view('pembayaran.SAGBidItem',compact('SAGBidItem', 'eachbid'));
|
||||
}
|
||||
@@ -98,14 +115,7 @@ class PaymentController extends Controller
|
||||
// dd($request->all());
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateString();
|
||||
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$day = $current->day;
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
@@ -124,25 +134,11 @@ class PaymentController extends Controller
|
||||
)
|
||||
->first();
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
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 = $request->user_id;
|
||||
$resit->lelongbid_id = $bid;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = '';
|
||||
$resit->total_payment = $request->amaunkiraan;
|
||||
$resit->resit_type = 2; // 1 = fee , 2 = bid
|
||||
$resit = Resit::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $currentdate;
|
||||
$resit->save();
|
||||
$resit->update();
|
||||
|
||||
$payment = Payment::create([
|
||||
'user_id' => $request->user_id,
|
||||
@@ -169,11 +165,14 @@ class PaymentController extends Controller
|
||||
'disahkan_pada' => $currentdate
|
||||
]);
|
||||
|
||||
$updatelelbidbidder = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->update(array(
|
||||
'lelongbid.status_jual' => 1,
|
||||
'lelongbid.t_jual' => $currentdate
|
||||
));
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 1;
|
||||
$updatelelbidbidder->update();
|
||||
|
||||
$eachbid->status_jual = 1;
|
||||
$eachbid->t_jual = $currentdate;
|
||||
$eachbid->update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreatePaymentTable extends Migration
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('user_id')->unsigned();
|
||||
$table->unsignedBigInteger('lelongbidder_id')->unsigned()->nullable();
|
||||
$table->unsignedBigInteger('lelongbid_id')->unsigned();
|
||||
$table->unsignedBigInteger('lelongbid_id')->unsigned()->nullable();
|
||||
$table->string('kodcaw')->nullable();
|
||||
$table->string('back_acc_pembeli')->nullable();
|
||||
$table->string('bank_acc_no_pembeli')->nullable();
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<td class="text-center">
|
||||
@hasrole('jurulelong')
|
||||
|
||||
@if(!$lel->masatamat_lelong)
|
||||
@if($lel->sts_lelong == 0)
|
||||
<a href="{{ route('lelong.refresh',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Kemaskini Data"><i class="fas fa-sync-alt"></i></a>
|
||||
<a class="startlelong" href="{{ route('lelong.start',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Start Lelong"><i class="fa fa-play"></i></a>
|
||||
<a class="confirmdel" href="{{ route('lelong.delete',$lel->id) }}" data-toggle="tooltip" data-placement="top" title="Delete"><i class="far fa-trash-alt"></i></a>
|
||||
|
||||
@@ -36,18 +36,24 @@
|
||||
<td class="text-center">{{ $biditem->norujukan}}</td>
|
||||
<td class="text-center">{{ $biditem->hargaasas}}</td>
|
||||
<td class="text-center">{{ $biditem->hargabida}}</td>
|
||||
<td class="text-center"><input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" data-bid_id="{{ $biditem->lelongbid_id}}" onclick="sum(this.value,this)" value="{{ $biditem->hargabida }}"></td>
|
||||
<td class="text-center">
|
||||
@if($biditem->status_payment == 0)
|
||||
<input type="checkbox" aria-label="Checkbox for following text input" name="checkboxdata[]" data-bid_id="{{ $biditem->lelongbid_id}}" onclick="sum(this.value,this)" value="{{ $biditem->hargabida }}">
|
||||
@else
|
||||
<span class="btn btn-danger btn-sm hovernone-danger">PAID</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<tr>
|
||||
<td colspan="3"><b> Jumlah Bayaran </b></td>
|
||||
<td colspan="3"><b> Jumlah Bayaran</b></td>
|
||||
<td class="text-center"><b>RM<input type="text" id="total" value="0" style="border: none;" readonly></b></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="text-right">
|
||||
<button type="button" class="btn btn-danger" style="width:15%" onclick="functerima()">Terima</button>
|
||||
<button type="button" class="btn btn-success" style="width:15%" id="btnterima" onclick="functerima()">Terima</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +164,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" onclick="funcbatal()">Batal</button>
|
||||
<button type="button" class="btn btn-success" data-toggle="modal" data-target=".bd-example-modal-sm" onclick="terimadeno()" >Terima</button>
|
||||
<button type="button" class="btn btn-success" data-toggle="modal" data-target=".bd-example-modal-sm" onclick="terimadeno()" >Terima</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -168,6 +174,7 @@
|
||||
|
||||
<script>
|
||||
var arraylelongbid = [];
|
||||
$("#btnterima").prop("disabled", true);
|
||||
function terimadeno() {
|
||||
$('#eachbid').val(arraylelongbid);
|
||||
$("#formpaymentdenokaunter").submit();
|
||||
@@ -176,11 +183,21 @@
|
||||
$('#denominasiHQModal').modal('hide');
|
||||
}
|
||||
function functerima(){
|
||||
|
||||
$('#denominasiHQModal').modal('show');
|
||||
var total_sum = parseFloat($('#total').val());
|
||||
$('#amaundiminta').val(parseFloat(total_sum).toFixed(2));
|
||||
}
|
||||
function sum(val, e){ //e = get all data
|
||||
if(arraylelongbid.length != 0)
|
||||
{
|
||||
$("#btnterima").prop("disabled", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#btnterima").prop("disabled", true);
|
||||
}
|
||||
|
||||
let bid_id = $(e).data('bid_id');
|
||||
console.log(bid_id);
|
||||
if(e.checked==true) //checkbox
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<th>No Telefon</th>
|
||||
<th>Bilangan Surat</th>
|
||||
<th>Jumlah Bidaan(RM)</th>
|
||||
<th>Jumlah Pembayaran(RM)</th>
|
||||
<th>Resit Bayaran</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
@@ -32,10 +33,15 @@
|
||||
<td>{{ $winner['details']['notelbimbit']}}</td>
|
||||
<td>{{ $winner['total_surat']}}</td>
|
||||
<td>{{ $winner['totalBid']}}</td>
|
||||
<td>{{ $winner['totalPay']}}</td>
|
||||
<td>
|
||||
<a href=" # " target = "blank" ><i class="fas fa-download"></i></a>
|
||||
</td>
|
||||
<td><a href=" {{ route('pembayaran.SAGBidItem', ['user_id'=>$winner['details']['id'], 'lelong_id'=>$lelong_id]) }} "><i class="far fa-edit"></i></a></td>
|
||||
<td>
|
||||
@if( $winner['totalPay'] < $winner['totalBid'] )
|
||||
<a href=" {{ route('pembayaran.SAGBidItem', ['user_id'=>$winner['details']['id'], 'lelong_id'=>$lelong_id]) }} "><i class="far fa-edit"></i></a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user