From b94a82100033ed3857b46f9803a11f1ef2c6c0b4 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 17 Aug 2021 07:55:45 -0400 Subject: [PATCH] fixe discount (#1069) Co-authored-by: elsiosanchez --- .../ADempiere/Form/VPOS/Order/index.vue | 175 +++++++++--------- .../ADempiere/Form/VPOS/Order/line/index.vue | 2 +- .../Form/VPOS/Order/orderLineMixin.js | 43 +++-- 3 files changed, 111 insertions(+), 109 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index fd4ce3d1..4a8e2450 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -53,20 +53,16 @@ /> - + @@ -315,23 +311,23 @@

-

{{ $t('form.pos.order.order') }}: {{ currentOrder.documentNo }}

+

{{ $t('form.pos.order.order') }}: {{ currentOrder.documentNo }}

{{ $t('form.pos.order.date') }}: - + {{ orderDate }}

-

{{ $t('form.pos.order.type') }}:{{ currentOrder.documentType.name }}

+

{{ $t('form.pos.order.type') }}:{{ currentOrder.documentType.name }}

{{ $t('form.pos.order.itemQuantity') }} - + {{ getItemQuantity }}

{{ $t('form.pos.order.numberLines') }} - + {{ numberOfLines }}

@@ -339,14 +335,13 @@

{{ $t('form.pos.order.seller') }}: {{ currentOrder.salesRepresentative.name }}

-

{{ $t('form.pos.order.subTotal') }}:{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}

-

{{ $t('form.pos.order.discount') }}:{{ formatPrice(0, pointOfSalesCurrency.iSOCode) }}

-

{{ $t('form.pos.order.tax') }}:{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}

+

{{ $t('form.pos.order.subTotal') }}:{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}

+

{{ $t('form.pos.order.tax') }}:{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}

{{ $t('form.pos.order.total') }}: - + -

{{ $t('form.pos.order.order') }}: {{ currentOrder.documentNo }}

+

{{ $t('form.pos.order.order') }}: {{ currentOrder.documentNo }}

{{ $t('form.pos.order.date') }}: - + {{ orderDate }}

{{ $t('form.pos.order.type') }}:{{ currentOrder.documentType.name }}

{{ $t('form.pos.order.itemQuantity') }} - + {{ getItemQuantity }}

{{ $t('form.pos.order.numberLines') }} - + {{ numberOfLines }}

@@ -436,7 +431,7 @@ import { formatPrice, formatQuantity } from '@/utils/ADempiere/valueFormat.js' -import { validatePin } from '@/api/ADempiere/form/point-of-sales.js' +// import { validatePin } from '@/api/ADempiere/form/point-of-sales.js' export default { name: 'Order', @@ -703,33 +698,33 @@ export default { focusPin() { this.$refs.pin.focus() }, - openPin(pin) { - validatePin({ - posUuid: this.currentPointOfSales.uuid, - pin - }) - .then(response => { - this.validatePin = false - this.pin = '' - this.visible = false - this.pinAction(this.attributePin) - }) - .catch(error => { - console.error(error.message) - this.$message({ - type: 'error', - message: error.message, - showClose: true - }) - this.pin = '' - }) - .finally(() => { - this.closePin() - }) - }, - closePin() { - this.visible = false - }, + // openPin(pin) { + // validatePin({ + // posUuid: this.currentPointOfSales.uuid, + // pin + // }) + // .then(response => { + // this.validatePin = false + // this.pin = '' + // this.visible = false + // this.pinAction(this.attributePin) + // }) + // .catch(error => { + // console.error(error.message) + // this.$message({ + // type: 'error', + // message: error.message, + // showClose: true + // }) + // this.pin = '' + // }) + // .finally(() => { + // this.closePin() + // }) + // }, + // closePin() { + // this.visible = false + // }, closeConvertion() { this.seeConversion = false }, @@ -753,10 +748,8 @@ export default { this.createOrder({ withLine: false, newOrder: true }) }, changePos(pointOfSales) { - if (pointOfSales.uuid !== this.currentPointOfSales.uuid) { - this.$store.dispatch('setCurrentPOS', pointOfSales) - this.clearOrder() - } + this.$store.dispatch('setCurrentPOS', pointOfSales) + this.clearOrder() }, changeWarehouse(warehouse) { this.attributePin = { @@ -800,42 +793,42 @@ export default { this.$refs.linesTable.setCurrentRow(this.listOrderLine[this.currentTable]) this.currentOrderLine = this.listOrderLine[this.currentTable] } - }, - pinAction(action) { - if (action.type === 'updateOrder') { - switch (action.columnName) { - case 'QtyEntered': - case 'PriceEntered': - case 'Discount': - this.updateOrderLine(action) - break - case 'C_DocTypeTarget_ID': { - const documentTypeUuid = this.$store.getters.getValueOfField({ - containerUuid: this.$route.meta.uuid, - columnName: 'C_DocTypeTarget_ID_UUID' - }) - this.$store.dispatch('updateOrder', { - orderUuid: this.$route.query.action, - posUuid: this.currentPointOfSales.uuid, - documentTypeUuid - }) - break - } - } - } else if (action.type === 'actionPos') { - switch (action.action) { - case 'changeWarehouse': - this.$store.commit('setCurrentWarehousePos', action) - break - case 'changeDocumentType': - this.$store.commit('setCurrentDocumentTypePos', action) - break - case 'changePriceList': - this.$store.commit('setCurrentPriceList', action) - break - } - } } + // pinAction(action) { + // if (action.type === 'updateOrder') { + // switch (action.columnName) { + // case 'QtyEntered': + // case 'PriceEntered': + // case 'Discount': + // this.updateOrderLine(action) + // break + // case 'C_DocTypeTarget_ID': { + // const documentTypeUuid = this.$store.getters.getValueOfField({ + // containerUuid: this.$route.meta.uuid, + // columnName: 'C_DocTypeTarget_ID_UUID' + // }) + // this.$store.dispatch('updateOrder', { + // orderUuid: this.$route.query.action, + // posUuid: this.currentPointOfSales.uuid, + // documentTypeUuid + // }) + // break + // } + // } + // } else if (action.type === 'actionPos') { + // switch (action.action) { + // case 'changeWarehouse': + // this.$store.commit('setCurrentWarehousePos', action) + // break + // case 'changeDocumentType': + // this.$store.commit('setCurrentDocumentTypePos', action) + // break + // case 'changePriceList': + // this.$store.commit('setCurrentPriceList', action) + // break + // } + // } + // } } } diff --git a/src/components/ADempiere/Form/VPOS/Order/line/index.vue b/src/components/ADempiere/Form/VPOS/Order/line/index.vue index e522730c..1d2976cf 100644 --- a/src/components/ADempiere/Form/VPOS/Order/line/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/line/index.vue @@ -138,7 +138,7 @@ export default { } if (value) { this.fillOrderLineQuantities({ - currentPrice: this.currentLine.price, + currentPrice: this.currentLine.priceList, quantityOrdered: this.currentLine.quantity, discount: this.currentLine.discountRate }) diff --git a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js index 68af47a1..72241188 100644 --- a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js +++ b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js @@ -74,8 +74,7 @@ export default { quantityOrdered: 0, uuid: '' }, - totalAmountConvertedLine: { - } + totalAmountConvertedLine: {} } }, computed: { @@ -93,6 +92,13 @@ export default { return converted.divideRate } return 1 + }, + isPosRequiredPin() { + const pos = this.$store.getters.posAttributes.currentPointOfSales + if (!this.isEmptyValue(pos.isPosRequiredPin)) { + return pos.isPosRequiredPin + } + return false } }, methods: { @@ -105,7 +111,7 @@ export default { // case this.$t('form.pos.tableProduct.editQuantities'): this.fillOrderLineQuantities({ - currentPrice: this.currentOrderLine.currentPrice, + currentPrice: this.currentOrderLine.priceList, quantityOrdered: this.currentOrderLine.quantityOrdered, discount: this.currentOrderLine.discount }) @@ -173,7 +179,7 @@ export default { }) .then(response => { this.fillOrderLineQuantities({ - currentPrice: response.price, + currentPrice: response.priceList, quantityOrdered: response.quantity, discount: response.discountRate }) @@ -191,21 +197,24 @@ export default { }) }) }, + deleteOrderLine(lineSelection) { - deleteOrderLine({ - orderLineUuid: lineSelection.uuid - }) - .then(() => { - this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid }) + if (!this.isPosRequiredPin) { + deleteOrderLine({ + orderLineUuid: lineSelection.uuid }) - .catch(error => { - console.error(error.message) - this.$message({ - type: 'error', - message: error.message, - showClose: true + .then(() => { + this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid }) }) - }) + .catch(error => { + console.error(error.message) + this.$message({ + type: 'error', + message: error.message, + showClose: true + }) + }) + } }, convertedAmount() { if (!this.isEmptyValue(this.currentPointOfSales.displayCurrency) && this.totalAmountConverted === 1) { @@ -229,7 +238,7 @@ export default { } const currency = this.pointOfSalesCurrency.iSOCode if (columnName === 'CurrentPrice') { - return this.formatPrice(row.priceActual, currency) + return this.formatPrice(row.priceList, currency) } else if (columnName === 'QtyOrdered') { return this.formatQuantity(row.quantityOrdered) } else if (columnName === 'Discount') {