give extra access for smc, and refactor the code for invoice po and do document

This commit is contained in:
Omair Saleh
2023-08-01 01:04:49 +08:00
parent 96a4e35091
commit 9d27e78bf4
6 changed files with 277 additions and 356 deletions
@@ -92,7 +92,7 @@
<div class="font-heading all-caps fs-12">Transfer Total:</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-12"><i class="fa fa-edit fs-12 pointer fa-fw requestModal" data-type="editBookingAmount" v-if="$store.getters.isSuperAdmin"></i> {{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
<div class="font-heading fs-12"><i class="fa fa-edit fs-12 pointer fa-fw requestModal" data-type="editBookingAmount" v-if="$store.getters.isSuperAdmin || ($store.getters.isCustomer && $store.getters.getCompanyId === 199)"></i> {{this.data.fixed_currency.short_code}} {{(Math.round((this.data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editBookingAmount">
<edit-booking-amount-form-component :data="this.data" :section="section"></edit-booking-amount-form-component>
@@ -151,7 +151,7 @@
<button class="btn btn-sm btn-danger b-rad-none btn-block" v-if="data.documents.proforma_invoice && data.outstanding_amount > 0" @click="submit(route('api.booking.proforma.create', data.id), 'post', section, true, true)">Regenerate Proforma Invoice</button>
</div>
</div>
<div class="row m-b-15" v-if="$store.getters.isAdmin && data.purchase_order.status === 1" >
<div class="row m-b-15" v-if="($store.getters.isAdmin && data.purchase_order.status === 1) || ($store.getters.isCustomer && data.purchase_order.status === 1 && $store.getters.getCompanyId === 199)" >
<div class="col">
<button class="btn btn-sm btn-block btn-success b-rad-none" @click="submit(route('api.booking.po.approval', data.id), 'post', section, true, true)">Approve Purchase Order</button>
</div>
@@ -281,7 +281,7 @@
<purchase-order-form-component v-if="booking.service.id !== 4 || $store.getters.isAdmin || [199, 510].includes($store.getters.getCompanyId) || companySegmentIds.includes(24)" :data="booking" :section="section"></purchase-order-form-component>
</div>
</div>
<div class="row m-t-15" v-if="booking.status === 3 && $store.getters.isSuperAdmin">
<div class="row m-t-15" v-if="booking.status === 3 && $store.getters.isSuperAdmin || ($store.getters.isCustomer && $store.getters.getCompanyId === 199)">
<div class="col-sm col-md-auto">
<div class="btn btn-sm btn block all-caps b-rad-none btn-danger pointer requestModal" data-type="regenerateInvoices">Regenerate Invoices</div>
</div>
@@ -12,11 +12,11 @@
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
</td>
<td class="header-cief-address">
<span class="company-name">
<strong>
CIEF WORLDWIDE SDN BHD
</strong>
</span>
<span class="company-name">
<strong>
CIEF WORLDWIDE SDN BHD
</strong>
</span>
<span class="company-reg">(1134596-M)</span><br>
No. 72-3, Jalan Jalil 1,<br>
The Earth Bukit Jalil,<br>
@@ -32,17 +32,15 @@
<div class="number">EDO: {{ $transaction->bill_no }}</div>
<div class="ref">REF: {{ $transaction->booking->marking }}</div>
<div class="date">Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
<tr>
<td colspan="3" class="bill-to">
<span class="sub-title">
Bill To
</span>
<span class="sub-title">
Bill To
</span>
</td>
</tr>
<tr>
@@ -52,14 +50,14 @@
</div>
<div class="address">
@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 }}
</div>
<div>
Phone: {{ $supplier->contacts()->first()->phone }}
@@ -72,116 +70,91 @@
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
@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)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@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
</td>
<td width="20%" class="right top">
@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
</td>
</tr>
@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)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@php
$unitPrice = $transaction_detail->price / $currencyRate;
@endphp
{{ number_format($unitPrice, 2) }}
</td>
<td width="20%" class="right top">
@php
$itemTotal = $unitPrice * $transaction_detail->quantity;
$subtotal += $itemTotal;
@endphp
{{ number_format($itemTotal, 2) }}
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($subtotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">{{ number_format($subtotal, 2) }}</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="voucher">
<td colspan="4"></td>
<td class="right middle">Voucher ({{ $voucher_redemption->voucher->code }})</td>
<td class="right middle">
-{{ $voucher_redemption->value }}
</td>
<td class="right middle">-{{ $voucherDiscount }}</td>
</tr>
@endif
@endif
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@php
$adjustment = $transaction->amount - $subtotal;
@endphp
{{ number_format($adjustment, 2) }}
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@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
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@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
</td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@php
$total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount;
@endphp
{{ number_format($total, 2) }}
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">
+89 -116
View File
@@ -11,11 +11,11 @@
<img src="{{ asset('images/ri_1.png') }}" alt="logo" id="logo" class="logo">
</td>
<td class="header-cief-address">
<span class="company-name">
<strong>
CIEF WORLDWIDE SDN BHD
</strong>
</span>
<span class="company-name">
<strong>
CIEF WORLDWIDE SDN BHD
</strong>
</span>
<span class="company-reg">(1134596-M)</span><br>
No. 72-3, Jalan Jalil 1,<br>
The Earth Bukit Jalil,<br>
@@ -25,23 +25,22 @@
<td class="header-details">
<div class="title">
<strong>
Invoice
Credit Note
</strong>
</div>
<div class="number">EI#: {{ $transaction->bill_no }}</div>
<div class="ref">Ref# {{ $po_order_transaction->booking->marking }}</div>
<div class="date">Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
</tr>
<tr>
<td colspan="3" class="bill-to">
<span class="sub-title">
Bill To
</span>
<span class="sub-title">
Bill To
</span>
</td>
</tr>
<tr>
@@ -51,14 +50,14 @@
</div>
<div class="address">
@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 }}
</div>
<div>
Phone: {{ $supplier->contacts()->first()->phone }}
@@ -71,116 +70,90 @@
<br>
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
@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)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@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
</td>
<td width="20%" class="right top">
@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
</td>
</tr>
@endforeach
$voucherDiscount = $voucher_redemption ? $voucher_redemption->value * -1 : 0;
$currencyRate = $transaction->currency_rate;
@endphp
@foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@php
$unitPrice = $transaction_detail->price / $currencyRate;
@endphp
{{ number_format($unitPrice, 2) }}
</td>
<td width="20%" class="right top">
@php
$itemTotal = $unitPrice * $transaction_detail->quantity;
$subtotal += $itemTotal;
@endphp
{{ number_format($itemTotal, 2) }}
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($subtotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">{{ number_format($subtotal, 2) }}</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">{{ number_format($transaction->service_charge, 2) }}</td>
</tr>
@if($voucher_redemption)
<tr class="voucher">
<td colspan="4"></td>
<td class="right middle">Voucher ({{ $voucher_redemption->voucher->code }})</td>
<td class="right middle">
-{{ $voucher_redemption->value }}
</td>
<td class="right middle">-{{ $voucherDiscount }}</td>
</tr>
@endif
@endif
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@php
$adjustment = $transaction->amount - $subtotal;
@endphp
{{ number_format($adjustment, 2) }}
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@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
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@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
</td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@php
$total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount;
@endphp
{{ number_format($total, 2) }}
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">
@@ -24,9 +24,9 @@
<table class="buyer-seller">
<tr>
<td width="50%" class="top">
<span class="buyer-seller-title">
Buyer
</span>
<span class="buyer-seller-title">
Buyer
</span>
<br>
<div class="buyer-company">
@@ -34,34 +34,34 @@
</div>
<span class="buyer-company">
{{ $supplier->name }}
</span>
{{ $supplier->name }}
</span>
<span class="reg">
{{-- {{ $supplier }} --}}
</span>
{{-- {{ $supplier }} --}}
</span>
<br>
<span class="address">
@php
$addresses = $supplier->addresses()->where('billing', '=', true)->first();
@endphp
{{ $addresses->street_one }}
{{ $addresses->street_two }}
{{ $addresses->state()->first()->name }}
{{ $addresses->district()->first()->name }}
</span>
@php
$billingAddress = $supplier->addresses()->where('billing', '=', true)->first();
@endphp
{{ $billingAddress->street_one }}
{{ $billingAddress->street_two }}
{{ $billingAddress->state()->first()->name }}
{{ $billingAddress->district()->first()->name }}
</span>
<br>
<span class="contact-no">
Phone: {{ $supplier->contacts()->first()->phone }}
</span>
Phone: {{ $supplier->contacts()->first()->phone }}
</span>
</td>
<td width="50%" class="top">
<span class="buyer-seller-title">
Seller
</span>
<span class="buyer-seller-title">
Seller
</span>
<br>
<span class="buyer-company">
CIEF Worldwide Sdn Bhd (1134596-M)
</span>
CIEF Worldwide Sdn Bhd (1134596-M)
</span>
<div class="address">
No. 72-3, Jalan Jalil 1,<br>
The Earth Bukit Jalil,<br>
@@ -78,116 +78,91 @@
<table class="line-table" style="overflow: wrap" autosize="1">
<thead>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
<tr>
<th width="5%">No</th>
<th class="stock-code" width="10%">Stock Code</th>
<th class="description">Description</th>
<th width="10%">Quantity</th>
<th width="15%">Unit Price (RM)</th>
<th width="10%">Total Amount<br>(RM)</th>
</tr>
</thead>
<tbody>
@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)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@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
</td>
<td width="20%" class="right top">
@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
</td>
</tr>
@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)
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="10%">{{ $transaction_detail->product_code }}</td>
<td class="description">{{ $transaction_detail->product_name }}</td>
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
<td width="15%" class="center top">
@php
$unitPrice = $transaction_detail->price / $currencyRate;
@endphp
{{ number_format($unitPrice, 2) }}
</td>
<td width="20%" class="right top">
@php
$itemTotal = $unitPrice * $transaction_detail->quantity;
$subtotal += $itemTotal;
@endphp
{{ number_format($itemTotal, 2) }}
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">
{{ number_format($subtotal, 2) }}
</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="subtotal">
<td colspan="4"></td>
<td class="right middle">Subtotal</td>
<td class="right middle">{{ number_format($subtotal, 2) }}</td>
</tr>
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Service Charges</td>
<td class="right">
{{ number_format($transaction->service_charge, 2) }}
</td>
</tr>
@if($voucher_redemption)
<tr class="voucher">
<td colspan="4"></td>
<td class="right middle">Voucher ({{ $voucher_redemption->voucher->code }})</td>
<td class="right middle">
-{{ $voucher_redemption->value }}
</td>
<td class="right middle">-{{ $voucherDiscount }}</td>
</tr>
@endif
@endif
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@php
$adjustment = $transaction->amount - $subtotal;
@endphp
{{ number_format($adjustment, 2) }}
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Adjustment</td>
<td class="right">
@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
</td>
</tr>
@if($transaction->tax > 0)
<tr class="billingcharges">
<td colspan="4"></td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@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
</td>
<td class="right">Tax</td>
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
</tr>
@endif
<tr>
<td colspan="4"></td>
<td class="right middle">Total</td>
<td class="total right middle">
@php
$total = $subtotal + $transaction->service_charge + $transaction->tax + $voucherDiscount;
@endphp
{{ number_format($total, 2) }}
</td>
</tr>
</tfoot>
</table>
<htmlpagefooter name="page-footer">