Status
-
+
{{ item.transaction_bill.status === 1 ? 'Processing Payment' : 'Transferred'}}
diff --git a/routes/web.php b/routes/web.php
index fd50e085..bc613043 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -25,6 +25,7 @@ use Spatie\Activitylog\Models\Activity;
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Bookings\Processors\CreatePurchaseOrderFor1688OrderProcessor;
+use App\Classes\Modules\Bookings\Services\CalculatesBookingRefundAmount;
use App\Classes\Modules\Documents\Services\DeletesDocument;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionWithInvoiceNoProcessor;
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
@@ -390,12 +391,18 @@ Route::get('/segments', function (Request $request) {
})->name('segments');
Route::get('/pending_orders', function(){
- $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED])->get();
+ $payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED])
+ ->whereDoesntHave('transactions', function ($query) {
+ return $query->where('type', TransactionType::REFUND)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION]);
+ })
+ ->get();
echo '
';
$i = 0;
foreach ($payments as $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);
}
@@ -411,11 +418,11 @@ Route::get('/pending_orders', function(){
echo '| '.$booking->marking.' | ';
echo ''.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].' | ';
echo ''.$payment->currency->short_code.' | ';
- echo ''.$payment->amount.' | ';
+ echo ''.number_format(bcsub($payment->amount, $refunds, 7), 5, '.', '').' | ';
echo ''.$booking->company->reference.' | ';
echo ' | ';
echo ''.$payment->original_currency->short_code.' | ';
- echo ''.$payment->original_amount.' | ';
+ echo ''.number_format(bcsub($payment->original_amount, $original_refunds, 7), 5, '.', '').' | ';
echo ' | ';
echo ''.$booking->service->name.' | ';
echo ''.$payment->updated_at->diffForHumans().' | ';