mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
-update payment amount under payment history section on booking page
-export approved refund payment
This commit is contained in:
@@ -18,13 +18,13 @@
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-8 muted all-caps">Payment Amount</div>
|
||||
<div class="font-heading fs-10 bold">
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount - item.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0" v-if="totalRefunds !== 0">
|
||||
<div class="font-heading fs-8 muted all-caps">Refunded Amount</div>
|
||||
<div class="font-heading fs-10 bold text-danger">
|
||||
{{item.currency.short_code}} {{(Math.round((totalConvertRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,15 +68,13 @@
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-8 muted all-caps">Payment Amount</div>
|
||||
<div class="font-heading fs-10 bold">
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount - item.refunded_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end m-b-10 bold text-danger" v-if="totalRefunds !== 0">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Refunded Amount</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-12">{{item.original_currency.short_code}} {{(Math.round((totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
<div class="col-auto p-l-0 text-danger" v-if="totalRefunds !== 0">
|
||||
<div class="font-heading fs-8 muted all-caps">Refunded Amount</div>
|
||||
<div class="font-heading fs-10 bold">
|
||||
{{item.original_currency.short_code}} {{(Math.round((totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="$store.getters.isAdmin">
|
||||
|
||||
@@ -433,6 +433,65 @@ Route::get('/pending_orders', function(){
|
||||
echo '</table>';
|
||||
})->name('orders.pending');
|
||||
|
||||
Route::get('/approve_refunds', function(){
|
||||
$payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED, ApprovalStatus::REFUNDED])
|
||||
->whereHas('transactions', function ($query) {
|
||||
return $query->where('type', TransactionType::REFUND)->where('status', ApprovalStatus::APPROVED);
|
||||
})
|
||||
->orderBy('updated_at', 'DESC')
|
||||
->get();
|
||||
|
||||
echo '<table>';
|
||||
echo '<tr>';
|
||||
echo '<td>No.</td>';
|
||||
echo '<td>Updated At</td>';
|
||||
echo '<td>Marking</td>';
|
||||
echo '<td>Payment Method</td>';
|
||||
echo '<td colspan="2">Refunded Amount</td>';
|
||||
echo '<td>Company Reference</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td colspan="2">Refunded Original Amount</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>Service</td>';
|
||||
echo '<td>Last Updated At</td>';
|
||||
echo '<td>Bank Type</td>';
|
||||
echo '<td>Bank Holder Name</td>';
|
||||
echo '</tr>';
|
||||
foreach ($payments as $index => $payment){
|
||||
$booking = $payment->owner;
|
||||
$original_refunds = floatval((App()->make(CalculatesBookingRefundAmount::class))->calculateRefundAmount($payment, $booking->fix_currency_id));
|
||||
$refunds = $original_refunds / $payment->currency_rate;
|
||||
if(!$booking instanceof Booking){
|
||||
dd($payment);
|
||||
}
|
||||
$bankType = str::length($booking->bank->holder_name) > 4 ? 'Company' : 'Personal';
|
||||
|
||||
if (!preg_match('/[^A-Za-z0-9]/', $booking->bank->holder_name))
|
||||
{
|
||||
$bankType = str_word_count($booking->bank->holder_name) > 4 ? 'Company' : 'Personal';
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td>'.($index + 1).'.</td>';
|
||||
echo '<td>'.$payment->updated_at->format('d-M-y').'</td>';
|
||||
echo '<td>'.$booking->marking.'</td>';
|
||||
echo '<td>'.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].'</td>';
|
||||
echo '<td>'.$payment->currency->short_code.'</td>';
|
||||
echo '<td>'.number_format($refunds, 5, '.', '').'</td>';
|
||||
echo '<td>'.$booking->company->reference.'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>'.$payment->original_currency->short_code.'</td>';
|
||||
echo '<td>'.number_format($original_refunds, 5, '.', '').'</td>';
|
||||
echo '<td></td>';
|
||||
echo '<td>'.$booking->service->name.'</td>';
|
||||
echo '<td>'.$payment->updated_at->diffForHumans().'</td>';
|
||||
echo '<td>'.$bankType.'</td>';
|
||||
echo '<td>'.$booking->bank->holder_name.'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
})->name('orders.refunds');
|
||||
|
||||
Route::get('/group/text/{id}', function($id){
|
||||
$group = \App\Models\Group::where('id', $id)->first();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user