This commit is contained in:
edmondlang
2024-01-02 19:32:02 +08:00
parent 5d0052a671
commit 72a945613a
2 changed files with 20 additions and 3 deletions
@@ -15,11 +15,12 @@
$subtotal = "0";
$voucherDiscount = $voucher_redemption ? bcmul((string)$voucher_redemption->value, "-1", 2) : "0";
$displayedSubtotal = 0;
$currency_id = $transaction->currency_id
@endphp
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
@php
$exactUnitPrice = bcdiv($transaction_detail->price, $transaction->currency_rate, 7);
$exactUnitPrice = ($currency_id) === 1 : $transaction_detail->price : bcdiv($transaction_detail->price, $transaction->currency_rate, 7);
$displayUnitPrice = round($exactUnitPrice, 2);
$itemTotal = bcmul($exactUnitPrice, $transaction_detail->quantity, 5);
$displayedItemTotal = round(bcmul($displayUnitPrice, $transaction_detail->quantity, 7), 2);
+18 -2
View File
@@ -112,7 +112,7 @@ Route::get('/transfer/{marking}', function ($marking) {
return view('pages.bookings.profile', ['marking' => $marking]);
})->name('booking.details');
Route::get('/transfer/{marking}/latest-invoice', function ($marking) {
Route::get('/transfer/{marking}/latest/{document_type}', function ($marking, $document_type) {
$booking= Booking::where('marking', $marking)->first();
$purchaseOrder = $booking->transactions()
@@ -126,7 +126,23 @@ Route::get('/transfer/{marking}/latest-invoice', function ($marking) {
$supplier = Company::where('id', $transaction->receiver)->first();
$lowercaseDocumentType = strtolower(DocumentType::INVOICE);
$lowercaseDocumentType = null;
switch ($document_type) {
case 'po':
$lowercaseDocumentType = DocumentType::PURCHASE_ORDER;
break;
case 'do':
$lowercaseDocumentType = DocumentType::DELIVER_ORDER;
break;
case 'sdo':
$lowercaseDocumentType = DocumentType::SUPPLIER_DELIVER_ORDER;
break;
default:
$lowercaseDocumentType = DocumentType::INVOICE;
break;
}
$lowercaseDocumentType = strtolower($lowercaseDocumentType);
$voucherRedemption = $transaction->voucherRedemption;