From c8cabee97b82e78c363e13dc96a1e60f86fb7f14 Mon Sep 17 00:00:00 2001 From: JiaSheng Date: Mon, 15 Jan 2024 23:41:12 +0800 Subject: [PATCH] update --- .../Eloquent/Filters/IsNotFullyRefunded.php | 24 +++++++++++++++++++ .../ExpiredRefundedBookingCommand.php | 12 +++++++--- .../elements/PaymentHistoryComponent.vue | 4 ++-- .../SupplierPendingOrdersSectionComponent.vue | 4 ++-- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/IsNotFullyRefunded.php diff --git a/app/Classes/General/Eloquent/Filters/IsNotFullyRefunded.php b/app/Classes/General/Eloquent/Filters/IsNotFullyRefunded.php new file mode 100644 index 00000000..fdbb2994 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/IsNotFullyRefunded.php @@ -0,0 +1,24 @@ +withSum(['transactions as total_refund_amount' => function($q) { + $q->refunds()->where('status', ApprovalStatus::APPROVED); + }], 'original_amount') + ->having('total_refund_amount', '<', DB::raw('original_amount')); + } +} diff --git a/app/Console/Commands/ExpiredRefundedBookingCommand.php b/app/Console/Commands/ExpiredRefundedBookingCommand.php index 4d49cb36..db7e00a7 100644 --- a/app/Console/Commands/ExpiredRefundedBookingCommand.php +++ b/app/Console/Commands/ExpiredRefundedBookingCommand.php @@ -122,19 +122,25 @@ class ExpiredRefundedBookingCommand extends Command //expired booking // $this->updatesBookingStatus->execute($booking, ApprovalStatus::EXPIRED); Log::info("Credit note transaction id: {$transaction->id} is fully refunded, the refunded amount was {$transaction->amount} the payment reference is: {$transaction->payment_reference}"); - Log::info("Credit note transaction id: {$transaction->id}, Rejected Booking Transaction Payment id: {$bookingPayment->id}, the payment amount was {$bookingPayment->amount}"); - Log::info("Credit note transaction id: {$transaction->id}, Expired Booking id: {$booking->id}"); + // Log::info("Credit note transaction id: {$transaction->id}, Rejected Booking Transaction Payment id: {$bookingPayment->id}, the payment amount was {$bookingPayment->amount}"); + // Log::info("Credit note transaction id: {$transaction->id}, Expired Booking id: {$booking->id}"); } else { Log::info("Credit note transaction id: {$transaction->id} is not fully refunded, the refunded amount was {$transaction->amount}, the payment amount was {$bookingPayment->amount}, the payment reference is: {$transaction->payment_reference}"); } $refund = $bookingPayment->transactions()->refunds()->where('amount', $transaction->amount)->where('status', ApprovalStatus::APPROVED)->first(); + $bookingInWhiteForm = $bookingPayment->transactions()->bills()->first(); + if ($refund) { Log::info("Credit note transaction id: {$transaction->id}, already created same amount of refund transaction for same booking payment transaction"); } - if (!$refund) { + if ($bookingInWhiteForm) { + Log::info("Credit note transaction id: {$transaction->id}, booking is in white form"); + } + + if (!$refund && !$bookingInWhiteForm) { $billNumber = $this->generatesTransactionBillNumber->execute('RFD-'); $object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id, diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 2649edcf..43e2e96d 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -299,14 +299,14 @@ -
+
-
+
diff --git a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue index 7df9c125..c7382629 100644 --- a/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue +++ b/resources/assets/vue/components/bookings/sections/SupplierPendingOrdersSectionComponent.vue @@ -117,7 +117,7 @@
- + @@ -195,7 +195,7 @@ }, updateList(){ - this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id}); + this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, is_not_fully_refunded: true, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id}); this.selectedSupplier.status = false; this.currencyDropdownLaunch.status = false;