mirror of
https://github.com/frappe/books.git
synced 2025-01-24 23:58:27 +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"
|
:template="printProps.template"
|
||||||
:values="printProps.values"
|
:values="printProps.values"
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
:width="templateDoc?.width"
|
:width="
|
||||||
:height="templateDoc?.height"
|
templateName?.startsWith('POS')
|
||||||
|
? fyo.singles.PrintSettings?.posPrintWidth
|
||||||
|
: templateDoc?.width
|
||||||
|
"
|
||||||
|
:height="templateName.startsWith('POS') ? 22 : templateDoc?.height"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,8 +55,8 @@
|
|||||||
:scale="scale"
|
:scale="scale"
|
||||||
:height="doc.name.startsWith('POS') ? 20 : doc.height"
|
:height="doc.name.startsWith('POS') ? 20 : doc.height"
|
||||||
:width="
|
:width="
|
||||||
doc.name.startsWith('POS') &&
|
doc.name?.startsWith('POS') &&
|
||||||
fyo.singles.PrintSettings.posPrintWidth
|
fyo.singles.PrintSettings?.posPrintWidth
|
||||||
? fyo.singles.PrintSettings.posPrintWidth
|
? fyo.singles.PrintSettings.posPrintWidth
|
||||||
: doc.width
|
: doc.width
|
||||||
"
|
"
|
||||||
|
@ -13,6 +13,7 @@ import {
|
|||||||
showExportInFolder,
|
showExportInFolder,
|
||||||
} from './ui';
|
} from './ui';
|
||||||
import { Money } from 'pesa';
|
import { Money } from 'pesa';
|
||||||
|
import { SalesInvoice } from 'models/baseModels/SalesInvoice/SalesInvoice';
|
||||||
|
|
||||||
export type PrintTemplateHint = {
|
export type PrintTemplateHint = {
|
||||||
[key: string]: string | PrintTemplateHint | PrintTemplateHint[];
|
[key: string]: string | PrintTemplateHint | PrintTemplateHint[];
|
||||||
@ -40,6 +41,18 @@ export async function getPrintTemplatePropValues(
|
|||||||
const values: PrintValues = { doc: {}, print: {} };
|
const values: PrintValues = { doc: {}, print: {} };
|
||||||
values.doc = await getPrintTemplateDocValues(doc);
|
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 printSettings = await fyo.doc.getDoc(ModelNameEnum.PrintSettings);
|
||||||
const printValues = await getPrintTemplateDocValues(
|
const printValues = await getPrintTemplateDocValues(
|
||||||
printSettings,
|
printSettings,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user