Skip to content

Commit

Permalink
calculate the total tax of the order (#1157)
Browse files Browse the repository at this point in the history
Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
  • Loading branch information
elsiosanchez and elsiosanchez authored Sep 3, 2021
1 parent f679e19 commit dbacfe7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/ADempiere/Form/VPOS/Order/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{{ $t('form.productInfo.price') }}:
<b>{{ formatPrice(scope.row.priceList, pointOfSalesCurrency.iSOCode) }}</b>
<br>
<b>{{ scope.row.taxRate.name }}</b>
<b>{{ scope.row.taxRate.name }}</b> {{ tax }}
<br>
{{ $t('form.productInfo.grandTotal') }}:
<b>{{ formatPrice((scope.row.priceList * scope.row.taxRate.rate / 100) + scope.row.priceList, pointOfSalesCurrency.iSOCode) }}</b>
Expand Down Expand Up @@ -334,7 +334,7 @@
{{ currentOrder.salesRepresentative.name }}
</b></p>
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b v-if="!isEmptyValue(currentOrder.uuid)" class="order-info">{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}</b></p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b v-if="!isEmptyValue(currentOrder.uuid)" style="float: right;">{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b v-if="!isEmptyValue(currentOrder.uuid)" style="float: right;">{{ formatPrice(tax, pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total">
<b>
{{ $t('form.pos.order.total') }}:
Expand Down Expand Up @@ -593,6 +593,13 @@ export default {
}
return this.currentPointOfSales.currentOrder
},
tax() {
if (!this.isEmptyValue(this.currentOrder.lineOrder)) {
const taxRate = this.currentOrder.lineOrder.filter(tax => tax.taxRate.rate > 0)
return this.sumTax(taxRate)
}
return 0
},
isDisabled() {
return this.currentPointOfSales.currentOrder.isProcessed
},
Expand Down Expand Up @@ -705,6 +712,15 @@ export default {
formatDateToSend,
formatPrice,
formatQuantity,
sumTax(tax) {
let sum = 0
if (tax) {
tax.forEach((line) => {
sum += line.priceList * line.taxRate.rate / 100
})
}
return sum
},
keyActionClosePin(event) {
this.visible = false
this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: false })
Expand Down

0 comments on commit dbacfe7

Please sign in to comment.