1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Support for cash payment types in the return of funds (#1101)

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-23 12:31:22 -04:00 committed by GitHub
parent 4d8aef3511
commit 849a93427a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 321 additions and 0 deletions

View File

@ -197,6 +197,9 @@ export default {
case 'P':
typePay = () => import('./paymentTypeChange/MobilePayment.vue')
break
case 'X':
typePay = () => import('./paymentTypeChange/cash/index.vue')
break
case 'A':
typePay = () => import('./paymentTypeChange/ACH/index.vue')
break

View File

@ -0,0 +1,35 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Yamel Senih ysenih@erpya.com www.erpya.com
// 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/>.
const tableName = 'C_Payment'
export default [
{
tableName,
elementColumnName: 'PayAmt',
columnName: 'PayAmt',
isFromDictionary: true,
overwriteDefinition: {
sequence: 0,
handleContentSelection: true,
handleActionPerformed: true,
size: 24,
isNumericField: true,
isActiveLogics: true,
isMandatory: true
}
}
]

View File

@ -0,0 +1,283 @@
<!--
ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
Contributor(s): Elsio Sanchez elsiosanches@gmail.com www.erpya.com
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>
<div>
<el-form
label-position="top"
label-width="10px"
>
<el-row :gutter="12">
<el-col
v-for="field in fieldsList"
:key="field.sequence"
:span="6"
>
<field-definition
:key="field.columnName"
:metadata-field="{
...field,
labelCurrency: dayRate.currencyTo
}"
/>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('form.pos.collect.Currency')">
<el-select
v-model="currentFieldCurrency"
@change="changeCurrency"
>
<el-option
v-for="item in listCurrency"
:key="item.id"
:label="item.name"
:value="item.key"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import { formatPrice } from '@/utils/ADempiere/valueFormat.js'
import formMixin from '@/components/ADempiere/Form/formMixin'
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
import fieldsListCash from './fieldsListCash.js'
export default {
name: 'Cash',
mixins: [
formMixin,
posMixin
],
props: {
change: {
type: Number,
default: 0
},
pay: {
type: Number,
default: 0
},
pending: {
type: Number,
default: 0
},
totalOrder: {
type: Number,
default: 0
},
currency: {
type: Object,
default: undefined
},
metadata: {
type: Object,
default: () => {
return {
uuid: 'Cash',
containerUuid: 'Cash'
}
}
}
},
data() {
return {
option: 1,
typePay: 0,
fieldsList: fieldsListCash,
currentFieldCurrency: '',
currentPaymentType: ''
}
},
computed: {
showDialogo() {
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.show
},
caseOrder() {
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.type
},
isoCode() {
return this.$store.getters.posAttributes.currentPointOfSales.displayCurrency.iso_code
},
maximumDailyRefundAllowed() {
console.log(this.$store.getters.posAttributes.currentPointOfSales.displayCurrency.iso_code)
return this.$store.getters.posAttributes.currentPointOfSales.maximumDailyRefundAllowed
},
maximumRefundAllowed() {
return this.$store.getters.posAttributes.currentPointOfSales.maximumRefundAllowed
},
displayeCurrency() {
const tenderType = this.$store.getters.getValueOfField({
containerUuid: 'OverdrawnInvoice',
columnName: 'TenderType'
})
if (tenderType === 'D') {
return true
}
return false
},
primaryFieldsList() {
return this.fieldsList.filter(field => field.sequence <= 2)
},
hiddenFieldsList() {
return this.fieldsList.filter(field => field.sequence >= 3)
},
listCurrency() {
return this.$store.getters.getCurrenciesList
},
emptyFieldGiftCard() {
const empty = this.fieldsList.filter(field => {
if (field.sequence < 3 && this.isEmptyValue(
this.$store.getters.getValueOfField({
containerUuid: 'OverdrawnInvoice',
columnName: field.columnName
})
)) {
return field
}
})
return empty.map(empty => empty.name)
},
emptyMandatoryFields() {
return this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: 'OverdrawnInvoice', formatReturn: 'name' })
},
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
},
convertionsList() {
return this.$store.state['pointOfSales/point/index'].conversionsList
},
currentConvertion() {
if (this.isEmptyValue(this.currentPointOfSales.displayCurrency)) {
return {}
}
const convert = this.convertionsList.find(convert => {
if (!this.isEmptyValue(convert.currencyTo) && !this.isEmptyValue(this.currentPointOfSales.displayCurrency) && convert.currencyTo.id === this.currentPointOfSales.displayCurrency.id) {
return convert
}
})
if (convert) {
return convert
}
return {}
},
dayRate() {
const currency = this.listCurrency.find(currency => currency.key === this.currentFieldCurrency)
const convert = this.convertionsList.find(convert => {
if (!this.isEmptyValue(currency) && !this.isEmptyValue(convert.currencyTo) && currency.id === convert.currencyTo.id && this.currentPointOfSales.currentPriceList.currency.id !== currency.id) {
return convert
}
})
if (!this.isEmptyValue(convert)) {
return convert
}
return {
currencyTo: this.currentPointOfSales.currentPriceList.currency,
divideRate: 1,
iSOCode: this.currentPointOfSales.currentPriceList.currency.iSOCode
}
}
},
created() {
this.$store.commit('updateValueOfField', {
containerUuid: 'Cash',
columnName: 'PayAmt',
value: this.change
})
},
methods: {
formatPrice,
close() {
this.$store.commit('dialogoInvoce', { show: false })
},
changeCurrency(value) {
this.currentFieldCurrency = value
},
changePaymentType(value) {
this.$store.commit('currentTenderChange', value)
this.currentPaymentType = value
this.$store.commit('updateValueOfField', {
containerUuid: 'OverdrawnInvoice',
columnName: 'TenderType',
value: value
})
}
}
}
</script>
<style scoped>
.el-image {
display: inline-block;
overflow: hidden;
}
.el-card__header {
padding: 18px 20px;
border-bottom: 1px solid #e6ebf5;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background-color: rgb(245, 247, 250);
}
.el-card__body {
padding-top: 0px !important;
padding-right: 0px!important;
padding-bottom: 20px;
padding-left: 10px!important;
height: 100%!important;
}
.bottom {
margin-top: 0px!important;
line-height: 1px;
}
.button {
padding: 0;
float: right;
}
.image {
width: 100%;
display: block;
height: 9vh;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.el-header {
background: 'white';
color: #333;
line-height: 10px;
}
.el-aside {
color: #333;
}
.el-row {
margin: 0px!important;
}
</style>