meemup-library 1.5.21 → 1.5.22
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.
|
@@ -2,6 +2,15 @@ import IAccount from "../interfaces/IAccount";
|
|
|
2
2
|
import IPrintTemplate from "../interfaces/IPrintTemplate";
|
|
3
3
|
import IOrderDetails from "../interfaces/print/IOrderDetails";
|
|
4
4
|
import IOrderDetailProduct from "../interfaces/print/IOrderDetailProduct";
|
|
5
|
+
import IPointOfSaleCashDrawer from "../interfaces/pos/IPointOfSaleCashDrawer";
|
|
6
|
+
import IPointOfSaleCashDrawerReportForm from "../interfaces/pos/IPointOfSaleCashDrawerReportForm";
|
|
7
|
+
import IPointOfSaleCashDrawerReportRecord from "../interfaces/pos/IPointOfSaleCashDrawerReportRecord";
|
|
8
|
+
import IPointOfSaleTeamMember from "../interfaces/pos/IPointOfSaleTeamMember";
|
|
9
|
+
import ITurnover from "../interfaces/turnover/ITurnover";
|
|
10
|
+
import IPointOfSalePrintParts from "../interfaces/pos/IPointOfSalePrintParts";
|
|
11
|
+
import IPointOfSaleSetting from "../interfaces/pos/IPointOfSaleSetting";
|
|
12
|
+
import IPointOfSaleActionFormCashDrawer from "../interfaces/pos/IPointOfSaleActionFormCashDrawer";
|
|
13
|
+
import IPointOfSaleApiClosingWorkDay from "../interfaces/pos/IPointOfSaleApiClosingWorkDay";
|
|
5
14
|
declare class _PreviewContentController {
|
|
6
15
|
calculatePaperSize: (paper: number, width: string | number) => string;
|
|
7
16
|
sortProduct: (products: IOrderDetailProduct[], sortType: number) => IOrderDetailProduct[];
|
|
@@ -15,7 +24,12 @@ declare class _PreviewContentController {
|
|
|
15
24
|
paymentFailed(detail: IOrderDetails, currency: string): string;
|
|
16
25
|
packageLabel(detail: IOrderDetails, template: IPrintTemplate): string;
|
|
17
26
|
previewForPos(account: IAccount, detail: IOrderDetails, template: IPrintTemplate): string;
|
|
27
|
+
createPrintFromTurnoverDetail(data: ITurnover, currency: string, printParts: IPointOfSalePrintParts): Promise<string>;
|
|
28
|
+
createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember): Promise<string>;
|
|
29
|
+
openCashDrawerMarkup(label?: string): Promise<string>;
|
|
18
30
|
standardHtmlContainer(strHtml: string): string;
|
|
31
|
+
createClosingWorkDay(data: IPointOfSaleApiClosingWorkDay, companyTitle: string): Promise<string>;
|
|
32
|
+
createCashDrawerReport(device: IPointOfSaleCashDrawer, form: IPointOfSaleCashDrawerReportForm, records: IPointOfSaleCashDrawerReportRecord[], company: string, currency: string, member: IPointOfSaleTeamMember, formatDate: (value: string) => string): Promise<string>;
|
|
19
33
|
}
|
|
20
34
|
declare const PreviewContentController: _PreviewContentController;
|
|
21
35
|
export default PreviewContentController;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import EnumPrintLayout from "../enums/EnumPrintLayout";
|
|
2
11
|
import SimplePreviewController from "./SimplePreviewController";
|
|
3
12
|
import LabelPreviewController from "./LabelPreviewController";
|
|
4
13
|
import EnumOrderSummaryPrintPlacementType from "../enums/EnumOrderSummaryPrintPlacementType";
|
|
14
|
+
import { initPointOfSaleTeamMember } from "../interfaces/pos/IPointOfSaleTeamMember";
|
|
15
|
+
import MoneyController from "./MoneyController";
|
|
16
|
+
import EnumClosingWorkDaySection from "../enums/EnumClosingWorkDaySection";
|
|
5
17
|
class _PreviewContentController {
|
|
6
18
|
constructor() {
|
|
7
19
|
this.calculatePaperSize = (paper, width) => {
|
|
@@ -79,184 +91,6 @@ class _PreviewContentController {
|
|
|
79
91
|
}
|
|
80
92
|
return new_product;
|
|
81
93
|
};
|
|
82
|
-
// async createClosingWorkDay(
|
|
83
|
-
// data: IPointOfSaleApiClosingWorkDay,
|
|
84
|
-
// companyTitle: string) {
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
// let content: string = "";
|
|
88
|
-
//
|
|
89
|
-
// try {
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
// content += SimplePreviewController.createHeader(data.title, 'center');
|
|
93
|
-
// content += SimplePreviewController.createTitle(companyTitle, 'center');
|
|
94
|
-
// content += SimplePreviewController.printSpace(20);
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
// const infoList: ITextValue[] = data.details
|
|
98
|
-
// .filter(i => i.section === EnumClosingWorkDaySection.INFORMATION)
|
|
99
|
-
// .sort((a, b) => a.priority - b.priority);
|
|
100
|
-
//
|
|
101
|
-
// const summaryList: ITextValue[] = data.details
|
|
102
|
-
// .filter(i => i.section === EnumClosingWorkDaySection.SUMMARY)
|
|
103
|
-
// .sort((a, b) => a.priority - b.priority);
|
|
104
|
-
//
|
|
105
|
-
// const detailList: ITextValue[] = data.details
|
|
106
|
-
// .filter(i => i.section === EnumClosingWorkDaySection.DETAILS)
|
|
107
|
-
// .sort((a, b) => a.priority - b.priority);
|
|
108
|
-
//
|
|
109
|
-
// const paymentMethodList: ITextValue[] = data.details
|
|
110
|
-
// .filter(i => i.section === EnumClosingWorkDaySection.PAYMENT_METHODS)
|
|
111
|
-
// .sort((a, b) => a.priority - b.priority);
|
|
112
|
-
//
|
|
113
|
-
// const categoryList: ITextValue[] = data.details
|
|
114
|
-
// .filter(i => i.section === EnumClosingWorkDaySection.CATEGORIES)
|
|
115
|
-
// .sort((a, b) => a.priority - b.priority);
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
// if (infoList.length > 0) {
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
// content += SimplePreviewController.createText(data.description);
|
|
122
|
-
// content += SimplePreviewController.printSpace(8);
|
|
123
|
-
//
|
|
124
|
-
// for (let index = 0; index < infoList.length; index++) {
|
|
125
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(infoList[index].text, infoList[index].value, 12);
|
|
126
|
-
// content += SimplePreviewController.printSpace(2);
|
|
127
|
-
// }
|
|
128
|
-
//
|
|
129
|
-
// }
|
|
130
|
-
//
|
|
131
|
-
// if (summaryList.length > 0) {
|
|
132
|
-
//
|
|
133
|
-
// content += SimplePreviewController.printSpace(20);
|
|
134
|
-
// content += SimplePreviewController.createTitle("Summaries");
|
|
135
|
-
// content += SimplePreviewController.printSpace(8);
|
|
136
|
-
//
|
|
137
|
-
// for (let index = 0; index < summaryList.length; index++) {
|
|
138
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(summaryList[index].text, summaryList[index].value, 12);
|
|
139
|
-
// content += SimplePreviewController.printSpace(2);
|
|
140
|
-
// }
|
|
141
|
-
//
|
|
142
|
-
// }
|
|
143
|
-
//
|
|
144
|
-
// if (detailList.length > 0) {
|
|
145
|
-
//
|
|
146
|
-
// content += SimplePreviewController.printSpace(20);
|
|
147
|
-
// content += SimplePreviewController.createTitle("Details");
|
|
148
|
-
// content += SimplePreviewController.printSpace(8);
|
|
149
|
-
//
|
|
150
|
-
// for (let index = 0; index < detailList.length; index++) {
|
|
151
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(detailList[index].text, detailList[index].value, 12);
|
|
152
|
-
// content += SimplePreviewController.printSpace(2);
|
|
153
|
-
// }
|
|
154
|
-
//
|
|
155
|
-
// }
|
|
156
|
-
//
|
|
157
|
-
// if (paymentMethodList.length > 0) {
|
|
158
|
-
//
|
|
159
|
-
// content += SimplePreviewController.printSpace(20);
|
|
160
|
-
// content += SimplePreviewController.createTitle("Payments");
|
|
161
|
-
// content += SimplePreviewController.printSpace(8);
|
|
162
|
-
//
|
|
163
|
-
// for (let index = 0; index < paymentMethodList.length; index++) {
|
|
164
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(paymentMethodList[index].text, paymentMethodList[index].value, 12);
|
|
165
|
-
// content += SimplePreviewController.printSpace(2);
|
|
166
|
-
// }
|
|
167
|
-
//
|
|
168
|
-
// }
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
// if (categoryList.length > 0) {
|
|
172
|
-
//
|
|
173
|
-
// content += SimplePreviewController.printSpace(20);
|
|
174
|
-
// content += SimplePreviewController.createTitle("Categories");
|
|
175
|
-
// content += SimplePreviewController.printSpace(8);
|
|
176
|
-
//
|
|
177
|
-
// for (let index = 0; index < categoryList.length; index++) {
|
|
178
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(categoryList[index].text, categoryList[index].value, 12);
|
|
179
|
-
// content += SimplePreviewController.printSpace(2);
|
|
180
|
-
// }
|
|
181
|
-
//
|
|
182
|
-
// }
|
|
183
|
-
//
|
|
184
|
-
// content += SimplePreviewController.printSpace(20);
|
|
185
|
-
// content += SimplePreviewController.footer();
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
// return this.standardHtmlContainer(content);
|
|
189
|
-
//
|
|
190
|
-
// } catch (e) {
|
|
191
|
-
// console.log(e);
|
|
192
|
-
// }
|
|
193
|
-
//
|
|
194
|
-
// return '';
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
// }
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
// async createCashDrawerReport(
|
|
201
|
-
// device: IPointOfSaleCashDrawer,
|
|
202
|
-
// form: IPointOfSaleCashDrawerReportForm,
|
|
203
|
-
// records: IPointOfSaleCashDrawerReportRecord[],
|
|
204
|
-
// company: string,
|
|
205
|
-
// currency: string,
|
|
206
|
-
// member: IPointOfSaleTeamMember,
|
|
207
|
-
// formatDate: (value: string) => string
|
|
208
|
-
// ) {
|
|
209
|
-
// let content: string = '';
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
// try {
|
|
213
|
-
//
|
|
214
|
-
// const sum = MoneyController.sumField(records, 'amount');
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
// content += SimplePreviewController.createHeader('Cash drawer report', 'center');
|
|
218
|
-
// content += SimplePreviewController.createText(company, 'center', true);
|
|
219
|
-
// content += SimplePreviewController.printSpace(20);
|
|
220
|
-
//
|
|
221
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Cash drawer:', `#${form.cashDrawerId} - ${device.name}`);
|
|
222
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Since:', form.since);
|
|
223
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Until:', form.until);
|
|
224
|
-
//
|
|
225
|
-
//
|
|
226
|
-
// if (member.id > initPointOfSaleTeamMember.id) {
|
|
227
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Member ID:', `#${member.id}`);
|
|
228
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Member:', `${member.firstName} ${member.lastName}`);
|
|
229
|
-
// }
|
|
230
|
-
//
|
|
231
|
-
// content += SimplePreviewController.printSolidLine();
|
|
232
|
-
// content += SimplePreviewController.printSpace(8);
|
|
233
|
-
//
|
|
234
|
-
// records.forEach(record => {
|
|
235
|
-
//
|
|
236
|
-
// //dayjs(record.dateTime).format(Formats.printedAt)
|
|
237
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(formatDate(record.dateTime), MoneyController.format(record.amount, currency));
|
|
238
|
-
// content += SimplePreviewController.createText(record.reason, 'left', false);
|
|
239
|
-
// content += SimplePreviewController.printSpace(16);
|
|
240
|
-
// });
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
// content += SimplePreviewController.printSolidLine();
|
|
244
|
-
// content += SimplePreviewController.printSpace(4);
|
|
245
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Total:', MoneyController.format(sum, currency), 18);
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
// content += SimplePreviewController.printSpace(20);
|
|
249
|
-
// content += SimplePreviewController.footer();
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
// return this.standardHtmlContainer(content);
|
|
253
|
-
//
|
|
254
|
-
// } catch (error) {
|
|
255
|
-
// console.log(`Error: ${String(error)}`);
|
|
256
|
-
// }
|
|
257
|
-
//
|
|
258
|
-
// return '';
|
|
259
|
-
// }
|
|
260
94
|
}
|
|
261
95
|
convertTimeStringToDateByT(data = null) {
|
|
262
96
|
if (data instanceof Date) {
|
|
@@ -531,383 +365,248 @@ class _PreviewContentController {
|
|
|
531
365
|
}
|
|
532
366
|
return this.standardHtmlContainer(content);
|
|
533
367
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
//
|
|
777
|
-
// if (printParts.deliveryZones && Array.isArray(data.deliveryZones)) {
|
|
778
|
-
//
|
|
779
|
-
//
|
|
780
|
-
// content += SimplePreviewController.createTitle("Delivery zones");
|
|
781
|
-
// content += SimplePreviewController.printSolidLine();
|
|
782
|
-
//
|
|
783
|
-
// for (let index = 0; index < data.deliveryZones.length; index++) {
|
|
784
|
-
//
|
|
785
|
-
// const value = data.deliveryZones[index];
|
|
786
|
-
//
|
|
787
|
-
// content += SimplePreviewController.createSubTitle(value.title);
|
|
788
|
-
//
|
|
789
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
790
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency), 12);
|
|
791
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
792
|
-
// content += SimplePreviewController.printSpace(10);
|
|
793
|
-
//
|
|
794
|
-
// }
|
|
795
|
-
//
|
|
796
|
-
// if (data.deliveryZones.length === 0) {
|
|
797
|
-
// content += SimplePreviewController.createTextForEmptyList();
|
|
798
|
-
// content += SimplePreviewController.printSpace(10);
|
|
799
|
-
// }
|
|
800
|
-
//
|
|
801
|
-
//
|
|
802
|
-
// }
|
|
803
|
-
//
|
|
804
|
-
// if (printParts.drivers && Array.isArray(data.drivers)) {
|
|
805
|
-
//
|
|
806
|
-
//
|
|
807
|
-
// content += SimplePreviewController.createTitle("Drivers");
|
|
808
|
-
// content += SimplePreviewController.printSolidLine();
|
|
809
|
-
//
|
|
810
|
-
//
|
|
811
|
-
// for (let index = 0; index < data.drivers.length; index++) {
|
|
812
|
-
//
|
|
813
|
-
// const value = data.drivers[index];
|
|
814
|
-
//
|
|
815
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Amount', MoneyController.format(value.amount, currency), 12);
|
|
816
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
817
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Distance', MoneyController.format(value.distance, "m"), 12);
|
|
818
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Delivery costs', MoneyController.format(value.deliveryCosts, currency), 12);
|
|
819
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
820
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Cash tip', MoneyController.format(value.cashTip, currency), 12);
|
|
821
|
-
//
|
|
822
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Online tip', MoneyController.format(value.onlineTip, currency), 12);
|
|
823
|
-
// content += SimplePreviewController.createTextValueSpaceBetween('Terminal tip', MoneyController.format(value.terminalTip, currency), 12);
|
|
824
|
-
//
|
|
825
|
-
// content += SimplePreviewController.printSpace(10);
|
|
826
|
-
//
|
|
827
|
-
// }
|
|
828
|
-
//
|
|
829
|
-
//
|
|
830
|
-
// if (data.drivers.length === 0) {
|
|
831
|
-
// content += SimplePreviewController.createTextForEmptyList();
|
|
832
|
-
// content += SimplePreviewController.printSpace(10);
|
|
833
|
-
// }
|
|
834
|
-
// }
|
|
835
|
-
//
|
|
836
|
-
// if (printParts.thirdPartySales && Array.isArray(data.thirdPartySales)) {
|
|
837
|
-
//
|
|
838
|
-
// content += SimplePreviewController.createTitle("Third-party sales");
|
|
839
|
-
// content += SimplePreviewController.printSolidLine();
|
|
840
|
-
//
|
|
841
|
-
// for (let index = 0; index < data.thirdPartySales.length; index++) {
|
|
842
|
-
//
|
|
843
|
-
// const value = data.thirdPartySales[index];
|
|
844
|
-
// content += SimplePreviewController.createTextValueSpaceBetween(value.title, value.count + ', ' + MoneyController.format(value.amount, currency) + (data.thirdPartySales.length - 1 === index ? '' : '\n'), 12);
|
|
845
|
-
//
|
|
846
|
-
// }
|
|
847
|
-
//
|
|
848
|
-
// if (data.thirdPartySales.length === 0) {
|
|
849
|
-
// content += SimplePreviewController.createTextForEmptyList();
|
|
850
|
-
// content += SimplePreviewController.printSpace(10);
|
|
851
|
-
// }
|
|
852
|
-
// }
|
|
853
|
-
//
|
|
854
|
-
// content += SimplePreviewController.printSpace(20);
|
|
855
|
-
// content += SimplePreviewController.footer();
|
|
856
|
-
//
|
|
857
|
-
// return this.standardHtmlContainer(content);
|
|
858
|
-
//
|
|
859
|
-
// } catch (e) {
|
|
860
|
-
// console.log(e);
|
|
861
|
-
// }
|
|
862
|
-
//
|
|
863
|
-
// return '';
|
|
864
|
-
// }
|
|
865
|
-
//
|
|
866
|
-
// async createCashDrawerPaidInOutMarkup(device: IPointOfSaleActionFormCashDrawer, setting: IPointOfSaleSetting, member: IPointOfSaleTeamMember) {
|
|
867
|
-
//
|
|
868
|
-
//
|
|
869
|
-
// let content: string = '';
|
|
870
|
-
//
|
|
871
|
-
// try {
|
|
872
|
-
//
|
|
873
|
-
//
|
|
874
|
-
// if (device) {
|
|
875
|
-
// const title = device.mode === 1 ? 'Paid in' : 'Paid out';
|
|
876
|
-
//
|
|
877
|
-
// if (member.id > initPointOfSaleTeamMember.id) {
|
|
878
|
-
//
|
|
879
|
-
// content += SimplePreviewController.createSubTitle(`Member ID: #${member.id}`);
|
|
880
|
-
// content += SimplePreviewController.createSubTitle(`Member: ${member.firstName} ${member.lastName}`);
|
|
881
|
-
// content += SimplePreviewController.printSpace(8);
|
|
882
|
-
//
|
|
883
|
-
// }
|
|
884
|
-
//
|
|
885
|
-
// content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`);
|
|
886
|
-
// content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
887
|
-
// // content += SimplePreviewController.printSolidLine();
|
|
888
|
-
//
|
|
889
|
-
//
|
|
890
|
-
// // content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
891
|
-
//
|
|
892
|
-
//
|
|
893
|
-
// content += SimplePreviewController.printSpace(24);
|
|
894
|
-
// content += SimplePreviewController.footer();
|
|
895
|
-
//
|
|
896
|
-
// return this.standardHtmlContainer(content);
|
|
897
|
-
//
|
|
898
|
-
// }
|
|
899
|
-
//
|
|
900
|
-
//
|
|
901
|
-
// } catch (error) {
|
|
902
|
-
// console.log(`Error: ${String(error)}`);
|
|
903
|
-
// }
|
|
904
|
-
//
|
|
905
|
-
// return "";
|
|
906
|
-
// }
|
|
907
|
-
//
|
|
908
|
-
// async openCashDrawerMarkup(label: string = "") {
|
|
909
|
-
// return `<div>${label}</div>`;
|
|
910
|
-
// }
|
|
368
|
+
createPrintFromTurnoverDetail(data, currency, printParts) {
|
|
369
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
370
|
+
try {
|
|
371
|
+
// const = PrintPartsStorageController.getJson();
|
|
372
|
+
let content = "";
|
|
373
|
+
content += SimplePreviewController.createHeader("Turnover");
|
|
374
|
+
content += SimplePreviewController.printSpace(20);
|
|
375
|
+
if (printParts.summaries && Array.isArray(data.summaries)) {
|
|
376
|
+
content += SimplePreviewController.createTitle("Summaries");
|
|
377
|
+
content += SimplePreviewController.printSolidLine();
|
|
378
|
+
data.summaries.forEach((item) => {
|
|
379
|
+
content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value, 12);
|
|
380
|
+
content += SimplePreviewController.printSpace(2);
|
|
381
|
+
});
|
|
382
|
+
if (data.summaries.length === 0) {
|
|
383
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
384
|
+
}
|
|
385
|
+
content += SimplePreviewController.printSpace(10);
|
|
386
|
+
}
|
|
387
|
+
if (printParts.details && Array.isArray(data.details)) {
|
|
388
|
+
content += SimplePreviewController.createTitle("Details");
|
|
389
|
+
content += SimplePreviewController.printSolidLine();
|
|
390
|
+
data.details.map(i => ({
|
|
391
|
+
text: i.title,
|
|
392
|
+
value: i.count + ', ' + MoneyController.format(i.amount, currency),
|
|
393
|
+
}))
|
|
394
|
+
.forEach((item) => {
|
|
395
|
+
content += SimplePreviewController.createTextValueSpaceBetween(item.text, item.value, 12);
|
|
396
|
+
content += SimplePreviewController.printSpace(2);
|
|
397
|
+
});
|
|
398
|
+
if (data.details.length === 0) {
|
|
399
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
400
|
+
}
|
|
401
|
+
content += SimplePreviewController.printSpace(10);
|
|
402
|
+
}
|
|
403
|
+
if (printParts.channels && Array.isArray(data.channels)) {
|
|
404
|
+
content += SimplePreviewController.createTitle("Channels");
|
|
405
|
+
content += SimplePreviewController.printSolidLine();
|
|
406
|
+
data.channels.forEach((value, index) => {
|
|
407
|
+
const channelData = [
|
|
408
|
+
{
|
|
409
|
+
text: ' Orders',
|
|
410
|
+
value: value.count,
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
text: ' Gross sales',
|
|
414
|
+
value: MoneyController.format(value.amount, currency),
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
text: ' Net sales',
|
|
418
|
+
value: MoneyController.format(value.net, currency),
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
text: ' Taxes',
|
|
422
|
+
value: MoneyController.format(value.tax, currency),
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
text: ' Tip',
|
|
426
|
+
value: MoneyController.format(value.tip, currency),
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
text: ' Discount',
|
|
430
|
+
value: MoneyController.format(value.discount, currency),
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
text: ' Delivery fee',
|
|
434
|
+
value: MoneyController.format(value.deliveryFee, currency),
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
text: ' Service fee',
|
|
438
|
+
value: MoneyController.format(value.serviceFee, currency),
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
text: ' Company fee',
|
|
442
|
+
value: MoneyController.format(value.companyFee, currency),
|
|
443
|
+
},
|
|
444
|
+
{ text: ' ', value: '' },
|
|
445
|
+
];
|
|
446
|
+
if (index > 0)
|
|
447
|
+
SimplePreviewController.printSolidLine();
|
|
448
|
+
content += SimplePreviewController.createTitle(value.title);
|
|
449
|
+
channelData.map(i => content += SimplePreviewController.createTextValueSpaceBetween(i.text, i.value + "", 12));
|
|
450
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per order types`);
|
|
451
|
+
for (let index = 0; index < value.orderTypes.length; index++) {
|
|
452
|
+
const value1 = value.orderTypes[index];
|
|
453
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`, 12);
|
|
454
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency), 12);
|
|
455
|
+
content += SimplePreviewController.printDashLine(4);
|
|
456
|
+
}
|
|
457
|
+
content += SimplePreviewController.printDashLine(4);
|
|
458
|
+
content += SimplePreviewController.createTitle(`${value.title} turnover per payment types`);
|
|
459
|
+
for (let index = 0; index < value.paymentTypes.length; index++) {
|
|
460
|
+
const value1 = value.paymentTypes[index];
|
|
461
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value1.title, `${value1.count}, ${MoneyController.format(value1.amount, currency)}`, 12);
|
|
462
|
+
content += SimplePreviewController.createTextValueSpaceBetween("Tip", MoneyController.format(value1.tip, currency), 12);
|
|
463
|
+
content += SimplePreviewController.printDashLine(4);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
content += SimplePreviewController.printDashLine(4);
|
|
467
|
+
if (data.channels.length === 0)
|
|
468
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
469
|
+
content += SimplePreviewController.printSolidLine();
|
|
470
|
+
}
|
|
471
|
+
if (printParts.categories && Array.isArray(data.categories)) {
|
|
472
|
+
content += SimplePreviewController.createTitle("Categories");
|
|
473
|
+
content += SimplePreviewController.printSolidLine();
|
|
474
|
+
for (let index = 0; index < data.categories.length; index++) {
|
|
475
|
+
const value = data.categories[index];
|
|
476
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
477
|
+
for (let j = 0; j < value.channels.length; j++) {
|
|
478
|
+
const i = value.channels[j];
|
|
479
|
+
content += SimplePreviewController.createTextValueSpaceBetween(i.title, `${i.count}, ${MoneyController.format(i.amount, currency)}`);
|
|
480
|
+
}
|
|
481
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total', `${value.count}, ${MoneyController.format(value.amount, currency)}`, 12);
|
|
482
|
+
content += SimplePreviewController.printSpace(20);
|
|
483
|
+
}
|
|
484
|
+
if (data.categories.length === 0) {
|
|
485
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
486
|
+
content += SimplePreviewController.printSpace(20);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (printParts.orderTypes && Array.isArray(data.orderTypes)) {
|
|
490
|
+
content += SimplePreviewController.createTitle("Order types");
|
|
491
|
+
content += SimplePreviewController.printSolidLine();
|
|
492
|
+
for (let index = 0; index < data.orderTypes.length; index++) {
|
|
493
|
+
const value = data.orderTypes[index];
|
|
494
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
495
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
496
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency), 12);
|
|
497
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
498
|
+
content += SimplePreviewController.printSpace(10);
|
|
499
|
+
}
|
|
500
|
+
if (data.orderTypes.length === 0) {
|
|
501
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
502
|
+
content += SimplePreviewController.printSpace(10);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (printParts.payments && Array.isArray(data.payments)) {
|
|
506
|
+
content += SimplePreviewController.createTitle("Payment types");
|
|
507
|
+
content += SimplePreviewController.printSolidLine();
|
|
508
|
+
for (let index = 0; index < data.payments.length; index++) {
|
|
509
|
+
const value = data.payments[index];
|
|
510
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
511
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
512
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency), 12);
|
|
513
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
514
|
+
content += SimplePreviewController.printSpace(10);
|
|
515
|
+
}
|
|
516
|
+
if (data.payments.length === 0) {
|
|
517
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
518
|
+
content += SimplePreviewController.printSpace(10);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (printParts.deliveryZones && Array.isArray(data.deliveryZones)) {
|
|
522
|
+
content += SimplePreviewController.createTitle("Delivery zones");
|
|
523
|
+
content += SimplePreviewController.printSolidLine();
|
|
524
|
+
for (let index = 0; index < data.deliveryZones.length; index++) {
|
|
525
|
+
const value = data.deliveryZones[index];
|
|
526
|
+
content += SimplePreviewController.createSubTitle(value.title);
|
|
527
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
528
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total amount', MoneyController.format(value.amount, currency), 12);
|
|
529
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
530
|
+
content += SimplePreviewController.printSpace(10);
|
|
531
|
+
}
|
|
532
|
+
if (data.deliveryZones.length === 0) {
|
|
533
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
534
|
+
content += SimplePreviewController.printSpace(10);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
if (printParts.drivers && Array.isArray(data.drivers)) {
|
|
538
|
+
content += SimplePreviewController.createTitle("Drivers");
|
|
539
|
+
content += SimplePreviewController.printSolidLine();
|
|
540
|
+
for (let index = 0; index < data.drivers.length; index++) {
|
|
541
|
+
const value = data.drivers[index];
|
|
542
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Amount', MoneyController.format(value.amount, currency), 12);
|
|
543
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Count', value.count + "", 12);
|
|
544
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Distance', MoneyController.format(value.distance, "m"), 12);
|
|
545
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Delivery costs', MoneyController.format(value.deliveryCosts, currency), 12);
|
|
546
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Tip', MoneyController.format(value.tip, currency), 12);
|
|
547
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Cash tip', MoneyController.format(value.cashTip, currency), 12);
|
|
548
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Online tip', MoneyController.format(value.onlineTip, currency), 12);
|
|
549
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Terminal tip', MoneyController.format(value.terminalTip, currency), 12);
|
|
550
|
+
content += SimplePreviewController.printSpace(10);
|
|
551
|
+
}
|
|
552
|
+
if (data.drivers.length === 0) {
|
|
553
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
554
|
+
content += SimplePreviewController.printSpace(10);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (printParts.thirdPartySales && Array.isArray(data.thirdPartySales)) {
|
|
558
|
+
content += SimplePreviewController.createTitle("Third-party sales");
|
|
559
|
+
content += SimplePreviewController.printSolidLine();
|
|
560
|
+
for (let index = 0; index < data.thirdPartySales.length; index++) {
|
|
561
|
+
const value = data.thirdPartySales[index];
|
|
562
|
+
content += SimplePreviewController.createTextValueSpaceBetween(value.title, value.count + ', ' + MoneyController.format(value.amount, currency) + (data.thirdPartySales.length - 1 === index ? '' : '\n'), 12);
|
|
563
|
+
}
|
|
564
|
+
if (data.thirdPartySales.length === 0) {
|
|
565
|
+
content += SimplePreviewController.createTextForEmptyList();
|
|
566
|
+
content += SimplePreviewController.printSpace(10);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
content += SimplePreviewController.printSpace(20);
|
|
570
|
+
content += SimplePreviewController.footer();
|
|
571
|
+
return this.standardHtmlContainer(content);
|
|
572
|
+
}
|
|
573
|
+
catch (e) {
|
|
574
|
+
console.log(e);
|
|
575
|
+
}
|
|
576
|
+
return '';
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
createCashDrawerPaidInOutMarkup(device, setting, member) {
|
|
580
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
581
|
+
let content = '';
|
|
582
|
+
try {
|
|
583
|
+
if (device) {
|
|
584
|
+
const title = device.mode === 1 ? 'Paid in' : 'Paid out';
|
|
585
|
+
if (member.id > initPointOfSaleTeamMember.id) {
|
|
586
|
+
content += SimplePreviewController.createSubTitle(`Member ID: #${member.id}`);
|
|
587
|
+
content += SimplePreviewController.createSubTitle(`Member: ${member.firstName} ${member.lastName}`);
|
|
588
|
+
content += SimplePreviewController.printSpace(8);
|
|
589
|
+
}
|
|
590
|
+
content += SimplePreviewController.createText(`${title}: ${MoneyController.format(device.money, setting.currencySymbol)}`);
|
|
591
|
+
content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
592
|
+
// content += SimplePreviewController.printSolidLine();
|
|
593
|
+
// content += SimplePreviewController.createText(`Reason: ${device.reason}`);
|
|
594
|
+
content += SimplePreviewController.printSpace(24);
|
|
595
|
+
content += SimplePreviewController.footer();
|
|
596
|
+
return this.standardHtmlContainer(content);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
console.log(`Error: ${String(error)}`);
|
|
601
|
+
}
|
|
602
|
+
return "";
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
openCashDrawerMarkup() {
|
|
606
|
+
return __awaiter(this, arguments, void 0, function* (label = "") {
|
|
607
|
+
return `<div>${label}</div>`;
|
|
608
|
+
});
|
|
609
|
+
}
|
|
911
610
|
standardHtmlContainer(strHtml) {
|
|
912
611
|
return `<!DOCTYPE html>
|
|
913
612
|
<html>
|
|
@@ -955,6 +654,118 @@ class _PreviewContentController {
|
|
|
955
654
|
</body>
|
|
956
655
|
</html>`;
|
|
957
656
|
}
|
|
657
|
+
createClosingWorkDay(data, companyTitle) {
|
|
658
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
659
|
+
let content = "";
|
|
660
|
+
try {
|
|
661
|
+
content += SimplePreviewController.createHeader(data.title, 'center');
|
|
662
|
+
content += SimplePreviewController.createTitle(companyTitle, 'center');
|
|
663
|
+
content += SimplePreviewController.printSpace(20);
|
|
664
|
+
const infoList = data.details
|
|
665
|
+
.filter(i => i.section === EnumClosingWorkDaySection.INFORMATION)
|
|
666
|
+
.sort((a, b) => a.priority - b.priority);
|
|
667
|
+
const summaryList = data.details
|
|
668
|
+
.filter(i => i.section === EnumClosingWorkDaySection.SUMMARY)
|
|
669
|
+
.sort((a, b) => a.priority - b.priority);
|
|
670
|
+
const detailList = data.details
|
|
671
|
+
.filter(i => i.section === EnumClosingWorkDaySection.DETAILS)
|
|
672
|
+
.sort((a, b) => a.priority - b.priority);
|
|
673
|
+
const paymentMethodList = data.details
|
|
674
|
+
.filter(i => i.section === EnumClosingWorkDaySection.PAYMENT_METHODS)
|
|
675
|
+
.sort((a, b) => a.priority - b.priority);
|
|
676
|
+
const categoryList = data.details
|
|
677
|
+
.filter(i => i.section === EnumClosingWorkDaySection.CATEGORIES)
|
|
678
|
+
.sort((a, b) => a.priority - b.priority);
|
|
679
|
+
if (infoList.length > 0) {
|
|
680
|
+
content += SimplePreviewController.createText(data.description);
|
|
681
|
+
content += SimplePreviewController.printSpace(8);
|
|
682
|
+
for (let index = 0; index < infoList.length; index++) {
|
|
683
|
+
content += SimplePreviewController.createTextValueSpaceBetween(infoList[index].text, infoList[index].value, 12);
|
|
684
|
+
content += SimplePreviewController.printSpace(2);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if (summaryList.length > 0) {
|
|
688
|
+
content += SimplePreviewController.printSpace(20);
|
|
689
|
+
content += SimplePreviewController.createTitle("Summaries");
|
|
690
|
+
content += SimplePreviewController.printSpace(8);
|
|
691
|
+
for (let index = 0; index < summaryList.length; index++) {
|
|
692
|
+
content += SimplePreviewController.createTextValueSpaceBetween(summaryList[index].text, summaryList[index].value, 12);
|
|
693
|
+
content += SimplePreviewController.printSpace(2);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (detailList.length > 0) {
|
|
697
|
+
content += SimplePreviewController.printSpace(20);
|
|
698
|
+
content += SimplePreviewController.createTitle("Details");
|
|
699
|
+
content += SimplePreviewController.printSpace(8);
|
|
700
|
+
for (let index = 0; index < detailList.length; index++) {
|
|
701
|
+
content += SimplePreviewController.createTextValueSpaceBetween(detailList[index].text, detailList[index].value, 12);
|
|
702
|
+
content += SimplePreviewController.printSpace(2);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (paymentMethodList.length > 0) {
|
|
706
|
+
content += SimplePreviewController.printSpace(20);
|
|
707
|
+
content += SimplePreviewController.createTitle("Payments");
|
|
708
|
+
content += SimplePreviewController.printSpace(8);
|
|
709
|
+
for (let index = 0; index < paymentMethodList.length; index++) {
|
|
710
|
+
content += SimplePreviewController.createTextValueSpaceBetween(paymentMethodList[index].text, paymentMethodList[index].value, 12);
|
|
711
|
+
content += SimplePreviewController.printSpace(2);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
if (categoryList.length > 0) {
|
|
715
|
+
content += SimplePreviewController.printSpace(20);
|
|
716
|
+
content += SimplePreviewController.createTitle("Categories");
|
|
717
|
+
content += SimplePreviewController.printSpace(8);
|
|
718
|
+
for (let index = 0; index < categoryList.length; index++) {
|
|
719
|
+
content += SimplePreviewController.createTextValueSpaceBetween(categoryList[index].text, categoryList[index].value, 12);
|
|
720
|
+
content += SimplePreviewController.printSpace(2);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
content += SimplePreviewController.printSpace(20);
|
|
724
|
+
content += SimplePreviewController.footer();
|
|
725
|
+
return this.standardHtmlContainer(content);
|
|
726
|
+
}
|
|
727
|
+
catch (e) {
|
|
728
|
+
console.log(e);
|
|
729
|
+
}
|
|
730
|
+
return '';
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
createCashDrawerReport(device, form, records, company, currency, member, formatDate) {
|
|
734
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
735
|
+
let content = '';
|
|
736
|
+
try {
|
|
737
|
+
const sum = MoneyController.sumField(records, 'amount');
|
|
738
|
+
content += SimplePreviewController.createHeader('Cash drawer report', 'center');
|
|
739
|
+
content += SimplePreviewController.createText(company, 'center', true);
|
|
740
|
+
content += SimplePreviewController.printSpace(20);
|
|
741
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Cash drawer:', `#${form.cashDrawerId} - ${device.name}`);
|
|
742
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Since:', form.since);
|
|
743
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Until:', form.until);
|
|
744
|
+
if (member.id > initPointOfSaleTeamMember.id) {
|
|
745
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Member ID:', `#${member.id}`);
|
|
746
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Member:', `${member.firstName} ${member.lastName}`);
|
|
747
|
+
}
|
|
748
|
+
content += SimplePreviewController.printSolidLine();
|
|
749
|
+
content += SimplePreviewController.printSpace(8);
|
|
750
|
+
records.forEach(record => {
|
|
751
|
+
//dayjs(record.dateTime).format(Formats.printedAt)
|
|
752
|
+
content += SimplePreviewController.createTextValueSpaceBetween(formatDate(record.dateTime), MoneyController.format(record.amount, currency));
|
|
753
|
+
content += SimplePreviewController.createText(record.reason, 'left', false);
|
|
754
|
+
content += SimplePreviewController.printSpace(16);
|
|
755
|
+
});
|
|
756
|
+
content += SimplePreviewController.printSolidLine();
|
|
757
|
+
content += SimplePreviewController.printSpace(4);
|
|
758
|
+
content += SimplePreviewController.createTextValueSpaceBetween('Total:', MoneyController.format(sum, currency), 18);
|
|
759
|
+
content += SimplePreviewController.printSpace(20);
|
|
760
|
+
content += SimplePreviewController.footer();
|
|
761
|
+
return this.standardHtmlContainer(content);
|
|
762
|
+
}
|
|
763
|
+
catch (error) {
|
|
764
|
+
console.log(`Error: ${String(error)}`);
|
|
765
|
+
}
|
|
766
|
+
return '';
|
|
767
|
+
});
|
|
768
|
+
}
|
|
958
769
|
}
|
|
959
770
|
const PreviewContentController = new _PreviewContentController();
|
|
960
771
|
export default PreviewContentController;
|
|
@@ -29,6 +29,14 @@ declare class SimplePreviewController {
|
|
|
29
29
|
printSimpleDashLine(): string;
|
|
30
30
|
printSolidLine(): string;
|
|
31
31
|
createTextValue(text: string, value: string, textLength: number, template: IPrintTemplate): string;
|
|
32
|
+
createTextValueSpaceBetween(text: string, value: string, fontSize?: number): string;
|
|
33
|
+
createHeader(text: string, align?: "left" | "center" | "right"): string;
|
|
34
|
+
createTitle(text: string, align?: "left" | "center" | "right"): string;
|
|
35
|
+
createSubTitle(text: string, align?: "left" | "center" | "right"): string;
|
|
36
|
+
createText(text: string, align?: "left" | "center" | "right", bold?: boolean): string;
|
|
37
|
+
createTextForEmptyList(text?: string): string;
|
|
38
|
+
printSpace(height: number): string;
|
|
39
|
+
footer(): string;
|
|
32
40
|
private createDivContainer;
|
|
33
41
|
private filterByCategoryList;
|
|
34
42
|
private sortProduct;
|
|
@@ -7,7 +7,7 @@ import EnumPizzaSide from "../enums/EnumPizzaSide";
|
|
|
7
7
|
import EnumPaymentState from "../enums/EnumPaymentState";
|
|
8
8
|
import OrderToolController from "./OrderToolController";
|
|
9
9
|
import EnumOrderDateTimePrintModeType from "../enums/EnumOrderDateTimePrintModeType";
|
|
10
|
-
import { Formats } from "../statics";
|
|
10
|
+
import { Formats, printPoweredBy } from "../statics";
|
|
11
11
|
import dayjs from "../utils/dayjs";
|
|
12
12
|
class SimplePreviewController {
|
|
13
13
|
constructor() {
|
|
@@ -566,60 +566,40 @@ class SimplePreviewController {
|
|
|
566
566
|
<div style=" font-size: ${template.fontSize}px; text-align: left; font-family: ${template.font};">${value}</div>
|
|
567
567
|
</div>`;
|
|
568
568
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
// public createTextForEmptyList(text: string = "There is no data!") {
|
|
604
|
-
//
|
|
605
|
-
// return `<i style=" font-size: 14px; text-align: left; color:rgb(49, 49, 49);">${text}</i>`;
|
|
606
|
-
//
|
|
607
|
-
// }
|
|
608
|
-
//
|
|
609
|
-
// public printSpace(height: number) {
|
|
610
|
-
// return `<div style="height : ${height}px;"></div>`;
|
|
611
|
-
// }
|
|
612
|
-
//
|
|
613
|
-
// public footer() {
|
|
614
|
-
// return `<div>
|
|
615
|
-
// <div style="text-align:center; font-size:12px; font-weight:normal; color:black;">
|
|
616
|
-
// Printed at ${dayjs().format(Formats.printedAt)}
|
|
617
|
-
// </div>
|
|
618
|
-
// <div style="text-align:center; font-size:12px; font-weight:bold; color:black;">
|
|
619
|
-
// ${printPoweredBy}
|
|
620
|
-
// </div>
|
|
621
|
-
// </div>`;
|
|
622
|
-
// }
|
|
569
|
+
createTextValueSpaceBetween(text, value, fontSize = 14) {
|
|
570
|
+
return `<div style="display:flex; flex-direction:row; justify-content:space-between; align-items:flex-start;">
|
|
571
|
+
<div style=" font-size:${fontSize}px; text-align: left; color: black;">${text}</div>
|
|
572
|
+
<div style=" font-size: ${fontSize}px; text-align: left; color: black;">${value}</div>
|
|
573
|
+
</div>`;
|
|
574
|
+
}
|
|
575
|
+
createHeader(text, align = "left") {
|
|
576
|
+
return `<div style=" font-size: 22px; text-align: ${align}; color: black;">${text}</div>`;
|
|
577
|
+
}
|
|
578
|
+
createTitle(text, align = "left") {
|
|
579
|
+
return `<div style=" font-size: 18px; text-align: ${align}; color: black;">${text}</div>`;
|
|
580
|
+
}
|
|
581
|
+
createSubTitle(text, align = "left") {
|
|
582
|
+
return `<div style=" font-size: 14px; font-weight:bold; text-align: ${align}; color: black;">${text}</div>`;
|
|
583
|
+
}
|
|
584
|
+
createText(text, align = "left", bold = false) {
|
|
585
|
+
return `<div style=" font-size: 14px; font-weight:${bold ? "normal" : "bold"}; text-align: ${align}; color: black;">${text}</div>`;
|
|
586
|
+
}
|
|
587
|
+
createTextForEmptyList(text = "There is no data!") {
|
|
588
|
+
return `<i style=" font-size: 14px; text-align: left; color:rgb(49, 49, 49);">${text}</i>`;
|
|
589
|
+
}
|
|
590
|
+
printSpace(height) {
|
|
591
|
+
return `<div style="height : ${height}px;"></div>`;
|
|
592
|
+
}
|
|
593
|
+
footer() {
|
|
594
|
+
return `<div>
|
|
595
|
+
<div style="text-align:center; font-size:12px; font-weight:normal; color:black;">
|
|
596
|
+
Printed at ${dayjs().format(Formats.printedAt)}
|
|
597
|
+
</div>
|
|
598
|
+
<div style="text-align:center; font-size:12px; font-weight:bold; color:black;">
|
|
599
|
+
${printPoweredBy}
|
|
600
|
+
</div>
|
|
601
|
+
</div>`;
|
|
602
|
+
}
|
|
623
603
|
createDivContainer(template, pt = 0, pb = 0) {
|
|
624
604
|
return `<div style="display: block; padding-left: ${template.paddingLeft}mm; padding-right: ${template.paddingRight}mm; padding-top: ${pt + "px"}; padding-bottom: ${pb + "px"};" >`;
|
|
625
605
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.22",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"remove:one": "rimraf dist",
|
|
12
12
|
"remove:two": "rimraf ./src/dist",
|
|
13
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"commit": "git add . && git commit -m \"version.1.5.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.5.22\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|