Revised the saveOriginalLineItem method of the JavaScript JournalEntryLineItemEditor class not to override the existing amount when the existing amount is less than the net balance. This make it easier when updating the existing journal entries.

This commit is contained in:
依瑪貓 2023-04-30 14:46:13 +08:00
parent b718d19450
commit 46bd27e126

View File

@ -290,7 +290,9 @@ class JournalEntryLineItemEditor {
this.account = originalLineItem.account.copy(); this.account = originalLineItem.account.copy();
this.isAccountConfirmed = false; this.isAccountConfirmed = false;
this.#accountText.innerText = this.account.text; this.#accountText.innerText = this.account.text;
this.#amountInput.value = String(originalLineItem.netBalance); if (this.#amountInput.value === "" || new Decimal(this.#amountInput.value).greaterThan(originalLineItem.netBalance)) {
this.#amountInput.value = String(originalLineItem.netBalance);
}
this.#amountInput.max = String(originalLineItem.netBalance); this.#amountInput.max = String(originalLineItem.netBalance);
this.#amountInput.min = "0"; this.#amountInput.min = "0";
this.#validate(); this.#validate();