mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-28 08:53:59 +00:00
Merge branch 'invoice-add-adjusment-and-fix-calculate-booking-rate' into 'master'
-created data on OP See merge request CIEFWorldwideSdnBhd/exchange-2.0!61
This commit is contained in:
@@ -12,16 +12,24 @@ class CalculatesBookingCurrencyAverageRate
|
||||
public function execute(Booking $booking, $type){
|
||||
|
||||
if ($type == TransactionType::PAYMENT) {
|
||||
return $booking->transactions()
|
||||
|
||||
$amount_without_service = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->avg('currency_rate');
|
||||
->selectRaw('ROUND(amount,2)-ROUND(service_charge,2) AS amount_without_service')
|
||||
->get()->sum('amount_without_service');
|
||||
|
||||
return number_format($booking->fix_amount/$amount_without_service,2);
|
||||
}
|
||||
else if ($type == TransactionType::BILL) {
|
||||
return $booking->transactions()
|
||||
|
||||
$amount_without_service = $booking->transactions()
|
||||
->where('type', TransactionType::BILL)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->avg('currency_rate');
|
||||
->selectRaw('ROUND(amount,2)-ROUND(service_charge,2) AS amount_without_service')
|
||||
->get()->sum('amount_without_service');
|
||||
|
||||
return number_format($booking->fix_amount/$amount_without_service,2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-5 p-r-5 bg-success requestModal pointer" data-type="paymentProofModal">
|
||||
<div class="row align-items-center h-100">
|
||||
<div @click="selectedID(item.id)" class="row align-items-center h-100">
|
||||
<div class="col">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
width="30" height="30"
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="paymentProofModal">
|
||||
<payment-proof-form-component section="paymentProofSection" :id="item.id" :data="item"></payment-proof-form-component>
|
||||
<payment-proof-form-component v-if="selected_id == item.id" section="paymentProofSection" :id="item.id" :data="item"></payment-proof-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,6 +63,16 @@
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
selected_id: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectedID(id){
|
||||
this.selected_id = id;
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
<div class="ref">REF: {{ $invoice_transaction->payment_reference ?? '-' }}</div>
|
||||
<div class="date">Date: {{ $invoice_transaction->created_at }}</div>
|
||||
<div class="date">Date: {{ $po_order_transaction->created_at }}</div>
|
||||
<div> </div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -77,18 +77,22 @@
|
||||
<th class="stock-code" width="10%">Stock Code</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Quantity</th>
|
||||
<th width="12%">Unit Price (RM)</th>
|
||||
<th width="15%">Unit Price (RM)</th>
|
||||
<th width="10%">Total Amount<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$subtotal = 0;
|
||||
@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="12%" class="center top">
|
||||
<td width="15%" class="center top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
@@ -97,9 +101,18 @@
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->amount, 2) }}
|
||||
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$invoice_transaction->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>
|
||||
@@ -110,11 +123,7 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($invoice_transaction->amount, 2) }}
|
||||
@endif
|
||||
{{ number_format($subtotal, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
@@ -124,6 +133,17 @@
|
||||
{{ number_format($invoice_transaction->service_charge, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice_transaction->tax > 0)
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
|
||||
<div class="ref">Ref# {{ $invoice_transaction->payment_reference ?? '-' }}</div>
|
||||
<div class="date">Date: {{ $invoice_transaction->created_at }}</div>
|
||||
<div class="date">Date: {{ $po_order_transaction->created_at }}</div>
|
||||
<div> </div>
|
||||
</div>
|
||||
</td>
|
||||
@@ -76,18 +76,22 @@
|
||||
<th class="stock-code" width="10%">Stock Code</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Quantity</th>
|
||||
<th width="12%">Unit Price (RM)</th>
|
||||
<th width="15%">Unit Price (RM)</th>
|
||||
<th width="10%">Total Amount<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$subtotal = 0;
|
||||
@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="12%" class="center top">
|
||||
<td width="15%" class="center top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
@@ -96,9 +100,18 @@
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->amount, 2) }}
|
||||
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$invoice_transaction->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>
|
||||
@@ -109,11 +122,7 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($invoice_transaction->amount, 2) }}
|
||||
@endif
|
||||
{{ number_format($subtotal, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
@@ -123,6 +132,17 @@
|
||||
{{ number_format($invoice_transaction->service_charge, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice_transaction->tax > 0)
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
|
||||
@@ -81,18 +81,22 @@
|
||||
<th class="stock-code" width="10%">Stock Code</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Quantity</th>
|
||||
<th width="12%">Unit Price (RM)</th>
|
||||
<th width="15%">Unit Price (RM)</th>
|
||||
<th width="10%">Total Amount<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$subtotal = 0;
|
||||
@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="12%" class="center top">
|
||||
<td width="15%" class="center top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
@@ -101,9 +105,18 @@
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->amount, 2) }}
|
||||
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$invoice_transaction->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>
|
||||
@@ -112,13 +125,9 @@
|
||||
<tfoot>
|
||||
<tr class="subtotal">
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($invoice_transaction->amount, 2) }}
|
||||
@endif
|
||||
{{ number_format($subtotal, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
@@ -128,6 +137,17 @@
|
||||
{{ number_format($invoice_transaction->service_charge, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice_transaction->tax > 0)
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<td class="document-detail">
|
||||
PO#: {{ $supplier_deliver_order_transaction->bill_no }} <br>
|
||||
Ref#: {{ $supplier_deliver_order_transaction->payment_reference ?? '-' }} <br>
|
||||
Date: {{ $supplier_deliver_order_transaction->created_at }}
|
||||
Date: {{ $po_order_transaction->created_at }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -66,18 +66,22 @@
|
||||
<th class="stock-code" width="10%">Stock Code</th>
|
||||
<th class="description">Description</th>
|
||||
<th width="10%">Quantity</th>
|
||||
<th width="12%">Unit Price (RM)</th>
|
||||
<th width="15%">Unit Price (RM)</th>
|
||||
<th width="10%">Total Amount<br>(RM)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$subtotal = 0;
|
||||
@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="12%" class="center top">
|
||||
<td width="15%" class="center top">
|
||||
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
@@ -86,9 +90,18 @@
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->amount, 2) }}
|
||||
|
||||
{{ number_format((float)number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$supplier_deliver_order_transaction->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>
|
||||
@@ -99,10 +112,17 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Subtotal</td>
|
||||
<td class="right middle">
|
||||
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount, 2) }}
|
||||
@else
|
||||
{{ number_format($supplier_deliver_order_transaction->amount, 2) }}
|
||||
{{ number_format($subtotal, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($supplier_deliver_order_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user