{{ $t('form.pos.order.subTotal') }}:{{ formatPrice(order.totalLines, currencyPoint.iSOCode) }}
{{ $t('form.pos.order.discount') }}:{{ formatPrice(0, currencyPoint.iSOCode) }}
{{ $t('form.pos.order.tax') }}:{{ getOrderTax(currencyPoint.iSOCode) }}
-{{ $t('form.pos.order.total') }}:{{ formatPrice(order.grandTotal, currencyPoint.iSOCode) }}
+
+
+ {{ $t('form.pos.order.total') }}:
+
+
+
{{ $t('form.pos.order.order') }}: {{ order.documentNo }}
@@ -288,12 +308,14 @@ import fieldsListOrder from './fieldsListOrder.js' import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js' import BusinessPartner from '@/components/ADempiere/Form/VPOS/BusinessPartner' import ProductInfo from '@/components/ADempiere/Form/VPOS/ProductInfo' +import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAmount/index' export default { name: 'Order', components: { BusinessPartner, - ProductInfo + ProductInfo, + convertAmount }, mixins: [ formMixin, @@ -368,6 +390,49 @@ export default { iSOCode: '', curSymbol: '' } + }, + multiplyRate() { + return this.$store.getters.getMultiplyRate + }, + converCurrency() { + return this.$store.getters.getValueOfField({ + containerUuid: 'Collection-Convert-Amount', + columnName: 'C_Currency_ID_UUID' + }) + }, + currencyUuid() { + return this.$store.getters.getValueOfField({ + containerUuid: this.containerUuid, + columnName: 'C_Currency_ID_UUID' + }) + }, + displayeTypeCurrency() { + return this.$store.getters.getValueOfField({ + containerUuid: this.containerUuid, + columnName: 'DisplayColumn_C_Currency_ID' + }) + } + }, + watch: { + currencyUuid(value) { + if (!this.isEmptyValue(value)) { + this.$store.dispatch('conversionDivideRate', { + conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid, + currencyFromUuid: this.currencyPoint.uuid, + currencyToUuid: value + }) + } + }, + converCurrency(value) { + if (!this.isEmptyValue(value)) { + this.$store.dispatch('conversionMultiplyRate', { + conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid, + currencyFromUuid: this.currencyPoint.uuid, + currencyToUuid: value + }) + } else { + this.$store.commit('currencyMultiplyRate', 1) + } } }, methods: { @@ -528,7 +593,12 @@ export default { color: #333; line-height: 10px; } - + .el-button--text { + border-color: transparent; + color: #1890ff; + background: transparent; + padding: 0px; + } .el-aside { color: #333; } diff --git a/src/store/modules/ADempiere/pointOfSales/collection.js b/src/store/modules/ADempiere/pointOfSales/collection.js index 64a87138..be258c75 100644 --- a/src/store/modules/ADempiere/pointOfSales/collection.js +++ b/src/store/modules/ADempiere/pointOfSales/collection.js @@ -77,31 +77,28 @@ const collection = { conversionMultiplyRate({ commit }, { conversionTypeUuid, currencyFromUuid, - currencyToUuid, - conversionDate + currencyToUuid + // conversionDate }) { - return Promise(resolve => { - requestGetConversionRate({ - conversionTypeUuid, - currencyFromUuid, - currencyToUuid, - conversionDate - }) - .then(response => { - const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate - - commit('currencyMultiplyRate', multiplyRate) - resolve(multiplyRate) - }) - .catch(error => { - console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) + requestGetConversionRate({ + conversionTypeUuid, + currencyFromUuid, + currencyToUuid + // conversionDate }) + .then(response => { + const multiplyRate = isEmptyValue(response.multiplyRate) ? 1 : response.multiplyRate + + commit('currencyMultiplyRate', multiplyRate) + }) + .catch(error => { + console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) }, changeMultiplyRate({ commit }, params) { commit('currencyMultiplyRate', params) diff --git a/src/store/modules/ADempiere/pointOfSales/index.js b/src/store/modules/ADempiere/pointOfSales/index.js index 8a6a8d85..853e05d4 100644 --- a/src/store/modules/ADempiere/pointOfSales/index.js +++ b/src/store/modules/ADempiere/pointOfSales/index.js @@ -49,7 +49,6 @@ const pointOfSales = { */ listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) { const userUuid = getters['user/getUserUuid'] - requestListPointOfSales({ userUuid }) diff --git a/src/store/modules/ADempiere/process.js b/src/store/modules/ADempiere/process.js index 5f7e57af..fcd85eb5 100644 --- a/src/store/modules/ADempiere/process.js +++ b/src/store/modules/ADempiere/process.js @@ -114,7 +114,7 @@ const processControl = { containerUuid, panelType, action, - parametersList = [], + parametersList, reportFormat, isProcessTableSelection, isActionDocument, @@ -660,6 +660,236 @@ const processControl = { } }) }, + processOption({ commit, dispatch, getters, rootGetters }, { + parentUuid, + containerUuid, + panelType, + action, + parametersList = [], + reportFormat, + menuParentUuid, + routeToDelete + }) { + return new Promise((resolve, reject) => { + // get info metadata process + const processDefinition = rootGetters.getProcess(action.uuid) + const reportType = reportFormat + + const isSession = !isEmptyValue(getToken()) + let procesingMessage = { + close: () => false + } + if (isSession) { + procesingMessage = showNotification({ + title: language.t('notifications.processing'), + message: processDefinition.name, + summary: processDefinition.description, + type: 'info' + }) + } + const timeInitialized = (new Date()).getTime() + let processResult = { + // panel attributes from where it was executed + parentUuid, + containerUuid, + panelType, + lastRun: timeInitialized, + parametersList, + logs: [], + isError: false, + isProcessing: true, + summary: '', + resultTableName: '', + output: { + uuid: '', + name: '', + description: '', + fileName: '', + output: '', + outputStream: '', + reportType: '' + } + } + // Run process on server and wait for it for notify + // uuid of process + processResult = { + ...processResult, + menuParentUuid, + processIdPath: routeToDelete.path, + printFormatUuid: '', + // process attributes + action: processDefinition.name, + name: processDefinition.name, + description: processDefinition.description, + instanceUuid: '', + processUuid: processDefinition.uuid, + processId: processDefinition.id, + processName: processDefinition.processName, + parameters: parametersList, + isReport: processDefinition.isReport + } + commit('addInExecution', processResult) + requestRunProcess({ + uuid: processDefinition.uuid, + id: processDefinition.id, + reportType, + parametersList + }) + .then(runProcessResponse => { + const { instanceUuid, output } = runProcessResponse + let logList = [] + if (!isEmptyValue(runProcessResponse.logsList)) { + logList = runProcessResponse.logsList + } + + let link = { + href: undefined, + download: undefined + } + if ((runProcessResponse.isReport || processDefinition.isReport) && output.outputStream) { + const reportObject = Object.values(output.outputStream) + const blob = new Blob([Uint8Array.from(reportObject)], { + type: output.mimeType + }) + link = document.createElement('a') + link.href = window.URL.createObjectURL(blob) + link.download = output.fileName + if (reportType !== 'pdf' && reportType !== 'html') { + link.click() + } + const contextMenuMetadata = rootGetters.getContextMenu(processResult.processUuid) + // Report views List to context menu + const reportViewList = { + name: language.t('views.reportView'), + type: 'summary', + action: '', + childs: [], + option: 'reportView' + } + reportViewList.childs = getters.getReportViewList(processResult.processUuid) + if (reportViewList && !reportViewList.childs.length) { + dispatch('getReportViewsFromServer', { + processUuid: processResult.processUuid, + instanceUuid, + processId: processDefinition.id, + tableName: output.tableName, + printFormatUuid: output.printFormatUuid, + reportViewUuid: output.reportViewUuid + }) + .then(responseReportView => { + reportViewList.childs = responseReportView + if (reportViewList.childs.length) { + // Get contextMenu metadata and concat print report views with contextMenu actions + contextMenuMetadata.actions.push(reportViewList) + } + }) + } + + // Print formats to context menu + const printFormatList = { + name: language.t('views.printFormat'), + type: 'summary', + action: '', + childs: [], + option: 'printFormat' + } + printFormatList.childs = rootGetters.getPrintFormatList(processResult.processUuid) + if (printFormatList && !printFormatList.childs.length) { + dispatch('getListPrintFormats', { + processUuid: processResult.processUuid, + instanceUuid, + processId: processDefinition.id, + tableName: output.tableName, + printFormatUuid: output.printFormatUuid, + reportViewUuid: output.reportViewUuid + }) + .then(printFormarResponse => { + printFormatList.childs = printFormarResponse + if (printFormatList.childs.length) { + // Get contextMenu metadata and concat print Format List with contextMenu actions + contextMenuMetadata.actions.push(printFormatList) + } + }) + } else { + const index = contextMenuMetadata.actions.findIndex(action => action.option === 'printFormat') + if (index !== -1) { + contextMenuMetadata.actions[index] = printFormatList + } + } + + // Drill Tables to context menu + const drillTablesList = { + name: language.t('views.drillTable'), + type: 'summary', + action: '', + childs: [], + option: 'drillTable' + } + if (!isEmptyValue(output.tableName)) { + drillTablesList.childs = rootGetters.getDrillTablesList(processResult.processUuid) + if (drillTablesList && isEmptyValue(drillTablesList.childs)) { + dispatch('getDrillTablesFromServer', { + processUuid: processResult.processUuid, + instanceUuid, + processId: processDefinition.id, + tableName: output.tableName, + printFormatUuid: output.printFormatUuid, + reportViewUuid: output.reportViewUuid + }) + .then(drillTablesResponse => { + drillTablesList.childs = drillTablesResponse + if (drillTablesList.childs.length) { + // Get contextMenu metadata and concat print Format List with contextMenu actions + contextMenuMetadata.actions.push(drillTablesList) + } + }) + } + } + } + // assign new attributes + Object.assign(processResult, { + ...runProcessResponse, + url: link.href, + download: link.download, + logs: logList, + output + }) + resolve(processResult) + if (!isEmptyValue(processResult.output)) { + dispatch('setReportTypeToShareLink', processResult.output.reportType) + } + }) + .catch(error => { + Object.assign(processResult, { + isError: true, + message: error.message, + isProcessing: false + }) + console.warn(`Error running the process ${error.message}. Code: ${error.code}.`) + reject(error) + }) + .finally(() => { + commit('addNotificationProcess', processResult) + dispatch('finishProcess', { + processOutput: processResult, + procesingMessage + }) + + commit('deleteInExecution', { + containerUuid + }) + + dispatch('setProcessTable', { + valueRecord: 0, + tableName: '', + processTable: false + }) + dispatch('setProcessSelect', { + finish: true + }) + }) + }) + }, // Supported to process selection selectionProcess({ commit, state, dispatch, getters, rootGetters }, { parentUuid, @@ -946,7 +1176,7 @@ const processControl = { } if (processOutput.isReport && !processOutput.isError) { // open report viewer with report response - let menuParentUuid = routeToDelete.params.menuParentUuid + let menuParentUuid = isEmptyValue(routeToDelete) ? '' : routeToDelete.params.menuParentUuid if (isEmptyValue(menuParentUuid)) { menuParentUuid = processOutput.menuParentUuid } diff --git a/src/utils/ADempiere/constants/zoomReport.js b/src/utils/ADempiere/constants/zoomReport.js new file mode 100644 index 00000000..29e3f296 --- /dev/null +++ b/src/utils/ADempiere/constants/zoomReport.js @@ -0,0 +1,15 @@ +const today = new Date() +export default [ + { + uuid: '92b9a696-adba-4409-a200-7df0ba74cb63', + action: 'processOption', + tabChild: undefined, + parametersList: [{ columnName: 'ValidFrom', value: today }] + }, + { + uuid: '78b249ee-613e-4241-a2c1-00243fa36470', + action: 'processOption', + tabChild: undefined, + parametersList: [{ columnName: 'ValidFrom', value: today }, { columnName: 'MustBeStocked', value: false }] + } +] diff --git a/src/views/ADempiere/Form/index.vue b/src/views/ADempiere/Form/index.vue index 82794f26..b4fc11a2 100644 --- a/src/views/ADempiere/Form/index.vue +++ b/src/views/ADempiere/Form/index.vue @@ -108,7 +108,6 @@ export default { return this.formMetadata.name || this.$route.meta.title }, fromFileName() { - console.log(this.$route) return this.formMetadata.fileName || this.$route.meta.title }, getterForm() {