Fixes
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
d4c78b46c1
commit
a8377950f5
|
@ -53,9 +53,9 @@
|
|||
</vn-button>
|
||||
</vn-tool-bar>
|
||||
<vn-one class="taxes" ng-if="$ctrl.sales.length > 0">
|
||||
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR':2}}</p>
|
||||
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR':2}}</p>
|
||||
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR':2}}</strong></p>
|
||||
<p><vn-label translate>Subtotal</vn-label> {{$ctrl.subtotal | currency: 'EUR': 2}}</p>
|
||||
<p><vn-label translate>VAT</vn-label> {{$ctrl.VAT | currency: 'EUR': 2}}</p>
|
||||
<p><vn-label><strong>Total</strong></vn-label> <strong>{{$ctrl.total | currency: 'EUR': 2}}</strong></p>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-table model="model">
|
||||
|
|
|
@ -69,11 +69,11 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
refreshTotal() {
|
||||
this.loadSubTotal();
|
||||
this.loadVAT();
|
||||
this.getSubTotal();
|
||||
this.getVat();
|
||||
}
|
||||
|
||||
loadSubTotal() {
|
||||
getSubTotal() {
|
||||
if (!this.$params.id || !this.sales) return;
|
||||
this.$http.get(`Tickets/${this.$params.id}/subtotal`).then(res => {
|
||||
this.subtotal = res.data || 0.0;
|
||||
|
@ -81,13 +81,16 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
getSaleTotal(sale) {
|
||||
if (!sale.quantity || !sale.price)
|
||||
return;
|
||||
if (sale.quantity == null || sale.price == null)
|
||||
return null;
|
||||
|
||||
return sale.quantity * sale.price * ((100 - sale.discount) / 100);
|
||||
const price = sale.quantity * sale.price;
|
||||
const discount = (sale.discount * price) / 100;
|
||||
|
||||
return price - discount;
|
||||
}
|
||||
|
||||
loadVAT() {
|
||||
getVat() {
|
||||
this.VAT = 0.0;
|
||||
if (!this.$params.id || !this.sales) return;
|
||||
this.$http.get(`Tickets/${this.$params.id}/getVAT`).then(res => {
|
||||
|
@ -320,9 +323,10 @@ class Controller extends Section {
|
|||
|
||||
updatePrice() {
|
||||
const sale = this.edit.sale;
|
||||
if (this.edit.price != sale.price) {
|
||||
const newPrice = this.edit.price;
|
||||
if (newPrice != null && newPrice != sale.price) {
|
||||
const query = `Sales/${sale.id}/updatePrice`;
|
||||
this.$http.post(query, {newPrice: this.edit.price}).then(res => {
|
||||
this.$http.post(query, {newPrice}).then(res => {
|
||||
sale.price = res.data.price;
|
||||
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
|
@ -363,7 +367,8 @@ class Controller extends Section {
|
|||
|
||||
changeDiscount() {
|
||||
const sale = this.edit.sale;
|
||||
if (this.edit.discount != sale.discount)
|
||||
const newDiscount = this.edit.discount;
|
||||
if (newDiscount != null && newDiscount != sale.discount)
|
||||
this.updateDiscount([sale]);
|
||||
|
||||
this.$.editDiscount.hide();
|
||||
|
@ -371,13 +376,12 @@ class Controller extends Section {
|
|||
|
||||
changeMultipleDiscount() {
|
||||
const sales = this.edit.sales;
|
||||
const newDiscount = this.edit.discount;
|
||||
const hasChanges = sales.some(sale => {
|
||||
return sale.discount != this.edit.discount;
|
||||
return sale.discount != newDiscount;
|
||||
});
|
||||
|
||||
console.log(hasChanges);
|
||||
|
||||
if (hasChanges)
|
||||
if (newDiscount != null && hasChanges)
|
||||
this.updateDiscount(sales);
|
||||
|
||||
this.$.editDiscountDialog.hide();
|
||||
|
|
Loading…
Reference in New Issue