update 14/6
This commit is contained in:
@@ -14,6 +14,7 @@ use App\Models\Payment;
|
||||
use App\Models\LelongBid;
|
||||
use App\Models\LelongBidder;
|
||||
use App\Models\Resit;
|
||||
use App\Models\FileResit;
|
||||
|
||||
class AccountController extends Controller
|
||||
{
|
||||
@@ -30,14 +31,23 @@ class AccountController extends Controller
|
||||
return view('account.senarailelongan',compact('senarai'));
|
||||
}
|
||||
|
||||
public function listbayaranonline($lelong_id){
|
||||
public function listbayaranonline($lelong_id, $caw_code)
|
||||
{
|
||||
$getkodcaw = CawanganLelong::join('lelong', 'cawangan_lelong.lelong_id', '=', 'lelong.id')
|
||||
->join('cawangan','cawangan_lelong.caw_id', '=', 'cawangan.id')
|
||||
->where('lelong.id', $lelong_id)
|
||||
->where('caw_code')
|
||||
->select('cawangan.caw_name')
|
||||
->get();
|
||||
|
||||
$getkodcaw = Cawangan::where('caw_code', $caw_code)->select('caw_name')->first();
|
||||
|
||||
|
||||
$listwinner = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('payment', 'lelongbidder.payment_id', 'payment.id')
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('payment.status_payment_opt','=', '3,2')
|
||||
->where('payment.status_payment_opt', 3)
|
||||
->orWhere('payment.status_payment_opt', 2)
|
||||
->where('lelongbidder.status_payment', 2)
|
||||
->whereNull('payment.disahkan_pada')
|
||||
->select('.lelongbidder.user_id'
|
||||
@@ -45,7 +55,6 @@ class AccountController extends Controller
|
||||
->groupBy('lelongbidder.user_id')
|
||||
->get();
|
||||
|
||||
// dd($listwinner);
|
||||
foreach($listwinner as $index1=>$winner){
|
||||
|
||||
$userdetails = User::where('id', $winner['user_id'])->first();
|
||||
@@ -82,26 +91,42 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
|
||||
return view('account.listbayaranonline',compact('listwinner','lelong_id'));
|
||||
return view('account.listbayaranonline',compact('listwinner','lelong_id', 'getkodcaw', 'caw_code'));
|
||||
}
|
||||
|
||||
public function sahsagonline($lelong_id, $user_id)
|
||||
public function sahsagonline($lelong_id, $user_id, $caw_code)
|
||||
{
|
||||
$userdetails = User::where('id', $user_id)->first();
|
||||
|
||||
$senaraisag = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('payment', 'lelongbidder.payment_id', '=', 'payment.id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('lelongbid.kodcaw', $caw_code)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('payment.status_payment_opt', '=', '3,2')
|
||||
->where('payment.status_payment_opt', 3)
|
||||
->orWhere('payment.status_payment_opt', 2)
|
||||
->where('lelongbidder.status_payment', 2)
|
||||
->get()->toArray();
|
||||
|
||||
foreach($senaraisag as $index1=>$sag)
|
||||
{
|
||||
$checking = Payment::join('lelongbid', 'payment.lelong_id', '=', 'lelongbid.lelong_id')
|
||||
->where('lelongbid.status_jual', 1)
|
||||
->where('lelongbid.status_payment', 1)
|
||||
->whereNotNull('payment.disahkan_pada')
|
||||
->whereNotNull('payment.disahkan_pada')
|
||||
->first();
|
||||
}
|
||||
|
||||
$saggroupbyid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('payment', 'lelongbidder.payment_id', '=', 'payment.id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('lelongbid.kodcaw', $caw_code)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('payment.status_payment_opt', '=', '3,2')
|
||||
->where('payment.status_payment_opt', 3)
|
||||
->orWhere('payment.status_payment_opt', 2)
|
||||
->where('lelongbidder.status_payment', 2)
|
||||
->select(
|
||||
'lelongbidder.payment_id as payment_id'
|
||||
@@ -110,14 +135,24 @@ class AccountController extends Controller
|
||||
->get();
|
||||
// $payments = Payment::whereIn($saggroupbyid)->get()
|
||||
$total_payment = Payment::whereIn('id',$saggroupbyid)->get()->sum('total_payment');
|
||||
|
||||
|
||||
return view('account.sahsagonline', compact('senaraisag', 'lelong_id', 'user_id', 'total_payment'));
|
||||
$getresit = FileResit::join('payment', 'fileresit.payment_id', '=', 'payment.id')
|
||||
->where('payment.lelong_id', $lelong_id)
|
||||
->where('payment.user_id', $user_id)
|
||||
->where('payment.kodcaw', $caw_code)
|
||||
->get()->toArray();
|
||||
|
||||
$array_resit = [];
|
||||
foreach($getresit as $index1=>$resit)
|
||||
{
|
||||
$getresit[$index1]['resit64'] = 'data:image/' . $resit['file_type'] . ';base64' . base64_encode($resit['filename']);
|
||||
}
|
||||
|
||||
return view('account.sahsagonline', compact('senaraisag', 'lelong_id', 'user_id', 'total_payment', 'caw_code', 'userdetails', 'getresit', 'checking'));
|
||||
}
|
||||
|
||||
public function sahbayaronline(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
@@ -128,7 +163,8 @@ class AccountController extends Controller
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('payment.status_payment_opt', '3,2')
|
||||
->where('payment.status_payment_opt', 3)
|
||||
->orWhere('payment.status_payment_opt', 2)
|
||||
->where('lelongbidder.status_payment', 2)
|
||||
->select(
|
||||
'lelongbid.id as lelongbid_id',
|
||||
@@ -144,7 +180,8 @@ class AccountController extends Controller
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('payment.status_payment_opt', '3,2')
|
||||
->where('payment.status_payment_opt', 3)
|
||||
->orWhere('payment.status_payment_opt', 2)
|
||||
->where('lelongbidder.status_payment', 2)
|
||||
->select(
|
||||
'lelongbidder.payment_id as payment_id'
|
||||
|
||||
@@ -664,37 +664,16 @@ class MarhunController extends Controller
|
||||
$rugilelong = $totalbaki;
|
||||
}
|
||||
|
||||
// if($gadaimarhun)
|
||||
// {
|
||||
$marhuns[$index1]['harga_gadai'] = $marhun['old_harga'];
|
||||
$marhuns[$index1]['nmarhun_gadai'] = $marhun['old_nmarhun'];
|
||||
$marhuns[$index1]['old_marhun'] = $marhun['marhun'];
|
||||
$marhuns[$index1]['status_ubah'] = $status;
|
||||
$marhuns[$index1]['pembiayaan'] = $lelongbid->pinjaman;
|
||||
$marhuns[$index1]['baki_lelong'] = $bakilelong;
|
||||
$marhuns[$index1]['rugi_lelong'] = $rugilelong;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $marhuns[$index1]['harga_gadai'] = 0;
|
||||
// $marhuns[$index1]['nmarhun_gadai'] = 0;
|
||||
// $marhuns[$index1]['old_marhun'] = 0;
|
||||
// $marhuns[$index1]['status_ubah'] = 0;
|
||||
// $marhuns[$index1]['pembiayaan'] = 0;
|
||||
// $marhuns[$index1]['baki_lelong'] = 0;
|
||||
// $marhuns[$index1]['rugi_lelong'] = 0;
|
||||
// }
|
||||
|
||||
// $marhuns[$index1]['harga_gadai'] = $gadaimarhun->harga;
|
||||
// $marhuns[$index1]['nmarhun_gadai'] = $gadaimarhun->n_marhun;
|
||||
// $marhuns[$index1]['old_marhun'] = $gadaimarhun->marhun;
|
||||
// $marhuns[$index1]['status_ubah'] = $status;
|
||||
// $marhuns[$index1]['pembiayaan'] = $lelongbid->pinjaman;
|
||||
// $marhuns[$index1]['bakiupah'] = $lelongbid->bakiupah;
|
||||
// $marhuns[$index1]['baki_lelong'] = $bakilelong;
|
||||
// $marhuns[$index1]['rugi_lelong'] = $rugilelong;
|
||||
$marhuns[$index1]['harga_gadai'] = $marhun['old_harga'];
|
||||
$marhuns[$index1]['nmarhun_gadai'] = $marhun['old_nmarhun'];
|
||||
$marhuns[$index1]['old_marhun'] = $marhun['marhun'];
|
||||
$marhuns[$index1]['status_ubah'] = $status;
|
||||
$marhuns[$index1]['pembiayaan'] = $lelongbid->pinjaman;
|
||||
$marhuns[$index1]['bakiupah'] = $lelongbid->bakiupah;
|
||||
$marhuns[$index1]['baki_lelong'] = $bakilelong;
|
||||
$marhuns[$index1]['rugi_lelong'] = $rugilelong;
|
||||
}
|
||||
// dd($marhuns);
|
||||
|
||||
array_push($arraylelbidmarhun,$marhuns);
|
||||
}
|
||||
|
||||
@@ -740,7 +719,9 @@ class MarhunController extends Controller
|
||||
{
|
||||
if($bidmarhuns->status_ubah == 3)
|
||||
{
|
||||
$bidmarhuns->delete();
|
||||
$deletemarhun = LelongBidMarhun::where('id', $bidmarhuns->lelongbidmarhun_id)
|
||||
->where('lelongbid_id', $bidmarhuns->lelongbid_id)
|
||||
->delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -751,8 +732,10 @@ class MarhunController extends Controller
|
||||
|
||||
$pengesahans = Pengesahan::join('lelongbidmarhun', 'pengesahan.lelongbid_id', '=', 'lelongbidmarhun.lelongbid_id')
|
||||
->where('pengesahan.lelongbid_id', $terimalel['lelongbid_id'])
|
||||
->select('pengesahan.id as pengesahan_id')
|
||||
->first();
|
||||
->select('pengesahan.id as pengesahan_id',
|
||||
'pengesahan.status'
|
||||
)
|
||||
->update(['status' => 1]);
|
||||
|
||||
$lelongbids = LelongBid::where('id', $lelongbid['id'])->first();
|
||||
$lelongbids->marhun = str_replace( $txtmarhun,"",$lelongbids->marhun);
|
||||
|
||||
@@ -12,6 +12,8 @@ use App\Models\LelongBidder;
|
||||
use App\Models\LelongBidMarhun;
|
||||
use App\Models\Payment;
|
||||
use App\Models\User;
|
||||
use App\Models\File;
|
||||
use App\Models\FileResit;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -83,6 +85,7 @@ class PaymentController extends Controller
|
||||
foreach($payment_id as $id){
|
||||
$payment = Payment::where('id', $id->payment_id)
|
||||
->first();
|
||||
// dd($payment);
|
||||
|
||||
if($payment){
|
||||
$total_payment = $total_payment + $payment->total_payment;
|
||||
@@ -128,8 +131,20 @@ class PaymentController extends Controller
|
||||
'lelongbidder.status_payment'
|
||||
)
|
||||
->get();
|
||||
// dd($eachbid);
|
||||
|
||||
$getresit = FileResit::join('payment', 'fileresit.payment_id', '=', 'payment.id')
|
||||
->where('payment.lelong_id', $lelong_id)
|
||||
->where('payment.user_id', $user_id)
|
||||
->get()->toArray();
|
||||
|
||||
return view('pembayaran.SAGBidItem',compact('SAGBidItem', 'eachbid', 'lelong_id','user_id'));
|
||||
$array_resit = [];
|
||||
foreach($getresit as $index1=>$resit)
|
||||
{
|
||||
$getresit[$index1]['resit64'] = 'data:image/' . $resit['file_type'] . ';base64' . base64_encode($resit['filename']);
|
||||
}
|
||||
|
||||
return view('pembayaran.SAGBidItem',compact('SAGBidItem', 'eachbid', 'lelong_id','user_id', 'getresit'));
|
||||
}
|
||||
|
||||
public function paymentdenokaunter(Request $request){
|
||||
@@ -243,66 +258,112 @@ class PaymentController extends Controller
|
||||
public function banktransfer(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
//eachbid = lelongbid_id
|
||||
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
// $totalcheck = implode(",", $request->checkboxdata);
|
||||
$bid_id = explode(",", $request->eachbid); //bid_id = lelongbid_id
|
||||
|
||||
$resit = Resit::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->where('resit_type', 2)
|
||||
$paymentexist = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->first();
|
||||
|
||||
$payment = new Payment;
|
||||
$payment->user_id = $request->user_id;
|
||||
$payment->lelong_id = $request->lelong_id;
|
||||
$payment->kodcaw = $user->kodcaw;
|
||||
$payment->status_payment_opt = 3;
|
||||
$payment->status = 2;
|
||||
$payment->remark = 'BAYARAN CDM';
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->total_payment = $request->total;
|
||||
$payment->diminta_pada = $currentdate;
|
||||
$payment->diminta_oleh = $user->id;
|
||||
$payment->save();
|
||||
|
||||
foreach($bid_id as $bid){
|
||||
if($paymentexist)
|
||||
{
|
||||
$getpayment = Payment::join('fileresit', 'payment.id', '=', 'fileresit.payment_id')
|
||||
->where('payment.lelong_id', $request->lelong_id)
|
||||
->where('payment.user_id', $request->user_id)
|
||||
->select('payment.id as payment_id',
|
||||
'payment.lelong_id',
|
||||
'payment.user_id',
|
||||
'fileresit.id as fileresit_id',
|
||||
'fileresit.file_type',
|
||||
'fileresit.filename'
|
||||
)
|
||||
->first();
|
||||
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
$data = base64_encode($request->resit->get());
|
||||
$file_type = $request->resit->extension();
|
||||
|
||||
$updatepayment = FileResit::where('payment_id', $getpayment['payment_id'])
|
||||
->where('id', $getpayment['fileresit_id'])
|
||||
->first();
|
||||
$updatepayment->id;
|
||||
$updatepayment->user_id = $request->user_id;
|
||||
$updatepayment->payment_id = $updatepayment->payment_id;
|
||||
$updatepayment->file_type = $file_type;
|
||||
$updatepayment->filename = $data;
|
||||
$updatepayment->update();
|
||||
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $request->lelong_id)
|
||||
->with('success','Ubah Resit Berjaya, Tunggu Pengesahan Akaun');
|
||||
}
|
||||
else
|
||||
{
|
||||
$bid_id = $request->eachbid;
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 1;
|
||||
$updatelelbidbidder->payment_id = $payment->id;
|
||||
$updatelelbidbidder->save();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id',$bid)->first();
|
||||
$eachbidupdate->status_jual = 1;
|
||||
$eachbidupdate->status_payment = 2;
|
||||
$eachbidupdate->t_jual = $currentdate;
|
||||
$eachbidupdate->hargajual = $eachbid->hargabida;
|
||||
$eachbidupdate->save();
|
||||
$user = Auth::user();
|
||||
|
||||
// $imageName = time().'.'.$request->resit->extension();
|
||||
$data = base64_encode($request->resit->get());
|
||||
$file_type = $request->resit->extension();
|
||||
|
||||
$resit = Resit::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->where('resit_type', 2)
|
||||
->first();
|
||||
|
||||
$payment = new Payment;
|
||||
$payment->user_id = $request->user_id;
|
||||
$payment->lelong_id = $request->lelong_id;
|
||||
$payment->kodcaw = $user->kodcaw;
|
||||
$payment->status_payment_opt = 3;
|
||||
$payment->status = 2;
|
||||
$payment->remark = 'BAYARAN CDM';
|
||||
$payment->resit_id = $resit->id;
|
||||
$payment->total_payment = $request->total_payment;
|
||||
$payment->diminta_pada = $currentdate;
|
||||
$payment->diminta_oleh = $user->id;
|
||||
$payment->save();
|
||||
|
||||
$addfile = new FileResit;
|
||||
$addfile->user_id = $request->user_id;
|
||||
$addfile->payment_id = $payment->id;
|
||||
$addfile->file_type = $file_type;
|
||||
$addfile->filename = $data;
|
||||
$addfile->save();
|
||||
|
||||
foreach($bid_id as $bid)
|
||||
{
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
->join('users', 'lelongbidder.user_id', '=', 'users.id')
|
||||
->where('lelongbidder.lelongbid_id', $bid)
|
||||
->select('lelongbidder.hargabida',
|
||||
'lelongbid.hargaasas',
|
||||
'lelongbid.norujukan',
|
||||
'lelongbidder.lelongbid_id',
|
||||
'lelongbidder.id as lelongbidder_id',
|
||||
'lelongbid.lelong_id as lelong_id'
|
||||
)
|
||||
->first();
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->where('user_id',$request->user_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 2;
|
||||
$updatelelbidbidder->payment_id = $payment->id;
|
||||
$updatelelbidbidder->save();
|
||||
|
||||
$eachbidupdate = LelongBid::where('id',$bid)->first();
|
||||
$eachbidupdate->hargajual = $eachbid->hargabida;
|
||||
$eachbidupdate->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('pembayaran.kaunterpembayaran', $request->lelong_id)
|
||||
->with('success','Menunggu Pengesahan Akaun');
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('pembayaran.SenaraiLelongBayar')
|
||||
->with('success','Menunggu Pengesahan Account');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user