mirror of
https://github.com/frappe/books.git
synced 2024-12-22 19:09:01 +00:00
incr: add discount to print view
This commit is contained in:
parent
f05f77e191
commit
90e5680df0
@ -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!)
|
||||
|
@ -25,6 +25,9 @@ export default {
|
||||
showHSN() {
|
||||
return this.doc.items.map((i) => i.hsnCode).every(Boolean);
|
||||
},
|
||||
totalDiscount() {
|
||||
return this.doc.getTotalDiscount();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -104,6 +104,13 @@
|
||||
<div>{{ t`Subtotal` }}</div>
|
||||
<div>{{ fyo.format(doc.netTotal, 'Currency') }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-3 border-b"
|
||||
v-if="totalDiscount?.float > 0 && !doc.discountAfterTax"
|
||||
>
|
||||
<div>{{ t`Discount` }}</div>
|
||||
<div>{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-3"
|
||||
v-for="tax in doc.taxes"
|
||||
@ -112,6 +119,13 @@
|
||||
<div>{{ tax.account }}</div>
|
||||
<div>{{ fyo.format(tax.amount, 'Currency') }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-3 border-t"
|
||||
v-if="totalDiscount?.float > 0 && doc.discountAfterTax"
|
||||
>
|
||||
<div>{{ t`Discount` }}</div>
|
||||
<div>{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="
|
||||
flex
|
||||
|
@ -85,18 +85,25 @@
|
||||
</div>
|
||||
<div class="mt-12">
|
||||
<div class="flex -mx-3">
|
||||
<div class="flex justify-end flex-1 p-3 bg-gray-100">
|
||||
<div class="flex justify-end flex-1 py-3 bg-gray-100 gap-8 pr-6">
|
||||
<div class="text-right">
|
||||
<div class="text-gray-800">{{ t`Subtotal` }}</div>
|
||||
<div class="text-xl mt-2">
|
||||
{{ fyo.format(doc.netTotal, 'Currency') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="ml-8 text-right"
|
||||
v-for="tax in doc.taxes"
|
||||
:key="tax.name"
|
||||
class="text-right"
|
||||
v-if="totalDiscount?.float > 0 && !doc.discountAfterTax"
|
||||
>
|
||||
<div class="text-gray-800">{{ t`Discount` }}</div>
|
||||
<div class="text-xl mt-2">
|
||||
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-right" v-for="tax in doc.taxes" :key="tax.name">
|
||||
<div class="text-gray-800">
|
||||
{{ tax.account }}
|
||||
</div>
|
||||
@ -104,9 +111,19 @@
|
||||
{{ fyo.format(tax.amount, 'Currency') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="text-right"
|
||||
v-if="totalDiscount?.float > 0 && !doc.discountAfterTax"
|
||||
>
|
||||
<div class="text-gray-800">{{ t`Discount` }}</div>
|
||||
<div class="text-xl mt-2">
|
||||
{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="p-3 text-right text-white"
|
||||
class="py-3 px-4 text-right text-white"
|
||||
:style="{ backgroundColor: printSettings.color }"
|
||||
>
|
||||
<div>
|
||||
|
@ -128,6 +128,13 @@
|
||||
<div>{{ t`Subtotal` }}</div>
|
||||
<div>{{ fyo.format(doc.netTotal, 'Currency') }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-1"
|
||||
v-if="totalDiscount?.float > 0 && !doc.discountAfterTax"
|
||||
>
|
||||
<div>{{ t`Discount` }}</div>
|
||||
<div>{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-1"
|
||||
v-for="tax in doc.taxes"
|
||||
@ -136,6 +143,13 @@
|
||||
<div>{{ tax.account }}</div>
|
||||
<div>{{ fyo.format(tax.amount, 'Currency') }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-1"
|
||||
v-if="totalDiscount?.float > 0 && doc.discountAfterTax"
|
||||
>
|
||||
<div>{{ t`Discount` }}</div>
|
||||
<div>{{ `- ${fyo.format(totalDiscount, 'Currency')}` }}</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex pl-2 justify-between py-1 font-semibold"
|
||||
:style="{ color: printSettings.color }"
|
||||
|
Loading…
Reference in New Issue
Block a user