diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index ca45e766..f75cbeed 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -1,21 +1,20 @@ @extends('layouts.base_pdf') + @section('inner_content')


{{ $transaction->bill_no }}
+ +
- - - CIEF WORLDWIDE SDN BHD - - + CIEF WORLDWIDE SDN BHD (1134596-M)
No. 72-3, Jalan Jalil 1,
The Earth Bukit Jalil,
@@ -23,14 +22,8 @@ Tel: 03-8082 1252
-
- - Invoice - -
- +
Invoice
EI#: {{ $transaction->bill_no }}
-
Ref# {{ $po_order_transaction->booking->marking }}
Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}
 
@@ -38,37 +31,34 @@
- - Bill To - + Bill To
-
- {{ $supplier->name }} -
+
{{ $supplier->name }}
+ @php + $billingAddress = $supplier->addresses()->where('billing', '=', true)->first(); + @endphp
- @php - $billingAddress = $supplier->addresses()->where('billing', '=', true)->first(); - @endphp {{ $billingAddress->street_one }} - {{ $billingAddress->street_two }} , + {{ $billingAddress->street_two }}, {{ $billingAddress->district()->first()->name }}, {{ $billingAddress->postcode }} {{ $billingAddress->state()->first()->name }}, {{ $billingAddress->country()->first()->name }}
-
- Phone: {{ $supplier->contacts()->first()->phone }} -
+
Phone: {{ $supplier->contacts()->first()->phone }}


+ + + @@ -81,11 +71,8 @@ @php - $subtotal = 0; - $voucher_redemption = isset($voucher_redemption) ? $voucher_redemption : null; - - $voucherDiscount = $voucher_redemption ? $voucher_redemption->value * -1 : 0; - $currencyRate = $transaction->currency_rate; + $subtotal = calculateSubtotal($po_order_transaction, $transaction->currency_rate); + $voucherDiscount = getVoucherDiscount($voucher_redemption); @endphp @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) @@ -93,19 +80,8 @@ - - + + @endforeach @@ -124,19 +100,9 @@ - + @endif - - - - - @if($transaction->tax > 0) @@ -149,19 +115,42 @@
No
{{ $transaction_detail->product_code }} {{ $transaction_detail->product_name }} {{ $transaction_detail->quantity }} - @php - $unitPrice = $transaction_detail->price / $currencyRate; - @endphp - {{ number_format($unitPrice, 2) }} - - @php - $itemTotal = $unitPrice * $transaction_detail->quantity; - $subtotal += $itemTotal; - @endphp - {{ number_format($itemTotal, 2) }} - {{ number_format($transaction_detail->price / $transaction->currency_rate, 2) }}{{ number_format(($transaction_detail->price / $transaction->currency_rate) * $transaction_detail->quantity, 2) }}
Voucher ({{ $voucher_redemption->voucher->code }})-{{ $voucherDiscount }}-{{ number_format($voucherDiscount, 2) }}
Adjustment - @php - $adjustment = $transaction->amount - $subtotal; - @endphp - {{ number_format($adjustment, 2) }} -
Total @php - $total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount; + $total = calculateTotalInvoice($subtotal, $transaction->service_charge, $transaction->tax, $voucherDiscount); @endphp {{ number_format($total, 2) }}
- - - - - - -
This is generated by computer. No signature required.Page {PAGENO} of {nbpg}
-
+
+
+ Note: All items purchased are subject to our Terms & Conditions. Please refer to our official website for more information. +
+

+
+ Please transfer the payment to:
+ Bank: Maybank Berhad
+ Account Name: CIEF Worldwide Sdn Bhd
+ Account No: 564892103405
+
@endsection + +@php + function calculateSubtotal($po_order_transaction, $currencyRate) { + $subtotal = 0; + foreach ($po_order_transaction->transactionDetails as $transaction_detail) { + $unitPrice = $transaction_detail->price / $currencyRate; + $itemTotal = $unitPrice * $transaction_detail->quantity; + $subtotal += $itemTotal; + } + return $subtotal; + } + + function getVoucherDiscount($voucher_redemption) { + return $voucher_redemption ? $voucher_redemption->value * -1 : 0; + } + + function calculateTotalInvoice($subtotal, $service_charge, $tax, $voucherDiscount) { + return $subtotal + $service_charge + $tax + $voucherDiscount; + } +@endphp