mirror of
https://github.com/frappe/books.git
synced 2025-01-09 17:53:56 +00:00
feat: optimize POS print template size for compatibility with POS machines
This commit is contained in:
parent
d07e424315
commit
d803151cf9
@ -39,8 +39,12 @@
|
||||
:template="printProps.template"
|
||||
:values="printProps.values"
|
||||
:scale="scale"
|
||||
:width="templateDoc?.width"
|
||||
:height="templateDoc?.height"
|
||||
:width="
|
||||
templateName?.startsWith('POS')
|
||||
? fyo.singles.PrintSettings?.posPrintWidth
|
||||
: templateDoc?.width
|
||||
"
|
||||
:height="templateName.startsWith('POS') ? 22 : templateDoc?.height"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -55,8 +55,8 @@
|
||||
:scale="scale"
|
||||
:height="doc.name.startsWith('POS') ? 20 : doc.height"
|
||||
:width="
|
||||
doc.name.startsWith('POS') &&
|
||||
fyo.singles.PrintSettings.posPrintWidth
|
||||
doc.name?.startsWith('POS') &&
|
||||
fyo.singles.PrintSettings?.posPrintWidth
|
||||
? fyo.singles.PrintSettings.posPrintWidth
|
||||
: doc.width
|
||||
"
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
showExportInFolder,
|
||||
} from './ui';
|
||||
import { Money } from 'pesa';
|
||||
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
|
||||
|
||||
export type PrintTemplateHint = {
|
||||
[key: string]: string | PrintTemplateHint | PrintTemplateHint[];
|
||||
@ -40,6 +41,18 @@ export async function getPrintTemplatePropValues(
|
||||
const values: PrintValues = { doc: {}, print: {} };
|
||||
values.doc = await getPrintTemplateDocValues(doc);
|
||||
|
||||
const totalTax = await (doc as Invoice)?.getTotalTax();
|
||||
const paymentId = await (doc as SalesInvoice).getPaymentIds();
|
||||
|
||||
const paymentDoc = await fyo.doc.getDoc(ModelNameEnum.Payment, paymentId[0]);
|
||||
|
||||
(values.doc as PrintTemplateData).paymentMethod = paymentDoc.paymentMethod;
|
||||
|
||||
(values.doc as PrintTemplateData).subTotal = doc.fyo.format(
|
||||
(doc.grandTotal as Money).sub(totalTax),
|
||||
ModelNameEnum.Currency
|
||||
);
|
||||
|
||||
const printSettings = await fyo.doc.getDoc(ModelNameEnum.PrintSettings);
|
||||
const printValues = await getPrintTemplateDocValues(
|
||||
printSettings,
|
||||
|
Loading…
Reference in New Issue
Block a user