Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Refund Errors #1133

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ export function createPayment({
amount,
paymentDate,
tenderTypeCode,
isRefund,
currencyUuid
}) {
return request({
Expand All @@ -570,6 +571,7 @@ export function createPayment({
amount: amount,
payment_date: paymentDate,
tender_type_code: tenderTypeCode,
is_refund: isRefund,
currency_uuid: currencyUuid
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/ADempiere/Form/VPOS/Collection/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default {
const listLocal = this.$store.getters.getPaymentBox
const listServer = this.currentOrder.listPayments
if (!this.sendToServer) {
return listServer.payments
return listServer.payments.filter(payment => !payment.isRefund)
}
return listLocal
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,6 @@
</div>
</el-card>
</div>
<el-card v-if="option === 3" class="box-card">
<div class="text item">
<type-refund
:is-add-type-pay="refundLoaded"
/>
</div>
</el-card>
<div v-if="caseOrder === 2">
<el-card>
<div slot="header" class="clearfix">
Expand Down Expand Up @@ -483,7 +476,7 @@ export default {
tenderTypeCode: this.selectionTypeRefund.tender_type
}
const emptyMandatoryFields = this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: this.renderComponentContainer, formatReturn: 'name' })
if (!this.isEmptyValue(emptyMandatoryFields) || this.isEmptyValue(this.$store.getters.getCurrencyRedund.uuid)) {
if (!this.isEmptyValue(emptyMandatoryFields) || this.isEmptyValue(this.defaultReferenceCurrency.uuid)) {
this.isEmptyValue(this.$store.getters.getCurrencyRedund.uuid) ? emptyMandatoryFields.push(this.$t('form.pos.collect.Currency')) : emptyMandatoryFields
this.$message({
type: 'warning',
Expand All @@ -501,9 +494,18 @@ export default {
})
})
this.$store.dispatch('addRefundLoaded', values)
this.$store.dispatch('sendCreateCustomerAccount', customer)
this.$store.dispatch('sendCreateCustomerAccount', {
posUuid: this.currentPointOfSales.uuid,
orderUuid: this.currentOrder.uuid,
bankUuid: customer.C_Bank_ID_UUID,
amount: this.change,
tenderTypeCode: this.selectionTypeRefund.tender_type,
currencyUuid: this.defaultReferenceCurrency.uuid
})
.then(response => {
this.success()
})
this.selectionTypeRefund = {}
this.success()
},
success() {
const customerDetails = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,5 @@ export default [
isActiveLogics: true,
isMandatory: true
}
},
{
tableName,
elementColumnName: 'PayAmt',
columnName: 'PayAmt',
isFromDictionary: true,
overwriteDefinition: {
sequence: 6,
handleContentSelection: true,
handleActionPerformed: true,
size: 24,
isNumericField: true,
isActiveLogics: true,
isMandatory: true,
isReadOnly: true
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@
:metadata-field="field"
/>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('form.pos.collect.change')">
<el-input v-model="amountRefund" disabled />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('form.pos.collect.Currency')">
<el-select
v-model="currentFieldCurrency"
v-model="currencyReference.iso_code"
style="width: -webkit-fill-available;"
disabled
@change="changeCurrency"
Expand Down Expand Up @@ -115,8 +120,11 @@ export default {
}
},
computed: {
amountRefund() {
return this.formatPrice(this.change / this.dayRate.divideRate, this.currencyReference.key)
},
currencyReference() {
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency.id) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const currency = this.listCurrency.find(currency => {
if (currency.id === reference) {
return currency
Expand Down Expand Up @@ -177,13 +185,17 @@ export default {
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
},
convertionsList() {
return this.$store.state['pointOfSales/point/index'].conversionsList
},
dayRate() {
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.key)
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.iso_code)
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
}
})
console.log(convert)
if (!this.isEmptyValue(convert)) {
return convert
}
Expand All @@ -194,13 +206,6 @@ export default {
}
}
},
mounted() {
this.$store.commit('updateValueOfField', {
containerUuid: this.metadata.containerUuid,
columnName: 'PayAmt',
value: this.change / this.dayRate.divideRate
})
},
methods: {
formatPrice,
close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{ $t('form.pos.collect.change') }} : {{ amountRefund }}
</b>
<b class="order-info" style="padding-left: 2%;">
{{ $t('form.pos.collect.Currency') }} : {{ currencyReference.name }}
{{ $t('form.pos.collect.Currency') }} : {{ currencyReference.iso_code + '(' + currencyReference.currency_symbol + ')' }}
</b>
</p>
</el-form>
Expand Down Expand Up @@ -86,7 +86,7 @@ export default {
return this.formatPrice(this.change / this.dayRate.divideRate, this.currencyReference.key)
},
currencyReference() {
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency.id) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const currency = this.listCurrency.find(currency => {
if (currency.id === reference) {
return currency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,5 @@ export default [
isActiveLogics: true,
isMandatory: true
}
},
{
tableName,
elementColumnName: 'PayAmt',
columnName: 'PayAmt',
isFromDictionary: true,
overwriteDefinition: {
sequence: 4,
handleContentSelection: true,
handleActionPerformed: true,
size: 24,
isNumericField: true,
isActiveLogics: true,
isMandatory: true,
isReadOnly: true
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@
:metadata-field="field"
/>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('form.pos.collect.change')">
<el-input v-model="amountRefund" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('form.pos.collect.Currency')">
<el-select
v-model="currencyReference.name"
v-model="currencyReference.iso_code"
style="width: -webkit-fill-available;"
disabled
@change="changeCurrency"
Expand Down Expand Up @@ -119,8 +124,11 @@ export default {
}
},
computed: {
amountRefund() {
return this.formatPrice(this.change / this.dayRate.divideRate, this.currencyReference.key)
},
currencyReference() {
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency.id) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const currency = this.listCurrency.find(currency => {
if (currency.id === reference) {
return currency
Expand Down Expand Up @@ -181,13 +189,17 @@ export default {
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
},
convertionsList() {
return this.$store.state['pointOfSales/point/index'].conversionsList
},
dayRate() {
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.key)
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.iso_code)
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
}
})
console.log(convert)
if (!this.isEmptyValue(convert)) {
return convert
}
Expand All @@ -198,13 +210,6 @@ export default {
}
}
},
mounted() {
this.$store.commit('updateValueOfField', {
containerUuid: this.metadata.containerUuid,
columnName: 'PayAmt',
value: this.change / this.dayRate.divideRate
})
},
methods: {
formatPrice,
close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// 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 [
// Name
{
Expand Down Expand Up @@ -45,21 +43,5 @@ export default [
isActiveLogics: true,
isMandatory: true
}
},
{
tableName,
elementColumnName: 'PayAmt',
columnName: 'PayAmt',
isFromDictionary: true,
overwriteDefinition: {
sequence: 1,
handleContentSelection: true,
handleActionPerformed: true,
size: 24,
isNumericField: true,
isActiveLogics: true,
isMandatory: true,
isReadOnly: true
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@
:metadata-field="field"
/>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('form.pos.collect.change')">
<el-input v-model="amountRefund" disabled />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('form.pos.collect.Currency')">
<el-select
v-model="currencyReference.name"
v-model="currencyReference.iso_code"
style="width: -webkit-fill-available;"
disabled
@change="changeCurrency"
Expand Down Expand Up @@ -115,8 +120,11 @@ export default {
}
},
computed: {
amountRefund() {
return this.formatPrice(this.change / this.dayRate.divideRate, this.currencyReference.key)
},
currencyReference() {
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency.id) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const reference = this.isEmptyValue(this.typeRefund.refund_reference_currency) ? this.defaultCurrency.id : this.typeRefund.refund_reference_currency.id
const currency = this.listCurrency.find(currency => {
if (currency.id === reference) {
return currency
Expand Down Expand Up @@ -177,13 +185,17 @@ export default {
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
},
convertionsList() {
return this.$store.state['pointOfSales/point/index'].conversionsList
},
dayRate() {
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.key)
const currency = this.listCurrency.find(currency => currency.iso_code === this.currencyReference.iso_code)
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
}
})
console.log(convert)
if (!this.isEmptyValue(convert)) {
return convert
}
Expand All @@ -194,13 +206,6 @@ export default {
}
}
},
mounted() {
this.$store.commit('updateValueOfField', {
containerUuid: this.metadata.containerUuid,
columnName: 'PayAmt',
value: this.change / this.dayRate.divideRate
})
},
methods: {
formatPrice,
close() {
Expand Down
Loading