meemup-library 1.6.7 → 1.6.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import IAccount from "../interfaces/IAccount";
|
|
1
2
|
import IPrintTemplate from "../interfaces/IPrintTemplate";
|
|
2
3
|
import IOrderDetailOrder from "../interfaces/print/IOrderDetailOrder";
|
|
3
|
-
import IAccount from "../interfaces/IAccount";
|
|
4
4
|
import IOrderDetails from "../interfaces/print/IOrderDetails";
|
|
5
5
|
declare class SimplePreviewController {
|
|
6
6
|
printPreOrderText(template: IPrintTemplate): string;
|
|
@@ -14,6 +14,7 @@ declare class SimplePreviewController {
|
|
|
14
14
|
printCustomerInformation(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
15
15
|
printProductCount(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
16
16
|
printTextBeforeProducts(template: IPrintTemplate): string;
|
|
17
|
+
printProductInDineIn(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
17
18
|
printProducts(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
18
19
|
printLargeProducts(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
19
20
|
printCustomerRemark(template: IPrintTemplate, detail: IOrderDetails): string;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import PrintToolController from "./PrintToolController.js";
|
|
2
1
|
import EnumFeeType from "../enums/EnumFeeType.js";
|
|
3
|
-
import
|
|
4
|
-
import EnumPaymentType from "../enums/EnumPaymentType";
|
|
5
|
-
import MoneyController from "./MoneyController";
|
|
6
|
-
import EnumShowCustomer from "../enums/EnumShowCustomer";
|
|
2
|
+
import EnumOrderDateTimePrintModeType from "../enums/EnumOrderDateTimePrintModeType";
|
|
7
3
|
import EnumOrderType from "../enums/EnumOrderType";
|
|
8
|
-
import EnumPizzaSide from "../enums/EnumPizzaSide";
|
|
9
4
|
import EnumPaymentState from "../enums/EnumPaymentState";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
5
|
+
import EnumPaymentType from "../enums/EnumPaymentType";
|
|
6
|
+
import EnumPizzaSide from "../enums/EnumPizzaSide";
|
|
7
|
+
import EnumPointOfSaleOrderItemSharingType from "../enums/EnumPointOfSaleOrderItemSharingType.js";
|
|
8
|
+
import EnumPrintLayout from "../enums/EnumPrintLayout.js";
|
|
9
|
+
import EnumShowCustomer from "../enums/EnumShowCustomer";
|
|
10
|
+
import { BundleGroupPreName, BundleProductQuantityPreName, Formats, printPoweredBy } from "../statics";
|
|
13
11
|
import dayjs from "../utils/dayjs";
|
|
12
|
+
import MoneyController from "./MoneyController";
|
|
13
|
+
import OrderToolController from "./OrderToolController";
|
|
14
|
+
import PhoneController from "./PhoneController";
|
|
15
|
+
import PrintToolController from "./PrintToolController.js";
|
|
16
|
+
import TagToolController from "./tag-tool-controller.js";
|
|
14
17
|
class SimplePreviewController {
|
|
15
18
|
constructor() {
|
|
16
19
|
this.filterByCategoryList = (products, catList, onlyListCategory, productList, onlyListProduct) => {
|
|
@@ -227,11 +230,97 @@ class SimplePreviewController {
|
|
|
227
230
|
content += `</div>`;
|
|
228
231
|
return content;
|
|
229
232
|
}
|
|
233
|
+
printProductInDineIn(template, detail) {
|
|
234
|
+
var _a;
|
|
235
|
+
const TagController = TagToolController.getInstance();
|
|
236
|
+
let flag = true;
|
|
237
|
+
const fontSize = template.layout === EnumPrintLayout.LARGE ? (template.printer === 5 ? 22 : parseInt((template.fontSize + 10) + "")) : template.fontSize;
|
|
238
|
+
const seats = TagController.allSeatInOrderDetail(detail.products);
|
|
239
|
+
let content = this.createDivContainer(template);
|
|
240
|
+
const list = this.filterByCategoryList(this.sortProduct(detail.products, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
241
|
+
if (list.length > 0) {
|
|
242
|
+
flag = false;
|
|
243
|
+
}
|
|
244
|
+
if (flag)
|
|
245
|
+
return "";
|
|
246
|
+
for (let index = 0; index < seats.length; index++) {
|
|
247
|
+
const seatId = seats[index];
|
|
248
|
+
//
|
|
249
|
+
content += `<div style="margin-botttom:8px; font-size:${fontSize * 1.2}px; font-weight:bold; text-align:left; background-color:black; color:white; padding:4px 8px;">
|
|
250
|
+
${TagController.createSeatLabel(seatId)}
|
|
251
|
+
</div>`;
|
|
252
|
+
// 2. Iterate over the array using a standard 'for' loop
|
|
253
|
+
for (let i = 0; i < list.length; i++) {
|
|
254
|
+
const row = detail.products[i]; // Get the current product (IOrderDetailProduct)
|
|
255
|
+
const productSeats = TagController.tagsToOrderItemSeats(row.tags || []);
|
|
256
|
+
const productSeatIdList = TagController.tagsToOrderItemSeats(row.tags || []).map(i => i.seatId);
|
|
257
|
+
const seat = productSeats.find(i => i.seatId === seatId);
|
|
258
|
+
const tagSharingType = TagController.findTagSharingType(row.tags);
|
|
259
|
+
const sharingType = TagController.tagToSharingType(tagSharingType);
|
|
260
|
+
if (productSeatIdList.includes(seatId)) {
|
|
261
|
+
let sharp = `${row.quantity}×`;
|
|
262
|
+
let quantity = row.quantity;
|
|
263
|
+
switch (sharingType) {
|
|
264
|
+
case EnumPointOfSaleOrderItemSharingType.Single:
|
|
265
|
+
sharp = `${(seat === null || seat === void 0 ? void 0 : seat.ratio) || 1}×`;
|
|
266
|
+
quantity = (seat === null || seat === void 0 ? void 0 : seat.ratio) || 1;
|
|
267
|
+
break;
|
|
268
|
+
case EnumPointOfSaleOrderItemSharingType.EqualSplit:
|
|
269
|
+
sharp = `1/${productSeats.length}`;
|
|
270
|
+
quantity = +((((seat === null || seat === void 0 ? void 0 : seat.ratio) || 1) / MoneyController.sumField(productSeats, "ratio")).toFixed(2));
|
|
271
|
+
break;
|
|
272
|
+
case EnumPointOfSaleOrderItemSharingType.Shared:
|
|
273
|
+
sharp = `${(seat === null || seat === void 0 ? void 0 : seat.ratio) || 1}/${MoneyController.sumField(productSeats, "ratio")}`;
|
|
274
|
+
quantity = +((((seat === null || seat === void 0 ? void 0 : seat.ratio) || 1) / MoneyController.sumField(productSeats, "ratio")).toFixed(2));
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
let price = template.showPrices ? `${MoneyController.format(quantity * row.price, detail.company.currencySymbol)}` : '';
|
|
280
|
+
let productName = (template.showProductKitchenName && row.kitchenReceiptName !== '' && row.kitchenReceiptName !== null ? row.kitchenReceiptName : row.productName).trim();
|
|
281
|
+
productName = ((_a = productName === null || productName === void 0 ? void 0 : productName.replace(sharp, '')) === null || _a === void 0 ? void 0 : _a.trim()) + '';
|
|
282
|
+
content += `<div style="display:flex; flex-direction:row; align-items:center; justify-content: flex-start; gap: 8px;">
|
|
283
|
+
<span style="font-size:${fontSize}px; min-width:40px; width: 40px; text-align: left;">${sharp}</span>
|
|
284
|
+
<span style="font-size:${fontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${productName}</span>
|
|
285
|
+
<span style="font-size:${fontSize}px; max-width: 90px; text-align: right;">${price}</span>
|
|
286
|
+
</div>`;
|
|
287
|
+
// -------------------------
|
|
288
|
+
if (row.extrasNames) {
|
|
289
|
+
const extList = row.extras
|
|
290
|
+
.filter(item => !item.doNotPrintOnReceipt)
|
|
291
|
+
.map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText, template.showPrices))
|
|
292
|
+
.filter(i => i.length > 0);
|
|
293
|
+
for (let ind = 0; ind < extList.length; ind++) {
|
|
294
|
+
content += `<div style="display:flex; flex-direction:row; align-items:center; justify-content: flex-start; gap: 8px;">
|
|
295
|
+
<span style="font-size:${fontSize}px; min-width:40px; width: 40px; text-align: left;"></span>
|
|
296
|
+
<span style="font-size:${fontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2; padding-left: 24px;">${extList[ind]}</span>
|
|
297
|
+
</div>`;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
const note = PrintToolController.productNote(row);
|
|
301
|
+
if (note !== '') {
|
|
302
|
+
content += `<div style="display:flex; flex-direction:row; align-items:center; justify-content: flex-start; gap: 8px;">
|
|
303
|
+
<span style="font-size:${fontSize}px; min-width:40px; width: 40px; text-align: left;"></span>
|
|
304
|
+
<span style="font-size:${fontSize}px; font-weight: bold; flex: 1; width: 100%; text-align: left; column-span: 2; padding-left: 24px;">${note}</span>
|
|
305
|
+
</div>`;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
content += this.printSolidLine();
|
|
310
|
+
}
|
|
311
|
+
return content;
|
|
312
|
+
}
|
|
230
313
|
printProducts(template, detail) {
|
|
231
314
|
var _a, _b, _c;
|
|
315
|
+
const TagController = TagToolController.getInstance();
|
|
232
316
|
let flag = true;
|
|
233
|
-
|
|
234
|
-
|
|
317
|
+
const seats = TagController.allSeatInOrderDetail(detail.products);
|
|
318
|
+
if (detail.order.orderType === EnumOrderType.dining && detail.order.tableId !== null && seats.length > 0) {
|
|
319
|
+
return this.printProductInDineIn(template, detail);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
let content = this.createDivContainer(template);
|
|
323
|
+
content += `<table style="width: 100%; border-collapse: collapse;">
|
|
235
324
|
<thead style="border-bottom: 1px solid #000000;">
|
|
236
325
|
<tr style="height: 28px;">
|
|
237
326
|
<th style="font-size:${template.fontSize}px;min-width:40px; width: 40px; text-align: left; font-weight: bold;">#</th>
|
|
@@ -241,129 +330,129 @@ class SimplePreviewController {
|
|
|
241
330
|
</thead>
|
|
242
331
|
<tbody>
|
|
243
332
|
`;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const bundles = detail.order.items.filter(i => i.type === EnumFeeType.BundleProduct);
|
|
259
|
-
for (let ind = 0; ind < bundleGroups.length; ind++) {
|
|
260
|
-
const group = bundleGroups[ind] + '';
|
|
261
|
-
const groupTag = BundleGroupPreName + group;
|
|
262
|
-
const list = bundledProducts.filter(pro => Array.isArray(pro.tags) && pro.tags.includes(groupTag));
|
|
263
|
-
if (list.length > 0) {
|
|
264
|
-
const firstItem = list[0];
|
|
265
|
-
// const bundleGroup: string = (firstItem.tags?.find(i => i.startsWith(BundleGroupPreName)) + '').split(BundleGroupPreName)[1];
|
|
266
|
-
// const bundleId: number = +(firstItem.tags?.find(i => i.startsWith(BundleIdPreName)) + '').split(BundleIdPreName)[1];
|
|
267
|
-
const firstItemRatio = +(((_a = firstItem.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleProductQuantityPreName))) + '').split(BundleProductQuantityPreName)[1];
|
|
268
|
-
const bundleQuantity = firstItem.quantity / firstItemRatio;
|
|
269
|
-
const bundle = bundles.find(i => { var _a; return ((_a = i.metadata.find(j => j.text === "BundleGroup")) === null || _a === void 0 ? void 0 : _a.value) === group; });
|
|
270
|
-
if (bundle) {
|
|
271
|
-
const sharp = ` ${bundleQuantity}×`;
|
|
272
|
-
const sumBundleDiscount = bundle.amount; // bundleQuantity * bundle.discountAmount;
|
|
273
|
-
const _total = MoneyController.sumField(list, 'totalAmount');
|
|
274
|
-
// let _lastTotal = _total - sumBundleDiscount;
|
|
275
|
-
let _lastTotal = _total - sumBundleDiscount;
|
|
276
|
-
if (_lastTotal < 0) {
|
|
277
|
-
_lastTotal = 0;
|
|
333
|
+
let bundledProducts = detail.products.filter(i => TagController.findTagBundleId(i.tags) !== undefined);
|
|
334
|
+
if (bundledProducts.length > 0) {
|
|
335
|
+
flag = false;
|
|
336
|
+
const bundleGroups = [];
|
|
337
|
+
bundledProducts.forEach(pro => {
|
|
338
|
+
var _a;
|
|
339
|
+
const tag = (_a = pro.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleGroupPreName));
|
|
340
|
+
if (tag) {
|
|
341
|
+
const bundleGroup = (tag + '').split(BundleGroupPreName)[1];
|
|
342
|
+
if (!bundleGroups.includes(bundleGroup)) {
|
|
343
|
+
bundleGroups.push(bundleGroup);
|
|
278
344
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
const bundles = detail.order.items.filter(i => i.type === EnumFeeType.BundleProduct);
|
|
348
|
+
for (let ind = 0; ind < bundleGroups.length; ind++) {
|
|
349
|
+
const group = bundleGroups[ind] + '';
|
|
350
|
+
const groupTag = BundleGroupPreName + group;
|
|
351
|
+
const list = bundledProducts.filter(pro => Array.isArray(pro.tags) && pro.tags.includes(groupTag));
|
|
352
|
+
if (list.length > 0) {
|
|
353
|
+
const firstItem = list[0];
|
|
354
|
+
// const bundleGroup: string = (firstItem.tags?.find(i => i.startsWith(BundleGroupPreName)) + '').split(BundleGroupPreName)[1];
|
|
355
|
+
// const bundleId: number = +(firstItem.tags?.find(i => i.startsWith(BundleIdPreName)) + '').split(BundleIdPreName)[1];
|
|
356
|
+
const firstItemRatio = +(((_a = firstItem.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleProductQuantityPreName))) + '').split(BundleProductQuantityPreName)[1];
|
|
357
|
+
const bundleQuantity = firstItem.quantity / firstItemRatio;
|
|
358
|
+
const bundle = bundles.find(i => { var _a; return ((_a = i.metadata.find(j => j.text === "BundleGroup")) === null || _a === void 0 ? void 0 : _a.value) === group; });
|
|
359
|
+
if (bundle) {
|
|
360
|
+
const sharp = ` ${bundleQuantity}×`;
|
|
361
|
+
const sumBundleDiscount = bundle.amount; // bundleQuantity * bundle.discountAmount;
|
|
362
|
+
const _total = MoneyController.sumField(list, 'totalAmount');
|
|
363
|
+
// let _lastTotal = _total - sumBundleDiscount;
|
|
364
|
+
let _lastTotal = _total - sumBundleDiscount;
|
|
365
|
+
if (_lastTotal < 0) {
|
|
366
|
+
_lastTotal = 0;
|
|
367
|
+
}
|
|
368
|
+
const price = template.showPrices ? MoneyController.format(_lastTotal, detail.company.currencySymbol) : '';
|
|
369
|
+
let bundleText = bundle.text;
|
|
370
|
+
bundleText = ((_b = bundleText === null || bundleText === void 0 ? void 0 : bundleText.replace(sharp, '')) === null || _b === void 0 ? void 0 : _b.trim()) + "";
|
|
371
|
+
content += `<tr style="height: 28px;">
|
|
283
372
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;">${sharp}</td>
|
|
284
373
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${bundleText}</td>
|
|
285
374
|
<td style="font-size:${template.fontSize}px; max-width: 90px; text-align: right;">${price}</td>
|
|
286
375
|
</tr>`;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
376
|
+
for (let index = 0; index < list.length; index++) {
|
|
377
|
+
const row = list[index];
|
|
378
|
+
const sharp = `${row.quantity}× `;
|
|
379
|
+
let product = (template.showProductKitchenName && typeof row.kitchenReceiptName === "string" && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.title;
|
|
380
|
+
product = sharp + ((_c = product === null || product === void 0 ? void 0 : product.replace(sharp, '')) === null || _c === void 0 ? void 0 : _c.trim()) + "";
|
|
381
|
+
content += `<tr>
|
|
293
382
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
294
383
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2;">${product}</td>
|
|
295
384
|
</tr>`;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
385
|
+
if (row.extrasNames) {
|
|
386
|
+
const extList = row.extras
|
|
387
|
+
.filter(item => !item.doNotPrintOnReceipt)
|
|
388
|
+
.map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText, template.showPrices))
|
|
389
|
+
.filter(i => i.length > 0);
|
|
390
|
+
for (let ind = 0; ind < extList.length; ind++) {
|
|
391
|
+
content += `<tr>
|
|
303
392
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
304
393
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2; padding-left: 24px;">${extList[ind]}</td>
|
|
305
394
|
</tr>`;
|
|
395
|
+
}
|
|
306
396
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
content += `<tr>
|
|
397
|
+
const note = PrintToolController.productNote(row);
|
|
398
|
+
if (note !== '') {
|
|
399
|
+
content += `<tr>
|
|
311
400
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
312
401
|
<td style="font-size:${template.fontSize}px; font-weight: bold; flex: 1; width: 100%; text-align: left; column-span: 2; padding-left: 24px;">${note}</td>
|
|
313
402
|
</tr>`;
|
|
403
|
+
}
|
|
314
404
|
}
|
|
315
405
|
}
|
|
316
406
|
}
|
|
317
407
|
}
|
|
318
408
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
content += `<tr style="height: 28px;">
|
|
409
|
+
let unBundledProducts = detail.products.filter(i => TagController.findTagBundleId(i.tags) === undefined);
|
|
410
|
+
const list = this.filterByCategoryList(this.sortProduct(unBundledProducts, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
411
|
+
if (list.length > 0) {
|
|
412
|
+
flag = false;
|
|
413
|
+
}
|
|
414
|
+
if (flag)
|
|
415
|
+
return "";
|
|
416
|
+
list.forEach((row) => {
|
|
417
|
+
let cat;
|
|
418
|
+
if (!template.showCategoryTitle || !row.categoryTitle || row.categoryTitle.trim().length === 0)
|
|
419
|
+
cat = "";
|
|
420
|
+
else
|
|
421
|
+
cat = `[${row.categoryTitle.trim()}] `;
|
|
422
|
+
const productName = cat + ((template.showProductKitchenName && typeof row.kitchenReceiptName === "string" && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.productName).trim();
|
|
423
|
+
const amount = template.showPrices ? MoneyController.format(row.totalAmount, detail.company.currencySymbol) : "";
|
|
424
|
+
content += `<tr style="height: 28px;">
|
|
336
425
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;">${row.quantity}X</td>
|
|
337
426
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${productName}</td>
|
|
338
427
|
<td style="font-size:${template.fontSize}px; max-width: 90px; text-align: right;">${amount}</td>
|
|
339
428
|
</tr>`;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
429
|
+
row.extras.filter(i => !i.doNotPrintOnReceipt).forEach(element => {
|
|
430
|
+
const side = this.pizzaSideText(element.pizzaSide, template.skipWholePizzaToppingText);
|
|
431
|
+
let extraText = "";
|
|
432
|
+
if (side !== "")
|
|
433
|
+
extraText += side;
|
|
434
|
+
if (element.quantity > 1)
|
|
435
|
+
extraText += element.quantity + "x ";
|
|
436
|
+
extraText += element.extraItemTitle;
|
|
437
|
+
extraText = extraText.trim();
|
|
438
|
+
const extraAmount = template.showPrices ? MoneyController.format(element.totalAmount, detail.company.currencySymbol) : "";
|
|
439
|
+
content += `<tr>
|
|
351
440
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
352
441
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left;">${extraText}</td>
|
|
353
442
|
<td style="font-size:${template.fontSize}px; max-width: 90px; text-align: right;">${extraAmount}</td>
|
|
354
443
|
</tr>`;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
444
|
+
});
|
|
445
|
+
if (row.note !== null && row.note.trim().length > 0) {
|
|
446
|
+
content += `<tr>
|
|
358
447
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;">Note:</td>
|
|
359
448
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left;font-weight: bold;">${row.note}</td>
|
|
360
449
|
<td style="font-size:${template.fontSize}px; max-width: 90px; text-align: right;"></td>
|
|
361
450
|
</tr>`;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
if (template.showPrices) {
|
|
454
|
+
//order amount
|
|
455
|
+
content += `<tr style=" border-top: 1px dashed #000000; padding: 4px 0;">
|
|
367
456
|
<td style="font-size:${template.fontSize}px; width: 40px; text-align: left;"></td>
|
|
368
457
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
369
458
|
Order Amount:
|
|
@@ -372,9 +461,9 @@ class SimplePreviewController {
|
|
|
372
461
|
${MoneyController.format(detail.order.orderAmount, detail.company.currencySymbol)}
|
|
373
462
|
</td>
|
|
374
463
|
</tr>`;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
464
|
+
if (detail.order.orderType === EnumOrderType.delivery && detail.order.deliveryCost > 0) {
|
|
465
|
+
//delivery amount
|
|
466
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
378
467
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
379
468
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
380
469
|
Delivery costs:
|
|
@@ -383,10 +472,10 @@ class SimplePreviewController {
|
|
|
383
472
|
${MoneyController.format(detail.order.deliveryCost, detail.company.currencySymbol)}
|
|
384
473
|
</td>
|
|
385
474
|
</tr>`;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
475
|
+
}
|
|
476
|
+
if (detail.order.discountAmount > 0) {
|
|
477
|
+
//discount amount
|
|
478
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
390
479
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
391
480
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
392
481
|
Discount:
|
|
@@ -395,9 +484,9 @@ class SimplePreviewController {
|
|
|
395
484
|
${MoneyController.format(detail.order.discountAmount, detail.company.currencySymbol)}
|
|
396
485
|
</td>
|
|
397
486
|
</tr>`;
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
487
|
+
}
|
|
488
|
+
//subtotal amount
|
|
489
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
401
490
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
402
491
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
403
492
|
Subtotal:
|
|
@@ -406,9 +495,9 @@ class SimplePreviewController {
|
|
|
406
495
|
${MoneyController.format(detail.order.subtotalAmount, detail.company.currencySymbol)}
|
|
407
496
|
</td>
|
|
408
497
|
</tr>`;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
498
|
+
if (detail.order.hstAmount > 0) {
|
|
499
|
+
//hst and service fee and company fee amount
|
|
500
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
412
501
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
413
502
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
414
503
|
HST(${MoneyController.format(detail.order.hstPercentage, "%")}):
|
|
@@ -417,10 +506,10 @@ class SimplePreviewController {
|
|
|
417
506
|
${MoneyController.format(detail.order.hstAmount, detail.company.currencySymbol)}
|
|
418
507
|
</td>
|
|
419
508
|
</tr>`;
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
509
|
+
}
|
|
510
|
+
if (detail.order.tipAmount > 0) {
|
|
511
|
+
//tip amount
|
|
512
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
424
513
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
425
514
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
426
515
|
Tip:
|
|
@@ -429,10 +518,10 @@ class SimplePreviewController {
|
|
|
429
518
|
${MoneyController.format(detail.order.tipAmount, detail.company.currencySymbol)}
|
|
430
519
|
</td>
|
|
431
520
|
</tr>`;
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
521
|
+
}
|
|
522
|
+
if (detail.order.thirdPartyDriverTipAmount > 0) {
|
|
523
|
+
//tip amount
|
|
524
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
436
525
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
437
526
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
438
527
|
Driver tip:
|
|
@@ -441,12 +530,12 @@ class SimplePreviewController {
|
|
|
441
530
|
${MoneyController.format(detail.order.thirdPartyDriverTipAmount, detail.company.currencySymbol)}
|
|
442
531
|
</td>
|
|
443
532
|
</tr>`;
|
|
533
|
+
}
|
|
444
534
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
content += `<div style="display: flex; flex-direction: row; align-items: center; background-color: black; padding: 4px;">
|
|
535
|
+
content += `</tbody></table>`;
|
|
536
|
+
if (template.showPrices) {
|
|
537
|
+
//total amount
|
|
538
|
+
content += `<div style="display: flex; flex-direction: row; align-items: center; background-color: black; padding: 4px;">
|
|
450
539
|
<div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px; background-color: transparent; color: white;">
|
|
451
540
|
${detail.order.paymentState !== EnumPaymentState.Paid ? "Total & NOT PAID" : "Total"}:
|
|
452
541
|
</div>
|
|
@@ -454,16 +543,23 @@ class SimplePreviewController {
|
|
|
454
543
|
${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)}
|
|
455
544
|
</div>
|
|
456
545
|
</div>`;
|
|
546
|
+
}
|
|
547
|
+
content += `</div>`;
|
|
548
|
+
return content;
|
|
457
549
|
}
|
|
458
|
-
content += `</div>`;
|
|
459
|
-
return content;
|
|
460
550
|
}
|
|
461
551
|
printLargeProducts(template, detail) {
|
|
462
552
|
var _a, _b, _c;
|
|
553
|
+
const TagController = TagToolController.getInstance();
|
|
463
554
|
let flag = true;
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
555
|
+
const seats = TagController.allSeatInOrderDetail(detail.products);
|
|
556
|
+
if (detail.order.orderType === EnumOrderType.dining && detail.order.tableId !== null && seats.length > 0) {
|
|
557
|
+
return this.printProductInDineIn(template, detail);
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
let content = this.createDivContainer(template);
|
|
561
|
+
const largeFontSize = template.printer === 5 ? 22 : parseInt((template.fontSize + 10) + "");
|
|
562
|
+
content += `<table style="width: 100%; border-collapse: collapse;">
|
|
467
563
|
<thead style="border-bottom: 1px solid #000000;">
|
|
468
564
|
<tr>
|
|
469
565
|
<th style="font-size:${template.fontSize}px;min-width:40px; width: 40px; text-align: left; font-weight: bold;">#</th>
|
|
@@ -473,115 +569,115 @@ class SimplePreviewController {
|
|
|
473
569
|
</thead>
|
|
474
570
|
<tbody>
|
|
475
571
|
`;
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
const bundles = detail.order.items.filter(i => i.type === EnumFeeType.BundleProduct);
|
|
491
|
-
for (let ind = 0; ind < bundleGroups.length; ind++) {
|
|
492
|
-
const group = bundleGroups[ind] + '';
|
|
493
|
-
const groupTag = BundleGroupPreName + group;
|
|
494
|
-
const list = bundledProducts.filter(pro => Array.isArray(pro.tags) && pro.tags.includes(groupTag));
|
|
495
|
-
if (list.length > 0) {
|
|
496
|
-
const firstItem = list[0];
|
|
497
|
-
const firstItemRatio = +(((_a = firstItem.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleProductQuantityPreName))) + '').split(BundleProductQuantityPreName)[1];
|
|
498
|
-
const bundleQuantity = firstItem.quantity / firstItemRatio;
|
|
499
|
-
const bundle = bundles.find(i => { var _a; return ((_a = i.metadata.find(j => j.text === "BundleGroup")) === null || _a === void 0 ? void 0 : _a.value) === group; });
|
|
500
|
-
if (bundle) {
|
|
501
|
-
const sharp = ` ${bundleQuantity}×`;
|
|
502
|
-
const sumBundleDiscount = bundle.amount; // bundleQuantity * bundle.discountAmount;
|
|
503
|
-
const _total = MoneyController.sumField(list, 'totalAmount');
|
|
504
|
-
// let _lastTotal = _total - sumBundleDiscount;
|
|
505
|
-
let _lastTotal = _total - sumBundleDiscount;
|
|
506
|
-
if (_lastTotal < 0) {
|
|
507
|
-
_lastTotal = 0;
|
|
572
|
+
let bundledProducts = detail.products.filter(i => TagController.findTagBundleId(i.tags) !== undefined);
|
|
573
|
+
if (bundledProducts.length > 0) {
|
|
574
|
+
flag = false;
|
|
575
|
+
const bundleGroups = [];
|
|
576
|
+
bundledProducts.forEach(pro => {
|
|
577
|
+
var _a;
|
|
578
|
+
const tag = (_a = pro.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleGroupPreName));
|
|
579
|
+
if (tag) {
|
|
580
|
+
const bundleGroup = (tag + '').split(BundleGroupPreName)[1];
|
|
581
|
+
if (!bundleGroups.includes(bundleGroup)) {
|
|
582
|
+
bundleGroups.push(bundleGroup);
|
|
508
583
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
const bundles = detail.order.items.filter(i => i.type === EnumFeeType.BundleProduct);
|
|
587
|
+
for (let ind = 0; ind < bundleGroups.length; ind++) {
|
|
588
|
+
const group = bundleGroups[ind] + '';
|
|
589
|
+
const groupTag = BundleGroupPreName + group;
|
|
590
|
+
const list = bundledProducts.filter(pro => Array.isArray(pro.tags) && pro.tags.includes(groupTag));
|
|
591
|
+
if (list.length > 0) {
|
|
592
|
+
const firstItem = list[0];
|
|
593
|
+
const firstItemRatio = +(((_a = firstItem.tags) === null || _a === void 0 ? void 0 : _a.find(i => i.startsWith(BundleProductQuantityPreName))) + '').split(BundleProductQuantityPreName)[1];
|
|
594
|
+
const bundleQuantity = firstItem.quantity / firstItemRatio;
|
|
595
|
+
const bundle = bundles.find(i => { var _a; return ((_a = i.metadata.find(j => j.text === "BundleGroup")) === null || _a === void 0 ? void 0 : _a.value) === group; });
|
|
596
|
+
if (bundle) {
|
|
597
|
+
const sharp = ` ${bundleQuantity}×`;
|
|
598
|
+
const sumBundleDiscount = bundle.amount; // bundleQuantity * bundle.discountAmount;
|
|
599
|
+
const _total = MoneyController.sumField(list, 'totalAmount');
|
|
600
|
+
// let _lastTotal = _total - sumBundleDiscount;
|
|
601
|
+
let _lastTotal = _total - sumBundleDiscount;
|
|
602
|
+
if (_lastTotal < 0) {
|
|
603
|
+
_lastTotal = 0;
|
|
604
|
+
}
|
|
605
|
+
const price = template.showPrices ? MoneyController.format(_lastTotal, detail.company.currencySymbol) : '';
|
|
606
|
+
let bundleText = bundle.text;
|
|
607
|
+
bundleText = ((_b = bundleText === null || bundleText === void 0 ? void 0 : bundleText.replace(sharp, '')) === null || _b === void 0 ? void 0 : _b.trim()) + "";
|
|
608
|
+
content += `<tr>
|
|
513
609
|
<td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;">${sharp}</td>
|
|
514
610
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${bundleText}</td>
|
|
515
611
|
<td style="font-size:${largeFontSize}px; max-width: 90px; text-align: right;">${price}</td>
|
|
516
612
|
</tr>`;
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
613
|
+
for (let index = 0; index < list.length; index++) {
|
|
614
|
+
const row = list[index];
|
|
615
|
+
const sharp = `${row.quantity}× `;
|
|
616
|
+
let product = (template.showProductKitchenName && row.kitchenReceiptName !== '' && row.kitchenReceiptName !== null) ? row.kitchenReceiptName : row.title;
|
|
617
|
+
product = sharp + ((_c = product === null || product === void 0 ? void 0 : product.replace(sharp, '')) === null || _c === void 0 ? void 0 : _c.trim()) + "";
|
|
618
|
+
content += `<tr>
|
|
523
619
|
<td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;"> </td>
|
|
524
620
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2;">${product}</td>
|
|
525
621
|
</tr>`;
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
622
|
+
if (row.extrasNames) {
|
|
623
|
+
const extList = row.extras
|
|
624
|
+
.filter(item => !item.doNotPrintOnReceipt)
|
|
625
|
+
.map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText, template.showPrices))
|
|
626
|
+
.filter(i => i.length > 0);
|
|
627
|
+
for (let ind = 0; ind < extList.length; ind++) {
|
|
628
|
+
content += `<tr>
|
|
533
629
|
<td style=" min-width:40px; width: 40px;"> </td>
|
|
534
630
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left;column-span: 2; padding-left: 24px;">${extList[ind]}</td>
|
|
535
631
|
</tr>`;
|
|
632
|
+
}
|
|
536
633
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
content += `<tr>
|
|
634
|
+
const note = PrintToolController.productNote(row);
|
|
635
|
+
if (note !== '') {
|
|
636
|
+
content += `<tr>
|
|
541
637
|
<td style=" min-width:40px; width: 40px;"> </td>
|
|
542
638
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left;column-span: 2; padding-left: 24px;">${note}</td>
|
|
543
639
|
</tr>`;
|
|
640
|
+
}
|
|
544
641
|
}
|
|
545
642
|
}
|
|
546
643
|
}
|
|
547
644
|
}
|
|
548
645
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
content += `<tr>
|
|
646
|
+
let unBundledProducts = detail.products.filter(i => TagController.findTagBundleId(i.tags) === undefined);
|
|
647
|
+
const list = this.filterByCategoryList(this.sortProduct(unBundledProducts, template.sortProducts), template.printOnlyCertainCategoriesList, template.printOnlyCertainCategories, template.printOnlyCertainProductsList, template.printOnlyCertainProducts);
|
|
648
|
+
if (list.length > 0) {
|
|
649
|
+
flag = false;
|
|
650
|
+
}
|
|
651
|
+
if (flag)
|
|
652
|
+
return "";
|
|
653
|
+
list.forEach((row) => {
|
|
654
|
+
const productName = (template.showCategoryTitle ? `[${row.categoryTitle}] ` : "") + ((template.showProductKitchenName && typeof row.kitchenReceiptName === "string" && row.kitchenReceiptName.trim().length > 0) ? row.kitchenReceiptName : row.title).trim();
|
|
655
|
+
const amount = template.showPrices ? MoneyController.format(row.totalAmount, detail.company.currencySymbol) : "";
|
|
656
|
+
content += `<tr>
|
|
561
657
|
<td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;">${row.quantity}×</td>
|
|
562
658
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left; font-weight: bold;">${productName}</td>
|
|
563
659
|
<td style="font-size:${largeFontSize}px; max-width: 90px; text-align: right;">${amount}</td>
|
|
564
660
|
</tr>`;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
661
|
+
row.extras.filter(i => !i.doNotPrintOnReceipt).forEach(element => {
|
|
662
|
+
const extraText = this.pizzaSideText(element.pizzaSide, template.skipWholePizzaToppingText) + element.quantity + "× " + element.extraItemTitle;
|
|
663
|
+
const extraAmount = template.showPrices ? MoneyController.format(element.totalAmount, detail.company.currencySymbol) : "";
|
|
664
|
+
content += `<tr>
|
|
569
665
|
<td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;"> </td>
|
|
570
666
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left;">${extraText}</td>
|
|
571
667
|
<td style="font-size:${largeFontSize}px; max-width: 90px; text-align: right;">${extraAmount}</td>
|
|
572
668
|
</tr>`;
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
669
|
+
});
|
|
670
|
+
if (row.note !== null && row.note.trim().length > 0) {
|
|
671
|
+
content += `<tr>
|
|
576
672
|
<td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;">Note:</td>
|
|
577
673
|
<td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left;font-weight: bold;">${row.note}</td>
|
|
578
674
|
<td style="font-size:${largeFontSize}px; max-width: 90px; text-align: right;"></td>
|
|
579
675
|
</tr>`;
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
if (template.showPrices) {
|
|
679
|
+
//order amount
|
|
680
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
585
681
|
<td style="font-size:${template.fontSize}px; width: 40px; text-align: left;"></td>
|
|
586
682
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
587
683
|
Order Amount:
|
|
@@ -590,9 +686,9 @@ class SimplePreviewController {
|
|
|
590
686
|
${MoneyController.format(detail.order.orderAmount, detail.company.currencySymbol)}
|
|
591
687
|
</td>
|
|
592
688
|
</tr>`;
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
689
|
+
if (detail.order.orderType === EnumOrderType.delivery && detail.order.deliveryCost > 0) {
|
|
690
|
+
//delivery amount
|
|
691
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
596
692
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
597
693
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
598
694
|
Delivery costs:
|
|
@@ -601,10 +697,10 @@ class SimplePreviewController {
|
|
|
601
697
|
${MoneyController.format(detail.order.deliveryCost, detail.company.currencySymbol)}
|
|
602
698
|
</td>
|
|
603
699
|
</tr>`;
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
700
|
+
}
|
|
701
|
+
if (detail.order.discountAmount > 0) {
|
|
702
|
+
//discount amount
|
|
703
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
608
704
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
609
705
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
610
706
|
Discount:
|
|
@@ -613,9 +709,9 @@ class SimplePreviewController {
|
|
|
613
709
|
${MoneyController.format(detail.order.discountAmount, detail.company.currencySymbol)}
|
|
614
710
|
</td>
|
|
615
711
|
</tr>`;
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
712
|
+
}
|
|
713
|
+
//subtotal amount
|
|
714
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
619
715
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
620
716
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right;padding-right: 8px;">
|
|
621
717
|
Subtotal:
|
|
@@ -624,9 +720,9 @@ class SimplePreviewController {
|
|
|
624
720
|
${MoneyController.format(detail.order.subtotalAmount, detail.company.currencySymbol)}
|
|
625
721
|
</td>
|
|
626
722
|
</tr>`;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
723
|
+
if (detail.order.hstAmount > 0) {
|
|
724
|
+
//hst and service fee and company fee amount
|
|
725
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
630
726
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
631
727
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
632
728
|
HST(${MoneyController.format(detail.order.hstPercentage, "%")}):
|
|
@@ -635,10 +731,10 @@ class SimplePreviewController {
|
|
|
635
731
|
${MoneyController.format(detail.order.hstAmount, detail.company.currencySymbol)}
|
|
636
732
|
</td>
|
|
637
733
|
</tr>`;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
734
|
+
}
|
|
735
|
+
if (detail.order.tipAmount > 0) {
|
|
736
|
+
//tip amount
|
|
737
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
642
738
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
643
739
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
644
740
|
Tip:
|
|
@@ -647,10 +743,10 @@ class SimplePreviewController {
|
|
|
647
743
|
${MoneyController.format(detail.order.tipAmount, detail.company.currencySymbol)}
|
|
648
744
|
</td>
|
|
649
745
|
</tr>`;
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
746
|
+
}
|
|
747
|
+
if (detail.order.thirdPartyDriverTipAmount > 0) {
|
|
748
|
+
//tip amount
|
|
749
|
+
content += `<tr style=" border-top: 1px dashed #000000; margin: 4px 0;">
|
|
654
750
|
<td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
|
|
655
751
|
<td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: right; padding-right: 8px;">
|
|
656
752
|
Driver tip:
|
|
@@ -659,12 +755,12 @@ class SimplePreviewController {
|
|
|
659
755
|
${MoneyController.format(detail.order.thirdPartyDriverTipAmount, detail.company.currencySymbol)}
|
|
660
756
|
</td>
|
|
661
757
|
</tr>`;
|
|
758
|
+
}
|
|
662
759
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
content += `<div style="display: flex; flex-direction: row; align-items: center; border-top: 1px dashed #000000; margin: 4px 0;">
|
|
760
|
+
content += `</tbody></table>`;
|
|
761
|
+
if (template.showPrices) {
|
|
762
|
+
//total amount
|
|
763
|
+
content += `<div style="display: flex; flex-direction: row; align-items: center; border-top: 1px dashed #000000; margin: 4px 0;">
|
|
668
764
|
<div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px;">
|
|
669
765
|
${detail.order.paymentState !== EnumPaymentState.Paid ? "Total & Still to pay" : "Total"}:
|
|
670
766
|
</div>
|
|
@@ -672,10 +768,11 @@ class SimplePreviewController {
|
|
|
672
768
|
${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)}
|
|
673
769
|
</div>
|
|
674
770
|
</div>`;
|
|
771
|
+
}
|
|
772
|
+
content += this.printSolidLine();
|
|
773
|
+
content += `</div>`;
|
|
774
|
+
return content;
|
|
675
775
|
}
|
|
676
|
-
content += this.printSolidLine();
|
|
677
|
-
content += `</div>`;
|
|
678
|
-
return content;
|
|
679
776
|
}
|
|
680
777
|
printCustomerRemark(template, detail) {
|
|
681
778
|
if (detail.order.remarks === null || detail.order.remarks.trim().length === 0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meemup-library",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
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.6.
|
|
14
|
+
"commit": "git add . && git commit -m \"version.1.6.8\" && git push origin "
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"/dist"
|