diff --git a/resources/assets/js/components/NewInvoice.vue b/resources/assets/js/components/NewInvoice.vue index b2cc0918..b6d5b3c4 100644 --- a/resources/assets/js/components/NewInvoice.vue +++ b/resources/assets/js/components/NewInvoice.vue @@ -284,7 +284,7 @@ Adjustment - {{ adjustment || 'auto' }} + {{ form.formData.adjustment || 'auto' }}   @@ -520,6 +520,7 @@ export default { marking: this.booking_details.marking, gst_id: '', reg_no: '', + adjustment: '', lines: [] }, addLine: { @@ -547,8 +548,7 @@ export default { total: 0, role: null, currentStatus: null, - statuses: [], - adjustment: 0 + statuses: [] } }, computed: { @@ -577,6 +577,8 @@ export default { }, gst_id: { + }, + adjustment: { } }, addLine: { @@ -683,7 +685,7 @@ export default { setTotal: function () { if (this.form.formData.lines.length < 1) { this.subtotal = 0 - this.adjustment = 0 + this.form.formData.adjustment = 0 this.total = this.billing_charge // Temporary fix. Will return error if GST is implemented. return } @@ -693,11 +695,11 @@ export default { // Set Adjustment if CNY total is equal to Invoice CNY Total const cnyTotal = this.form.formData.lines.map(l => +l.unit_price_rmb * +l.quantity).reduce((a, b) => a + b) if (cnyTotal === this.amount) { - this.adjustment = parseFloat(+this.bia - +this.subtotal - this.billing_charge).toFixed(2) + this.form.formData.adjustment = parseFloat(+this.bia - +this.subtotal - this.billing_charge).toFixed(2) } else { - this.adjustment = 0 + this.form.formData.adjustment = 0 } - this.total = parseFloat(+this.subtotal + (+this.subtotal * (+this.tax || 0) / 100) + +this.billing_charge + +this.adjustment).toFixed(2) + this.total = parseFloat(+this.subtotal + (+this.subtotal * (+this.tax || 0) / 100) + +this.billing_charge + +this.form.formData.adjustment).toFixed(2) }, clearAddLine: function () { this.form.addLine.order = null @@ -785,7 +787,7 @@ export default { this.currentStatus = resp.data.status[resp.data.status.length - 1].status - this.adjustment = resp.data.adjustment + this.form.formData.adjustment = resp.data.adjustment this.setTotal() })