2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00

incr: convert other templates to template.html files

- delete old invoice template files
This commit is contained in:
18alantom 2023-02-24 17:16:49 +05:30
parent f398e190e6
commit 44f172316f
9 changed files with 307 additions and 503 deletions

View File

@ -0,0 +1,146 @@
<main class="bg-white h-full px-6" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="py-6 flex text-sm text-gray-900 border-b">
<!-- Company Logo & Name -->
<section class="w-1/3">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contain"
:src="print.logo"
/>
<div class="text-xl text-gray-700 font-semibold" v-else>
{{ print.companyName }}
</div>
</section>
<!-- Company Contacts -->
<section class="w-1/3">
<div>{{ print.email }}</div>
<div class="mt-1">{{ print.phone }}</div>
</section>
<!-- Company Address & GSTIN -->
<section class="w-1/3">
<div v-if="print.address">{{ print.links.address.addressDisplay }}</div>
<div v-if="print.gstin">GSTIN: {{ print.gstin }}</div>
</section>
</header>
<!-- Sub Heading Section -->
<section class="mt-8 flex justify-between">
<!-- Invoice Details -->
<section class="w-1/3">
<h2 class="text-2xl font-semibold">{{ doc.name }}</h2>
<p class="py-2 text-base">{{ doc.date }}</p>
</section>
<!-- Party Details -->
<section class="w-1/3" v-if="doc.party">
<h2 class="py-1 text-right text-lg font-semibold">{{ doc.party }}</h2>
<p
v-if="doc.links.party.address"
class="mt-1 text-xs text-gray-600 text-right"
>
{{ doc.links.party.links.address.addressDisplay }}
</p>
<p
v-if="doc.links.party.gstin"
class="mt-1 text-xs text-gray-600 text-right"
>
GSTIN: {{ doc.partyGSTIN }}
</p>
</section>
</section>
<!-- Items Table -->
<section class="mt-8 text-base">
<!-- Heading Row -->
<section class="text-gray-600 w-full flex border-b">
<div class="py-4 w-5/12">Item</div>
<div class="py-4 text-right w-2/12" v-if="doc.showHSN">HSN/SAC</div>
<div class="py-4 text-right w-1/12">Quantity</div>
<div class="py-4 text-right w-3/12">Rate</div>
<div class="py-4 text-right w-3/12">Amount</div>
</section>
<!-- Body Rows -->
<section
class="flex py-1 text-gray-900 w-full border-b"
v-for="row in doc.items"
:key="row.name"
>
<div class="w-5/12 py-4">{{ row.item }}</div>
<div class="w-2/12 text-right py-4" v-if="doc.showHSN">
{{ row.hsnCode }}
</div>
<div class="w-1/12 text-right py-4">{{ row.quantity }}</div>
<div class="w-3/12 text-right py-4">{{ row.rate }}</div>
<div class="w-3/12 text-right py-4">{{ row.amount }}</div>
</section>
</section>
<!-- Invoice Footer -->
<footer class="mt-8 flex justify-end text-base">
<!-- Invoice Terms -->
<section class="w-1/2">
<h3 class="text-sm tracking-widest text-gray-600 mt-2" v-if="doc.terms">
Notes
</h3>
<p class="my-4 text-lg whitespace-pre-line">{{ doc.terms }}</p>
</section>
<!-- Totaled Amounts -->
<section class="w-1/2">
<!-- Subtotal -->
<div class="flex pl-2 justify-between py-3 border-b">
<h3>{{ t`Subtotal` }}</h3>
<p>{{ doc.netTotal }}</p>
</div>
<!-- Discount (if applied before tax) -->
<div
class="flex pl-2 justify-between py-3 border-b"
v-if="doc.totalDiscount && !doc.discountAfterTax"
>
<h3>{{ t`Discount` }}</h3>
<p>{{ doc.totalDiscount }}</p>
</div>
<!-- Tax Breakdown -->
<div
class="flex pl-2 justify-between py-3"
v-for="tax in doc.taxes"
:key="tax.name"
>
<h3>{{ tax.account }}</h3>
<p>{{ tax.amount }}</p>
</div>
<!-- Discount (if applied after tax) -->
<div
class="flex pl-2 justify-between py-3 border-t"
v-if="doc.totalDiscount && doc.discountAfterTax"
>
<h3>{{ t`Discount` }}</h3>
<p>{{ doc.totalDiscount }}</p>
</div>
<!-- Grand Total -->
<div
class="
flex
pl-2
justify-between
py-3
border-t
text-green-600
font-semibold
text-base
"
>
<h3>{{ t`Grand Total` }}</h3>
<p>{{ doc.grandTotal }}</p>
</div>
</section>
</footer>
</main>

View File

@ -0,0 +1,130 @@
<main class="bg-white h-full" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="bg-gray-100 px-12 py-10">
<!-- Company Details -->
<section class="flex items-center">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contain mr-4"
:src="print.logo"
/>
<div>
<p class="font-semibold text-xl" :style="{ color: print.color }">
{{ print.companyName }}
</p>
<p class="text-sm text-gray-800" v-if="print.address">
{{ print.links.address.addressDisplay }}
</p>
<p class="text-sm text-gray-800" v-if="print.gstin">
GSTIN: {{ print.gstin }}
</p>
</div>
</section>
<!-- Sub Heading Section -->
<div class="mt-8 text-lg">
<!-- Doc Details -->
<section class="flex">
<h3 class="w-1/3 font-semibold">
{{ doc.entryType === 'SalesInvoice' ? 'Invoice' : 'Bill' }}
</h3>
<div class="w-2/3 text-gray-800">
<p class="font-semibold">{{ doc.name }}</p>
<p>{{ doc.date }}</p>
</div>
</section>
<!-- Party Details -->
<section class="mt-4 flex">
<h3 class="w-1/3 font-semibold">
{{ doc.entryType === 'SalesInvoice' ? 'Customer' : 'Supplier' }}
</h3>
<div class="w-2/3 text-gray-800" v-if="doc.party">
<p class="font-semibold">{{ doc.party }}</p>
<p v-if="doc.links.party.address">
{{ doc.links.party.links.address.addressDisplay }}
</p>
<p v-if="doc.links.party.gstin">GSTIN: {{ doc.links.party.gstin }}</p>
</div>
</section>
</div>
</header>
<!-- Items Table -->
<section class="px-12 pt-12 text-lg">
<!-- Heading Row -->
<section class="mb-4 flex font-semibold">
<div class="w-4/12">Item</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">HSN/SAC</div>
<div class="w-2/12 text-right">Quantity</div>
<div class="w-3/12 text-right">Rate</div>
<div class="w-3/12 text-right">Amount</div>
</section>
<!-- Body Rows -->
<section
class="flex py-1 text-gray-800"
v-for="row in doc.items"
:key="row.name"
>
<div class="w-4/12">{{ row.item }}</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-2/12 text-right">{{ row.quantity }}</div>
<div class="w-3/12 text-right">{{ row.rate }}</div>
<div class="w-3/12 text-right">{{ row.amount }}</div>
</section>
</section>
<!-- Invoice Footer -->
<footer class="px-12 py-12 text-lg">
<!-- Totaled Amounts -->
<section class="flex -mx-3 justify-end flex-1 bg-gray-100 gap-8">
<!-- Subtotal -->
<div class="text-right py-3">
<h3 class="text-gray-800">{{ t`Subtotal` }}</h3>
<p class="text-xl mt-2">{{ doc.netTotal }}</p>
</div>
<!-- Discount (if applied before tax) -->
<div
class="text-right py-3"
v-if="doc.totalDiscount && !doc.discountAfterTax"
>
<h3 class="text-gray-800">{{ t`Discount` }}</h3>
<p class="text-xl mt-2">{{ doc.totalDiscount }}</p>
</div>
<!-- Tax Breakdown -->
<div class="text-right py-3" v-for="tax in doc.taxes" :key="tax.name">
<h3 class="text-gray-800">{{ tax.account }}</h3>
<p class="text-xl mt-2">{{ tax.amount }}</p>
</div>
<!-- Discount (if applied after tax) -->
<div
class="text-right py-3"
v-if="doc.totalDiscount && doc.discountAfterTax"
>
<h3 class="text-gray-800">{{ t`Discount` }}</h3>
<p class="text-xl mt-2">{{ doc.totalDiscount }}</p>
</div>
<!-- Grand Total -->
<div
class="py-3 px-4 text-right text-white"
:style="{ backgroundColor: print.color }"
>
<h3>{{ t`Grand Total` }}</h3>
<p class="text-2xl mt-2 font-semibold">{{ doc.grandTotal }}</p>
</div>
</section>
<!-- Invoice Terms -->
<section class="mt-12" v-if="doc.terms">
<h3 class="text-lg font-semibold">Notes</h3>
<p class="mt-4 text-lg whitespace-pre-line">{{ doc.terms }}</p>
</section>
</footer>
</main>

View File

@ -1,11 +1,11 @@
<main class="h-full">
<main class="h-full" :style="{ 'font-family': print.font }">
<!-- Invoice Header -->
<header class="flex items-center justify-between w-full border-b px-12 py-10">
<!-- Left Section -->
<section class="flex items-center">
<img
v-if="print.displayLogo"
class="h-12 max-w-32 object-contain me-4"
class="h-12 max-w-32 object-contain mr-4"
:src="print.logo"
/>
@ -18,7 +18,7 @@
</section>
<!-- Right Section -->
<section class="text-end">
<section class="text-right">
<p class="font-semibold text-xl" :style="{ color: print.color }">
{{ doc.entryType }}
</p>
@ -57,23 +57,23 @@
font-semibold
tracking-widest
text-gray-800
ms-8
ml-8
"
>
{{ doc.entryType === 'SalesInvoice' ? 'From' : 'To' }}
</h3>
<p class="mt-4 ms-8 text-black leading-relaxed text-lg">
<p class="mt-4 ml-8 text-black leading-relaxed text-lg">
{{ print.companyName }}
</p>
<p
v-if="print.address"
class="mt-2 ms-8 text-black leading-relaxed text-lg"
class="mt-2 ml-8 text-black leading-relaxed text-lg"
>
{{ print.links.address.addressDisplay }}
</p>
<p
v-if="print.gstin"
class="mt-2 ms-8 text-black leading-relaxed text-lg"
class="mt-2 ml-8 text-black leading-relaxed text-lg"
>
GSTIN: {{ print.gstin }}
</p>
@ -94,24 +94,24 @@
text-gray-800
"
>
<div class="w-4/12 text-start">Item</div>
<div class="w-2/12 text-end" v-if="doc.showHSN">HSN/SAC</div>
<div class="w-2/12 text-end">Quantity</div>
<div class="w-3/12 text-end">Rate</div>
<div class="w-3/12 text-end">Amount</div>
<div class="w-4/12 text-left">Item</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">HSN/SAC</div>
<div class="w-2/12 text-right">Quantity</div>
<div class="w-3/12 text-right">Rate</div>
<div class="w-3/12 text-right">Amount</div>
</section>
<!-- Body Rows -->
<section class="flex py-1 text-lg" v-for="row in doc.items" :key="row.name">
<div class="w-4/12 text-start">{{ row.item }}</div>
<div class="w-2/12 text-end" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-2/12 text-end">{{ row.quantity }}</div>
<div class="w-3/12 text-end">{{ row.rate }}</div>
<div class="w-3/12 text-end">{{ row.amount }}</div>
<div class="w-4/12 text-left">{{ row.item }}</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ row.hsnCode }}</div>
<div class="w-2/12 text-right">{{ row.quantity }}</div>
<div class="w-3/12 text-right">{{ row.rate }}</div>
<div class="w-3/12 text-right">{{ row.amount }}</div>
</section>
</section>
<!-- Footer -->
<!-- Invoice Footer -->
<footer class="flex px-12 py-10">
<!-- Invoice Terms -->
<section class="w-1/2" v-if="doc.terms">
@ -124,14 +124,14 @@
<!-- Totaled Amounts -->
<section class="w-1/2 text-lg ml-auto">
<!-- Subtotal -->
<div class="flex ps-2 justify-between py-1">
<div class="flex pl-2 justify-between py-1">
<h3>{{ t`Subtotal` }}</h3>
<p>{{ doc.netTotal }}</p>
</div>
<!-- Discount (if applied before tax) -->
<div
class="flex ps-2 justify-between py-1"
class="flex pl-2 justify-between py-1"
v-if="doc.totalDiscount && !doc.discountAfterTax"
>
<h3>{{ t`Discount` }}</h3>
@ -140,7 +140,7 @@
<!-- Tax Breakdown -->
<div
class="flex ps-2 justify-between py-1"
class="flex pl-2 justify-between py-1"
v-for="tax in doc.taxes"
:key="tax.name"
>
@ -150,7 +150,7 @@
<!-- Discount (if applied after tax) -->
<div
class="flex ps-2 justify-between py-1"
class="flex pl-2 justify-between py-1"
v-if="doc.totalDiscount && doc.discountAfterTax"
>
<h3>{{ t`Discount` }}</h3>
@ -159,7 +159,7 @@
<!-- Grand Total -->
<div
class="flex ps-2 justify-between py-1 font-semibold"
class="flex pl-2 justify-between py-1 font-semibold"
:style="{ color: print.color }"
>
<h3>{{ t`Grand Total` }}</h3>

View File

@ -60,4 +60,10 @@ export class PrintTemplate extends Doc {
}));
},
};
override duplicate(): Doc {
const doc = super.duplicate() as PrintTemplate;
doc.isCustom = true;
return doc;
}
}

View File

@ -1,26 +0,0 @@
<template>
<component :is="printComponent" :doc="doc" :print-settings="printSettings" />
</template>
<script>
import Basic from './Templates/Basic';
import Business from './Templates/Business';
export default {
name: 'InvoiceTemplate',
props: ['doc', 'printSettings'],
computed: {
printComponent() {
let type = this.printSettings.template;
let templates = {
Basic,
Business,
};
if (!(type in templates)) {
type = 'Basic';
}
return templates[type];
},
},
};
</script>

View File

@ -1,109 +0,0 @@
<script>
export default {
name: 'Base',
props: { doc: Object, printSettings: Object },
data: () => ({ party: null, companyAddress: null, partyAddress: null }),
async mounted() {
await this.printSettings.loadLinks();
this.companyAddress = this.printSettings.getLink('address');
await this.doc.loadLinks();
this.party = this.doc.getLink('party');
this.partyAddress = this.party.getLink('address')?.addressDisplay ?? null;
if (this.fyo.store.isDevelopment) {
window.bt = this;
}
},
methods: {
getFormattedField(fieldname, doc) {
doc ??= this.doc;
const field = doc.fieldMap[fieldname];
const value = doc.get(fieldname);
if (Array.isArray(value)) {
return this.getFormattedChildDocList(fieldname);
}
return this.fyo.format(value, field, doc);
},
getFormattedChildDocList(fieldname) {
const formattedDocs = [];
for (const childDoc of this.doc?.[fieldname] ?? {}) {
formattedDocs.push(this.getFormattedChildDoc(childDoc));
}
return formattedDocs;
},
getFormattedChildDoc(childDoc) {
const formattedChildDoc = {};
for (const field of childDoc?.schema?.fields) {
if (field.meta) {
continue;
}
formattedChildDoc[field.fieldname] = this.getFormattedField(
field.fieldname,
childDoc
);
}
return formattedChildDoc;
},
},
computed: {
currency() {
return this.doc.isMultiCurrency
? this.doc.currency
: this.fyo.singles.SystemSettings.currency;
},
isSalesInvoice() {
return this.doc.schemaName === 'SalesInvoice';
},
showHSN() {
return this.doc.items.map((i) => i.hsnCode).every(Boolean);
},
totalDiscount() {
return this.doc.getTotalDiscount();
},
formattedTotalDiscount() {
if (!this.totalDiscount?.float) {
return '';
}
const totalDiscount = this.fyo.format(this.totalDiscount, {
fieldname: 'Total Discount',
fieldtype: 'Currency',
currency: this.currency,
});
return `- ${totalDiscount}`;
},
printObject() {
return {
isSalesInvoice: this.isSalesInvoice,
font: this.printSettings.font,
color: this.printSettings.color,
showHSN: this.showHSN,
displayLogo: this.printSettings.displayLogo,
displayTaxInvoice: this.printSettings.displayTaxInvoice,
displayBatch: this.printSettings.displayBatch,
discountAfterTax: this.doc.discountAfterTax,
logo: this.printSettings.logo,
companyName: this.fyo.singles.AccountingSettings.companyName,
email: this.printSettings.email,
phone: this.printSettings.phone,
address: this.companyAddress?.addressDisplay,
gstin: this.fyo.singles?.AccountingSettings?.gstin,
invoiceName: this.doc.name,
date: this.getFormattedField('date'),
partyName: this.party?.name,
partyAddress: this.partyAddress,
partyGSTIN: this.party?.gstin,
terms: this.doc.terms,
netTotal: this.getFormattedField('netTotal'),
items: this.getFormattedField('items'),
taxes: this.getFormattedField('taxes'),
grandTotal: this.getFormattedField('grandTotal'),
totalDiscount: this.formattedTotalDiscount,
};
},
},
};
</script>

View File

@ -1,172 +0,0 @@
<template>
<div
class="bg-white border h-full"
:style="{ 'font-family': printObject.font }"
>
<div>
<div class="px-6 pt-6">
<h2
v-if="printObject.displayTaxInvoice"
class="font-semibold text-black text-2xl mb-4"
>
{{ t`Tax Invoice` }}
</h2>
<div class="flex text-sm text-gray-900 border-b pb-4">
<div class="w-1/3">
<div v-if="printObject.displayLogo">
<img
class="h-12 max-w-32 object-contain"
:src="printObject.logo"
/>
</div>
<div class="text-xl text-gray-700 font-semibold" v-else>
{{ printObject.companyName }}
</div>
</div>
<div class="w-1/3">
<div>{{ printObject.email }}</div>
<div class="mt-1">{{ printObject.phone }}</div>
</div>
<div class="w-1/3">
<div v-if="printObject.address">
{{ printObject.address }}
</div>
<div v-if="printObject.gstin">GSTIN: {{ printObject.gstin }}</div>
</div>
</div>
</div>
<div class="mt-8 px-6">
<div class="flex justify-between">
<div class="w-1/3">
<h1 class="text-2xl font-semibold">
{{ printObject.invoiceName }}
</h1>
<div class="py-2 text-base">
{{ printObject.date }}
</div>
</div>
<div class="w-1/3" v-if="printObject.partyName">
<div class="py-1 text-end text-lg font-semibold">
{{ printObject.partyName }}
</div>
<div
v-if="printObject.partyAddress"
class="mt-1 text-xs text-gray-600 text-end"
>
{{ printObject.partyAddress }}
</div>
<div
v-if="printObject.partyGSTIN"
class="mt-1 text-xs text-gray-600 text-end"
>
GSTIN: {{ printObject.partyGSTIN }}
</div>
</div>
</div>
</div>
<div class="mt-2 px-6 text-base">
<div>
<div class="text-gray-600 w-full flex border-b">
<div class="py-4 w-5/12">Item</div>
<div class="py-4 text-end w-2/12" v-if="printObject.showHSN">
HSN/SAC
</div>
<div class="py-4 text-end w-2/12">Quantity</div>
<div
class="w-3/12 text-end py-4"
v-if="printObject.displayBatch"
>
Batch
</div>
<div class="py-4 text-end w-3/12">Rate</div>
<div class="py-4 text-end w-3/12">Amount</div>
</div>
<div
class="flex py-1 text-gray-900 w-full border-b"
v-for="row in printObject.items"
:key="row.name"
>
<div class="w-5/12 py-4">{{ row.item }}</div>
<div class="w-2/12 text-end py-4" v-if="printObject.showHSN">
{{ row.hsnCode }}
</div>
<div class="w-2/12 text-end py-4">{{ row.quantity }}</div>
<div
class="w-3/12 text-end py-4"
v-if="printObject.displayBatch"
>
{{ row.batch }}
</div>
<div class="w-3/12 text-end py-4">{{ row.rate }}</div>
<div class="w-3/12 text-end py-4">{{ row.amount }}</div>
</div>
</div>
</div>
</div>
<div class="px-6 mt-2 flex justify-end text-base">
<div class="w-1/2">
<div
class="text-sm tracking-widest text-gray-600 mt-2"
v-if="printObject.terms"
>
Notes
</div>
<div class="my-4 text-lg whitespace-pre-line">
{{ printObject.terms }}
</div>
</div>
<div class="w-1/2">
<div class="flex ps-2 justify-between py-3 border-b">
<div>{{ t`Subtotal` }}</div>
<div>{{ printObject.netTotal }}</div>
</div>
<div
class="flex ps-2 justify-between py-3 border-b"
v-if="printObject.totalDiscount && !printObject.discountAfterTax"
>
<div>{{ t`Discount` }}</div>
<div>{{ printObject.totalDiscount }}</div>
</div>
<div
class="flex ps-2 justify-between py-3"
v-for="tax in printObject.taxes"
:key="tax.name"
>
<div>{{ tax.account }}</div>
<div>{{ tax.amount }}</div>
</div>
<div
class="flex ps-2 justify-between py-3 border-t"
v-if="printObject.totalDiscount && printObject.discountAfterTax"
>
<div>{{ t`Discount` }}</div>
<div>{{ printObject.totalDiscount }}</div>
</div>
<div
class="
flex
ps-2
justify-between
py-3
border-t
text-green-600
font-semibold
text-base
"
>
<div>{{ t`Grand Total` }}</div>
<div>{{ printObject.grandTotal }}</div>
</div>
</div>
</div>
</div>
</template>
<script>
import BaseTemplate from './BaseTemplate.vue';
export default {
name: 'Default',
extends: BaseTemplate,
};
</script>

View File

@ -1,165 +0,0 @@
<template>
<div
class="bg-white border h-full"
:style="{ 'font-family': printObject.font }"
>
<div class="bg-gray-100 px-12 py-10">
<h2
v-if="printObject.displayTaxInvoice"
class="font-semibold text-gray-900 text-2xl mb-4"
>
{{ t`Tax Invoice` }}
</h2>
<div class="flex items-center">
<div class="flex items-center rounded h-16">
<div class="me-4" v-if="printObject.displayLogo">
<img class="h-12 max-w-32 object-contain" :src="printObject.logo" />
</div>
</div>
<div>
<div
class="font-semibold text-xl"
:style="{ color: printObject.color }"
>
{{ printObject.companyName }}
</div>
<div class="text-sm text-gray-800" v-if="printObject.address">
{{ printObject.address }}
</div>
<div class="text-sm text-gray-800" v-if="printObject.gstin">
GSTIN: {{ printObject.gstin }}
</div>
</div>
</div>
<div class="mt-8 text-lg">
<div class="flex">
<div class="w-1/3 font-semibold">
{{ printObject.isSalesInvoice ? 'Invoice' : 'Bill' }}
</div>
<div class="w-2/3 text-gray-800">
<div class="font-semibold">
{{ printObject.invoiceName }}
</div>
<div>
{{ printObject.date }}
</div>
</div>
</div>
<div class="mt-4 flex">
<div class="w-1/3 font-semibold">
{{ printObject.isSalesInvoice ? 'Customer' : 'Supplier' }}
</div>
<div class="w-2/3 text-gray-800" v-if="printObject.partyName">
<div class="font-semibold">
{{ printObject.partyName }}
</div>
<div v-if="printObject.partyAddress">
{{ printObject.partyAddress }}
</div>
<div v-if="printObject.partyGSTIN">
GSTIN: {{ printObject.partyGSTIN }}
</div>
</div>
</div>
</div>
</div>
<div class="px-12 py-12 text-lg">
<div class="mb-4 flex font-semibold">
<div class="w-4/12">Item</div>
<div class="w-2/12 text-end" v-if="printObject.showHSN">HSN/SAC</div>
<div class="w-2/12 text-end">Quantity</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
Batch
</div>
<div class="w-3/12 text-end">Rate</div>
<div class="w-3/12 text-end">Amount</div>
</div>
<div
class="flex py-1 text-gray-800"
v-for="row in printObject.items"
:key="row.name"
>
<div class="w-4/12">{{ row.item }}</div>
<div class="w-2/12 text-end" v-if="printObject.showHSN">
{{ row.hsnCode }}
</div>
<div class="w-2/12 text-end">{{ row.quantity }}</div>
<div class="w-3/12 text-end" v-if="printObject.displayBatch">
{{ row.batch }}
</div>
<div class="w-3/12 text-end">{{ row.rate }}</div>
<div class="w-3/12 text-end">{{ row.amount }}</div>
</div>
<div class="mt-12">
<div class="flex -mx-3">
<div class="flex justify-end flex-1 py-3 bg-gray-100 gap-8 pe-6">
<div class="text-end">
<div class="text-gray-800">{{ t`Subtotal` }}</div>
<div class="text-xl mt-2">
{{ printObject.netTotal }}
</div>
</div>
<div
class="text-end"
v-if="printObject.totalDiscount && !printObject.discountAfterTax"
>
<div class="text-gray-800">{{ t`Discount` }}</div>
<div class="text-xl mt-2">
{{ printObject.totalDiscount }}
</div>
</div>
<div
class="text-end"
v-for="tax in printObject.taxes"
:key="tax.name"
>
<div class="text-gray-800">
{{ tax.account }}
</div>
<div class="text-xl mt-2">
{{ tax.amount }}
</div>
</div>
<div
class="text-end"
v-if="printObject.totalDiscount && printObject.discountAfterTax"
>
<div class="text-gray-800">{{ t`Discount` }}</div>
<div class="text-xl mt-2">
{{ printObject.totalDiscount }}
</div>
</div>
</div>
<div
class="py-3 px-4 text-end text-white"
:style="{ backgroundColor: printObject.color }"
>
<div>
<div>{{ t`Grand Total` }}</div>
<div class="text-2xl mt-2 font-semibold">
{{ printObject.grandTotal }}
</div>
</div>
</div>
</div>
<div class="mt-12" v-if="printObject.terms">
<div class="text-lg font-semibold">Notes</div>
<div class="mt-4 text-lg whitespace-pre-line">
{{ printObject.terms }}
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import BaseTemplate from './BaseTemplate.vue';
export default {
name: 'Business',
extends: BaseTemplate,
};
</script>

View File

@ -57,19 +57,13 @@
</div>
</template>
<script>
import { ipcRenderer } from 'electron';
import { Verb } from 'fyo/telemetry/types';
import Button from 'src/components/Button.vue';
import PageHeader from 'src/components/PageHeader.vue';
import InvoiceTemplate from 'src/components/SalesInvoice/InvoiceTemplate.vue';
import TwoColumnForm from 'src/components/TwoColumnForm.vue';
import { fyo } from 'src/initFyo';
import { makePDF } from 'src/utils/ipcCalls';
import {
constructPrintDocument,
getPathAndMakePDF,
} from 'src/utils/printTemplates';
import { IPC_ACTIONS } from 'utils/messages';
import { getPathAndMakePDF } from 'src/utils/printTemplates';
export default {
name: 'PrintView',
@ -96,7 +90,7 @@ export default {
},
computed: {
printTemplate() {
return InvoiceTemplate;
return { template: '<div>Hello</div>' };
},
},
methods: {