Merge pull request #1249 from Jas1rk/fix-description-print

fix: added description in print when enables settings
This commit is contained in:
Able k Saju
2025-06-24 14:22:04 +05:30
committed by GitHub
6 changed files with 30 additions and 0 deletions
@@ -12,6 +12,7 @@ export class PrintSettings extends Doc {
font?: string;
displayLogo?: boolean;
displayTime?: boolean;
displayDescription?: boolean;
posPrintWidth?: number;
amountInWords?: boolean;
override hidden: HiddenMap = {};
+6
View File
@@ -127,6 +127,12 @@
"fieldtype": "Check",
"section": "Customizations"
},
{
"fieldname": "displayDescription",
"label": "Display Description In Invoice",
"fieldtype": "Check",
"section": "Customizations"
},
{
"fieldname": "posPrintWidth",
"label": "Pos Print Width",
+11
View File
@@ -127,6 +127,10 @@ export async function getPrintTemplatePropValues(
(values.doc as PrintTemplateData).time = getTime(doc.date as string);
}
if (printSettings.displayDescription) {
(values.doc as PrintTemplateData).description = showDescription(doc);
}
return values;
}
async function getPaymentDetails(doc: Doc, paymentId: string[]) {
@@ -311,6 +315,13 @@ function showHSN(doc: Doc): boolean {
return items.map((i: Doc) => i.hsnCode).every(Boolean);
}
function showDescription(doc: Doc): boolean {
const description = Array.isArray(doc.items)
? doc.items.map((item: Doc) => item.description).filter(Boolean)
: [];
return description.length > 0;
}
function formattedTotalDiscount(doc: Doc): string {
if (!(doc instanceof Invoice)) {
return '';
+4
View File
@@ -61,6 +61,7 @@
<!-- Heading Row -->
<section class="text-gray-600 w-full flex border-b">
<div class="py-4 w-5/12">{{ t`Item` }}</div>
<div class="py-4 w-5/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="py-4 text-right w-2/12" v-if="doc.showHSN">
{{ t`HSN/SAC` }}
</div>
@@ -76,6 +77,9 @@
:key="row.name"
>
<div class="w-5/12 py-4">{{ row.item }}</div>
<div class="w-5/12 py-4" v-if="doc.description">
{{ row.description }}
</div>
<div class="w-2/12 text-right py-4" v-if="doc.showHSN">
{{ row.hsnCode }}
</div>
+2
View File
@@ -61,6 +61,7 @@
<!-- Heading Row -->
<section class="mb-4 flex font-semibold">
<div class="w-4/12">{{ t`Item` }}</div>
<div class="w-4/12" v-if="doc.description">{{ t`Description` }}</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-2/12 text-right">{{ t`Quantity` }}</div>
<div class="w-3/12 text-right">{{ t`Rate` }}</div>
@@ -74,6 +75,7 @@
:key="row.name"
>
<div class="w-4/12">{{ row.item }}</div>
<div class="w-4/12" v-if="doc.description">{{ row.description }}</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>
+6
View File
@@ -99,6 +99,9 @@
"
>
<div class="w-4/12 text-left">{{ t`Item` }}</div>
<div class="w-4/12 text-left" v-if="doc.description">
{{ t`Description` }}
</div>
<div class="w-2/12 text-right" v-if="doc.showHSN">{{ t`HSN/SAC` }}</div>
<div class="w-2/12 text-right">{{ t`Quantity` }}</div>
<div class="w-3/12 text-right">{{ t`Rate` }}</div>
@@ -108,6 +111,9 @@
<!-- Body Rows -->
<section class="flex py-1 text-lg" v-for="row in doc.items" :key="row.name">
<div class="w-4/12 text-left">{{ row.item }}</div>
<div class="w-4/12 text-left" v-if="doc.description">
{{ row.description }}
</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>