-
-
+
+
+
{{ formatPrice(value.amount, currency.iSOCode) }}
-
-
- {{ formatPrice(value.quantityCahs) }}
+
+
+ {{
+ formatPrice(
+ (amountConvertion(value)),
+ currencyFind({
+ currencyCurrent: value.currencyUuid,
+ listCurrency: listCurrency,
+ defaultCurrency: currency
+ }).currencyDisplay
+ )
+ }}
+
+
+
+
+
+
+ {{ formatPrice(value.amount, currency.iSOCode) }}
@@ -81,9 +112,20 @@ export default {
default: undefined
}
},
+ data() {
+ return {
+ conevertion: 0
+ }
+ },
computed: {
- label() {
- return this.$store.getters.getTenderTypeDisplaye
+ typesPayment() {
+ return this.$store.getters.getListsPaymentTypes
+ },
+ listCurrency() {
+ return this.$store.getters.getListCurrency
+ },
+ conevertionAmount() {
+ return this.$store.getters.getConvertionPayment
}
},
methods: {
@@ -139,16 +181,8 @@ export default {
paymentUuid
})
},
- tenderTypeDisplay(payments) {
- const display = this.label.find(item => {
- if (item.tenderTypeCode === payments) {
- return item.tenderTypeDisplay
- }
- })
- if (display) {
- return display.tenderTypeDisplay
- }
- return payments
+ amountConvertion(payment) {
+ return payment.amount * this.conevertionAmount.multiplyRate
}
}
}
diff --git a/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js b/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js
index e30b95a1..25d0e354 100644
--- a/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js
+++ b/src/components/ADempiere/Form/VPOS/Order/fieldsListOrder.js
@@ -3,10 +3,12 @@ export default [
{
elementColumnName: 'ProductValue',
columnName: 'ProductValue',
+ tabindex: '1',
isFromDictionary: true,
overwriteDefinition: {
size: 24,
sequence: 10,
+ handleFocusGained: true,
handleActionPerformed: true,
handleActionKeyPerformed: true
}
@@ -14,6 +16,7 @@ export default [
{
elementColumnName: 'QtyEntered',
columnName: 'QtyEntered',
+ tabindex: '2',
isFromDictionary: true,
overwriteDefinition: {
size: 24,
@@ -26,6 +29,7 @@ export default [
{
elementColumnName: 'PriceEntered',
columnName: 'PriceEntered',
+ tabindex: '3',
isFromDictionary: true,
overwriteDefinition: {
size: 24,
@@ -39,6 +43,7 @@ export default [
{
elementColumnName: 'Discount',
columnName: 'Discount',
+ tabindex: '4',
isFromDictionary: true,
overwriteDefinition: {
size: 24,
@@ -48,5 +53,34 @@ export default [
handleContentSelection: true,
handleActionKeyPerformed: true
}
+ },
+ {
+ tableName: 'C_Order',
+ columnName: 'C_Currency_ID',
+ isFromDictionary: true,
+ overwriteDefinition: {
+ size: 24,
+ handleActionKeyPerformed: true,
+ handleActionPerformed: true,
+ validationCode: 'C_Currency.C_Currency_ID = 100',
+ isActiveLogics: false,
+ isMandatory: true
+ }
+ },
+ // TenderType
+ {
+ tableName: 'C_Payment',
+ elementColumnName: 'TenderType',
+ columnName: 'TenderType',
+ isFromDictionary: true,
+ overwriteDefinition: {
+ defaultValue: 'X',
+ handleActionKeyPerformed: true,
+ handleContentSelection: true,
+ handleActionPerformed: true,
+ size: 24,
+ isActiveLogics: false,
+ isMandatory: true
+ }
}
]
diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue
index 128ef4c4..972cdee9 100644
--- a/src/components/ADempiere/Form/VPOS/Order/index.vue
+++ b/src/components/ADempiere/Form/VPOS/Order/index.vue
@@ -84,7 +84,7 @@
-
+
-
- {{ $t('form.productInfo.productInformation') }}
+
+ {{ $t('form.productInfo.productInformation') }}
-
+
- {{ $t('form.pos.tableProduct.editQuantities') }}
+ {{ $t('form.pos.tableProduct.editQuantities') }}
@@ -444,6 +444,12 @@ export default {
}
}
},
+ mounted() {
+ setTimeout(() => {
+ this.tenderTypeDisplaye()
+ this.currencyDisplaye()
+ }, 1500)
+ },
methods: {
changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement)
@@ -503,6 +509,30 @@ export default {
if (!this.seeConversion) {
this.seeConversion = true
}
+ },
+ tenderTypeDisplaye() {
+ if (!this.isEmptyValue(this.fieldsList)) {
+ const tenderType = this.fieldsList[5].reference
+ this.$store.dispatch('getLookupListFromServer', {
+ tableName: tenderType.tableName,
+ query: tenderType.query
+ })
+ .then(response => {
+ this.$store.dispatch('tenderTypeDisplaye', response)
+ })
+ }
+ },
+ currencyDisplaye() {
+ if (!this.isEmptyValue(this.fieldsList)) {
+ const currency = this.fieldsList[4].reference
+ this.$store.dispatch('getLookupListFromServer', {
+ tableName: currency.tableName,
+ query: currency.query
+ })
+ .then(response => {
+ this.$store.dispatch('currencyDisplaye', response)
+ })
+ }
}
}
}
diff --git a/src/components/ADempiere/Form/VPOS/OrderList/fieldsListOrders.js b/src/components/ADempiere/Form/VPOS/OrderList/fieldsListOrders.js
index d79bd21b..7e9e1d9f 100644
--- a/src/components/ADempiere/Form/VPOS/OrderList/fieldsListOrders.js
+++ b/src/components/ADempiere/Form/VPOS/OrderList/fieldsListOrders.js
@@ -3,6 +3,7 @@ const tableName = 'C_Order'
export default [
{
tableName,
+ elementColumnName: 'DocumentNo',
columnName: 'DocumentNo',
isFromDictionary: true,
overwriteDefinition: {
@@ -12,6 +13,7 @@ export default [
},
{
tableName,
+ elementColumnName: 'C_BPartner_ID',
columnName: 'C_BPartner_ID',
isFromDictionary: true,
overwriteDefinition: {
@@ -22,6 +24,7 @@ export default [
{
tableName,
columnName: 'GrandTotal',
+ elementColumnName: 'GrandTotal',
isFromDictionary: true,
overwriteDefinition: {
size: 8,
@@ -48,7 +51,7 @@ export default [
},
{
tableName,
- columnName: 'Processed',
+ elementColumnName: 'Processed',
isFromDictionary: true,
overwriteDefinition: {
size: 8,
@@ -66,7 +69,8 @@ export default [
},
{
tableName,
- columnName: 'IsInvoiced',
+ elementColumnName: 'IsInvoiced',
+ columnName: 'IsInvoiced ',
isFromDictionary: true,
overwriteDefinition: {
size: 8,
@@ -75,6 +79,7 @@ export default [
},
{
tableName,
+ elementColumnName: 'DateOrdered',
columnName: 'DateOrdered',
isFromDictionary: true,
overwriteDefinition: {
@@ -85,7 +90,8 @@ export default [
},
{
tableName,
- columnName: 'DateOrdered',
+ elementColumnName: 'DateOrdered',
+ columnName: 'DateOrderedTo',
isFromDictionary: true,
overwriteDefinition: {
columnName: 'DateOrderedTo',
@@ -95,6 +101,7 @@ export default [
},
{
tableName,
+ elementColumnName: 'SalesRep_ID',
columnName: 'SalesRep_ID',
isFromDictionary: true,
overwriteDefinition: {
diff --git a/src/store/modules/ADempiere/pointOfSales/collection.js b/src/store/modules/ADempiere/pointOfSales/collection.js
index 4de91a49..f5ac4cea 100644
--- a/src/store/modules/ADempiere/pointOfSales/collection.js
+++ b/src/store/modules/ADempiere/pointOfSales/collection.js
@@ -17,7 +17,14 @@ const collection = {
multiplyRateCollection: 1,
divideRateCollection: 1,
listPayments: [],
- tenderTypeDisplaye: []
+ tenderTypeDisplaye: [
+ {
+ tenderTypeCode: 0,
+ tenderTypeDisplay: ''
+ }
+ ],
+ currency: [],
+ convertion: {}
},
mutations: {
addPaymentBox(state, paymentBox) {
@@ -40,6 +47,12 @@ const collection = {
},
setTenderTypeDisplaye(state, tenderTypeDisplaye) {
state.tenderTypeDisplaye = tenderTypeDisplaye
+ },
+ setCurrencyDisplaye(state, currency) {
+ state.currency = currency
+ },
+ setConvertionPayment(state, convertion) {
+ state.convertion = convertion
}
},
actions: {
@@ -86,6 +99,38 @@ const collection = {
state.paymentBox = addPayment
}
},
+ // upload orders to theServer
+ uploadOrdersToServer({ dispatch }, {
+ listPaymentsLocal,
+ posUuid,
+ orderUuid
+ }) {
+ listPaymentsLocal.forEach(payment => {
+ requestCreatePayment({
+ posUuid,
+ orderUuid,
+ bankUuid: payment.bankUuid,
+ referenceNo: payment.referenceNo,
+ description: payment.description,
+ amount: payment.amount,
+ paymentDate: payment.paymentDate,
+ tenderTypeCode: payment.tenderTypeCode,
+ currencyUuid: payment.currencyUuid
+ })
+ .then(response => {
+ const orderUuid = response.order_uuid
+ dispatch('listPayments', { orderUuid })
+ })
+ .catch(error => {
+ console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`)
+ showMessage({
+ type: 'error',
+ message: error.message,
+ showClose: true
+ })
+ })
+ })
+ },
deleteCollectBox({ state }, key) {
const payment = state.paymentBox
payment.splice(key, 1)
@@ -224,12 +269,10 @@ const collection = {
orderUuid,
paymentUuid
}) {
- console.log(paymentUuid, orderUuid)
requestDeletePayment({
paymentUuid
})
.then(response => {
- console.log(response.listPayments)
dispatch('listPayments', { orderUuid })
})
.catch(error => {
@@ -241,13 +284,12 @@ const collection = {
})
})
},
- listPayments({ commit }, { posUuid, orderUuid }) {
+ listPayments({ commit, rootGetters }, { posUuid, orderUuid }) {
requestListPayments({
posUuid,
orderUuid
})
.then(response => {
- console.log(response.listPayments)
commit('setListPayments', response.listPayments)
})
.catch(error => {
@@ -267,6 +309,38 @@ const collection = {
}
})
commit('setTenderTypeDisplaye', displayTenderType)
+ },
+ currencyDisplaye({ commit }, currency) {
+ const displaycurrency = currency.map(item => {
+ return {
+ currencyUuid: item.uuid,
+ currencyId: item.id,
+ currencyDisplay: item.label
+ }
+ })
+ commit('setCurrencyDisplaye', displaycurrency)
+ },
+ convertionPayment({ commit }, {
+ conversionTypeUuid,
+ currencyFromUuid,
+ currencyToUuid
+ }) {
+ requestGetConversionRate({
+ conversionTypeUuid,
+ currencyFromUuid,
+ currencyToUuid
+ })
+ .then(response => {
+ commit('setConvertionPayment', response)
+ })
+ .catch(error => {
+ console.warn(`ConvertionPayment: ${error.message}. Code: ${error.code}.`)
+ showMessage({
+ type: 'error',
+ message: error.message,
+ showClose: true
+ })
+ })
}
},
getters: {
@@ -286,11 +360,16 @@ const collection = {
return state.divideRateCollection
},
getListPayments: (state) => {
- console.log(state.listPayments)
return state.listPayments
},
- getTenderTypeDisplaye: (state) => {
+ getListsPaymentTypes: (state) => {
return state.tenderTypeDisplaye
+ },
+ getListCurrency: (state) => {
+ return state.currency
+ },
+ getConvertionPayment: (state) => {
+ return state.convertion
}
}
}
diff --git a/src/utils/ADempiere/globalMethods.js b/src/utils/ADempiere/globalMethods.js
index 9a2bd74c..f8ccaa28 100644
--- a/src/utils/ADempiere/globalMethods.js
+++ b/src/utils/ADempiere/globalMethods.js
@@ -6,5 +6,7 @@ export {
isEmptyValue,
calculationValue,
clearVariables,
+ currencyFind,
+ tenderTypeFind,
typeValue
} from '@/utils/ADempiere/valueUtils.js'
diff --git a/src/utils/ADempiere/valueUtils.js b/src/utils/ADempiere/valueUtils.js
index c6c3ba95..8cc8a8c7 100644
--- a/src/utils/ADempiere/valueUtils.js
+++ b/src/utils/ADempiere/valueUtils.js
@@ -251,6 +251,7 @@ export const recursiveTreeSearch = ({
/**
* Parsed value to component type
+ * @author Elsio Sanchez
* @param {mixed} value, value to parsed
* @param {string} componentPath
* @param {number} displayType, reference in ADempiere
@@ -358,6 +359,7 @@ export function parsedValueComponent({
/**
* add a tab depending on the status of the document
+ * @author Elsio Sanchez
* @param {string} tag, document status key
*/
export function tagStatus(tag) {
@@ -405,7 +407,8 @@ export function tagStatus(tag) {
/**
* add a tab depending on the status of the document
- * @param {string} tag, document status key
+ * @author Elsio Sanchez
+ * @param {string} iconElment, icon the Elment
*/
export function iconStatus(iconElment) {
let icon
@@ -479,7 +482,51 @@ export function calculationValue(value, event) {
}
}
}
+/**
+ * Search in the currency lists for the current currency
+ * @author Elsio Sanchez
+ * @param {string} currencyCurrent current currency to search
+ * @param {array} listCurrency Currency Listing
+ * @param {object} currencyCurrent Default Currency
+ */
+export function currencyFind({
+ currencyCurrent,
+ listCurrency,
+ defaultCurrency
+}) {
+ if (!isEmptyValue(listCurrency)) {
+ const currency = listCurrency.find(item => {
+ if (item.currencyUuid === currencyCurrent) {
+ return item
+ }
+ })
+ if (currency) {
+ return currency
+ }
+ }
+ return defaultCurrency.iSOCode
+}
+/**
+ * Search the Payment List for the Current Payment
+ * @author Elsio Sanchez
+ * @param {string} currentPayment Current Payment
+ * @param {array} listTypePayment Payment Type Listings
+ */
+export function tenderTypeFind({
+ currentPayment,
+ listTypePayment
+}) {
+ const payment = listTypePayment.find(item => {
+ if (item.tenderTypeCode === currentPayment) {
+ return item.tenderTypeDisplay
+ }
+ })
+ if (payment) {
+ return payment.tenderTypeDisplay
+ }
+ return currentPayment
+}
export function clearVariables() {
partialValue = ''
}