From 9d27e78bf41e9c4ebf693f5c1ac1b74769ca5fb7 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Tue, 1 Aug 2023 01:04:49 +0800 Subject: [PATCH] give extra access for smc, and refactor the code for invoice po and do document --- .../BookingPaymentQuotationComponent.vue | 2 +- .../forms/PurchaseOrderFormComponent.vue | 2 +- .../BookingDetailsSectionComponent.vue | 2 +- .../views/pages/pdfs/deliver_order.blade.php | 205 +++++++---------- resources/views/pages/pdfs/invoice.blade.php | 205 +++++++---------- .../views/pages/pdfs/purchase_order.blade.php | 217 ++++++++---------- 6 files changed, 277 insertions(+), 356 deletions(-) diff --git a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue index c9ababa4..6f436dcb 100644 --- a/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue +++ b/resources/assets/vue/components/bookings/forms/BookingPaymentQuotationComponent.vue @@ -92,7 +92,7 @@
Transfer Total:
-
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
+
{{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue index 101f92ed..7b7ec3d4 100644 --- a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue @@ -151,7 +151,7 @@ -
+
diff --git a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue index 1bf92781..a65c2ce8 100644 --- a/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/BookingDetailsSectionComponent.vue @@ -281,7 +281,7 @@
-
+
Regenerate Invoices
diff --git a/resources/views/pages/pdfs/deliver_order.blade.php b/resources/views/pages/pdfs/deliver_order.blade.php index 5cd724bd..ba30bc68 100644 --- a/resources/views/pages/pdfs/deliver_order.blade.php +++ b/resources/views/pages/pdfs/deliver_order.blade.php @@ -12,11 +12,11 @@ - - - CIEF WORLDWIDE SDN BHD - - + + + CIEF WORLDWIDE SDN BHD + + (1134596-M)
No. 72-3, Jalan Jalil 1,
The Earth Bukit Jalil,
@@ -32,17 +32,15 @@
EDO: {{ $transaction->bill_no }}
-
REF: {{ $transaction->booking->marking }}
Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->created_at }}
 
-
- - Bill To - + + Bill To + @@ -52,14 +50,14 @@
@php - $addresses = $supplier->addresses()->where('billing', '=', true)->first(); + $billingAddress = $supplier->addresses()->where('billing', '=', true)->first(); @endphp - {{ $addresses->street_one }} - {{ $addresses->street_two }} , - {{ $addresses->district()->first()->name }}, - {{ $addresses->postcode }} - {{ $addresses->state()->first()->name }}, - {{ $addresses->country()->first()->name }} + {{ $billingAddress->street_one }} + {{ $billingAddress->street_two }} , + {{ $billingAddress->district()->first()->name }}, + {{ $billingAddress->postcode }} + {{ $billingAddress->state()->first()->name }}, + {{ $billingAddress->country()->first()->name }}
Phone: {{ $supplier->contacts()->first()->phone }} @@ -72,116 +70,91 @@
- - - - - - - - + + + + + + + + - @php - $subtotal = 0; - @endphp - @if($voucher_redemption) - @php - $voucher_discount = $voucher_redemption->value * -1; - $original_price = 1 / $voucher_redemption->transaction->currency_rate; - $currency_rate = $voucher_redemption->transaction->currency_rate; - @endphp - @else - @php - $voucher_discount = 0; - $currency_rate = $transaction->currency_rate; - @endphp - @endif - @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) - - - - - - - - - @endforeach + @php + $subtotal = 0; + $voucher_redemption = isset($voucher_redemption) ? $voucher_redemption : null; + $voucherDiscount = $voucher_redemption ? $voucher_redemption->value * -1 : 0; + $currencyRate = $transaction->currency_rate; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) + + + + + + + + + @endforeach - - - - - - - - - - - @if($voucher_redemption) + + + + + + + + + + + @if($voucher_redemption) - + - @endif + @endif + + + + + + @if($transaction->tax > 0) - - - - @if($transaction->tax > 0) - - - - - - @endif - - - - + + + @endif + + + + +
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
{{ $key + 1 }}{{ $transaction_detail->product_code }}{{ $transaction_detail->product_name }}{{ $transaction_detail->quantity }} - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$currency_rate) * $transaction_detail->price, 2) }} - @else - {{ number_format($transaction_detail->price, 2) }} - @endif - - @if($transaction->booking()->first()->fix_currency_id !== 1) - - {{ number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @else - {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @endif -
{{ $key + 1 }}{{ $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) }} +
Subtotal - {{ number_format($subtotal, 2) }} -
Service Charges - {{ number_format($transaction->service_charge, 2) }} -
Subtotal{{ number_format($subtotal, 2) }}
Service Charges + {{ number_format($transaction->service_charge, 2) }} +
Voucher ({{ $voucher_redemption->voucher->code }}) - -{{ $voucher_redemption->value }} - -{{ $voucherDiscount }}
Adjustment + @php + $adjustment = $transaction->amount - $subtotal; + @endphp + {{ number_format($adjustment, 2) }} +
Adjustment - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format((float)number_format( (1/$currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @else - {{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @endif -
Tax{{ number_format($transaction->tax, 2) }}
Total - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( ((1/$currency_rate) * $transaction->amount) + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @else - {{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @endif - Tax{{ number_format($transaction->tax, 2) }}
Total + @php + $total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount; + @endphp + {{ number_format($total, 2) }} +
diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 1a12df38..054cebdc 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -11,11 +11,11 @@ - - - CIEF WORLDWIDE SDN BHD - - + + + CIEF WORLDWIDE SDN BHD + + (1134596-M)
No. 72-3, Jalan Jalil 1,
The Earth Bukit Jalil,
@@ -25,23 +25,22 @@
- Invoice + Credit Note
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 }}
 
-
+ - - Bill To - + + Bill To + @@ -51,14 +50,14 @@
@php - $addresses = $supplier->addresses()->where('billing', '=', true)->first(); + $billingAddress = $supplier->addresses()->where('billing', '=', true)->first(); @endphp - {{ $addresses->street_one }} - {{ $addresses->street_two }} , - {{ $addresses->district()->first()->name }}, - {{ $addresses->postcode }} - {{ $addresses->state()->first()->name }}, - {{ $addresses->country()->first()->name }} + {{ $billingAddress->street_one }} + {{ $billingAddress->street_two }} , + {{ $billingAddress->district()->first()->name }}, + {{ $billingAddress->postcode }} + {{ $billingAddress->state()->first()->name }}, + {{ $billingAddress->country()->first()->name }}
Phone: {{ $supplier->contacts()->first()->phone }} @@ -71,116 +70,90 @@
- - - - - - - - + + + + + + + + - @php - $subtotal = 0; - @endphp - @if($voucher_redemption) - @php - $voucher_discount = $voucher_redemption->value * -1; - $original_price = 1 / $voucher_redemption->transaction->currency_rate; - $currency_rate = $voucher_redemption->transaction->currency_rate; - @endphp - @else - @php - $voucher_discount = 0; - $currency_rate = $transaction->currency_rate - @endphp - @endif - @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) - - - - - - - - - @endforeach + $voucherDiscount = $voucher_redemption ? $voucher_redemption->value * -1 : 0; + $currencyRate = $transaction->currency_rate; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) + + + + + + + + + @endforeach - - - - - - - - - - - @if($voucher_redemption) + + + + + + + + + + + @if($voucher_redemption) - + - @endif + @endif + + + + + + @if($transaction->tax > 0) - - - - @if($transaction->tax > 0) - - - - - - @endif - - - - + + + @endif + + + + +
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
{{ $key + 1 }}{{ $transaction_detail->product_code }}{{ $transaction_detail->product_name }}{{ $transaction_detail->quantity }} - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$currency_rate) * $transaction_detail->price, 2) }} - @else - {{ number_format($transaction_detail->price, 2) }} - @endif - - @if($transaction->booking()->first()->fix_currency_id !== 1) + @php + $subtotal = 0; + $voucher_redemption = isset($voucher_redemption) ? $voucher_redemption : null; - {{ number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @else - {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @endif -
{{ $key + 1 }}{{ $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) }} +
Subtotal - {{ number_format($subtotal, 2) }} -
Service Charges - {{ number_format($transaction->service_charge, 2) }} -
Subtotal{{ number_format($subtotal, 2) }}
Service Charges{{ number_format($transaction->service_charge, 2) }}
Voucher ({{ $voucher_redemption->voucher->code }}) - -{{ $voucher_redemption->value }} - -{{ $voucherDiscount }}
Adjustment + @php + $adjustment = $transaction->amount - $subtotal; + @endphp + {{ number_format($adjustment, 2) }} +
Adjustment - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format((float)number_format( (1/$currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @else - {{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @endif -
Tax{{ number_format($transaction->tax, 2) }}
Total - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format($subtotal + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @else - {{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @endif - Tax{{ number_format($transaction->tax, 2) }}
Total + @php + $total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount; + @endphp + {{ number_format($total, 2) }} +
diff --git a/resources/views/pages/pdfs/purchase_order.blade.php b/resources/views/pages/pdfs/purchase_order.blade.php index 85608c28..79841363 100644 --- a/resources/views/pages/pdfs/purchase_order.blade.php +++ b/resources/views/pages/pdfs/purchase_order.blade.php @@ -24,9 +24,9 @@
- - Buyer - + + Buyer +
@@ -34,34 +34,34 @@
- {{ $supplier->name }} - + {{ $supplier->name }} + - {{-- {{ $supplier }} --}} - + {{-- {{ $supplier }} --}} +
- @php - $addresses = $supplier->addresses()->where('billing', '=', true)->first(); - @endphp - {{ $addresses->street_one }} - {{ $addresses->street_two }} - {{ $addresses->state()->first()->name }} - {{ $addresses->district()->first()->name }} - + @php + $billingAddress = $supplier->addresses()->where('billing', '=', true)->first(); + @endphp + {{ $billingAddress->street_one }} + {{ $billingAddress->street_two }} + {{ $billingAddress->state()->first()->name }} + {{ $billingAddress->district()->first()->name }} +
- Phone: {{ $supplier->contacts()->first()->phone }} - + Phone: {{ $supplier->contacts()->first()->phone }} +
- - Seller - + + Seller +
- CIEF Worldwide Sdn Bhd (1134596-M) - + CIEF Worldwide Sdn Bhd (1134596-M) +
No. 72-3, Jalan Jalil 1,
The Earth Bukit Jalil,
@@ -78,116 +78,91 @@ - - - - - - - - + + + + + + + + - @php - $subtotal = 0; - @endphp - @if($voucher_redemption) - @php - $voucher_discount = $voucher_redemption->value * -1; - $original_price = 1 / $voucher_redemption->transaction->currency_rate; - $currency_rate = $voucher_redemption->transaction->currency_rate; - @endphp - @else - @php - $voucher_discount = 0; - $currency_rate = $transaction->currency_rate; - @endphp - @endif - @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) - - - - - - - - - @endforeach + @php + $subtotal = 0; + $voucher_redemption = isset($voucher_redemption) ? $voucher_redemption : null; + $voucherDiscount = $voucher_redemption ? $voucher_redemption->value * -1 : 0; + $currencyRate = $transaction->currency_rate; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) + + + + + + + + + @endforeach - - - - - - - - - - - @if($voucher_redemption) + + + + + + + + + + + @if($voucher_redemption) - + - @endif + @endif + + + + + + @if($transaction->tax > 0) - - - - @if($transaction->tax > 0) - - - - - - @endif - - - - + + + @endif + + + + +
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
NoStock CodeDescriptionQuantityUnit Price (RM)Total Amount
(RM)
{{ $key + 1 }}{{ $transaction_detail->product_code }}{{ $transaction_detail->product_name }}{{ $transaction_detail->quantity }} - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$currency_rate) * $transaction_detail->price, 2) }} - @else - {{ number_format($transaction_detail->price, 2) }} - @endif - - @if($transaction->booking()->first()->fix_currency_id !== 1) - - {{ number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format( (1/$currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @else - {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} - - @php - $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); - @endphp - @endif -
{{ $key + 1 }}{{ $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) }} +
Subtotal - {{ number_format($subtotal, 2) }} -
Service Charges - {{ number_format($transaction->service_charge, 2) }} -
Subtotal{{ number_format($subtotal, 2) }}
Service Charges + {{ number_format($transaction->service_charge, 2) }} +
Voucher ({{ $voucher_redemption->voucher->code }}) - -{{ $voucher_redemption->value }} - -{{ $voucherDiscount }}
Adjustment + @php + $adjustment = $transaction->amount - $subtotal; + @endphp + {{ number_format($adjustment, 2) }} +
Adjustment - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format((float)number_format( (1/$currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @else - {{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} - @endif -
Tax{{ number_format($transaction->tax, 2) }}
Total - @if($transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( ((1/$currency_rate) * $transaction->amount) + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @else - {{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax + $voucher_discount, 2) }} - @endif - Tax{{ number_format($transaction->tax, 2) }}
Total + @php + $total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount; + @endphp + {{ number_format($total, 2) }} +