diff --git a/models/baseModels/Invoice/Invoice.ts b/models/baseModels/Invoice/Invoice.ts index e786d9e7..7105175d 100644 --- a/models/baseModels/Invoice/Invoice.ts +++ b/models/baseModels/Invoice/Invoice.ts @@ -187,7 +187,7 @@ export abstract class Invoice extends Transactional { return this._taxes[tax]; } - async getTotalDiscount() { + getTotalDiscount() { if (!this.enableDiscounting) { return this.fyo.pesa(0); } @@ -198,7 +198,7 @@ export abstract class Invoice extends Transactional { } async getGrandTotal() { - const totalDiscount = await this.getTotalDiscount(); + const totalDiscount = this.getTotalDiscount(); return ((this.taxes ?? []) as Doc[]) .map((doc) => doc.amount as Money) .reduce((a, b) => a.add(b), this.netTotal!) diff --git a/src/components/SalesInvoice/Templates/BaseTemplate.vue b/src/components/SalesInvoice/Templates/BaseTemplate.vue index baa7ae4f..4c32040a 100644 --- a/src/components/SalesInvoice/Templates/BaseTemplate.vue +++ b/src/components/SalesInvoice/Templates/BaseTemplate.vue @@ -25,6 +25,9 @@ export default { showHSN() { return this.doc.items.map((i) => i.hsnCode).every(Boolean); }, + totalDiscount() { + return this.doc.getTotalDiscount(); + }, }, }; diff --git a/src/components/SalesInvoice/Templates/Basic.vue b/src/components/SalesInvoice/Templates/Basic.vue index d5a27a1f..0d022a86 100644 --- a/src/components/SalesInvoice/Templates/Basic.vue +++ b/src/components/SalesInvoice/Templates/Basic.vue @@ -104,6 +104,13 @@
{{ t`Subtotal` }}
{{ fyo.format(doc.netTotal, 'Currency') }}
+
+
{{ t`Discount` }}
+
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
+
{{ tax.account }}
{{ fyo.format(tax.amount, 'Currency') }}
+
+
{{ t`Discount` }}
+
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
+
-
+
{{ t`Subtotal` }}
{{ fyo.format(doc.netTotal, 'Currency') }}
+
+
{{ t`Discount` }}
+
+ {{ `- ${fyo.format(totalDiscount, 'Currency')}` }} +
+
+ +
{{ tax.account }}
@@ -104,9 +111,19 @@ {{ fyo.format(tax.amount, 'Currency') }}
+ +
+
{{ t`Discount` }}
+
+ {{ `- ${fyo.format(totalDiscount, 'Currency')}` }} +
+
diff --git a/src/components/SalesInvoice/Templates/Minimal.vue b/src/components/SalesInvoice/Templates/Minimal.vue index e3b58d29..158767b5 100644 --- a/src/components/SalesInvoice/Templates/Minimal.vue +++ b/src/components/SalesInvoice/Templates/Minimal.vue @@ -128,6 +128,13 @@
{{ t`Subtotal` }}
{{ fyo.format(doc.netTotal, 'Currency') }}
+
+
{{ t`Discount` }}
+
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
+
{{ tax.account }}
{{ fyo.format(tax.amount, 'Currency') }}
+
+
{{ t`Discount` }}
+
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
+