mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 17:34:02 +00:00
show latest invoice in html
This commit is contained in:
@@ -110,6 +110,27 @@ Route::get('/transfer/{marking}', function ($marking) {
|
||||
return view('pages.bookings.profile', ['marking' => $marking]);
|
||||
})->name('booking.details');
|
||||
|
||||
Route::get('/transfer/{marking}/latest-invoice', function ($marking) {
|
||||
$booking= Booking::where('marking', $marking)->first();
|
||||
|
||||
$purchaseOrder = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->complete()
|
||||
->first();
|
||||
|
||||
$transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->latest()->get()[0];
|
||||
|
||||
$supplier = Company::where('id', $transaction->receiver)->first();
|
||||
|
||||
$lowercaseDocumentType = strtolower(DocumentType::INVOICE);
|
||||
|
||||
$voucherRedemption = $transaction->voucherRedemption;
|
||||
|
||||
return view('pages.pdfs.' . $lowercaseDocumentType, ['transaction' => $transaction, 'po_order_transaction' => $purchaseOrder, 'supplier' => $supplier, 'voucher_redemption' => $voucherRedemption]);
|
||||
})->name('booking.details.latest_invoice');
|
||||
|
||||
Route::get('/transfer/merge/{marking}', function ($marking) {
|
||||
return view('pages.bookings.merge', ['marking' => $marking]);
|
||||
})->name('booking.merge');
|
||||
|
||||
Reference in New Issue
Block a user