diff --git a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingWithStorageComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingWithStorageComponent.vue index 9e592546..0b06985a 100644 --- a/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingWithStorageComponent.vue +++ b/resources/assets/vue/components/paymentsBilling/elements/CustomerPaymentsBillingWithStorageComponent.vue @@ -15,7 +15,7 @@

Invoice Date

-
{{ item.created_at }}
+
{{ invoiceDate }}
-
@@ -508,7 +508,35 @@ } } return false; - } + }, + invoiceDate() { + if (this.isEinvoiceApplicable) { + for (let i = 0; i < this.items.length; i++) { + const history = this.items[i].payment_history; + if (history && history.length > 0) { + for (let j = 0; j < history.length; j++) { + let dateStr = history[j].created_at; + const [day, month, year] = dateStr.split("-").map(Number); + const lastDay = new Date(year, month, 0).getDate(); + return `${lastDay}-${String(month).padStart(2, "0")}-${year}`; + } + } + } + } + else{ + for (let i = 0; i < this.items.length; i++) { + const history = this.items[i].payment_history; + if (history && history.length > 0) { + for (let j = 0; j < history.length; j++) { + return history[j].created_at;; + } + } + return this.items[i].created_at; + } + } + + return null; + }, }, methods: { getLatestComment(item) {