From 2f158577cb80a29950801c893de18ed3cc92f472 Mon Sep 17 00:00:00 2001 From: elsiosanchez Date: Thu, 19 Aug 2021 23:50:09 -0400 Subject: [PATCH 1/3] Add function for number formatting in decimals --- src/components/ADempiere/Form/VPOS/Collection/index.vue | 5 +++-- src/utils/ADempiere/globalMethods.js | 1 + src/utils/ADempiere/valueUtils.js | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index 4ab7bb65b8a..9ff6aec47fe 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -749,13 +749,14 @@ export default { containerUuid, columnName: 'ReferenceNo' }) + if (this.sendToServer) { this.$store.dispatch('setPaymentBox', { posUuid, orderUuid, bankUuid, referenceNo, - amount: this.amontSend, + amount: this.roundNumber(this.amontSend), convertedAmount: this.amontSend * this.dayRate.divideRate, paymentDate, tenderTypeCode, @@ -767,7 +768,7 @@ export default { orderUuid, bankUuid, referenceNo, - amount: this.amontSend, + amount: this.roundNumber(this.amontSend), convertedAmount: this.amontSend * this.dayRate.divideRate, paymentDate, tenderTypeCode, diff --git a/src/utils/ADempiere/globalMethods.js b/src/utils/ADempiere/globalMethods.js index 99d933a485d..351785f3e9b 100644 --- a/src/utils/ADempiere/globalMethods.js +++ b/src/utils/ADempiere/globalMethods.js @@ -24,6 +24,7 @@ export { currencyFind, tenderTypeFind, formatConversionCurrenty, + roundNumber, convertValuesToSend, typeValue } from '@/utils/ADempiere/valueUtils.js' diff --git a/src/utils/ADempiere/valueUtils.js b/src/utils/ADempiere/valueUtils.js index 43a4ed83513..e559afcbd91 100644 --- a/src/utils/ADempiere/valueUtils.js +++ b/src/utils/ADempiere/valueUtils.js @@ -114,6 +114,13 @@ export function extractPagingToken(token) { return onlyToken } +/** + * @param {number} number + */ +export function roundNumber(number) { + return Math.round(number * 100 + Number.EPSILON) / 100 +} + /** * zero pad * @author EdwinBetanc0urt From 001eb06bb24df4a07bdd2c4bed4aed68fa7e223a Mon Sep 17 00:00:00 2001 From: elsiosanchez Date: Fri, 20 Aug 2021 01:54:17 -0400 Subject: [PATCH 2/3] minimal changes --- .../Form/VPOS/Collection/overdrawnInvoice/index.vue | 4 ++-- src/utils/ADempiere/valueUtils.js | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue index ecdc3621c8f..beff7e716cb 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue @@ -97,7 +97,7 @@ - + From 57dac2547796febad844173dc2026d6dee76ab66 Mon Sep 17 00:00:00 2001 From: elsiosanchez Date: Fri, 20 Aug 2021 02:03:32 -0400 Subject: [PATCH 3/3] rename function --- .../ADempiere/Form/VPOS/Collection/index.vue | 7 +++++-- .../VPOS/Collection/overdrawnInvoice/index.vue | 16 ---------------- src/utils/ADempiere/globalMethods.js | 2 +- src/utils/ADempiere/valueUtils.js | 8 ++------ 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index 9ff6aec47fe..45a26fb0857 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -670,6 +670,9 @@ export default { } }) } + }, + precision() { + return this.$store.getters.getCurrency.standardPrecision } }, created() { @@ -756,7 +759,7 @@ export default { orderUuid, bankUuid, referenceNo, - amount: this.roundNumber(this.amontSend), + amount: this.round(this.amontSend, this.precision), convertedAmount: this.amontSend * this.dayRate.divideRate, paymentDate, tenderTypeCode, @@ -768,7 +771,7 @@ export default { orderUuid, bankUuid, referenceNo, - amount: this.roundNumber(this.amontSend), + amount: this.round(this.amontSend, this.precision), convertedAmount: this.amontSend * this.dayRate.divideRate, paymentDate, tenderTypeCode, diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue index beff7e716cb..268648ba43e 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue @@ -97,22 +97,6 @@ -