From fe8aa2e758183c51aee973debaa4ceadc65876f2 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Thu, 26 Jun 2025 11:37:51 +0200 Subject: [PATCH] Added getIsPaid --- composables/useSum.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/composables/useSum.js b/composables/useSum.js index e6b8f48..752a9d4 100644 --- a/composables/useSum.js +++ b/composables/useSum.js @@ -139,6 +139,13 @@ export const useSum = () => { } } - return {getIncomingInvoiceSum, getCreatedDocumentSum, getCreatedDocumentSumDetailed} + const getIsPaid = (createddocument,createddocuments) => { + let amountPaid = 0 + createddocument.statementallocations.forEach(allocation => amountPaid += allocation.amount) + + return Number(amountPaid.toFixed(2)) === getCreatedDocumentSum(createddocument,createddocuments) + } + + return {getIncomingInvoiceSum, getCreatedDocumentSum, getCreatedDocumentSumDetailed, getIsPaid} } \ No newline at end of file