@bookmypuja-tech/bmp-pdf 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +13 -2
- package/dist/index.js +27 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface IPujaReceipt {
|
|
|
27
27
|
interface ITotalReceipt {
|
|
28
28
|
templeName: string;
|
|
29
29
|
address: string;
|
|
30
|
-
receiptNumber:
|
|
30
|
+
receiptNumber: string;
|
|
31
31
|
numberOfPujas: Number;
|
|
32
32
|
totalAmount: Number;
|
|
33
33
|
qrContent?: string;
|
|
@@ -46,6 +46,16 @@ interface IPujaReport {
|
|
|
46
46
|
prasadam?: string;
|
|
47
47
|
}[];
|
|
48
48
|
}
|
|
49
|
+
interface IQuickReport {
|
|
50
|
+
templeName: string;
|
|
51
|
+
receiptNumber: string;
|
|
52
|
+
pujas: {
|
|
53
|
+
name: string;
|
|
54
|
+
pujaQty?: number;
|
|
55
|
+
pujaAmount: number;
|
|
56
|
+
pujaDate: Date;
|
|
57
|
+
}[];
|
|
58
|
+
}
|
|
49
59
|
|
|
50
60
|
declare const A4Print: ({ data, dates, }: {
|
|
51
61
|
data: IPrintablePuja[];
|
|
@@ -66,5 +76,6 @@ declare const getPrintBlob: ({ size, data, dates, }: {
|
|
|
66
76
|
declare const printDevoteeReceipt2Inch: (data: IPujaReceipt) => Promise<void>;
|
|
67
77
|
declare const printTotalReceipt2Inch: (data: ITotalReceipt) => Promise<void>;
|
|
68
78
|
declare const printePujaReport2Inch: (data: IPujaReport) => Promise<void>;
|
|
79
|
+
declare const printQuickPrintReceipt2Inch: (data: IQuickReport) => Promise<void>;
|
|
69
80
|
|
|
70
|
-
export { A4Print, type IPrintablePuja, type IPujaReceipt, T2Inch, getPrintBlob, printDevoteeReceipt2Inch, printTotalReceipt2Inch, printePujaReport2Inch };
|
|
81
|
+
export { A4Print, type IPrintablePuja, type IPujaReceipt, T2Inch, getPrintBlob, printDevoteeReceipt2Inch, printQuickPrintReceipt2Inch, printTotalReceipt2Inch, printePujaReport2Inch };
|
package/dist/index.js
CHANGED
|
@@ -213,7 +213,7 @@ var A4Print = ({
|
|
|
213
213
|
var A4Print_default = A4Print;
|
|
214
214
|
|
|
215
215
|
// src/index.tsx
|
|
216
|
-
import
|
|
216
|
+
import React7 from "react";
|
|
217
217
|
|
|
218
218
|
// src/sizes/T2Inch.tsx
|
|
219
219
|
import React2 from "react";
|
|
@@ -546,6 +546,23 @@ var getPujaReportReceipt2InchBase64Data = async (receiptData) => {
|
|
|
546
546
|
return btoa(String.fromCharCode.apply(null, Array.from(data)));
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
+
// src/sizes/receipt/QuickReceipt2Inch.tsx
|
|
550
|
+
import React6 from "react";
|
|
551
|
+
import { Br as Br4, Cut as Cut4, Line as Line4, Printer as Printer4, render as render4, Text as Text6 } from "react-thermal-printer";
|
|
552
|
+
var QuickReceipt2Inch = (data) => {
|
|
553
|
+
return /* @__PURE__ */ React6.createElement(Printer4, { type: "epson", width: 32, characterSet: "iso8859_15_latin9" }, data.pujas.map((puja) => {
|
|
554
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(Text6, { align: "center", bold: true }, data.templeName), /* @__PURE__ */ React6.createElement(Text6, { align: "center" }, data.receiptNumber), /* @__PURE__ */ React6.createElement(Line4, null), /* @__PURE__ */ React6.createElement(Text6, { bold: true, size: { height: 2, width: 1 } }, puja.name, Number(puja.pujaQty) > 1 && ` (Qty:${puja.pujaQty})`), /* @__PURE__ */ React6.createElement(Text6, { align: "left" }, puja.pujaDate.toLocaleDateString("en-US", {
|
|
555
|
+
month: "short",
|
|
556
|
+
day: "numeric",
|
|
557
|
+
year: "numeric"
|
|
558
|
+
}), " ", "Rs ", Number(puja.pujaAmount).toLocaleString("en-IN")), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Br4, null), /* @__PURE__ */ React6.createElement(Cut4, null));
|
|
559
|
+
}));
|
|
560
|
+
};
|
|
561
|
+
var getQuickReceipt2InchBase64Data = async (receiptData) => {
|
|
562
|
+
const data = await render4(QuickReceipt2Inch(receiptData));
|
|
563
|
+
return btoa(String.fromCharCode.apply(null, Array.from(data)));
|
|
564
|
+
};
|
|
565
|
+
|
|
549
566
|
// src/index.tsx
|
|
550
567
|
var getPrintBlob = ({
|
|
551
568
|
size,
|
|
@@ -553,10 +570,10 @@ var getPrintBlob = ({
|
|
|
553
570
|
dates
|
|
554
571
|
}) => {
|
|
555
572
|
if (size === "A4") {
|
|
556
|
-
const blob = pdf(/* @__PURE__ */
|
|
573
|
+
const blob = pdf(/* @__PURE__ */ React7.createElement(A4Print_default, { data, dates })).toBlob();
|
|
557
574
|
return blob;
|
|
558
575
|
} else {
|
|
559
|
-
const blob = pdf(/* @__PURE__ */
|
|
576
|
+
const blob = pdf(/* @__PURE__ */ React7.createElement(T2Inch_default, { data, dates })).toBlob();
|
|
560
577
|
return blob;
|
|
561
578
|
}
|
|
562
579
|
};
|
|
@@ -578,11 +595,18 @@ var printePujaReport2Inch = async (data) => {
|
|
|
578
595
|
var P = "package=ru.a402d.rawbtprinter;end;";
|
|
579
596
|
window.location.href = "intent:base64," + base64DataObject + S + P;
|
|
580
597
|
};
|
|
598
|
+
var printQuickPrintReceipt2Inch = async (data) => {
|
|
599
|
+
const base64DataObject = await getQuickReceipt2InchBase64Data(data);
|
|
600
|
+
var S = "#Intent;scheme=rawbt;";
|
|
601
|
+
var P = "package=ru.a402d.rawbtprinter;end;";
|
|
602
|
+
window.location.href = "intent:base64," + base64DataObject + S + P;
|
|
603
|
+
};
|
|
581
604
|
export {
|
|
582
605
|
A4Print_default as A4Print,
|
|
583
606
|
T2Inch_default as T2Inch,
|
|
584
607
|
getPrintBlob,
|
|
585
608
|
printDevoteeReceipt2Inch,
|
|
609
|
+
printQuickPrintReceipt2Inch,
|
|
586
610
|
printTotalReceipt2Inch,
|
|
587
611
|
printePujaReport2Inch
|
|
588
612
|
};
|
package/package.json
CHANGED