Add details payment role operasi

This commit is contained in:
Amir
2023-02-21 05:05:08 +08:00
parent 1913c36ba9
commit 37b70cc5d3
5 changed files with 175 additions and 63 deletions
+36 -2
View File
@@ -22,18 +22,20 @@ use App\Models\LogUser;
use App\Models\FileResit;
use App\Models\Invoice;
use App\Models\ScanJual;
use App\Services\ResitPhotoService;
class PembidaController extends Controller
{
private $resitPhotoService;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
public function __construct(ResitPhotoService $resitPhotoService)
{
$this->middleware('auth');
$this->resitPhotoService = $resitPhotoService;
}
/**
@@ -311,6 +313,7 @@ class PembidaController extends Controller
$listwinner[$index1]['payment_id'] = $payment_id;
$listwinner[$index1]['jenisbayaran']['status_payment'] = $sag->status_payment;
$listwinner[$index1]['jenisbayaran']['status'] = ($detailspayment) ? $detailspayment['status'] : 0;
$listwinner[$index1]['jenisbayaran']['kaedah_bayaran'] = ($detailspayment) ? $detailspayment['status_payment_opt'] : 0;
}
@@ -376,6 +379,37 @@ class PembidaController extends Controller
return view('pembida.detailsbidaan', compact('infos', 'userdetail', 'kodcaw'));
}
public function detailsbayaran($lelong_id, $user_id, $kodcaw)
{
$lelong = Lelong::find($lelong_id, ['id', 'tarikh_lelong']);
$cawangan = Cawangan::where('caw_code', $kodcaw)->select('id', 'caw_name')->first();
$user = User::find($user_id, ['id', 'name']);
$lelong_bid_all = LelongBid::join('cawangan', 'lelongbid.kodcaw', '=', 'cawangan.caw_code')
->join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
->where('lelongbid.nopembeli', $user_id)
->where('cawangan.caw_code', $kodcaw)
->where('lelongbid.kodcaw', $kodcaw)
->where('lelongbidder.status_payment', 1)
->where('lelongbid.lelong_id', $lelong_id)
->select('lelongbid.id', 'norujukan', 'hargabida')
->get();
$disahkan_oleh = Payment::with('disahkanOleh:id,name')->where('lelongbid_id', $lelong_bid_all[0]->id)->where('disahkan_oleh', '<>', null)->select('id', 'disahkan_oleh', 'disahkan_pada', 'remark')->first();
$total_payment = $lelong_bid_all->sum('hargabida');
$fileresit_all = FileResit::where('lelong_id', $lelong_id)->where('user_id', $user_id)->where('kodcaw', $kodcaw)->get();
if ($disahkan_oleh->remark == "BERJAYA BAYARAN ONLINE") {
$disahkan_oleh->remark = "FPX";
}
return view('pembida.detailspembayaran', compact('lelong', 'cawangan', 'user', 'fileresit_all', 'total_payment', 'disahkan_oleh'));
}
public function showPhotoResit(Request $request)
{
$resit = FileResit::where('id', '=', $request->fileresit_id)->first();
return $this->resitPhotoService->show($request->user_id, $resit);
}
public function belumbayarbidaan(Request $request)
{