From 22cf998ae6b59e9d298b5442789fd6bab12ceb38 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 12 Sep 2025 14:38:11 +0800 Subject: [PATCH] E-Invoice - Fix transfer with full refund PO total should not be 0 --- .../forms/PurchaseOrderFormComponent.vue | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue index 697315d6..c499e6b3 100644 --- a/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PurchaseOrderFormComponent.vue @@ -143,7 +143,19 @@
Total:
-
{{(Math.round(( poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3)}}/{{(Math.round((data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3)}} {{data.fixed_currency.short_code}}
+ +
+ + {{ totalFormattedPoTotal }}/ + + + {{ totalFormattedDataAmount }} {{ data.fixed_currency.short_code }} + +
@@ -267,7 +279,7 @@ return last + product.total; }, 0); }, - allowPOEditing() { + allowPOEditing() { //Condition 1 const noPaymentsMade = Math.round((this.data.paid_amount + Number.EPSILON) * 100) / 100 === 0; const noPaymentPendingVerifications = this.data.payment_history.every(payment => payment.status !== 1); @@ -281,6 +293,23 @@ const adminBeforeApproval = this.$store.getters.isAdmin && !(this.data.purchase_order.status === 2); return (noPaymentsMade && noPaymentPendingVerifications) || (paymentsMade && outstandingAmount && allPaymentApproved) || adminBeforeApproval; + }, + totalFormattedPoTotal() { + return (Math.round((this.poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3); + }, + totalFormattedDataAmount() { + if(this.data.amount === 0 && this.data.outstanding_amount === 0 && this.data.floating_amount === 0 && this.data.paid_amount === 0){ + return (Math.round((this.poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3); + } + else{ + return (Math.round((this.data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3); + } + }, + totalAmountClass() { + return { + 'text-danger': this.totalFormattedPoTotal !== this.totalFormattedDataAmount, + 'text-success': this.totalFormattedPoTotal === this.totalFormattedDataAmount, + }; } }, watch: {