#744 fix edit sale bug

This commit is contained in:
Gerard 2018-10-23 14:33:07 +02:00
parent 410c38c420
commit 0b112b3d59
1 changed files with 15 additions and 11 deletions

View File

@ -25,14 +25,18 @@ class Controller {
set sales(value) { set sales(value) {
this._sales = value; this._sales = value;
this.loadSubTotal(); this.refreshTotal();
this.loadVAT();
} }
get sales() { get sales() {
return this._sales; return this._sales;
} }
refreshTotal() {
this.loadSubTotal();
this.loadVAT();
}
loadSubTotal() { loadSubTotal() {
this.subTotal = 0.0; this.subTotal = 0.0;
if (!this.sales) return; if (!this.sales) return;
@ -151,9 +155,9 @@ class Controller {
} }
removeInstances(instances) { removeInstances(instances) {
for (let i = instances.length - 1; i >= 0; i--) { for (let i of instances)
this.sales.splice(instances[i].instance, 1); this.sales.splice(i.instance, 1);
} this.refreshTotal();
} }
showRemoveLinesDialog() { showRemoveLinesDialog() {
@ -327,16 +331,16 @@ class Controller {
}); });
} }
/** /**
* Unmark sale as reserved * Unmark sale as reserved
*/ */
unmarkAsReserved() { unmarkAsReserved() {
this.setReserved(false); this.setReserved(false);
} }
/** /**
* Mark sale as reserved * Mark sale as reserved
*/ */
markAsReserved() { markAsReserved() {
this.setReserved(true); this.setReserved(true);
} }