Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Fix: Point of Salses (#1742)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Dec 11, 2023
1 parent cb1ef28 commit 6cc8911
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default defineComponent({
multiply_rate,
divide_rate
} = rate
if (multiply_rate.value > divide_rate.value) return multiply_rate.value
return divide_rate.value
if (Number(multiply_rate) > Number(divide_rate)) return Number(multiply_rate)
return Number(divide_rate)
})

const isDisabled = computed(() => {
Expand Down Expand Up @@ -91,8 +91,8 @@ export default defineComponent({
})

function findConverRate(currency) {
const { price_list } = currentOrder.value
let amountConvert = Number(store.getters.getCurrentOrder.open_amount.value)
const { price_list, open_amount } = currentOrder.value
let amountConvert = Number(open_amount)
if (
isEmptyValue(currency) ||
!isEmptyValue(price_list) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
>
<field-amount
:value-amount="amount"
:value-display="amountDisplay"
:value-display="amount"
:handle-change="updateAmount"
/>
</el-form-item>
Expand Down Expand Up @@ -284,6 +284,7 @@ export default defineComponent({
const currency = getCurrencyPayment({
paymentMethods: currentPaymentMethod
})
updateAmount(0)
store.commit('setAvailableCurrencies', currency)
clearFieldsCollections()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
{{ $t('form.pos.collect.orderTotal') }} {{ '(' + currentOrder.document_no + ')' }}:
</b>
<b style="float: right">
{{ displayAmount(currentOrder.grand_total.value) }}
{{ displayAmount(currentOrder.grand_total) }}
</b>
</p>
<p class="line-info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
<template>
<span>
<el-input-number
v-if="isFocus"
v-model="amount"
v-show="isFocus"
ref="fieldNumber"
v-model="totalAmount"
controls-position="right"
:precision="precision"
autofocus
Expand All @@ -28,8 +29,8 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
@blur="customFocusLost"
/>
<el-input
v-else
v-model="valueDisplay"
v-show="!isFocus"
v-model="displayValue"
readonly
autofocus
:disabled="disabled"
Expand All @@ -40,14 +41,15 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
</template>

<script>
import { defineComponent, ref } from '@vue/composition-api'
import { defineComponent, computed, ref } from '@vue/composition-api'
// import lang from '@/lang'
// import store from '@/store'
import store from '@/store'
// // Utils and Helper Methods
// import { formatPrice, formatQuantity } from '@/utils/ADempiere/formatValue/numberFormat'
// import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
// import { displayLineProductPriceValue } from '@/utils/ADempiere/dictionary/form/VPOS'
// import { copyToClipboard } from '@/utils/ADempiere/coreUtils.js'
import { formatPrice } from '@/utils/ADempiere/formatValue/numberFormat'

export default defineComponent({
name: 'fieldAmount',
Expand All @@ -57,7 +59,7 @@ export default defineComponent({
required: true
},
valueDisplay: {
type: String,
type: [String, Number],
required: true
},
precision: {
Expand All @@ -78,11 +80,33 @@ export default defineComponent({
setup(props) {
// Ref
const isFocus = ref(false)
const fieldNumber = ref(null)

const amount = ref(props.valueAmount)

const totalAmount = computed({
get() {
return props.valueAmount
},
// setter
set(value) {
store.commit('setPayAmount', value)
}
})
// Methods
const displayValue = computed(() => {
const currency = store.getters.getAvailableCurrencies.currencie
return formatPrice({ value: Number(totalAmount.value), currency: currency.iso_code })
})
function customFocusGained(event) {
fieldNumber.value.select
fieldNumber.value.select()
isFocus.value = true
amount.value = props.valueAmount
setTimeout(() => {
fieldNumber.value.select
fieldNumber.value.select()
}, 500)
}

function customFocusLost(event) {
Expand All @@ -92,6 +116,9 @@ export default defineComponent({
// Ref
amount,
isFocus,
fieldNumber,
totalAmount,
displayValue,
// Methods
customFocusLost,
customFocusGained
Expand Down

0 comments on commit 6cc8911

Please sign in to comment.