Skip to content

Commit

Permalink
feat: Invoice search field (#2199)
Browse files Browse the repository at this point in the history
* bugfix: Invoices

* fix: Invoice

* fix: Invoice

* fix: Invoice

* fix: Invoice

* fix: Invoice

* bugfix: Invoices

* fix: Invoice

* fix: Invoice

* fix: Invoice
  • Loading branch information
Ricargame committed May 6, 2024
1 parent 559ede1 commit 32fb3f8
Show file tree
Hide file tree
Showing 25 changed files with 2,720 additions and 4 deletions.
114 changes: 114 additions & 0 deletions src/api/ADempiere/field/search/invoice.ts
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

// 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
}
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!--
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 <https:www.gnu.org/licenses/>.
-->
<template>
<el-form-item :label="$t('field.invoice.saleOrder')">
<el-select
v-model="saleOrderField"
clearable
filterable
size="mini"
:filter-method="filterSearchOrder"
style="margin: 0px; width: 100%"
@visible-change="showList"
@change="currentValue()"
>
<el-option
v-for="item in optionsListOrder"
:key="item.id"
:label="item.displayColumn"
:value="item.id"
/>
</el-select>
</el-form-item>
</template>

<script>
import {
defineComponent, ref
} from '@vue/composition-api'
// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import store from '@/store'
//
import { requestListOrders } from '@/api/ADempiere/field/search/invoice.ts'
export default defineComponent({
name: 'InvoiceField',
setup() {
const optionsListOrder = ref([])
const saleOrderField = ref('')
function showList(isShow) {
if (isShow && isEmptyValue(optionsListOrder.value)) { filterSearchOrder({}) }
}
function filterSearchOrder(
searchQuery
) {
requestListOrders({
search_value: searchQuery
})
.then(response => {
const { records } = response
optionsListOrder.value = records.map((list) => {
return {
...list,
displayColumn: list.values.DisplayColumn
}
})
})
}
const currentValue = () => {
store.dispatch('searchInvociesInfos', {
order_id: saleOrderField.value
})
}
return {
optionsListOrder,
saleOrderField,
//
filterSearchOrder,
showList,
currentValue
}
}
})
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!--
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 <https:www.gnu.org/licenses/>.
-->
<template>
<el-form-item
:label="$t('field.invoice.paid')"
style="align-items: center;"
>
<el-select
v-model="paidFieldValue"
@change="currentValue()"
>
<el-option
v-for="(option, key) in YES_NO_OPTIONS_LIST"
:key="key"
:value="option.stringValue"
:label="option.displayValue"
/>
</el-select>
</el-form-item>
</template>

<script>
import { defineComponent, ref } from '@vue/composition-api'
import store from '@/store'
// Constants
import { YES_NO_OPTIONS_LIST } from '@/utils/ADempiere/dictionary/field/yesNo.js'
export default defineComponent({
name: 'PaidField',
setup() {
const paidFieldValue = ref('')
const currentValue = () => {
store.dispatch('searchInvociesInfos', {
is_paid: paidFieldValue.value
})
}
return {
paidFieldValue,
YES_NO_OPTIONS_LIST,
//
currentValue
}
}
})
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<!--
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 <https:www.gnu.org/licenses/>.
-->
<template>
<el-form-item
:label="$t('field.invoice.saleTransaction')"
style="align-items: center;"
>
<el-select
v-model="saleTransactionField"
@change="currentValue()"
>
<el-option
v-for="(option, key) in YES_NO_OPTIONS_LIST"
:key="key"
:value="option.stringValue"
:label="option.displayValue"
/>
</el-select>
</el-form-item>
</template>

<script>
import { defineComponent, ref, computed } from '@vue/composition-api'
import store from '@/store'
// Constants
import { YES_NO_OPTIONS_LIST } from '@/utils/ADempiere/dictionary/field/yesNo'
// Utils and Helper Methods
import { isSalesTransaction } from '@/utils/ADempiere/contextUtils'
// import { isEmptyValue } from '@/utils/ADempiere'
export default defineComponent({
name: 'saleTransactionField',
props: {
uuidForm: {
required: true,
type: String
},
parentUuid: {
type: String,
default: undefined
},
containerUuid: {
required: true,
type: String
}
},
setup(props) {
const saleTransactionField = ref('')
const currentValue = () => {
store.dispatch('searchInvociesInfos', {
is_sales_transaction: saleTransactionField.value
})
}
const isSalesTransactionContext = computed(() => {
return isSalesTransaction({
parentUuid: props.parentUuid,
containerUuid: props.containerUuid
})
})
function changeValue() {
const response = isSalesTransactionContext.value
if (response === true) {
saleTransactionField.value = 'Y'
return
} else if (response === false) {
saleTransactionField.value = 'N'
return
} else {
saleTransactionField.value = ''
}
currentValue()
return
}
changeValue()
return {
saleTransactionField,
YES_NO_OPTIONS_LIST,
isSalesTransactionContext,
//
currentValue,
changeValue
}
}
})
</script>
Loading

0 comments on commit 32fb3f8

Please sign in to comment.