From 32fb3f8649aaab0611947bf18368045fb4125094 Mon Sep 17 00:00:00 2001 From: Ricargame <78000356+Ricargame@users.noreply.github.com> Date: Mon, 6 May 2024 15:33:04 -0400 Subject: [PATCH] feat: `Invoice` search field (#2199) * bugfix: Invoices * fix: Invoice * fix: Invoice * fix: Invoice * fix: Invoice * fix: Invoice * bugfix: Invoices * fix: Invoice * fix: Invoice * fix: Invoice --- src/api/ADempiere/field/search/invoice.ts | 114 +++++ .../PanelForm/QueryCriteria/InvoiceField.vue | 95 +++++ .../QueryCriteria/PaidFieldInvoice.vue | 63 +++ .../QueryCriteria/SaleTransactionField.vue | 106 +++++ .../QueryCriteria/billingDateField.vue | 73 ++++ .../QueryCriteria/businessPartnerField.vue | 100 +++++ .../QueryCriteria/descriptionField.vue | 54 +++ .../PanelForm/QueryCriteria/documentField.vue | 53 +++ .../QueryCriteria/grandTotalField.vue | 66 +++ .../PanelForm/QueryCriteria/index.vue | 120 ++++++ .../InvoiceInfo/PanelForm/index.vue | 403 ++++++++++++++++++ .../InvoiceInfo/PanelForm/useInvoice.js | 288 +++++++++++++ .../FieldSearch/InvoiceInfo/button.vue | 141 ++++++ .../FieldSearch/InvoiceInfo/index.vue | 207 +++++++++ .../FieldSearch/InvoiceInfo/mixinInvoice.js | 85 ++++ .../FieldSearch/InvoiceInfo/panelFooter.vue | 229 ++++++++++ .../FieldSearch/InvoiceInfo/tableRecords.vue | 280 ++++++++++++ .../FieldDefinition/FieldSearch/index.vue | 3 + src/lang/ADempiere/en/field/index.js | 4 +- src/lang/ADempiere/en/field/invoice.js | 36 ++ src/lang/ADempiere/es/field/index.js | 4 +- src/lang/ADempiere/es/field/invoice.js | 36 ++ src/lang/ADempiere/es/field/product.ts | 4 +- .../ADempiere/field/search/invoiceSearch.js | 99 +++++ .../dictionary/field/search/invoice.ts | 61 +++ 25 files changed, 2720 insertions(+), 4 deletions(-) create mode 100644 src/api/ADempiere/field/search/invoice.ts create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/InvoiceField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/PaidFieldInvoice.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/SaleTransactionField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/billingDateField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/businessPartnerField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/descriptionField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/documentField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/grandTotalField.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/index.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/index.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/useInvoice.js create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/button.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/mixinInvoice.js create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/panelFooter.vue create mode 100644 src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/tableRecords.vue create mode 100644 src/lang/ADempiere/en/field/invoice.js create mode 100644 src/lang/ADempiere/es/field/invoice.js create mode 100644 src/store/modules/ADempiere/field/search/invoiceSearch.js create mode 100644 src/utils/ADempiere/dictionary/field/search/invoice.ts diff --git a/src/api/ADempiere/field/search/invoice.ts b/src/api/ADempiere/field/search/invoice.ts new file mode 100644 index 00000000000..7565090501c --- /dev/null +++ b/src/api/ADempiere/field/search/invoice.ts @@ -0,0 +1,114 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Get Instance for connection +import { request } from '@/utils/ADempiere/request' + +export function requestListOrders({ + filters, + sort_by, + group_columns, + select_columns, + page_size, + page_token, + search_value, + context_attributes, + is_only_active_records, + is_sales_transaction +}) { + return request({ + url: '/field/invoices/orders', + method: 'get', + params: { + filters, + sort_by, + group_columns, + select_columns, + page_size, + page_token, + search_value, + context_attributes, + is_only_active_records, + is_sales_transaction + } + }) +} + +export function requestListBusinessPartners({ + filters, + sort_by, + group_columns, + select_columns, + page_size, + page_token, + search_value, + context_attributes, + is_only_active_records, + is_sales_transaction +}) { + return request({ + url: '/field/invoices/business-partners', + method: 'get', + params: { + filters, + sort_by, + group_columns, + select_columns, + page_size, + page_token, + search_value, + context_attributes, + is_only_active_records, + is_sales_transaction + } + }) +} + +export function requestListInvoicesInfo({ + page_size, + page_token, + document_no, + is_sales_transaction, + business_partner_id, + is_paid, + description, + invoice_date_from, + invoice_date_to, + order_id, + grand_total_from, + grand_total_to +}) { + return request({ + url: '/field/invoices', + method: 'get', + params: { + page_size, + page_token, + document_no, + is_sales_transaction, + business_partner_id, + is_paid, + description, + invoice_date_from, + invoice_date_to, + order_id, + grand_total_from, + grand_total_to + } + }) +} diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/InvoiceField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/InvoiceField.vue new file mode 100644 index 00000000000..396164c8a2f --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/InvoiceField.vue @@ -0,0 +1,95 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/PaidFieldInvoice.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/PaidFieldInvoice.vue new file mode 100644 index 00000000000..e8be3fc9561 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/PaidFieldInvoice.vue @@ -0,0 +1,63 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/SaleTransactionField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/SaleTransactionField.vue new file mode 100644 index 00000000000..28172132a00 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/SaleTransactionField.vue @@ -0,0 +1,106 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/billingDateField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/billingDateField.vue new file mode 100644 index 00000000000..23bd1ea6d95 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/billingDateField.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/businessPartnerField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/businessPartnerField.vue new file mode 100644 index 00000000000..7a159c64d87 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/businessPartnerField.vue @@ -0,0 +1,100 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/descriptionField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/descriptionField.vue new file mode 100644 index 00000000000..2088265c25d --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/descriptionField.vue @@ -0,0 +1,54 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/documentField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/documentField.vue new file mode 100644 index 00000000000..33c19c19ede --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/documentField.vue @@ -0,0 +1,53 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/grandTotalField.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/grandTotalField.vue new file mode 100644 index 00000000000..75e16acb555 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/grandTotalField.vue @@ -0,0 +1,66 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/index.vue new file mode 100644 index 00000000000..59c83897a87 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/QueryCriteria/index.vue @@ -0,0 +1,120 @@ + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/index.vue new file mode 100644 index 00000000000..e68a0c5d895 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/index.vue @@ -0,0 +1,403 @@ + + + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/useInvoice.js b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/useInvoice.js new file mode 100644 index 00000000000..90c1a598789 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/PanelForm/useInvoice.js @@ -0,0 +1,288 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import { computed, nextTick, ref } from '@vue/composition-api' + +import store from '@/store' + +// Constants +import { + DISPLAY_COLUMN_PREFIX, + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX +} from '@/utils/ADempiere/dictionaryUtils' +import { + INVOICE_LIST_FORM, + COLUMN_NAME +} from '@/utils/ADempiere/dictionary/field/search/invoice.ts' +import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils' + +// Utils and Helper Methods +import { isEmptyValue } from '@/utils/ADempiere/valueUtils' +import { generateDisplayedValue } from '@/utils/ADempiere/dictionary/field/search/invoice.ts' +import { isSalesTransaction } from '@/utils/ADempiere/contextUtils' + +/** + * Use Business Partner as mixin + * @param {*} recordRow + * @returns + */ +export default ({ + uuidForm = INVOICE_LIST_FORM, + parentUuid, + containerUuid, + containerManager, + fieldAttributes +}) => { + const timeOutRecords = ref(null) + + const blankValues = computed(() => { + const { column_name, elementColumnName } = this.metadata + return { + [column_name]: undefined, + [elementColumnName]: undefined, + [COLUMN_NAME]: undefined, + id: undefined, + uuid: undefined, + business_partner: undefined, + date_invoiced: undefined, + document_no: undefined, + currency: undefined, + grand_total: undefined, + converted_amount: undefined, + open_amount: undefined, + payment_term: undefined, + is_paid: undefined, + is_sales_transaction: undefined, + description: undefined, + po_reference: undefined, + document_status: undefined + } + }) + + const businessPartnerData = computed(() => { + return store.getters.getBusinessPartnerData({ + containerUuid: uuidForm + }) + }) + + const isLoadedRecords = computed(() => { + const { isLoaded } = businessPartnerData.value + return isLoaded + }) + + const isLoadingRecords = computed(() => { + const { isLoading } = businessPartnerData.value + return isLoading + }) + + const currentRow = computed({ + set(rowSelected) { + store.commit('setBusinessPartnerSelectedRow', { + containerUuid: uuidForm, + currentRow: rowSelected + }) + }, + get() { + return store.getters.getBusinessPartnerCurrentRow({ + containerUuid: uuidForm + }) + } + }) + + const showQueryFields = computed({ + set(newValue) { + store.commit('setBusinessPartnerShowQueryFields', { + containerUuid: uuidForm, + showQueryFields: newValue + }) + }, + get() { + return store.getters.getBusinessPartnerShowQueryFields({ + containerUuid: uuidForm + }) + } + }) + + const isSalesTransactionContext = computed(() => { + return isSalesTransaction({ + parentUuid: fieldAttributes.parentUuid, + containerUuid: fieldAttributes.containerUuid + }) + }) + + function clearValues() { + setValues( + blankValues.value + ) + } + + function closeList() { + store.commit('setInoviceShow', { + containerUuid: uuidForm, + show: false + }) + } + function setValues(recordRow) { + const { columnName, elementName, isSameColumnElement } = fieldAttributes + const { uuid, id } = recordRow + + const displayValue = generateDisplayedValue(recordRow) + // console.log(displayValue) + store.commit('updateValueOfField', { + parentUuid, + containerUuid, + columnName, + value: id + }) + // set display column (name) value + store.commit('updateValueOfField', { + parentUuid, + containerUuid, + // DisplayColumn_'ColumnName' + columnName: DISPLAY_COLUMN_PREFIX + columnName, + value: displayValue + }) + // set UUID value + store.commit('updateValueOfField', { + parentUuid, + containerUuid, + columnName: columnName + UNIVERSALLY_UNIQUE_IDENTIFIER_COLUMN_SUFFIX, + value: uuid + }) + // update element column name (smart browse) + if (!isSameColumnElement) { + store.commit('updateValueOfField', { + parentUuid, + containerUuid, + columnName: elementName, + value: id + }) + // set display column (name) value + store.commit('updateValueOfField', { + parentUuid, + containerUuid, + // DisplayColumn_'ColumnName' + columnName: DISPLAY_COLUMN_PREFIX + elementName, + value: displayValue + }) + } + + // implement container manager row + if (fieldAttributes.inTable && containerManager && containerManager.setCell) { + containerManager.setCell({ + containerUuid, + rowIndex: fieldAttributes.rowIndex, + columnName, + value: id + }) + containerManager.setCell({ + containerUuid, + rowIndex: fieldAttributes.rowIndex, + columnName: DISPLAY_COLUMN_PREFIX + columnName, + value: displayValue + }) + } + + store.dispatch('notifyFieldChange', { + containerUuid, + containerManager, + field: fieldAttributes, + columnName, + newValue: id + }) + } + + function loadRecordsList({ pageNumber = 0, pageSize = ROWS_OF_RECORDS_BY_PAGE }) { + let parentUuid = fieldAttributes.parentUuid + if (isEmptyValue(parentUuid)) { + parentUuid = fieldAttributes.containerUuid + } + + // isLoadingRecords.value = true + clearTimeout(timeOutRecords.value) + timeOutRecords.value = setTimeout(() => { + // search on server + containerManager.getSearchRecordsList({ + parentUuid, + containerUuid: uuidForm, + contextColumnNames: fieldAttributes.reference.context_column_names, + tableName: fieldAttributes.referenceTableName, + uuid: fieldAttributes.uuid, + id: fieldAttributes.id, + // filters, + pageNumber, + pageSize + }) + .then(response => { + // store.commit('setFiltersList', { + // containerUuid: uuidForm, + // isSOTrx: this.isSOTrx + // }) + if (isEmptyValue(response)) { + // this.$message({ + // type: 'warning', + // showClose: true, + // message: this.$t('businessPartner.notFound') + // }) + } + + nextTick(() => { + // if (this.$refs.businessPartnerTable) { + // this.$refs.businessPartnerTable.setCurrentRow(this.currentRow) + // } + }) + }) + }, 500) + } + + function keyAction(event) { + switch (event.srcKey) { + case 'toggleQuery': + showQueryFields.value = !showQueryFields.value + break + case 'refreshList': + /** + * TODO: When refreshing you are making 2 list requests, you can be the + * observer that activates the second request + */ + loadRecordsList({}) + break + + case 'close': + closeList() + break + } + } + + return { + blankValues, + businessPartnerData, + currentRow, + isLoadedRecords, + isLoadingRecords, + isSalesTransactionContext, + showQueryFields, + // + clearValues, + closeList, + generateDisplayedValue, + keyAction, + setValues, + loadRecordsList + } +} diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/button.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/button.vue new file mode 100644 index 00000000000..1834e44dbf0 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/button.vue @@ -0,0 +1,141 @@ + + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue new file mode 100644 index 00000000000..b079462b877 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/index.vue @@ -0,0 +1,207 @@ + + + + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/mixinInvoice.js b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/mixinInvoice.js new file mode 100644 index 00000000000..cd9a276f811 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/mixinInvoice.js @@ -0,0 +1,85 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import store from '@/store' + +// Constants +import { + COLUMN_NAME +} from '@/utils/ADempiere/dictionary/field/search/invoice.ts' + +// Utils and Helper Methods +import { generateDisplayedValue } from '@/utils/ADempiere/dictionary/field/search/invoice.ts' + +export default { + name: 'MixinInvoice', + + props: { + metadata: { + type: Object, + default: () => { + return { + parentUuid: undefined, + containerUuid: undefined, + column_name: COLUMN_NAME, + elementColumnName: COLUMN_NAME + } + } + } + }, + + computed: { + blankValues() { + const { column_name, elementColumnName } = this.metadata + return { + [column_name]: undefined, + [elementColumnName]: undefined, + [COLUMN_NAME]: undefined, + id: undefined, + uuid: undefined, + business_partner: undefined, + date_invoiced: undefined, + document_no: undefined, + currency: undefined, + grand_total: undefined, + converted_amount: undefined, + open_amount: undefined, + payment_term: undefined, + is_paid: undefined, + is_sales_transaction: undefined, + description: undefined, + po_reference: undefined, + document_status: undefined + } + }, + recordsList() { + return store.getters.getBusinessPartnerRecordsList({ + containerUuid: this.uuidForm + }) + } + }, + + methods: { + /** + * @overwrite + * Get custom displayed value + * @returns {string} + */ + generateDisplayedValue + } +} diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/panelFooter.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/panelFooter.vue new file mode 100644 index 00000000000..aa8a072cf2d --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/panelFooter.vue @@ -0,0 +1,229 @@ + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/tableRecords.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/tableRecords.vue new file mode 100644 index 00000000000..60d036e35d0 --- /dev/null +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo/tableRecords.vue @@ -0,0 +1,280 @@ + + + + + diff --git a/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue b/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue index b81547c4d26..a9e570c73a5 100644 --- a/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue +++ b/src/components/ADempiere/FieldDefinition/FieldSearch/index.vue @@ -92,6 +92,9 @@ export default { break // case 'A_Asset': // case 'C_Order': + case 'C_Invoice': + fieldRender = () => import('@/components/ADempiere/FieldDefinition/FieldSearch/InvoiceInfo') + break default: fieldRender = () => import('@/components/ADempiere/FieldDefinition/FieldSearch/GeneralInfoSearch') break diff --git a/src/lang/ADempiere/en/field/index.js b/src/lang/ADempiere/en/field/index.js index b404bb618e9..a43177d0699 100644 --- a/src/lang/ADempiere/en/field/index.js +++ b/src/lang/ADempiere/en/field/index.js @@ -21,6 +21,7 @@ import product from './product.ts' import productAttribute from './productAttribute' import warehouseLocator from './warehouseLocator' import locationsAddress from './locationsAddress' +import invoice from './invoice' export default { businessPartner, @@ -40,5 +41,6 @@ export default { product, productAttribute, warehouseLocator, - locationsAddress + locationsAddress, + invoice } diff --git a/src/lang/ADempiere/en/field/invoice.js b/src/lang/ADempiere/en/field/invoice.js new file mode 100644 index 00000000000..b5ee7c19ef9 --- /dev/null +++ b/src/lang/ADempiere/en/field/invoice.js @@ -0,0 +1,36 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Elsio Sanchez elsiosanchez15@outlook.com https://github.com/elsiosanchez + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +const invoice = { + document: 'Document', + businessParnet: 'Business Partner', + saleTransaction: 'Sale Transaction', + paid: 'Paid', + description: 'Description', + invoiceDate: 'Invoice Date', + saleOrder: 'Sale Order', + grandTotal: 'Grand Total', + documentNo: 'Document No.', + currency: 'Currency', + converted: 'Converted', + open: 'Open', + payment: 'Payment Term', + reference: 'Business Partner Order Reference' +} + +export default invoice diff --git a/src/lang/ADempiere/es/field/index.js b/src/lang/ADempiere/es/field/index.js index 644628d539d..9a7136e96dc 100644 --- a/src/lang/ADempiere/es/field/index.js +++ b/src/lang/ADempiere/es/field/index.js @@ -21,6 +21,7 @@ import product from './product.ts' import productAttribute from './productAttribute' import warehouseLocator from './warehouseLocator' import locationsAddress from './locationsAddress' +import invoice from './invoice' export default { businessPartner, @@ -40,5 +41,6 @@ export default { product, productAttribute, warehouseLocator, - locationsAddress + locationsAddress, + invoice } diff --git a/src/lang/ADempiere/es/field/invoice.js b/src/lang/ADempiere/es/field/invoice.js new file mode 100644 index 00000000000..af0e500949b --- /dev/null +++ b/src/lang/ADempiere/es/field/invoice.js @@ -0,0 +1,36 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Elsio Sanchez elsiosanchez15@outlook.com https://github.com/elsiosanchez + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +const invoice = { + document: 'Número de Documento', + businessParnet: 'Socio del Negocio', + saleTransaction: 'Transacción de Venta', + paid: 'Pagado', + description: 'Descripción', + invoiceDate: 'Fecha de Facturación', + saleOrder: 'Orden de Venta', + grandTotal: 'Gran Total', + documentNo: 'Documento No.', + currency: 'Moneda', + converted: 'Convertido', + open: 'Abierto', + payment: 'Término de Pago', + reference: 'Referencia de Orden de Socio del Negocio' +} + +export default invoice diff --git a/src/lang/ADempiere/es/field/product.ts b/src/lang/ADempiere/es/field/product.ts index f3a59b23d42..fb451661363 100644 --- a/src/lang/ADempiere/es/field/product.ts +++ b/src/lang/ADempiere/es/field/product.ts @@ -87,14 +87,14 @@ const product = { availableToPromisesTables: { name: 'Nombre', value: 'Código', - locator: 'localizacion', + locator: 'localización', availableQuantity: 'Cantidad Disponible', onHandQuantity: 'Cantidad Pedida', expectedChangeQuantity: 'Cantidad de Cambio Prevista', businessPartner: 'Socio de Negocios', reservedQuantity: 'Cantidad Disponible', standardPrice: 'Precio Estandar', - documentNo: 'Numero de Documento', + documentNo: 'Número de Documento', attributeSetInstance: 'Attributo' }, vendorPurchasesTables: { diff --git a/src/store/modules/ADempiere/field/search/invoiceSearch.js b/src/store/modules/ADempiere/field/search/invoiceSearch.js new file mode 100644 index 00000000000..32151043017 --- /dev/null +++ b/src/store/modules/ADempiere/field/search/invoiceSearch.js @@ -0,0 +1,99 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Elsio Sanchez elsiosanchez@gmail.com https://github.com/elsiosanchez + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import Vue from 'vue' + +import { requestListInvoicesInfo } from '@/api/ADempiere/field/search/invoice.ts' + +const initState = { + InvociesInfo: {}, + CountInvocies: 0, + BPShowInvoice: {} +} + +export default { + state: initState, + + mutations: { + setInvociesInfo(state, element) { + state.InvociesInfo = element + }, + setCountInfo(state, count) { + state.CountInvocies = count + }, + setInoviceShow(state, { + containerUuid, + show = false + }) { + Vue.set(state.BPShowInvoice, containerUuid, show) + } + }, + + actions: { + searchInvociesInfos({ commit }, { + page_size, + page_token, + document_no, + is_sales_transaction, + business_partner_id, + is_paid, + description, + invoice_date_from, + invoice_date_to, + order_id, + grand_total_from, + grand_total_to + }) { + return new Promise(resolve => { + requestListInvoicesInfo({ + page_size, + page_token, + document_no, + is_sales_transaction, + business_partner_id, + is_paid, + description, + invoice_date_from, + invoice_date_to, + order_id, + grand_total_from, + grand_total_to + }) + .then(response => { + const { records } = response + commit('setInvociesInfo', records) + + commit('setCountInfo', records.length) + resolve(records) + }) + }) + } + }, + + getters: { + getInvoicesSearchFieldRecordsList: (state) => { + return state.InvociesInfo + }, + getCountInvocies: (state) => { + return state.CountInvocies + }, + getSetShow: (state) => ({ containerUuid }) => { + return state.BPShowInvoice[containerUuid] || false + } + } +} diff --git a/src/utils/ADempiere/dictionary/field/search/invoice.ts b/src/utils/ADempiere/dictionary/field/search/invoice.ts new file mode 100644 index 00000000000..8cfb8369565 --- /dev/null +++ b/src/utils/ADempiere/dictionary/field/search/invoice.ts @@ -0,0 +1,61 @@ +/** + * ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution + * Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com + * Contributor(s): Edwin Betancourt EdwinBetanc0urt@outlook.com https://github.com/EdwinBetanc0urt + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Utils and Helper Methods +import { isEmptyValue } from '@/utils/ADempiere/valueUtils' + +export const TABLE_NAME = 'C_Invoice' + +export const COLUMN_NAME = 'C_Invoice_ID' + +export const INVOICE_LIST_FORM = 'Accouting-Combination-List' + +/** + * Generate displayed value from values + * @param {Object} recordRow + * @returns {String} + */ + +export function generateDisplayedValue(recordRow) { + const { document_no, date_invoiced, grand_total } = recordRow + let displayedValue = document_no + if (!isEmptyValue(date_invoiced)) { + if (!isEmptyValue(displayedValue)) { + displayedValue += ' - ' + date_invoiced + } if (!isEmptyValue(grand_total)) { + displayedValue += ' - ' + grand_total + } else { + displayedValue = date_invoiced + } + return displayedValue + } + // generate with standard columns + const { business_partner } = recordRow + + if (!isEmptyValue(business_partner)) { + displayedValue = business_partner + } + if (!isEmptyValue(date_invoiced)) { + if (!isEmptyValue(displayedValue)) { + displayedValue += ' - ' + date_invoiced + } else { + displayedValue = date_invoiced + } + } + return displayedValue +}