@posx/core 5.5.39 → 5.5.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts DELETED
@@ -1,4694 +0,0 @@
1
- declare module '@posx/core/index' {
2
- export * from '@posx/core/types/auto.query.type';
3
- export * from '@posx/core/types/wyo.customer.type';
4
- export * from '@posx/core/types/wyo.coupon.type';
5
- export * from '@posx/core/types/shift.type';
6
- export * from '@posx/core/types/section.type';
7
- export * from '@posx/core/types/role.type';
8
- export * from '@posx/core/types/product.type';
9
- export * from '@posx/core/types/printer.type';
10
- export * from '@posx/core/types/payment.type';
11
- export * from '@posx/core/types/note.type';
12
- export * from '@posx/core/types/misc.type';
13
- export * from '@posx/core/types/invoice.type';
14
- export * from '@posx/core/types/employee.type';
15
- export * from '@posx/core/types/config.type';
16
- export * from '@posx/core/types/abstract.type';
17
- export * from '@posx/core/types/request.type';
18
- export * from '@posx/core/services/app.service';
19
- export * from '@posx/core/services/abstract.service';
20
- export * from '@posx/core/service.factory';
21
- export * from '@posx/core/services/invoice.service';
22
- export * from '@posx/core/libs/FindOptions';
23
- export * from '@posx/core/types/report.type';
24
- export * from '@posx/core/services/printer.service';
25
- export * from '@posx/core/utils/misc.utils';
26
- export * from '@posx/core/service.factory';
27
- export * from '@posx/core/libs/escpos.printer';
28
- export * from '@posx/core/services/ods.service';
29
- export * from '@posx/core/types/ods.type';
30
- export * from '@posx/core/utils/autoquery.utils';
31
- export * from '@posx/core/libs/electron.socket';
32
- export * from '@posx/core/types/condition.type';
33
- export * from '@posx/core/types/merchant.type';
34
-
35
- }
36
- declare module '@posx/core/libs/FindOptions' {
37
- export const Include: (query?: string) => (val: any) => any;
38
- export const In: (query?: never[]) => (val: never) => boolean;
39
- export const Between: (begin: number, end: number) => (val: number) => boolean;
40
- export const Not: (query?: any) => (val: any, values: any) => boolean;
41
- export const Raw: (fn: any) => any;
42
- export const filterByParams: (params: {
43
- [key: string]: any;
44
- }) => (values: any) => boolean;
45
-
46
- }
47
- declare module '@posx/core/libs/electron.socket' {
48
- export class ElectronSocket {
49
- static State: {
50
- CLOSED: number;
51
- OPENING: number;
52
- OPENED: number;
53
- CLOSING: number;
54
- };
55
- private _state;
56
- private cleanup?;
57
- onData: ((data: Uint8Array) => void) | null;
58
- onClose: ((hadError: boolean) => void) | null;
59
- onError: ((error: string) => void) | null;
60
- get state(): number;
61
- static electronSocket: any;
62
- static setWindow(win: {
63
- electronSocket: typeof window.electronSocket;
64
- }): void;
65
- private setupListeners;
66
- open(host: string, port: number, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
67
- write(data: Uint8Array, success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
68
- close(success?: () => void, error?: (errorMessage: string) => void): Promise<void>;
69
- }
70
-
71
- }
72
- declare module '@posx/core/libs/escpos.printer' {
73
- /**
74
- * Represents an ESC/POS printer.
75
- */
76
- export interface IEscPosPrinter {
77
- /**
78
- * Prints the content to the printer.
79
- * @returns A promise that resolves to true if the printing is successful, otherwise false.
80
- */
81
- testPrint(template: IPrintCommand): Promise<boolean>;
82
- /**
83
- * Connects to the printer with the specified IP address and port number.
84
- * @param ip The IP address of the printer.
85
- * @param port The port number of the printer. Default is 9100.
86
- * @param timeout The connection timeout in milliseconds. Default is 5000ms.
87
- * @returns A promise that resolves to true if the connection is successful, otherwise false.
88
- */
89
- connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
90
- /**
91
- * Writes the content to the printer.
92
- * @param resultByte The content to write to the printer.
93
- * @param timeout The write timeout in milliseconds. Default is 10000ms.
94
- * @returns A promise that resolves to true if the writing is successful, otherwise false.
95
- */
96
- write(resultByte: any, timeout?: number): Promise<boolean>;
97
- /**
98
- * Interprets the print command and returns the encoded byte array.
99
- * @param template The print command to interpret.
100
- * @returns A promise that resolves to the encoded byte array.
101
- */
102
- interpret(template: IPrintCommand): Promise<Uint8Array>;
103
- }
104
- export class EscPosPrinter implements IEscPosPrinter {
105
- socket: any;
106
- constructor();
107
- /**
108
- * Prints esc pos printer
109
- * @returns print
110
- */
111
- testPrint(template: IPrintCommand): Promise<boolean>;
112
- connect(ip: string, port?: number, timeout?: number): Promise<boolean>;
113
- write(resultByte: any, timeout?: number): Promise<boolean>;
114
- interpret(template: IPrintCommand): Promise<Uint8Array>;
115
- private formatTable;
116
- private padEnd;
117
- private padStart;
118
- private wrapText;
119
- disconnect(): Promise<boolean>;
120
- private close;
121
- private base64ToImageBitmap;
122
- }
123
- export enum Codepages {
124
- English = "cp437",
125
- Greek = "cp737",
126
- WesternEurope = "cp850",
127
- BalticRim = "cp775",
128
- CentralEurope = "cp852",
129
- Cyrillic = "cp855",
130
- Turkish = "cp857",
131
- MultilingualLatin1WithEuro = "cp858",
132
- Portuguese = "cp860",
133
- Icelandic = "cp861",
134
- Hebrew = "cp862",
135
- FrenchCanadian = "cp863",
136
- Arabic = "cp864",
137
- Nordic = "cp865",
138
- Russian = "cp866",
139
- ModernGreek = "cp869",
140
- SimplifiedChinese = "cp936",
141
- Korean = "cp949",
142
- TraditionalChinese = "cp950",
143
- WesternEuropeanLatin = "cp1252",
144
- ArabicISO = "iso88596",
145
- Japanese = "shiftjis",
146
- CentralEuropeanLatinWindows = "windows1250",
147
- CyrillicWindows = "windows1251",
148
- WesternEuropeanLatinWindows = "windows1252",
149
- GreekWindows = "windows1253",
150
- TurkishWindows = "windows1254",
151
- HebrewWindows = "windows1255",
152
- ArabicWindows = "windows1256",
153
- BalticWindows = "windows1257",
154
- Vietnamese = "windows1258"
155
- }
156
- export enum PrintAlign {
157
- Left = "left",
158
- Center = "center",
159
- Right = "right"
160
- }
161
- export enum PrintStyle {
162
- Normal = "normal",
163
- Bold = "bold",
164
- Italic = "italic",
165
- Underline = "underline"
166
- }
167
- export enum PrintSize {
168
- Custom = "custom",
169
- Normal = "normal",
170
- Small = "small"
171
- }
172
- export enum PrintType {
173
- Text = "text",
174
- Table = "table",
175
- Line = "line",
176
- Image = "image",
177
- QRCode = "qrcode",
178
- NewLine = "newline",
179
- Barcode = "barcode",
180
- Cut = "cut",
181
- Beeper = "beeper",
182
- OpenCashDrawer = "open_cash_drawer"
183
- }
184
- export interface IPrintBarcode {
185
- data: string;
186
- symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
187
- height: number;
188
- }
189
- export interface IPrintQrcode {
190
- data: string;
191
- model: number;
192
- size: number;
193
- errorlevel: 'l' | 'm' | 'q' | 'h';
194
- }
195
- export type IFontSize = {
196
- width?: number;
197
- height?: number;
198
- size: PrintSize;
199
- };
200
- export type IPrintText = IFontSize & {
201
- text: string;
202
- line_width?: number;
203
- };
204
- export type IPrintTableRowItem = {
205
- text: string;
206
- column_width: number;
207
- };
208
- export type IPrintTable = IFontSize & {
209
- items: IPrintTableRowItem[];
210
- line_width?: number;
211
- };
212
- export class PrintBarcode {
213
- data: string;
214
- symbology: 'upca' | 'upce' | 'ean13' | 'ean8' | 'coda39' | 'itf' | 'codabar';
215
- height: number;
216
- }
217
- export class PrintQrcode {
218
- data: string;
219
- model: number;
220
- size: number;
221
- errorlevel: 'l' | 'm' | 'q' | 'h';
222
- }
223
- export type IPrintImage = {
224
- base64_data: string;
225
- width: number;
226
- height: number;
227
- algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
228
- threshold: number;
229
- };
230
- export class PrintImage implements IPrintImage {
231
- base64_data: string;
232
- width: number;
233
- height: number;
234
- algorithm: 'threshold' | 'bayer' | 'floydsteinberg' | 'atkinson';
235
- threshold: number;
236
- }
237
- export type IPrintCommandLine = {
238
- item?: IPrintText;
239
- table?: IPrintTable;
240
- image?: IPrintImage;
241
- qrcode?: IPrintQrcode;
242
- barcode?: IPrintBarcode;
243
- align?: PrintAlign;
244
- style?: PrintStyle;
245
- type: PrintType;
246
- repeat?: number;
247
- codepage?: Codepages;
248
- };
249
- export type IPrintCommand = {
250
- codepage: Codepages;
251
- items: IPrintCommandLine[];
252
- };
253
- export enum EscPosCompatibility {
254
- 'SunmiPrinter' = 0
255
- }
256
- export class PrintCommand implements IPrintCommand {
257
- codepage: Codepages;
258
- items: IPrintCommandLine[];
259
- }
260
-
261
- }
262
- declare module '@posx/core/service.factory' {
263
- import { IServiceOptions } from '@posx/core/types/misc.type';
264
- import { IAppRemoteService } from '@posx/core/services/abstract.service';
265
- import Dexie from 'dexie';
266
- export const dbSchemas: {
267
- items: string;
268
- sections: string;
269
- section_items: string;
270
- categories: string;
271
- shifts: string;
272
- tills: string;
273
- employees: string;
274
- payment_methods: string;
275
- invoices: string;
276
- configs: string;
277
- reports: string;
278
- printers: string;
279
- print_jobs: string;
280
- print_templates: string;
281
- employee_roles: string;
282
- order_displays: string;
283
- };
284
- export class ServiceFactory {
285
- readonly options: IServiceOptions;
286
- readonly win: any;
287
- private mode;
288
- private readonly http;
289
- private dataSource;
290
- private status;
291
- constructor(options: IServiceOptions, win: any);
292
- initializeDatabase(): Promise<Dexie>;
293
- dropDatabase(): Promise<void>;
294
- clearTableData(tableName: string): import("dexie").PromiseExtended<void>;
295
- getService<T>(serviceClass: any): Promise<T>;
296
- getServiceByName(modelName: string): Promise<IAppRemoteService<any>>;
297
- }
298
-
299
- }
300
- declare module '@posx/core/services/abstract.service' {
301
- import { IAppCoreModel } from '@posx/core/types/abstract.type';
302
- import { AxiosInstance } from 'axios';
303
- import Dexie, { Observable } from 'dexie';
304
- import { IServiceOptions } from '@posx/core/types/misc.type';
305
- export type GetManyResult<T> = {
306
- list: T[];
307
- count: number;
308
- page: number;
309
- pageSize: number;
310
- };
311
- /**
312
- * Interface for a generic service.
313
- * @template T - Generic type parameter that extends IAppCoreModel.
314
- */
315
- export interface IAppCoreService<T extends IAppCoreModel> {
316
- db: Dexie;
317
- table: Dexie.Table<T>;
318
- moduleName: string;
319
- /**
320
- * Creates a live query.
321
- * @param expr - Function that returns the query expression.
322
- * @returns A live query.
323
- */
324
- liveQuery<T>(expr: () => T): Observable;
325
- /**
326
- * Saves a single entity.
327
- * @param item - Entity to save.
328
- * @returns A Promise that resolves to the saved entity.
329
- */
330
- saveOne(item: T): Promise<T>;
331
- /**
332
- * Saves multiple entities.
333
- * @param items - Entities to save.
334
- * @returns A Promise that resolves to the saved entities.
335
- */
336
- saveMany(items: T[]): Promise<T[]>;
337
- /**
338
- * Checks if any entity exists.
339
- * @returns A Promise that resolves to true if any entity exists or false otherwise.
340
- */
341
- hasAny(): Promise<boolean>;
342
- /**
343
- * Retrieves a single entity by its unique identifier.
344
- * @param id - Unique identifier of the entity to retrieve.
345
- * @returns A Promise that resolves to the retrieved entity.
346
- */
347
- getOne(id: string): Promise<T>;
348
- /**
349
- * Retrieves a single entity by its unique identifier.
350
- * @param params - Filtering parameters.
351
- * @returns A Promise that resolves to the retrieved entity or undefined.
352
- */
353
- getOneByParams(params: Partial<T>): Promise<T | undefined>;
354
- /**
355
- * Retrieves a single entity by its unique identifier.
356
- * @returns A Promise that resolves to the retrieved entity or undefined.
357
- */
358
- getDefaultOne(): Promise<T | undefined>;
359
- /**
360
- * Retrieves all entities with optional pagination.
361
- * @param skip - Number of entities to skip.
362
- * @param take - Number of entities to take.
363
- * @returns A Promise that resolves to an array of retrieved entities.
364
- */
365
- getAll(): Promise<T[]>;
366
- /**
367
- * Retrieves multiple entities with optional pagination and filtering.
368
- * @param params - [UNUSED PARAMETER, KEPT FOR POSSIBLE FUTURE USE]
369
- * Filtering parameters.
370
- * @param options - Query options including pagination.
371
- * @returns An object containing the retrieved entities and total count.
372
- */
373
- getMany(params: Partial<T>, options: {
374
- page?: number;
375
- pageSize?: number;
376
- }): Promise<GetManyResult<T>>;
377
- }
378
- export abstract class AppCoreService<T extends IAppCoreModel> implements IAppCoreService<T> {
379
- db: Dexie;
380
- moduleName: string;
381
- get table(): Dexie.Table<T>;
382
- liveQuery<T>(expr: () => T): Observable<T>;
383
- saveOne(item: T): Promise<T>;
384
- saveMany(items: T[]): Promise<T[]>;
385
- hasAny(): Promise<boolean>;
386
- /**
387
- * get one by uid
388
- * @param uid Primary nano id
389
- */
390
- getOne(uid: string): Promise<T>;
391
- getOneByParams(params: Partial<T>): Promise<T | null>;
392
- getDefaultOne(): Promise<T | undefined>;
393
- getAll(): Promise<T[]>;
394
- getMany(params?: Partial<T>, options?: any): Promise<GetManyResult<T>>;
395
- }
396
- export interface IAppLocalService<T extends IAppCoreModel> extends IAppCoreService<T> {
397
- updateOne(id: string, item: Partial<T>): Promise<T>;
398
- deleteOne(id: string): Promise<T>;
399
- }
400
- export class AppLocalService<T extends IAppCoreModel> extends AppCoreService<T> implements IAppLocalService<T> {
401
- updateOne(id: string, item: Partial<T>): Promise<T>;
402
- deleteOne(id: string): Promise<T>;
403
- }
404
- export interface IAppRemoteService<T extends IAppCoreModel> extends IAppCoreService<T> {
405
- addOne(item: T): Promise<T>;
406
- updateOne(id: number, item: Partial<T>): Promise<T>;
407
- updateMany(items: T[]): Promise<T[]>;
408
- deleteOne(model: T): Promise<T>;
409
- }
410
- export class AppRemoteService<T extends IAppCoreModel> extends AppCoreService<T> implements IAppRemoteService<T> {
411
- protected readonly http: AxiosInstance;
412
- readonly moduleName: string;
413
- protected readonly methodName: string;
414
- protected readonly options: IServiceOptions;
415
- addOne(item: T): Promise<T>;
416
- updateOne(id: number, item: Partial<T>): Promise<T>;
417
- updateMany(items: T[]): Promise<T[]>;
418
- deleteOne(model: T): Promise<T>;
419
- }
420
- export interface IAppModelSequence {
421
- sequence: number;
422
- }
423
-
424
- }
425
- declare module '@posx/core/services/app.service' {
426
- import { Employee, IEmployee } from '@posx/core/types/employee.type';
427
- import { IEmployeeRole } from '@posx/core/types/role.type';
428
- import { AppRemoteService, IAppRemoteService, IAppModelSequence } from '@posx/core/services/abstract.service';
429
- import { IAppConfig, IConfig, UpdateGeneralConfigOptions, ICache } from '@posx/core/types/config.type';
430
- import { IPrintJob, IPrintTemplate, IPrinter, IRenderPrintTemplateOptions, RenderPrintTemplateOptions } from '@posx/core/types/printer.type';
431
- import { IPayment, IPaymentMethod, IPaymentSyncData } from '@posx/core/types/payment.type';
432
- import { INote, INoteGroup } from '@posx/core/types/note.type';
433
- import { ISection, ISectionItem } from '@posx/core/types/section.type';
434
- import { Category, ICategory, ICoreItem, IItem, ISubcategory } from '@posx/core/types/product.type';
435
- import { AxiosInstance } from 'axios';
436
- import { IFileUploadResponse, IServiceOptions } from '@posx/core/types/misc.type';
437
- import Dexie from 'dexie';
438
- import { ICoreCategory } from '@posx/core/types/product.type';
439
- import { IShift, ITill } from '@posx/core/types/shift.type';
440
- import { IInvoice } from '@posx/core/types/invoice.type';
441
- import { IAppCoreModel } from '@posx/core/types/abstract.type';
442
- import { IAppReport, IReportData, IReportRequest, ReportData } from '@posx/core/types/report.type';
443
- import { IPrintCommand } from '@posx/core/libs/escpos.printer';
444
- import { QueryBuilder } from '@posx/core/utils/autoquery.utils';
445
- import { QueryResponse } from '@posx/core/types/auto.query.type';
446
- export type IEmployeeRoleService = IAppRemoteService<IEmployeeRole> & IAppRemoteService<IEmployeeRole>;
447
- export type INoteService = IAppRemoteService<INote>;
448
- export type INoteGroupService = IAppRemoteService<INoteGroup>;
449
- export type ISectionService = IAppRemoteService<ISection>;
450
- export type ISubcategoryService = IAppRemoteService<ISubcategory>;
451
- export class EmployeeRoleService extends AppRemoteService<IEmployeeRole> implements IEmployeeRoleService {
452
- readonly http: AxiosInstance;
453
- readonly db: Dexie;
454
- readonly options: IServiceOptions;
455
- readonly moduleName: string;
456
- readonly methodName: string;
457
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
458
- }
459
- /**
460
- * Represents a service for managing items.
461
- * Extends the IAppRemoteService interface for CRUD operations on IItem objects.
462
- */
463
- /**
464
- * Represents a service for managing section items.
465
- * Extends the IAppRemoteService interface with ISectionItem type.
466
- */
467
- export interface ISectionItemService extends IAppRemoteService<ISectionItem> {
468
- /**
469
- * Changes the section item with the specified uid to take out.
470
- * @param uid - The unique identifier of the section item to change.
471
- * @returns A promise that resolves with the updated section item.
472
- */
473
- changeToTakeOut(uid: string): Promise<ISectionItem>;
474
- }
475
- /**
476
- * Represents a service for managing employees.
477
- * @template IEmployee The type of employee object.
478
- * @extends IAppRemoteService<IEmployee> The interface for a remote service that manages employees.
479
- */
480
- export interface IEmployeeService extends IAppRemoteService<IEmployee> {
481
- /**
482
- * Logs in a user with the given user uid and password.
483
- * @param userUid The uid of the user to log in.
484
- * @param password The password of the user to log in.
485
- * @returns A promise that resolves to true if the login was successful, or false otherwise.
486
- */
487
- login(userUid: string, password: string): Promise<boolean>;
488
- createEmployee(employee: IEmployee): Promise<IEmployee>;
489
- /**
490
- * Changes the password of the user with the given user UID.
491
- * @param userUid The UID of the user whose password should be changed.
492
- * @param oldPassword The user's current password.
493
- * @param newPassword The new password to set for the user.
494
- * @returns A promise that resolves to true if the password was changed successfully, or false otherwise.
495
- */
496
- changePassword(userUid: string, oldPassword: string, newPassword: string): Promise<boolean>;
497
- }
498
- export class EmployeeService extends AppRemoteService<Employee> implements IEmployeeService {
499
- readonly http: any;
500
- readonly db: Dexie;
501
- readonly options: IServiceOptions;
502
- readonly moduleName: string;
503
- readonly methodName: string;
504
- constructor(http: any, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
505
- login(userUid: string, password: string): Promise<boolean>;
506
- createEmployee(employee: IEmployee): Promise<IEmployee>;
507
- changePassword(userUid: string, oldPassword: string, newPassword: string): Promise<boolean>;
508
- }
509
- export interface IItemService extends IAppRemoteService<IItem> {
510
- /**
511
- * Adds an image to an item.
512
- * @param file - The image file to add.
513
- * @param item - The item to add the image to.
514
- * @returns A Promise that resolves to the updated IItem object.
515
- */
516
- addImageAsync(file: File, item: ICoreItem): Promise<void>;
517
- /**
518
- * Adds a modifier category to an item.
519
- * @param item - The item to add the modifier category to.
520
- * @param category - The category to add.
521
- * @returns A Promise that resolves to the updated IItem object.
522
- */
523
- addModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
524
- /**
525
- * Updates a modifier category of an item.
526
- * @param item - The item to update the modifier category of.
527
- * @param category - The category to update.
528
- * @returns A Promise that resolves to the updated IItem object.
529
- */
530
- updateModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
531
- /**
532
- * Removes a modifier category from an item.
533
- * @param item - The item to remove the modifier category from.
534
- * @param category - The category to remove.
535
- * @returns A Promise that resolves to the updated IItem object.
536
- */
537
- removeModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
538
- /**
539
- * Adds a modifier to an item.
540
- * @param item - The item to add the modifier to.
541
- * @param modifier - The modifier to add.
542
- * @returns A Promise that resolves to the updated IItem object.
543
- */
544
- addModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
545
- /**
546
- * Updates a modifier of an item.
547
- * @param item - The item to update the modifier of.
548
- * @param modifier - The modifier to update.
549
- * @returns A Promise that resolves to the updated IItem object.
550
- */
551
- updateModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
552
- /**
553
- * Removes a modifier from an item.
554
- * @param item - The item to remove the modifier from.
555
- * @param modifier - The modifier to remove.
556
- * @returns A Promise that resolves to the updated IItem object.
557
- */
558
- removeModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
559
- /**
560
- * attach a ungrouped modifier to a modifier group (category)
561
- * if you want to detach a modifier from a group, pass an empty string as the category_uid
562
- * @param item the item to attach the modifier to it's modifier category
563
- * @param modifier_uid the uid of the modifier to attach
564
- * @param category_uid the uid of the category to attach the modifier to
565
- */
566
- attachModifierToGroup(item: IItem, modifier_uid: string, category_uid: string): Promise<IItem>;
567
- /**
568
- * Searches for items by name, codename or barcode.
569
- * @param query - The search query.
570
- * @returns A Promise that resolves to an array of IItem objects.
571
- */
572
- search(query: string): Promise<IItem[]>;
573
- /**
574
- * mark an item as sold out
575
- * @param uid uid of the item to change to sold out
576
- */
577
- changeToSoldOut(uid: string): Promise<IItem>;
578
- /**
579
- * change the stock of an item by increment or decrement
580
- * @param uid uid of the item to change stock
581
- * @param stock the quantity to change the stock by, can be negative
582
- */
583
- changeStock(uid: string, stock: number): Promise<IItem>;
584
- /**
585
- * Clone an item
586
- * @param item item to clone
587
- * @returns cloned item
588
- */
589
- cloneItem(item: IItem): Promise<IItem>;
590
- /**
591
- * Clone modifiers of an item
592
- * @param item item to clone modifiers
593
- * @returns cloned modifiers
594
- */
595
- cloneModifiers(modifierCategory: ICoreCategory, modifiers: ICoreItem[]): Promise<{
596
- modifierCategory: ICoreCategory;
597
- modifiers: ICoreItem[];
598
- }>;
599
- }
600
- export class ItemService extends AppRemoteService<IItem> implements IItemService {
601
- readonly http: AxiosInstance;
602
- readonly db: Dexie;
603
- readonly options: IServiceOptions;
604
- readonly moduleName: string;
605
- readonly methodName: string;
606
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
607
- search(query: string): Promise<IItem[]>;
608
- addModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
609
- updateModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
610
- removeModifierCategory(item: IItem, category: ICoreCategory): Promise<IItem>;
611
- addModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
612
- updateModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
613
- removeModifier(item: IItem, modifier: ICoreItem): Promise<IItem>;
614
- attachModifierToGroup(item: IItem, modifier_uid: string, category_uid: string): Promise<IItem>;
615
- addImageAsync(file: File, item: ICoreItem): Promise<void>;
616
- changeToSoldOut(uid: string): Promise<IItem>;
617
- changeStock(uid: string, stock: number): Promise<IItem>;
618
- private convertFileToBase64;
619
- private getFileExtension;
620
- cloneItem(item: IItem): Promise<IItem>;
621
- cloneModifiers(modifierCategory: ICoreCategory, modifiers: ICoreItem[]): Promise<{
622
- modifierCategory: ICoreCategory;
623
- modifiers: ICoreItem[];
624
- }>;
625
- }
626
- /**
627
- * Represents a service for managing categories.
628
- * Extends the IAppRemoteService interface with the ICategory type.
629
- */
630
- export interface ICategoryService extends IAppRemoteService<ICategory> {
631
- /**
632
- * Adds a subcategory to a category.
633
- * @param category - The category to add the subcategory to.
634
- * @param subcategory - The subcategory to add.
635
- * @returns A promise that resolves to the updated category.
636
- */
637
- addSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
638
- /**
639
- * Updates a subcategory of a category.
640
- * @param category - The category that contains the subcategory.
641
- * @param subcategory - The updated subcategory.
642
- * @returns A promise that resolves to the updated category.
643
- */
644
- updateSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
645
- /**
646
- * Removes a subcategory from a category.
647
- * @param category - The category to remove the subcategory from.
648
- * @param subcategoryUid - The unique identifier of the subcategory to remove.
649
- * @returns A promise that resolves to the updated category.
650
- */
651
- removeSubcategory(category: ICategory, subcategoryUid: string): Promise<ICategory>;
652
- }
653
- export class CategoryService extends AppRemoteService<Category> {
654
- readonly http: AxiosInstance;
655
- readonly db: Dexie;
656
- readonly options: IServiceOptions;
657
- readonly moduleName: string;
658
- readonly methodName: string;
659
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
660
- addSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
661
- updateSubcategory(category: ICategory, subcategory: ISubcategory): Promise<ICategory>;
662
- removeSubcategory(category: ICategory, subcategoryUid: string): Promise<ICategory>;
663
- }
664
- /**
665
- * Represents a configuration service that extends the IAppRemoteService interface and provides methods for updating general configuration.
666
- */
667
- export interface IConfigService extends IAppRemoteService<IAppConfig> {
668
- /**
669
- * Updates the general configuration with the specified options.
670
- * @param options The options for updating the general configuration.
671
- * @returns A promise that resolves to the updated application configuration.
672
- */
673
- updateGeneralConfig(options: UpdateGeneralConfigOptions): Promise<IAppConfig>;
674
- /**
675
- * Updates a config category with the specified options.
676
- * @param configKey the config category key to update
677
- * @param options the value to update the config category with
678
- */
679
- updateConfig(configKey: keyof IConfig, options: Partial<IConfig[typeof configKey]>): Promise<IAppConfig>;
680
- /**
681
- * Uploads an image to the server.
682
- * @param file - The file to upload.
683
- * @returns A promise that resolves with the uploaded file.
684
- */
685
- uploadFile(file: File): Promise<IFileUploadResponse>;
686
- }
687
- export class ConfigService extends AppRemoteService<IAppConfig> implements IConfigService {
688
- readonly http: AxiosInstance;
689
- readonly db: Dexie;
690
- readonly options: IServiceOptions;
691
- readonly moduleName: string;
692
- readonly methodName: string;
693
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
694
- private configFactories;
695
- updateConfig<T extends keyof IConfig>(configKey: T, options: Partial<IConfig[T]>): Promise<IAppConfig>;
696
- updateGeneralConfig(options: UpdateGeneralConfigOptions): Promise<IAppConfig>;
697
- updateCache(partialCache: Partial<ICache>): Promise<IAppConfig>;
698
- uploadFile(file: File): Promise<IFileUploadResponse>;
699
- }
700
- export class SectionService extends AppRemoteService<ISection> implements ISectionService {
701
- readonly http: AxiosInstance;
702
- readonly db: Dexie;
703
- readonly options: IServiceOptions;
704
- readonly moduleName: string;
705
- readonly methodName: string;
706
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
707
- }
708
- export class SectionItemService extends AppRemoteService<ISectionItem> implements ISectionItemService {
709
- readonly http: AxiosInstance;
710
- readonly db: Dexie;
711
- readonly options: IServiceOptions;
712
- readonly moduleName: string;
713
- readonly methodName: string;
714
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
715
- changeToTakeOut(uid: string): Promise<ISectionItem>;
716
- }
717
- export type IProductService = IAppRemoteService<IItem>;
718
- export class ProductService extends AppRemoteService<IItem> implements IProductService {
719
- readonly http: AxiosInstance;
720
- readonly db: Dexie;
721
- readonly options: IServiceOptions;
722
- readonly moduleName: string;
723
- readonly methodName: string;
724
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
725
- }
726
- export interface IShiftService extends IAppRemoteService<IShift> {
727
- closeShift(declareAmount: number, userUid: string): Promise<IShift>;
728
- openShift(openAmount: number, userUid: string, note?: string): Promise<IShift>;
729
- cashIn(amount: number, note: string): Promise<ITill>;
730
- cashOut(amount: number, note: string): Promise<ITill>;
731
- }
732
- export class ShiftService extends AppRemoteService<IShift> implements IShiftService {
733
- readonly http: AxiosInstance;
734
- readonly db: Dexie;
735
- readonly options: IServiceOptions;
736
- readonly moduleName: string;
737
- readonly methodName: string;
738
- private tillService;
739
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
740
- cashIn(amount: number, note: string): Promise<ITill>;
741
- cashOut(amount: number, note: string): Promise<ITill>;
742
- closeShift(declareAmount: number, userUid: string): Promise<IShift>;
743
- openShift(openAmount: number, userUid: string, note?: string): Promise<IShift>;
744
- }
745
- /**
746
- * Represents a service for creating cash invoice tills.
747
- * @interface
748
- * @extends IAppRemoteService
749
- */
750
- export interface ITillService extends IAppRemoteService<ITill> {
751
- /**
752
- * Creates a cash invoice till.
753
- * @param {IPayment[]} payments - Invoice payments.
754
- * @param {string} shift_uid - The shift UID.
755
- * @param {string} user_uid - The user UID.
756
- * @param {string} [note] - The note for the till.
757
- * @returns {Promise<ITill>} - A promise that resolves with the created till.
758
- */
759
- createCashInvoiceTill(payments: IPayment[], shift_uid: string, user_uid: string, note?: string): Promise<ITill>;
760
- }
761
- export class TillService extends AppRemoteService<ITill> implements ITillService {
762
- readonly http: AxiosInstance;
763
- readonly db: Dexie;
764
- readonly options: IServiceOptions;
765
- readonly moduleName: string;
766
- readonly methodName: string;
767
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
768
- createCashInvoiceTill(payments: IPayment[], shift_uid: string, user_uid: string, note?: string): Promise<ITill>;
769
- }
770
- /**
771
- * Represents a service for managing payment methods.
772
- * Extends the IAppRemoteService interface for CRUD operations.
773
- */
774
- export interface IPaymentMethodService extends IAppRemoteService<IPaymentMethod> {
775
- /**
776
- * Synchronizes the standard payment methods from server and updates database.
777
- * @returns A promise that resolves with an array of IPaymentMethod objects.
778
- */
779
- syncStandardPaymentMethods(): Promise<IPaymentMethod[]>;
780
- /**
781
- * Enables a payment method.
782
- * @param paymentMethod - The payment method to enable.
783
- * @returns A promise that resolves with the enabled IPaymentMethod object.
784
- */
785
- enablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
786
- /**
787
- * Disables a payment method.
788
- * @param paymentMethod - The payment method to disable.
789
- * @returns A promise that resolves with the disabled IPaymentMethod object.
790
- */
791
- disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
792
- /**
793
- * Changes the sequence of a payment method.
794
- * @param paymentMethod - The payment method to change the sequence of.
795
- * @param sequence - The new sequence number for the payment method.
796
- * @returns A promise that resolves with the updated IPaymentMethod object.
797
- */
798
- changeSequence(paymentMethod: IPaymentMethod, sequence: number): Promise<IPaymentMethod>;
799
- }
800
- export class PaymentMethodService extends AppRemoteService<IPaymentMethod> implements IPaymentMethodService {
801
- readonly http: AxiosInstance;
802
- readonly db: Dexie;
803
- readonly options: IServiceOptions;
804
- readonly moduleName: string;
805
- readonly methodName: string;
806
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
807
- syncStandardPaymentMethods(): Promise<IPaymentMethod[]>;
808
- enablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
809
- disablePaymentMethod(paymentMethod: IPaymentMethod): Promise<IPaymentMethod>;
810
- changeSequence(paymentMethod: IPaymentMethod, sequence: number): Promise<IPaymentMethod>;
811
- }
812
- /**
813
- * Interface for Payment Service that extends IAppRemoteService with IPayment type.
814
- */
815
- export interface IPaymentService extends IAppRemoteService<IPayment> {
816
- /**
817
- * Adds a payment to an invoice.
818
- * @param invoice - The invoice to add the payment to.
819
- * @param amount - The amount of the payment.
820
- * @param paymentMethod - The payment method used for the payment.
821
- * @returns A promise that resolves to the updated invoice.
822
- */
823
- addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
824
- /**
825
- * Removes a payment from an invoice.
826
- * @param invoice - The invoice to remove the payment from.
827
- * @param payment_uid - The unique identifier of the payment to remove.
828
- * @returns A promise that resolves to the updated invoice.
829
- */
830
- removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
831
- /**
832
- * Sync payment status callback function type
833
- */
834
- onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
835
- /**
836
- * Sync payment status to external systems
837
- * @param data - Payment sync data
838
- */
839
- syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
840
- }
841
- /**
842
- * Payment Service implementation
843
- *
844
- * Usage example for CDS payment status sync:
845
- * ```typescript
846
- * // Setup payment sync callback
847
- * paymentService.onPaymentSync = async (data: IPaymentSyncData) => {
848
- * // Send to CDS or other external systems
849
- * console.log('Payment status:', data.status, 'for payment:', data.payment_uid);
850
- * };
851
- *
852
- * // Manual payment status sync (for external payment flows)
853
- * await paymentService.syncPaymentStatus({
854
- * payment_uid: 'payment_123',
855
- * invoice_uid: 'invoice_456',
856
- * status: PaymentStatus.STARTED,
857
- * payment_method: paymentMethod,
858
- * amount: 100.00,
859
- * timestamp: new Date()
860
- * });
861
- * ```
862
- */
863
- export class PaymentService extends AppRemoteService<IPayment> implements IPaymentService {
864
- readonly http: AxiosInstance;
865
- readonly db: Dexie;
866
- readonly options: IServiceOptions;
867
- readonly moduleName: string;
868
- readonly methodName: string;
869
- onPaymentSync?: (data: IPaymentSyncData) => Promise<void>;
870
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
871
- addPayment(invoice: IInvoice, amount: number, paymentMethod: IPaymentMethod): Promise<IInvoice>;
872
- removePayment(invoice: IInvoice, payment_uid: string): Promise<IInvoice>;
873
- syncPaymentStatus(data: IPaymentSyncData): Promise<void>;
874
- }
875
- /**
876
- * Represents the interface for the AppMiscService.
877
- */
878
- export interface IAppMiscService {
879
- /**
880
- * Calibrates the sequence for a given service.
881
- * @param service - The service to calibrate the sequence for.
882
- * @returns A promise that resolves when the calibration is complete.
883
- */
884
- calibrateSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>): Promise<void>;
885
- /**
886
- * Changes the sequence of an item for a given service.
887
- * @param service - The service to change the sequence for.
888
- * @param item - The item to change the sequence of.
889
- * @param sequence - The new sequence number for the item.
890
- * @returns A promise that resolves with the updated item.
891
- */
892
- changeSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>, item: T, sequence: number): Promise<T>;
893
- }
894
- export class AppMiscService implements IAppMiscService {
895
- calibrateSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>): Promise<void>;
896
- changeSequence<T extends IAppCoreModel & IAppModelSequence>(service: IAppRemoteService<T>, item: T, sequence: number): Promise<T>;
897
- }
898
- /**
899
- * Represents the interface for the App Report Service.
900
- * Extends the IAppRemoteService interface with methods specific to report functionality.
901
- */
902
- export interface IAppReportService extends IAppRemoteService<IAppReport> {
903
- /**
904
- * Synchronizes standard reports.
905
- * @returns A promise that resolves to an instance of IAppReport.
906
- */
907
- syncStandardReports(): Promise<IAppReport>;
908
- /**
909
- * Prints a report.
910
- * @param request - The request object containing the necessary information for printing the report.
911
- * @returns A promise that resolves when the report is printed successfully.
912
- */
913
- printReport(request: IReportRequest): Promise<void>;
914
- }
915
- export class AppReportService extends AppRemoteService<IAppReport> implements IAppReportService {
916
- readonly http: AxiosInstance;
917
- readonly db: Dexie;
918
- readonly options: IServiceOptions;
919
- readonly moduleName: string;
920
- readonly methodName: string;
921
- private invoiceService;
922
- private tillService;
923
- private paymentService;
924
- private printerService;
925
- private printTemplateService;
926
- private printJobService;
927
- private configService;
928
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
929
- syncStandardReports(): Promise<IAppReport>;
930
- printReport(request: IReportRequest): Promise<void>;
931
- private getReportData;
932
- processReportInvoicesData(reportData: IReportData, invoices?: IInvoice[]): IReportData;
933
- }
934
- export type IPrintJobService = IAppRemoteService<IPrintJob> & {
935
- /**
936
- * Autoquery print jobs
937
- * @param builder autoquery builder
938
- */
939
- autoquery(builder: QueryBuilder<IPrintJob>): Promise<QueryResponse<IPrintJob>>;
940
- replacePrinter(printJob: IPrintJob, printer: IPrinter): IPrintJob;
941
- };
942
- export class PrintJobService extends AppRemoteService<IPrintJob> implements IPrintJobService {
943
- readonly http: AxiosInstance;
944
- readonly db: Dexie;
945
- readonly options: IServiceOptions;
946
- readonly moduleName: string;
947
- readonly methodName: string;
948
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
949
- autoquery(builder: QueryBuilder<IPrintJob>): Promise<QueryResponse<IPrintJob>>;
950
- replacePrinter(printJob: IPrintJob, printer: IPrinter): IPrintJob;
951
- }
952
- export interface IPrintTemplateService extends IAppRemoteService<IPrintTemplate> {
953
- /**
954
- * initialize all default print templates, it should be called only once
955
- * @returns void
956
- */
957
- initialize(): Promise<void>;
958
- /**
959
- * Render print template
960
- * @param invoice invoice to render
961
- * @param config config to render
962
- * @param template template to render
963
- * @returns print command
964
- */
965
- renderPrintTemplate(invoice: IInvoice, config: IConfig, template: IPrintTemplate, options: IRenderPrintTemplateOptions): Promise<IPrintCommand>;
966
- /**
967
- * Render report print template
968
- * @param reportData report data to render
969
- * @param template template to render
970
- * @returns print command
971
- */
972
- renderReportPrintTemplate(reportData: IReportData, config: IConfig, template: IPrintTemplate, options?: IRenderPrintTemplateOptions): Promise<IPrintCommand>;
973
- }
974
- export class PrintTemplateService extends AppRemoteService<IPrintTemplate> implements IPrintTemplateService {
975
- readonly http: AxiosInstance;
976
- readonly db: Dexie;
977
- readonly options: IServiceOptions;
978
- readonly moduleName: string;
979
- readonly methodName: string;
980
- httpClient: AxiosInstance;
981
- private secretKey;
982
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
983
- initialize(): Promise<void>;
984
- renderPrintTemplate(invoice: IInvoice, config: IConfig, template: IPrintTemplate, options?: RenderPrintTemplateOptions): Promise<IPrintCommand>;
985
- renderReportPrintTemplate(reportData: ReportData, config: IConfig, template: IPrintTemplate, options?: RenderPrintTemplateOptions): Promise<IPrintCommand>;
986
- private getPrintTemplate;
987
- private getCodepageByCountryCode;
988
- private renderPrintCommand;
989
- }
990
-
991
- }
992
- declare module '@posx/core/services/invoice.merge.test' {
993
- export {};
994
-
995
- }
996
- declare module '@posx/core/services/invoice.service' {
997
- import { IAppRemoteService, AppRemoteService } from '@posx/core/services/abstract.service';
998
- import { CalcFlow, CalcType, IInvoice, IInvoiceLine, TaxMethod, IInvoiceCoreLine, CreateInvoiceOptions, CancelInvoiceOptions, CheckInvoiceOptions, DirectPayInvoiceOptions } from '@posx/core/types/invoice.type';
999
- import { IAppConfig } from '@posx/core/types/config.type';
1000
- import { ICoreItem, IItem } from '@posx/core/types/product.type';
1001
- import { ICustomer } from '@posx/core/types/wyo.customer.type';
1002
- import { IServiceOptions } from '@posx/core/types/misc.type';
1003
- import { ISectionItem } from '@posx/core/types/section.type';
1004
- import { ITillService, ISectionItemService, ConfigService, PrintTemplateService, PrintJobService } from '@posx/core/services/app.service';
1005
- import { AxiosInstance } from 'axios';
1006
- import Dexie from 'dexie';
1007
- import { SwitchInvoiceOptions, PayInvoiceOptions, VoidInvoiceOptions, UpdateInvoiceOptions } from '@posx/core/types/invoice.type';
1008
- import { ITill } from '@posx/core/types/shift.type';
1009
- import { QueryResponse } from '@posx/core/types/auto.query.type';
1010
- import { IChangePaymentMethodOption } from '@posx/core/types/payment.type';
1011
- import { PrinterService } from '@posx/core/services/printer.service';
1012
- import { IPrinter, PrinterType } from '@posx/core/types/printer.type';
1013
- import { IEmployee } from '@posx/core/types/employee.type';
1014
- import { QueryBuilder, QueryEtcParams } from '@posx/core/utils/autoquery.utils';
1015
- export interface IInvoiceBaseService extends IAppRemoteService<IInvoice> {
1016
- calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
1017
- calculateLines(invoice: IInvoice): void;
1018
- calculateLine(line: IInvoiceLine): void;
1019
- calculatePointSubtotal(invoice: IInvoice): void;
1020
- calculateDeliveryCharge(invoice: IInvoice): void;
1021
- calculateInvoiceServiceChargeableSubtotal(invoice: IInvoice): void;
1022
- calculateDiscount(invoice: IInvoice, flow: CalcFlow): void;
1023
- calculateRounding(invoice: IInvoice, roundingBase: number, roundingUp: boolean, roundingCashless: boolean): void;
1024
- roundingStep(total: number, roundingBase: number, roundingUp: boolean): number;
1025
- calculateServiceCharge(invoice: IInvoice, rate: number): void;
1026
- calculateTax(invoice: IInvoice, taxRate: number, taxMethod: TaxMethod): void;
1027
- calculateCreditDeduction(invoice: IInvoice): void;
1028
- calculateTaxSubtotalRatio(invoice: IInvoice): number;
1029
- calculateRewardCredit(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: any): void;
1030
- calculateAddCredit(invoice: IInvoice): void;
1031
- calculateRewardPoint(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
1032
- calculateChangeAmount(invoice: IInvoice): void;
1033
- calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
1034
- }
1035
- export type LineOptions = {
1036
- quantity?: number;
1037
- price?: number;
1038
- remark?: string;
1039
- };
1040
- export class InvoiceBaseService extends AppRemoteService<IInvoice> implements IInvoiceBaseService {
1041
- readonly http: AxiosInstance;
1042
- readonly db: Dexie;
1043
- readonly options: IServiceOptions;
1044
- readonly moduleName: string;
1045
- readonly methodName: string;
1046
- protected tillService: ITillService;
1047
- protected sectionItemService: ISectionItemService;
1048
- protected configService: ConfigService;
1049
- protected printTemplateService: PrintTemplateService;
1050
- protected printerService: PrinterService;
1051
- protected printJobService: PrintJobService;
1052
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1053
- calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
1054
- calculateLines(invoice: IInvoice): void;
1055
- calculateLine(line: IInvoiceLine): void;
1056
- calculatePointSubtotal(invoice: IInvoice): void;
1057
- /**
1058
- * Calculate the invoice subtotal without considering take out
1059
- * @param invoice - The invoice object containing invoice lines
1060
- * @returns The updated invoice object with calculated subtotals
1061
- */
1062
- calculateInvoiceServiceChargeableSubtotal(invoice: IInvoice): void;
1063
- /**
1064
- * Calculate customer package and update line subtotals
1065
- * @param invoice - The invoice object containing customer details and lines
1066
- * @param line - The invoice line to be calculated
1067
- * @param write - Flag to decide if customer spend history should be updated
1068
- * @returns The calculated line subtotal
1069
- */
1070
- /**
1071
- * Calculate the total discount amount of an invoice and update grand total accordingly
1072
- * @param invoice - The invoice object containing discount details and lines
1073
- * @param flow - The calculation of discount flow
1074
- * @returns The updated invoice object with calculated discount and grand total
1075
- */
1076
- calculateDiscount(invoice: IInvoice, flow: CalcFlow): void;
1077
- /**
1078
- * Calculates the rounding for an invoice based on the given parameters.
1079
- * @param invoice - The invoice to calculate the rounding for.
1080
- * @param roundingBase - The base value to round to.
1081
- * @param roundingUp - Whether to round up or down.
1082
- * @param roundingCashless - Whether to apply rounding only for cash payments.
1083
- */
1084
- calculateRounding(invoice: IInvoice, roundingBase: number, roundingUp: boolean, roundingCashless: boolean): void;
1085
- roundingStep(total: number, roundingBase: number, roundingUp: boolean): number;
1086
- /**
1087
- * Calculate the delivery charge of an invoice
1088
- * @param invoice - The invoice object containing delivery charge and type
1089
- * @returns The updated invoice object with calculated grand total
1090
- */
1091
- calculateDeliveryCharge(invoice: IInvoice): void;
1092
- /**
1093
- * Calculate and set the service charge for a given invoice.
1094
- * The method updates the service_charge and grand_total fields of the invoice.
1095
- *
1096
- * @param invoice - invoice to calculate the service charge for
1097
- * @param rate - service charge rate. e.g. 0.1 for 10%
1098
- * @returns {void} -
1099
- */
1100
- calculateServiceCharge(invoice: IInvoice, rate: number): void;
1101
- /**
1102
- * Calculates the tax for an invoice based on the tax rate and tax method.
1103
- * @param invoice - The invoice to calculate the tax for.
1104
- * @param taxRate - The tax rate to apply.
1105
- * @param taxMethod - The tax method to use (inclusive or exclusive).
1106
- */
1107
- calculateTax(invoice: IInvoice, taxRate: number, taxMethod: TaxMethod): void;
1108
- /**
1109
- * Adjusts the grand total of the invoice by the deduction balance
1110
- * @param invoice - The invoice to adjust.
1111
- * @returns void
1112
- */
1113
- calculateCreditDeduction(invoice: IInvoice): void;
1114
- /**
1115
- * Calculate the tax subtotal ratio for the invoice.
1116
- * @param invoice - The invoice for which the ratio is calculated.
1117
- * @returns The calculated ratio as a number.
1118
- */
1119
- calculateTaxSubtotalRatio(invoice: IInvoice): number;
1120
- /**
1121
- * Calculates the rewarded credit for an invoice.
1122
- * @param invoice - The invoice to calculate the rewarded credit for.
1123
- * @param aboveInvoiceAmount - The minimum invoice amount required to be eligible for rewarded credit.
1124
- * @param includeServiceCharge - Whether to include the service charge in the calculation.
1125
- * @param includeTax - Whether to include the tax in the calculation.
1126
- */
1127
- calculateRewardCredit(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
1128
- calculateAddCredit(invoice: IInvoice): void;
1129
- /**
1130
- * Calculates and sets the rewarded points for the given invoice based on various conditions.
1131
- * @param invoice - The invoice to calculate rewarded points for.
1132
- * @returns void
1133
- */
1134
- calculateRewardPoint(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
1135
- private resetInvoiceCalculations;
1136
- private resetLineCalculations;
1137
- calculateChangeAmount(invoice: IInvoice): void;
1138
- calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
1139
- }
1140
- /**
1141
- * Interface for the Invoice Operation Service, which extends the IInvoiceBaseService interface.
1142
- * Provides methods for adding an item to an invoice line and adding a modifier to a list of modifiers.
1143
- */
1144
- /**
1145
- * Represents an extended invoice operation service that includes additional methods for adding items and modifiers to an invoice.
1146
- */
1147
- /**
1148
- * Interface for the Invoice Operation Service, which extends the Invoice Base Service.
1149
- */
1150
- /**
1151
- * Interface for a service that performs operations on invoice lines.
1152
- */
1153
- /**
1154
- * Represents a service that provides operations for manipulating invoice lines.
1155
- */
1156
- export interface ILineOperationService extends IInvoiceBaseService {
1157
- /**
1158
- * Adds an item to an invoice line. If the item already exists in the invoice, the quantity is increased, otherwise a new line is created.
1159
- * Adding items with positive quantities
1160
- * Reducing quantities of existing items with negative values
1161
- * Automatic removal of lines when quantity reaches 0 or below
1162
- * @param invoice - The invoice to add the item to.
1163
- * @param customer - The customer associated with the invoice.
1164
- * @param appConfig - The app configuration.
1165
- * @param item - The item to add to the invoice line.
1166
- * @param quantity - The quantity of the item to add.
1167
- * @param price - The price of the item.
1168
- * @param modifiers - An array of modifiers to apply to the item.
1169
- * @param options - Additional options for the line.
1170
- * @returns The updated invoice.
1171
- */
1172
- addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], options?: LineOptions): IInvoice;
1173
- /**
1174
- * Duplicates an invoice line
1175
- * @param invoice - The invoice to duplicate the line in.
1176
- * @param line - The line to duplicate.
1177
- * @returns The updated invoice.
1178
- */
1179
- duplicateLine(invoice: IInvoice, line: IInvoiceLine): IInvoice;
1180
- /**
1181
- * Calibrates the duplicates in an invoice.
1182
- * @param invoice - The invoice to calibrate the duplicates in.
1183
- * @returns The updated invoice.
1184
- */
1185
- calibrateDuplicates(invoice: IInvoice): IInvoice;
1186
- /**
1187
- * Decreases the quantity of an item in an invoice line.
1188
- * @param invoice - The invoice to decrease the item quantity in.
1189
- * @param line - The invoice line to decrease the item quantity in.
1190
- * @param quantity - The quantity of the item to decrease.
1191
- * @returns The updated invoice.
1192
- */
1193
- minusLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
1194
- /**
1195
- * Increases the quantity of an item in an invoice line.
1196
- * @param invoice - The invoice to increase the item quantity in.
1197
- * @param line - The invoice line to increase the item quantity in.
1198
- * @param quantity - The quantity of the item to increase.
1199
- * @returns The updated invoice.
1200
- */
1201
- addLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
1202
- /**
1203
- * Changes the unit price of an existing invoice line.
1204
- * @param line - The invoice line to change the item price in.
1205
- * @param price - The new price of the item.
1206
- * @returns The updated invoice.
1207
- */
1208
- changeLinePrice(line: IInvoiceLine, price: number): IInvoiceLine;
1209
- /**
1210
- * Changes the discount of an existing invoice line.
1211
- * @param line - The invoice line to change the discount in.
1212
- * @param discountType - The type of discount to apply.
1213
- * @param amountOrPercent - The amount of the discount to apply.
1214
- * @returns The updated invoice.
1215
- */
1216
- changeLineDiscount(line: IInvoiceLine, discountType: CalcType, amountOrPercent: number): IInvoiceLine;
1217
- /**
1218
- * to convert a modifier to an invoice core line object
1219
- * so it can be used in addModifier() method
1220
- * @param modifier ICoreItem, the modifier to be added to the invoice line
1221
- * @param quantity number, the quantity of the modifier to be added
1222
- */
1223
- toInvoiceCoreLine(modifier: ICoreItem, quantity: number): IInvoiceCoreLine;
1224
- /**
1225
- * Adds a modifier to a list of modifiers, if the modifier already exists in the list, the quantity is increased, otherwise a new modifier is created.
1226
- * @param modifiers - The list of modifiers to add the modifier to.
1227
- * @param modifier - The modifier to add to the list.
1228
- * @returns The updated list of modifiers.
1229
- */
1230
- addModifier(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine): IInvoiceCoreLine[];
1231
- /**
1232
- * @deprecated use changeModifierQuantity instead
1233
- * Decreases the quantity of a modifier in a list of modifiers.
1234
- * @param modifiers - The list of modifiers to decrease the quantity in.
1235
- * @param modifier - The modifier to decrease the quantity of.
1236
- * @param quantity - The quantity of the modifier to decrease.
1237
- * @returns The updated list of modifiers.
1238
- */
1239
- minusModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1240
- /**
1241
- * @deprecated use changeModifierQuantity instead
1242
- * Increases the quantity of a modifier in a list of modifiers.
1243
- * @param modifiers - The list of modifiers to increase the quantity in.
1244
- * @param modifier - The modifier to increase the quantity of.
1245
- * @param quantity - The quantity of the modifier to increase.
1246
- * @returns The updated list of modifiers.
1247
- */
1248
- addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1249
- /**
1250
- * Changes the quantity of a modifier in a list of modifiers.
1251
- * Positive quantity will increase the modifier quantity.
1252
- * Negative quantity will decrease the modifier quantity.
1253
- * If quantity becomes 0 or negative, the modifier will be removed.
1254
- * @param modifiers - The list of modifiers to change the quantity in.
1255
- * @param modifier - The modifier to change the quantity of.
1256
- * @param quantity - The quantity to add (positive) or subtract (negative).
1257
- * @returns The updated list of modifiers.
1258
- */
1259
- changeModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1260
- /**
1261
- * Changes the unit price of a existing modifier.
1262
- * @param modifier - The modifier to change the price of.
1263
- * @param price - The new price of the modifier.
1264
- * @returns The updated list of modifiers.
1265
- */
1266
- changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
1267
- /**
1268
- * Overwrites the note of an invoice line.
1269
- * @param line - The invoice line to overwrite the note of.
1270
- * @param note - The new note to overwrite the old note with.
1271
- * @returns The updated invoice line.
1272
- */
1273
- overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
1274
- }
1275
- export class LineOperationService extends InvoiceBaseService implements ILineOperationService {
1276
- addItemToLine(invoice: IInvoice, customer: ICustomer, appConfig: IAppConfig, item: IItem, modifiers?: IInvoiceCoreLine[], lineOptions?: LineOptions): IInvoice;
1277
- duplicateLine(invoice: IInvoice, line: IInvoiceLine): IInvoice;
1278
- calibrateDuplicates(invoice: IInvoice): IInvoice;
1279
- toInvoiceCoreLine(modifier: ICoreItem, quantity?: number): IInvoiceCoreLine;
1280
- addModifier(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine): IInvoiceCoreLine[];
1281
- changeLinePrice(line: IInvoiceLine, price: number): IInvoiceLine;
1282
- changeLineDiscount(line: IInvoiceLine, discountType: CalcType, amountOrPercent: number): IInvoiceLine;
1283
- minusLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
1284
- addLineQuantity(invoice: IInvoice, line: IInvoiceLine, quantity: number): IInvoice;
1285
- minusModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1286
- changeModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1287
- addModifierQuantity(modifiers: IInvoiceCoreLine[], modifier: IInvoiceCoreLine, quantity?: number): IInvoiceCoreLine[];
1288
- changeModifierPrice(modifier: IInvoiceCoreLine, price: number): IInvoiceCoreLine;
1289
- overwriteNoteToLine(line: IInvoiceLine, note: string): IInvoiceLine;
1290
- private findOrCreateLine;
1291
- private createInvoiceLine;
1292
- protected compareModifiers(target: IInvoiceCoreLine[], source: IInvoiceCoreLine[]): boolean;
1293
- /**
1294
- * false if not equal
1295
- * true if equal
1296
- * @param target
1297
- * @param source
1298
- */
1299
- protected compareLines(target: IInvoiceLine, source: IInvoiceLine): boolean;
1300
- }
1301
- /**
1302
- * Interface for invoice operation service that extends line operation service
1303
- */
1304
- export interface IInvoiceOperationService extends ILineOperationService {
1305
- /**
1306
- * Creates an invoice
1307
- * @param invoice - The invoice to create
1308
- * @param sectionItem - The section item to associate with the invoice
1309
- * @param employee - The employee to associate with the invoice
1310
- * @returns A promise that resolves with the created invoice options
1311
- */
1312
- createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
1313
- /**
1314
- * Updates an invoice
1315
- * @param invoice - The invoice to update
1316
- * @param sectionItem - The section item to associate with the invoice
1317
- * @param employee - The employee to associate with the invoice
1318
- * @returns A promise that resolves with the updated invoice
1319
- */
1320
- updateInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<UpdateInvoiceOptions>;
1321
- /**
1322
- * Cancels an invoice
1323
- * @param invoice - The invoice to cancel
1324
- * @param sectionItem - The section item to associate with the invoice
1325
- * @param employee - The employee to associate with the invoice
1326
- * @returns A promise that resolves with the cancelled invoice options
1327
- */
1328
- cancelInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CancelInvoiceOptions>;
1329
- /**
1330
- * Checks an invoice
1331
- * @param invoice - The invoice to check
1332
- * @param SectionItem - The section item to associate with the invoice
1333
- * @param employee - The employee to associate with the invoice
1334
- * @returns A promise that resolves with the checked invoice options
1335
- */
1336
- checkInvoice(invoice: IInvoice, SectionItem: ISectionItem, employee?: IEmployee): Promise<CheckInvoiceOptions>;
1337
- /**
1338
- * Directly pays an invoice without creating it first (kiosk use case)
1339
- * @param invoice the invoice to pay
1340
- * @param till the till to use for the payment
1341
- * @param employee the employee to associate with the invoice
1342
- * @param specificPrinter the printer to use for the payment
1343
- * @param specificKioskDeviceUid the kiosk device uid to use for the payment
1344
- * @param kitchenPrintOverride override the kitchen print setting, if true, will print kitchen print even if kitchen print is disabled in config
1345
- * @returns A promise that resolves with the direct pay invoice options
1346
- * @internal 加入 specificKioskDeviceUid 主要是考虑到多台 kiosk 和 iPad 作为主 POS 情况下, iPad有可能没在运行 APP 的情况下, 需要指定 kiosk 设备来打印小票
1347
- */
1348
- directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string, kitchenPrintOverride?: boolean): Promise<DirectPayInvoiceOptions>;
1349
- /**
1350
- * Pays an invoice
1351
- * @param invoice - The invoice to pay
1352
- * @param sectionItem - The section item to associate with the invoice
1353
- * @param till - (optional) The till to use for the payment
1354
- * @param employee - (optional) The employee to associate with the invoice
1355
- * @returns A promise that resolves with the paid invoice options
1356
- */
1357
- payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
1358
- /**
1359
- * Voids an invoice
1360
- * @param invoice - The invoice to void
1361
- * @param till - The till to use for the void
1362
- * @param reason - The reason for the void
1363
- * @returns A promise that resolves with the voided invoice options
1364
- */
1365
- voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
1366
- /**
1367
- * duplicate an invoice
1368
- * @param invoice the invoice to duplicate
1369
- * @param employee the employee to associate with the invoice
1370
- */
1371
- duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
1372
- /**
1373
- * Switches an invoice from one section item to another
1374
- * @param invoice - The invoice to switch
1375
- * @param targetSectionItem - The target section item to switch to
1376
- * @param sourceSectionItem - The source section item to switch from
1377
- * @param employee - The employee to associate with the invoice
1378
- * @returns A promise that resolves with the switched invoice options
1379
- */
1380
- switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
1381
- reprintReceipt(invoice: IInvoice): Promise<boolean>;
1382
- /**
1383
- * Adds a discount to an invoice
1384
- * @param invoice - The invoice to add the discount to
1385
- * @param discountType - The type of discount to add
1386
- * @param amountOrPercent - The amount or percent of the discount
1387
- * @param calcFlow - The calculation flow to use for the discount
1388
- * @returns The updated invoice with the added discount
1389
- */
1390
- addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1391
- /**
1392
- * Removes a discount from an invoice
1393
- * @param invoice - The invoice to remove the discount from
1394
- * @param discountUid - The uid of the discount to remove
1395
- * @returns The updated invoice with the removed discount
1396
- */
1397
- removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
1398
- /**
1399
- * Overwrites the note for an invoice
1400
- * @param invoice - The invoice to overwrite the note for
1401
- * @param note - The new note for the invoice
1402
- * @returns The updated invoice with the new note
1403
- */
1404
- overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
1405
- /**
1406
- * Adds a pax to an invoice
1407
- * @param invoice - The invoice to add the pax to
1408
- * @param pax - The pax to add to the invoice
1409
- */
1410
- addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
1411
- /**
1412
- * Adds a customer to an invoice
1413
- * @param invoice - The invoice to add the customer to
1414
- * @param customer - The customer to add to the invoice
1415
- */
1416
- addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
1417
- /**
1418
- * Adds a payment to an invoice
1419
- * @param invoice - The invoice to add the sales person to
1420
- * @param salesUserUid - The sales person's uid to add to the invoice
1421
- */
1422
- addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
1423
- /**
1424
- * merge invoice from local db and invoice sent from signalr
1425
- * @param localInvoice invoice from local db
1426
- * @param remoteInvoice invoice sent from signalr
1427
- */
1428
- mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
1429
- /**
1430
- * Queries invoices using the QueryBuilder to construct filter parameters
1431
- * @param query QueryBuilder instance to build the query
1432
- *
1433
- * Example usage:
1434
- * ```typescript
1435
- * // Create a new query builder
1436
- * const builder = new QueryBuilder<IInvoice>()
1437
- *
1438
- * // Add filter conditions:
1439
- * builder
1440
- * .addParam('status', 'Equals', InvoiceStatus.Paid) // Filter by status
1441
- * .addParam('created_at', 'GreaterThan', '2023-01-01') // Filter by date
1442
- * .addParam('customer_id', 'Equals', 123) // Filter by customer
1443
- * .addParam('grand_total', 'GreaterThan', 100) // Filter by amount
1444
- * .addParam('ref_id', 'Contains', 'INV') // Search by reference ID
1445
- *
1446
- * // Add sorting
1447
- * builder.orderBy('created_at', 'DESC')
1448
- *
1449
- * // Add pagination
1450
- * builder.skip(0).take(10)
1451
- *
1452
- * // Execute query
1453
- * const response = await invoiceService.autoQuery(builder)
1454
- * ```
1455
- *
1456
- * Common operators:
1457
- * - Equals: Exact match
1458
- * - Contains: Partial text match
1459
- * - GreaterThan/LessThan: Numeric/date comparisons
1460
- * - In: Match array of values
1461
- *
1462
- * @returns Promise<QueryResponse<IInvoice>> Response containing filtered invoices and total count
1463
- */
1464
- autoQuery(query: QueryBuilder<IInvoice>): Promise<QueryResponse<IInvoice>>;
1465
- getRefId(): Promise<string>;
1466
- /**
1467
- * Change payments of an invoice
1468
- * @param invoice invoice to change
1469
- * @param payments payments to change
1470
- */
1471
- changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
1472
- /**
1473
- * Adds a charge to an invoice
1474
- * @param invoice - The invoice to add the charge to
1475
- * @param name - The name of the charge
1476
- * @param percentage - The percentage of the charge (0 for flat amount)
1477
- * @param amount - The flat amount of the charge (0 for percentage)
1478
- * @param calcFlow - The calculation flow to use for the charge
1479
- * @returns The updated invoice with the added charge
1480
- */
1481
- addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
1482
- /**
1483
- * Removes a charge from an invoice
1484
- * @param invoice - The invoice to remove the charge from
1485
- * @param chargeUid - The uid of the charge to remove
1486
- * @returns The updated invoice with the removed charge
1487
- */
1488
- removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
1489
- /**
1490
- * Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
1491
- * @param invoice - The invoice to slice
1492
- * @returns An array of sliced invoices, one for each item quantity
1493
- */
1494
- sliceInvoice(invoice: IInvoice): IInvoice[];
1495
- }
1496
- export class InvoiceOperationService extends LineOperationService implements IInvoiceOperationService {
1497
- createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
1498
- updateInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<UpdateInvoiceOptions>;
1499
- cancelInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CancelInvoiceOptions>;
1500
- checkInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CheckInvoiceOptions>;
1501
- switchInvoice(invoice: IInvoice, targetSectionItem: ISectionItem, sourceSectionItem: ISectionItem, employee?: IEmployee): Promise<SwitchInvoiceOptions>;
1502
- payInvoice(invoice: IInvoice, sectionItem: ISectionItem, till?: ITill, employee?: IEmployee): Promise<PayInvoiceOptions>;
1503
- directPayInvoice(invoice: IInvoice, till?: ITill, employee?: IEmployee, specificPrinter?: IPrinter, specificKioskDeviceUid?: string, kitchenPrintOverride?: boolean): Promise<DirectPayInvoiceOptions>;
1504
- voidInvoice(invoice: IInvoice, till?: ITill, reason?: string, employee?: IEmployee): Promise<VoidInvoiceOptions>;
1505
- duplicateInvoice(invoice: IInvoice, employee?: IEmployee): Promise<IInvoice>;
1506
- reprintReceipt(invoice: IInvoice): Promise<boolean>;
1507
- addInvoiceDiscount(invoice: IInvoice, discountType: CalcType, amountOrPercent: number, calcFlow?: CalcFlow): IInvoice;
1508
- removeInvoiceDiscount(invoice: IInvoice, discountUid: string): IInvoice;
1509
- overwriteNoteToInvoice(invoice: IInvoice, note: string): IInvoice;
1510
- addSalesPersonToInvoice(invoice: IInvoice, salesUserUid: string): IInvoice;
1511
- addPaxToInvoice(invoice: IInvoice, pax: number): IInvoice;
1512
- addCustomerToInvoice(invoice: IInvoice, customer: ICustomer): IInvoice;
1513
- autoQuery(query: QueryBuilder<IInvoice & QueryEtcParams>): Promise<QueryResponse<IInvoice>>;
1514
- mergeInvoice(localInvoice: IInvoice, remoteInvoice: IInvoice): IInvoice;
1515
- getRefId(): Promise<string>;
1516
- changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
1517
- private formatDate;
1518
- private addEmployeeToInvoice;
1519
- private createReceiptPrintJob;
1520
- private createKitchenPrintJobs;
1521
- private createOrderPrintJobs;
1522
- private createLabelPrintJobs;
1523
- filterLinesAndPrintersToPrint(invoiceLines: IInvoiceLine[], printerType: PrinterType): {
1524
- lines: IInvoiceLine[];
1525
- printerUids: string[];
1526
- };
1527
- private preprocessInvoice;
1528
- /**
1529
- * Adds a charge to an invoice
1530
- * @param invoice - The invoice to add the charge to
1531
- * @param name - The name of the charge
1532
- * @param percentage - The percentage of the charge (0 for flat amount)
1533
- * @param amount - The flat amount of the charge (0 for percentage)
1534
- * @param calcFlow - The calculation flow to use for the charge
1535
- * @returns The updated invoice with the added charge
1536
- */
1537
- addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
1538
- /**
1539
- * Removes a charge from an invoice
1540
- * @param invoice - The invoice to remove the charge from
1541
- * @param chargeUid - The uid of the charge to remove
1542
- * @returns The updated invoice with the removed charge
1543
- */
1544
- removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
1545
- /**
1546
- * Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
1547
- * @param invoice - The invoice to slice
1548
- * @returns An array of sliced invoices, one for each item quantity
1549
- */
1550
- sliceInvoice(invoice: IInvoice): IInvoice[];
1551
- }
1552
- export type IInvoiceService = IInvoiceOperationService;
1553
- export class InvoiceService extends InvoiceOperationService implements IInvoiceService {
1554
- }
1555
-
1556
- }
1557
- declare module '@posx/core/services/misc.service' {
1558
- export function preciseRound(num: any, decimalPlaces?: number): number;
1559
- export function getFileExtension(file: File): string;
1560
- export function convertFileToBase64(file: File): Promise<string>;
1561
-
1562
- }
1563
- declare module '@posx/core/services/ods.service' {
1564
- import { AxiosInstance } from "axios";
1565
- import { IOrderDisplay } from '@posx/core/types/ods.type';
1566
- import { AppRemoteService, IAppRemoteService } from "@posx/core/services/abstract.service";
1567
- import Dexie from "dexie";
1568
- import { IServiceOptions } from "@posx/core/types/misc.type";
1569
- /**
1570
- * Represents the interface for the Order Display Service.
1571
- * Extends the IAppRemoteService interface with the IOrderDisplay type.
1572
- */
1573
- export interface IOrderDisplayService extends IAppRemoteService<IOrderDisplay> {
1574
- /**
1575
- * Changes the status of the order to ready for pickup
1576
- * @param uid The uid of the order
1577
- * @returns The updated order
1578
- */
1579
- toPickUp(uid: string): Promise<IOrderDisplay>;
1580
- /**
1581
- * Changes the status of the order to preparing
1582
- * @param uid The uid of the order
1583
- */
1584
- toPreparing(uid: string): Promise<IOrderDisplay>;
1585
- /**
1586
- * Undoes the last order that was marked as ready for pickup
1587
- */
1588
- undo(): Promise<IOrderDisplay>;
1589
- }
1590
- export class OrderDisplayService extends AppRemoteService<IOrderDisplay> implements IOrderDisplayService {
1591
- readonly http: AxiosInstance;
1592
- readonly db: Dexie;
1593
- readonly options: IServiceOptions;
1594
- readonly moduleName: string;
1595
- readonly methodName: string;
1596
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1597
- toPickUp(uid: string): Promise<IOrderDisplay>;
1598
- toPreparing(uid: string): Promise<IOrderDisplay>;
1599
- undo(): Promise<IOrderDisplay>;
1600
- }
1601
-
1602
- }
1603
- declare module '@posx/core/services/printer.service' {
1604
- import { AppRemoteService, IAppRemoteService } from '@posx/core/services/abstract.service';
1605
- import { CustomResponse, IServiceOptions } from '@posx/core/types/misc.type';
1606
- import { INodePrinter, IPrinter, INode } from '@posx/core/types/printer.type';
1607
- import { AxiosInstance } from 'axios';
1608
- import Dexie from 'dexie';
1609
- import { PrintJobService } from '@posx/core/services/app.service';
1610
- /**
1611
- * Represents the Printer Service interface.
1612
- * Extends the IAppRemoteService interface with IPrinter.
1613
- */
1614
- export interface IPrinterService extends IAppRemoteService<IPrinter> {
1615
- /**
1616
- * Retrieves the physical printers from the node.
1617
- * @returns A promise that resolves to an array of INodePrinter objects.
1618
- */
1619
- getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
1620
- /**
1621
- * Retrieves the unpaired node.
1622
- * @returns A promise that resolves to an array of INode objects.
1623
- */
1624
- getUnpairedNode(): Promise<CustomResponse<INode>>;
1625
- /**
1626
- * Pairs the node.
1627
- * @param nodeUid The node UID.
1628
- * @returns A promise that resolves to an array of INode objects.
1629
- */
1630
- pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
1631
- /**
1632
- * Retrieves the default kiosk printer.
1633
- * @returns A promise that resolves to an IPrinter object.
1634
- */
1635
- getDefaultKioskPrinter(): Promise<IPrinter>;
1636
- /**
1637
- * Retrieves the default receipt printer.
1638
- * @returns A promise that resolves to an IPrinter object.
1639
- */
1640
- getDefaultReceiptPrinter(): Promise<IPrinter>;
1641
- /**
1642
- * Searches for available printers on the network with the specified IP address and port number.
1643
- * @param wifiName The name of the wifi the device is connected to
1644
- * @param port The port number of the network. Default is 9100.
1645
- * @param refresh A boolean value indicating whether to refresh the cache. Default is false.
1646
- * @returns A promise that resolves to an array of printer names found on the network.
1647
- */
1648
- searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
1649
- /**
1650
- * Opens the cash drawer.
1651
- */
1652
- openCashDrawer(): Promise<void>;
1653
- }
1654
- export class PrinterService extends AppRemoteService<IPrinter> implements IPrinterService {
1655
- readonly http: AxiosInstance;
1656
- readonly db: Dexie;
1657
- readonly options: IServiceOptions;
1658
- readonly moduleName: string;
1659
- readonly methodName: string;
1660
- private configService;
1661
- protected printJobService: PrintJobService;
1662
- private printersFromCache;
1663
- constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1664
- private init;
1665
- getPhysicalPrintersFromNode(): Promise<INodePrinter[]>;
1666
- getUnpairedNode(): Promise<CustomResponse<INode>>;
1667
- pairNode(nodeUid: string): Promise<CustomResponse<INode>>;
1668
- getDefaultReceiptPrinter(): Promise<IPrinter>;
1669
- getDefaultKioskPrinter(): Promise<IPrinter>;
1670
- getDefaultCheckPrinter(): Promise<IPrinter>;
1671
- getDefaultKitchenPrinter(): Promise<IPrinter>;
1672
- getDefaultOrderPrinter(): Promise<IPrinter>;
1673
- getPrintersByUids(uids: string[]): Promise<IPrinter[]>;
1674
- searchPrinters(refresh?: boolean, port?: number): Promise<string[]>;
1675
- openCashDrawer(): Promise<void>;
1676
- }
1677
-
1678
- }
1679
- declare module '@posx/core/types/abstract.type' {
1680
- export const transformer: {
1681
- from(value: string): string;
1682
- to(value: string): string;
1683
- };
1684
- export interface IAppCoreModel {
1685
- /**
1686
- * primary unique id
1687
- * @ignore
1688
- */
1689
- uid: string;
1690
- /**
1691
- * the date when the object is updated
1692
- * @ignore
1693
- */
1694
- updated_at: Date;
1695
- /**
1696
- * the date when the object is created
1697
- * @ignore
1698
- */
1699
- created_at: Date;
1700
- /**
1701
- * the date when the object is created
1702
- * @ignore
1703
- */
1704
- created_at_timestamp: number;
1705
- /**
1706
- * the date when the object is deleted
1707
- * @ignore
1708
- */
1709
- deleted_at: Date;
1710
- /**
1711
- * timestamp in milliseconds
1712
- * @ignore
1713
- */
1714
- _timestamp: number;
1715
- /**
1716
- * Primary unique id in server 1,2,3,5
1717
- * @ignore
1718
- */
1719
- id_in_server: number;
1720
- }
1721
- export abstract class AppCoreModel implements IAppCoreModel {
1722
- uid: string;
1723
- updated_at: Date;
1724
- created_at: Date;
1725
- /**
1726
- * the date when the object is created
1727
- */
1728
- created_at_timestamp: number;
1729
- deleted_at: any;
1730
- _timestamp: number;
1731
- id_in_server: number;
1732
- constructor();
1733
- }
1734
- export interface IAppBaseModel extends IAppCoreModel {
1735
- /**
1736
- * name of the object
1737
- */
1738
- name: string;
1739
- /**
1740
- * Translations of the name
1741
- */
1742
- name_translations: Record<string, string>;
1743
- }
1744
- export class AppBaseModel extends AppCoreModel implements IAppBaseModel {
1745
- name: string;
1746
- name_translations: Record<string, string>;
1747
- constructor();
1748
- }
1749
- export interface IAppExtraModel extends IAppBaseModel {
1750
- /**
1751
- * description of the object
1752
- */
1753
- description: string;
1754
- /**
1755
- * Translations of the description
1756
- */
1757
- description_translations: Record<string, string>;
1758
- }
1759
- export class AppExtraModel extends AppBaseModel implements IAppExtraModel {
1760
- description: string;
1761
- description_translations: {};
1762
- }
1763
- export type IAppCore = Omit<IAppCoreModel, "id_in_server" | "_timestamp">;
1764
- export type IAppBase = Omit<IAppBaseModel, "id_in_server" | "_timestamp">;
1765
- export type IAppExtra = Omit<IAppExtraModel, "id_in_server" | "_timestamp">;
1766
-
1767
- }
1768
- declare module '@posx/core/types/auto.query.type' {
1769
- /**
1770
- * The IBaseParams interface provides a structure for query parameters commonly used
1771
- * in API requests to manipulate the presentation and organization of returned data.
1772
- *
1773
- * @property {string} [skip] - The number of records to skip before starting to collect the response set.
1774
- * @property {string} [take] - The limit on the number of records to return in the response set.
1775
- * @property {string} [format] - The desired format of the response (e.g., 'json', 'xml').
1776
- * @property {string} [include] - A way to include data from related tables/entities.
1777
- * @property {string} [jsconfig] - JavaScript configuration for client-side handling of the response.
1778
- * @property {string} [orderBy] - A parameter to specify the field to order the results by in ascending order.
1779
- * @property {string} [orderByDesc] - A parameter to specify the field to order the results by in descending order.
1780
- */
1781
- export interface IBaseParams {
1782
- skip?: number;
1783
- take?: number;
1784
- format?: string;
1785
- include?: string;
1786
- jsconfig?: string;
1787
- orderBy?: string;
1788
- orderByDesc?: string;
1789
- }
1790
- export interface IInvoiceParams extends IBaseParams {
1791
- RefIdContains?: string;
1792
- GrandTotal?: number;
1793
- StatusContains?: string;
1794
- PaidAtAfter?: string;
1795
- PaidAtBefore?: string;
1796
- PaidAtStartsWith?: string;
1797
- }
1798
- export interface IInvoicesQuery {
1799
- params: IInvoiceParams;
1800
- }
1801
- export class InvoicesQuery implements IInvoicesQuery {
1802
- params: {
1803
- format: string;
1804
- Include: string;
1805
- jsconfig: string;
1806
- };
1807
- constructor(params: IInvoiceParams);
1808
- }
1809
- export interface IQueryResponse<T> {
1810
- offset?: number;
1811
- total?: number;
1812
- results?: T[];
1813
- meta?: {
1814
- [index: string]: string;
1815
- };
1816
- responseStatus?: ResponseStatus;
1817
- }
1818
- export interface ResponseStatus {
1819
- errorCode?: string;
1820
- message?: string;
1821
- stackTrace?: string;
1822
- errors?: ValidationError[];
1823
- }
1824
- export interface ValidationError {
1825
- errorCode?: string;
1826
- fieldName?: string;
1827
- message?: string;
1828
- }
1829
- export class QueryResponse<T> {
1830
- offset?: number;
1831
- total?: number;
1832
- results?: T[];
1833
- meta?: {
1834
- [index: string]: string;
1835
- };
1836
- responseStatus?: ResponseStatus;
1837
- }
1838
- export enum SortOrder {
1839
- Asc = "asc",
1840
- Desc = "desc"
1841
- }
1842
- export type Operator<T> = T extends number ? keyof typeof NumericOperators : T extends string ? keyof typeof StringOperators : never;
1843
- export type OperatorValueMap = {
1844
- [K in Operator<any>]: K extends keyof typeof NumericOperators ? number : K extends keyof typeof StringOperators ? string : K extends keyof typeof MonthOperator ? MonthValues : K extends keyof typeof DayOperator ? string : never;
1845
- };
1846
- export enum NumericOperators {
1847
- '>' = 0,
1848
- '>=' = 1,
1849
- '<' = 2,
1850
- '<=' = 3,
1851
- '=' = 4
1852
- }
1853
- export enum StringOperators {
1854
- 'Contains' = 0,
1855
- 'NotContains' = 1,
1856
- 'StartsWith' = 2,
1857
- 'EndsWith' = 3,
1858
- "Like" = 4
1859
- }
1860
- export enum MonthOperator {
1861
- WithinAMonth = "Contains"
1862
- }
1863
- export enum DayOperator {
1864
- At = "StartsWith"
1865
- }
1866
- export enum MonthValues {
1867
- Jan = "-01-",
1868
- Feb = "-02-",
1869
- Mar = "-03-",
1870
- Apr = "-04-",
1871
- May = "-05-",
1872
- Jun = "-06-",
1873
- Jul = "-07-",
1874
- Aug = "-08-",
1875
- Sep = "-09-",
1876
- Oct = "-10-",
1877
- Nov = "-11-",
1878
- Dec = "-12-"
1879
- }
1880
-
1881
- }
1882
- declare module '@posx/core/types/condition.type' {
1883
- export enum Condition {
1884
- None = "",
1885
- Always = "always"
1886
- }
1887
-
1888
- }
1889
- declare module '@posx/core/types/config.type' {
1890
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
1891
- import { TaxMethod } from '@posx/core/types/invoice.type';
1892
- export interface IAppConfig extends IAppCoreModel {
1893
- config: IConfig;
1894
- cache: ICache;
1895
- }
1896
- export class AppConfig extends AppCoreModel implements IAppConfig {
1897
- config: Config;
1898
- cache: Cache;
1899
- constructor();
1900
- }
1901
- export interface ICache {
1902
- printers: string[];
1903
- }
1904
- export class Cache implements ICache {
1905
- printers: any[];
1906
- constructor();
1907
- }
1908
- export interface IConfig {
1909
- /** General setting */
1910
- general: IGeneralConfig;
1911
- /** Till setting */
1912
- till: ITillConfig;
1913
- /** Report setting */
1914
- report: IReportConfig;
1915
- /** Receipt setting */
1916
- receipt: IReceiptConfig;
1917
- /** Kitchen slip setting */
1918
- kitchen: IKitchenConfig;
1919
- /** KDS setting */
1920
- label: ILabelConfig;
1921
- /** Order setting */
1922
- order: IOrderConfig;
1923
- /** Payment setting */
1924
- payment: IPaymentConfig;
1925
- /** User setting */
1926
- user: IUserConfig;
1927
- /** Service charge setting */
1928
- /** Tax setting */
1929
- tax: ITaxConfig;
1930
- /** Rounding setting */
1931
- rounding: IRoundingConfig;
1932
- /** Charge setting */
1933
- charges: IChargeConfig;
1934
- /** Currency setting */
1935
- currency: ICurrencyConfig;
1936
- /** Inventory setting */
1937
- inventory: IInventoryConfig;
1938
- /** Pax setting */
1939
- pax_config: IPaxConfig;
1940
- /** Gto setting */
1941
- gto: IGtoConfig;
1942
- /** Cash drawer setting */
1943
- cash_drawer: ICashDrawerConfig;
1944
- /** Marketing setting */
1945
- marketing: IMarketing;
1946
- /** KDS setting */
1947
- kds: IKdsConfig;
1948
- /** Customer display system setting */
1949
- cds: ICustomerDisplaySystemConfig;
1950
- /** Kiosk system setting */
1951
- kiosk: IKioskSystemConfig;
1952
- /** Online order setting */
1953
- online_order: IOnlineOrderConfig;
1954
- }
1955
- export interface ICustomerDisplaySystemConfig {
1956
- full_screen_assets: string[];
1957
- half_screen_assets: string[];
1958
- }
1959
- export class CustomerDisplaySystemConfig implements ICustomerDisplaySystemConfig {
1960
- full_screen_assets: any[];
1961
- half_screen_assets: any[];
1962
- constructor();
1963
- }
1964
- export interface IKioskSystemConfig {
1965
- takeaway_only: boolean;
1966
- guest_order_only: boolean;
1967
- disable_paynow_payment: boolean;
1968
- disable_card_payment: boolean;
1969
- }
1970
- export class KioskSystemConfig implements IKioskSystemConfig {
1971
- takeaway_only: boolean;
1972
- guest_order_only: boolean;
1973
- disable_paynow_payment: boolean;
1974
- disable_card_payment: boolean;
1975
- constructor();
1976
- }
1977
- export interface IMarketing {
1978
- /** Marketing Point Configuration */
1979
- point: IPoint;
1980
- /** Marketing Credit Configuration */
1981
- credit: ICredit;
1982
- }
1983
- export interface ICredit {
1984
- /** Indicates if SMS notification is enabled */
1985
- sms_notification: boolean;
1986
- /** Threshold for invoices to apply credits */
1987
- above_invoice_amount: number;
1988
- /** Rate of conversion for credits */
1989
- conversion_rate: number;
1990
- /** Whether service charge is inclusive */
1991
- inclusive_service_charge: boolean;
1992
- /** Whether tax is inclusive */
1993
- inclusive_tax: boolean;
1994
- }
1995
- export interface IPoint {
1996
- /** Indicates if SMS notification is enabled */
1997
- sms_notification: boolean;
1998
- /** Threshold for invoices to apply points */
1999
- above_invoice_amount: number;
2000
- /** Rate of conversion for points */
2001
- conversion_rate: number;
2002
- /** Whether service charge is inclusive */
2003
- inclusive_service_charge: boolean;
2004
- /** Whether tax is inclusive */
2005
- inclusive_tax: boolean;
2006
- }
2007
- export class MarketingConfig implements IMarketing {
2008
- point: IPoint;
2009
- credit: ICredit;
2010
- constructor();
2011
- }
2012
- export class Config implements IConfig {
2013
- general: GeneralConfig;
2014
- till: TillConfig;
2015
- report: ReportConfig;
2016
- receipt: Receipt;
2017
- kitchen: KitchenConfig;
2018
- kds: KdsConfig;
2019
- label: LabelConfig;
2020
- order: OrderConfig;
2021
- payment: PaymentConfig;
2022
- user: UserConfig;
2023
- tax: TaxConfig;
2024
- rounding: RoundingConfig;
2025
- inventory: InventoryConfig;
2026
- pax_config: PaxConfig;
2027
- gto: GTOConfig;
2028
- cash_drawer: CashDrawerConfig;
2029
- marketing: MarketingConfig;
2030
- charges: ChargeConfig;
2031
- currency: CurrencyConfig;
2032
- cds: CustomerDisplaySystemConfig;
2033
- kiosk: KioskSystemConfig;
2034
- online_order: OnlineOrderConfig;
2035
- constructor();
2036
- }
2037
- export interface IOnlineOrderConfig {
2038
- menu_banner_image_url: string;
2039
- }
2040
- export class OnlineOrderConfig implements IOnlineOrderConfig {
2041
- menu_banner_image_url: string;
2042
- constructor();
2043
- }
2044
- export interface IGeneralConfig {
2045
- /**
2046
- * The default language for system interfaces and communications.
2047
- */
2048
- language: string;
2049
- /**
2050
- * The official registered name of the company using the system.
2051
- */
2052
- company_name: string;
2053
- /**
2054
- * An alternative name or shorthand for the company used for convenience.
2055
- */
2056
- company_name_alias: string;
2057
- /**
2058
- * The logo of the company
2059
- */
2060
- company_logo: string;
2061
- /**
2062
- * The official tax identification number for the company, used for legal and financial documentation.
2063
- */
2064
- company_tax_reg_no: string;
2065
- /**
2066
- * The postal code where the company's primary office or headquarters is located.
2067
- */
2068
- company_postcode: string;
2069
- /**
2070
- * The full street address of the company's primary location.
2071
- */
2072
- company_address: string;
2073
- /**
2074
- * The country in which the company is legally registered and operates.
2075
- */
2076
- company_country: string;
2077
- /**
2078
- * The main contact telephone number for the company.
2079
- */
2080
- company_tel: string;
2081
- /**
2082
- * The name assigned to the table layout or map within the floor plan of the establishment.
2083
- * @ignore
2084
- */
2085
- floor_plan_table_name: string;
2086
- /**
2087
- * The software distribution channel used for the deployment of updates or the application itself.
2088
- * @ignore
2089
- */
2090
- deploy_channel: DeployChannel;
2091
- /**
2092
- * A flag indicating whether the system should run in debug mode for troubleshooting and development purposes.
2093
- * @ignore
2094
- */
2095
- debug: boolean;
2096
- /**
2097
- * A flag that indicates whether system events should be logged for review and auditing purposes.
2098
- * @ignore
2099
- */
2100
- logging: boolean;
2101
- /**
2102
- * A setting that determines whether the system is capable of operating without an active internet connection.
2103
- * @ignore
2104
- */
2105
- offline_mode: boolean;
2106
- /**
2107
- * Business schedules
2108
- * @ignore
2109
- */
2110
- opening_schedules: Schedule[];
2111
- }
2112
- export type UpdateGeneralConfigOptions = {
2113
- [P in keyof IGeneralConfig]?: IGeneralConfig[P];
2114
- };
2115
- export enum DeployChannel {
2116
- PROD = "prod",
2117
- DEV = "dev"
2118
- }
2119
- export class GeneralConfig implements IGeneralConfig {
2120
- /** Name of the company */
2121
- company_name: string;
2122
- /** Alias for the company name */
2123
- company_name_alias: string;
2124
- /** Logo of the company */
2125
- company_logo: string;
2126
- /** Tax registration number of the company */
2127
- company_tax_reg_no: string;
2128
- /** Postcode of the company */
2129
- company_postcode: string;
2130
- /** Address of the company */
2131
- company_address: string;
2132
- /** Country of the company */
2133
- company_country: string;
2134
- /** Telephone number of the company */
2135
- company_tel: string;
2136
- /** Name of the floor plan table */
2137
- floor_plan_table_name: string;
2138
- /** Deployment channel */
2139
- deploy_channel: DeployChannel;
2140
- /** Language setting */
2141
- language: string;
2142
- /** Debug mode status */
2143
- debug: boolean;
2144
- /** Logging status */
2145
- logging: boolean;
2146
- /** Offline mode status */
2147
- offline_mode: boolean;
2148
- /** Open schedule */
2149
- opening_schedules: Schedule[];
2150
- constructor();
2151
- }
2152
- export type OpenHours = {
2153
- open: string;
2154
- close: string;
2155
- };
2156
- export type DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
2157
- export type SpecialDay = {
2158
- date: string;
2159
- hours: OpenHours[];
2160
- };
2161
- export type Holiday = {
2162
- name: string;
2163
- date: string;
2164
- };
2165
- export type BreakPeriod = {
2166
- days: DayOfWeek[];
2167
- time: {
2168
- start: string;
2169
- end: string;
2170
- };
2171
- };
2172
- export type Schedule = {
2173
- opening_hours: OpenHours;
2174
- };
2175
- export interface ITillConfig {
2176
- /** Control flag for Till */
2177
- control: boolean;
2178
- /** Slip flag for Till */
2179
- slip: boolean;
2180
- }
2181
- export class TillConfig implements ITillConfig {
2182
- /** Control flag for Till */
2183
- control: boolean;
2184
- /** Slip flag for Till */
2185
- slip: boolean;
2186
- constructor();
2187
- }
2188
- export interface IReportConfig {
2189
- /** Flag for itemized consolidated report */
2190
- itemized_consolidated: boolean;
2191
- /** Itemized separated report value */
2192
- itemized_separated: string;
2193
- /** Flag for shift itemized report */
2194
- shift_itemized: boolean;
2195
- /** Start time for report */
2196
- start_time: string;
2197
- /** End time for report */
2198
- end_time: string;
2199
- /** Time for shift print */
2200
- shift_print_time: number;
2201
- /** Flag to disable shift */
2202
- shift_disable: boolean;
2203
- /** Flag for email report */
2204
- email: boolean;
2205
- }
2206
- export class ReportConfig implements IReportConfig {
2207
- itemized_consolidated: boolean;
2208
- itemized_separated: string;
2209
- shift_itemized: boolean;
2210
- start_time: string;
2211
- end_time: string;
2212
- shift_print_time: number;
2213
- shift_disable: boolean;
2214
- email: boolean;
2215
- constructor();
2216
- }
2217
- export interface IReceiptConfig {
2218
- enabled: boolean;
2219
- show_print_dialog: boolean;
2220
- print_docket: boolean;
2221
- hide_non_price_item: boolean;
2222
- receipt_no_reset_daily: boolean;
2223
- language: string;
2224
- }
2225
- export class Receipt implements IReceiptConfig {
2226
- enabled: boolean;
2227
- show_print_dialog: boolean;
2228
- print_docket: boolean;
2229
- hide_non_price_item: boolean;
2230
- receipt_no_reset_daily: boolean;
2231
- language: string;
2232
- constructor();
2233
- }
2234
- export interface IKitchenConfig {
2235
- /** Flag to print */
2236
- enabled: boolean;
2237
- /** Flag to print slip price */
2238
- print_item_price: boolean;
2239
- /** Flag to print cancel slip */
2240
- print_cancel_slip: boolean;
2241
- /**
2242
- * The language to use for the kitchen slip.
2243
- */
2244
- language: string;
2245
- }
2246
- export class KitchenConfig implements IKitchenConfig {
2247
- enabled: boolean;
2248
- print_item_price: boolean;
2249
- print_cancel_slip: boolean;
2250
- language: string;
2251
- constructor();
2252
- }
2253
- export interface IKdsConfig {
2254
- enabled: boolean;
2255
- /** Display order after payment */
2256
- display_order_after_payment: boolean;
2257
- /** Print slip upon completion */
2258
- print_slip_upon_completed: boolean;
2259
- }
2260
- export class KdsConfig implements IKdsConfig {
2261
- enabled: boolean;
2262
- display_order_after_payment: boolean;
2263
- print_slip_upon_completed: boolean;
2264
- constructor();
2265
- }
2266
- export interface ILabelConfig {
2267
- /** Flag for printing the label */
2268
- print: boolean;
2269
- }
2270
- export class LabelConfig implements ILabelConfig {
2271
- print: boolean;
2272
- constructor();
2273
- }
2274
- export interface IOrderConfig {
2275
- /** Separation line for order */
2276
- separation_line: boolean;
2277
- /** Slip for order */
2278
- slip: boolean;
2279
- /** Font size ratio for the slip */
2280
- slip_font_size_ratio: number;
2281
- /** Maximum dining time in minutes */
2282
- max_dinning: number;
2283
- /** Flag to exit the menu after payment */
2284
- exit_menu_after_payment: boolean;
2285
- }
2286
- export class OrderConfig implements IOrderConfig {
2287
- separation_line: boolean;
2288
- slip: boolean;
2289
- slip_font_size_ratio: number;
2290
- max_dinning: number;
2291
- exit_menu_after_payment: boolean;
2292
- constructor();
2293
- }
2294
- export interface IPaymentConfig {
2295
- /** Quick cash payment */
2296
- quick_cash_payment: boolean;
2297
- /** Notification for payment */
2298
- notification: boolean;
2299
- /** Quick payment option */
2300
- quick: boolean;
2301
- }
2302
- export class PaymentConfig implements IPaymentConfig {
2303
- quick_cash_payment: boolean;
2304
- notification: boolean;
2305
- quick: boolean;
2306
- constructor();
2307
- }
2308
- export interface IUserConfig {
2309
- /** Control for the user */
2310
- control: boolean;
2311
- }
2312
- export class UserConfig implements IUserConfig {
2313
- control: boolean;
2314
- constructor();
2315
- }
2316
- export interface ITaxConfig {
2317
- /** Tax applicable flag */
2318
- enabled: boolean;
2319
- /** Method for the tax */
2320
- method: TaxMethod;
2321
- /** Rate of the tax */
2322
- rate: number;
2323
- /** Name of the tax */
2324
- name: string;
2325
- }
2326
- export class TaxConfig implements ITaxConfig {
2327
- enabled: boolean;
2328
- method: TaxMethod;
2329
- rate: number;
2330
- name: string;
2331
- constructor();
2332
- }
2333
- export interface IRoundingConfig {
2334
- /** Base for rounding */
2335
- base: number;
2336
- /** Rounding up flag */
2337
- up: boolean;
2338
- /** Cashless rounding flag */
2339
- cashless: boolean;
2340
- }
2341
- export interface IChargeConfig {
2342
- service_charge: boolean;
2343
- service_charge_rate: number;
2344
- }
2345
- export class ChargeConfig implements IChargeConfig {
2346
- service_charge: boolean;
2347
- service_charge_rate: number;
2348
- constructor();
2349
- }
2350
- export interface ICurrencyConfig {
2351
- currency_symbol: string;
2352
- }
2353
- export class CurrencyConfig implements ICurrencyConfig {
2354
- currency_symbol: string;
2355
- constructor();
2356
- }
2357
- export class RoundingConfig implements IRoundingConfig {
2358
- base: number;
2359
- up: boolean;
2360
- cashless: boolean;
2361
- constructor();
2362
- }
2363
- /** Inventory Configuration */
2364
- export interface IInventoryConfig {
2365
- /** Control flag for inventory */
2366
- control: boolean;
2367
- }
2368
- export class InventoryConfig implements IInventoryConfig {
2369
- control: boolean;
2370
- constructor();
2371
- }
2372
- /** Pax Configuration */
2373
- export interface IPaxConfig {
2374
- /** Pax flag */
2375
- pax: boolean;
2376
- /** Detail flag for Pax */
2377
- detail: boolean;
2378
- }
2379
- export class PaxConfig implements IPaxConfig {
2380
- pax: boolean;
2381
- detail: boolean;
2382
- constructor();
2383
- }
2384
- /** GTO Configuration */
2385
- export interface IGtoConfig {
2386
- /** Interface type */
2387
- interface: string;
2388
- /** Genesis date */
2389
- genesis_date: string;
2390
- /** Upload time */
2391
- upload_time: string;
2392
- /** FTP server */
2393
- ftp_svr: string;
2394
- /** FTP user */
2395
- ftp_usr: string;
2396
- /** FTP port */
2397
- ftp_port: string;
2398
- /** FTP path */
2399
- ftp_path: string;
2400
- /** FTP password */
2401
- ftp_pwd: string;
2402
- /** Mall ID */
2403
- mall_id: string;
2404
- /** Machine ID */
2405
- machine_id: string;
2406
- /** FTP type */
2407
- ftp_type: string;
2408
- }
2409
- export class GTOConfig implements IGtoConfig {
2410
- interface: string;
2411
- genesis_date: string;
2412
- upload_time: string;
2413
- ftp_svr: string;
2414
- ftp_usr: string;
2415
- ftp_port: string;
2416
- ftp_path: string;
2417
- ftp_pwd: string;
2418
- mall_id: string;
2419
- machine_id: string;
2420
- ftp_type: string;
2421
- constructor();
2422
- }
2423
- /** CashDrawer Configuration */
2424
- export interface ICashDrawerConfig {
2425
- /** CashDrawer code */
2426
- kick_code: string;
2427
- /** Connection mode */
2428
- connection_mode: 'via_receipt_printer' | 'via_imin_pos';
2429
- }
2430
- export class CashDrawerConfig implements ICashDrawerConfig {
2431
- /**
2432
- * The kick code for the cash drawer.
2433
- */
2434
- kick_code: string;
2435
- /** Connection mode */
2436
- connection_mode: 'via_receipt_printer' | 'via_imin_pos';
2437
- /**
2438
- * Creates a new instance of the CashDrawerConfig class.
2439
- */
2440
- constructor();
2441
- }
2442
-
2443
- }
2444
- declare module '@posx/core/types/employee.type' {
2445
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
2446
- export interface IEmployee extends IAppCoreModel {
2447
- /** User ID */
2448
- user_uid: string;
2449
- /** User name */
2450
- name: string;
2451
- /** User email */
2452
- email: string;
2453
- /** 6 digits of password */
2454
- password: string;
2455
- /** role uid */
2456
- role_uid: string;
2457
- /** language preference */
2458
- language: string;
2459
- }
2460
- export class Employee extends AppCoreModel implements IEmployee {
2461
- user_uid: string;
2462
- name: string;
2463
- email: string;
2464
- password: string;
2465
- uid: string;
2466
- role_uid: string;
2467
- language: string;
2468
- constructor();
2469
- }
2470
-
2471
- }
2472
- declare module '@posx/core/types/invoice.type' {
2473
- import { IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
2474
- import { IPayment } from '@posx/core/types/payment.type';
2475
- import { CoreItem, ICoreItem, IItem, Item } from '@posx/core/types/product.type';
2476
- import { Address, Customer, IAddress, ICustomer } from '@posx/core/types/wyo.customer.type';
2477
- import { ISectionItem } from '@posx/core/types/section.type';
2478
- import { ITill } from '@posx/core/types/shift.type';
2479
- import { IPrintJob } from '@posx/core/types/printer.type';
2480
- import { Condition } from '@posx/core/types/condition.type';
2481
- export enum InvoiceType {
2482
- DineIn = "dine_in",
2483
- TakeOut = "take_out",
2484
- Delivery = "delivery"
2485
- }
2486
- export enum TaxMethod {
2487
- Inclusive = "inclusive",
2488
- Exclusive = "exclusive"
2489
- }
2490
- export enum InvoiceStatus {
2491
- Open = "open",
2492
- OnHold = "on_hold",
2493
- Paying = "paying",
2494
- Paid = "paid",
2495
- Void = "void"
2496
- }
2497
- export enum InvoiceAction {
2498
- Calibration = "calibration",
2499
- Create = "create",
2500
- Update = "update",
2501
- Cancel = "cancel",
2502
- Hold = "hold",
2503
- PaymentAsync = "payment_async",
2504
- Check = "check",
2505
- Void = "void",
2506
- Switch = "switch",
2507
- Reprint = "reprint",
2508
- Display = "display",
2509
- Merge = "merge",
2510
- Calculate = "calculate",
2511
- Delivery = "delivery",
2512
- Payment = "payment",
2513
- ChangePayment = "change_payment",
2514
- AddCustomer = "add_customer",
2515
- VoidAndDuplicate = "void_and_duplicate",
2516
- Duplicate = "duplicate"
2517
- }
2518
- export enum UomType {
2519
- quantity = "quantity",
2520
- weight = "weight"
2521
- }
2522
- export enum CalcType {
2523
- Flat = "flat",
2524
- Percent = "percent"
2525
- }
2526
- export enum CalcFlow {
2527
- AfterSubtotal = "after_subtotal",
2528
- AfterServiceCharge = "after_service_charge",
2529
- AfterGrantTotal = "after_grant_total"
2530
- }
2531
- export enum DiscountType {
2532
- Custom = "custom",
2533
- Voucher = "voucher",
2534
- Coupon = "coupon"
2535
- }
2536
- /**
2537
- * Interface for invoice charge items
2538
- */
2539
- export interface IInvoiceCharge {
2540
- /** Charge unique id */
2541
- uid: string;
2542
- /** Charge name */
2543
- name: string;
2544
- /** Charge amount */
2545
- percentage: number;
2546
- /** Charge amount */
2547
- amount: number;
2548
- /** Charge calculation flow */
2549
- calc_flow: CalcFlow;
2550
- }
2551
- export class InvoiceCharge implements IInvoiceCharge {
2552
- uid: string;
2553
- name: string;
2554
- percentage: number;
2555
- amount: number;
2556
- calc_flow: CalcFlow;
2557
- }
2558
- export interface IInvoiceActivity {
2559
- /** Action */
2560
- action: InvoiceAction;
2561
- /** Action by */
2562
- action_by: string;
2563
- /** Device unique id */
2564
- device_uid: string;
2565
- /** Action at */
2566
- action_at: Date;
2567
- }
2568
- export class InvoiceActivity {
2569
- action: InvoiceAction;
2570
- action_by: string;
2571
- device_uid: string;
2572
- action_at: Date;
2573
- }
2574
- export interface IDiscount {
2575
- uid: string;
2576
- calc_type: CalcType;
2577
- amount: number;
2578
- percent: number;
2579
- percent_amount: number;
2580
- }
2581
- export interface ICharge {
2582
- uid: string;
2583
- name: string;
2584
- percent: number;
2585
- calc_flow: CalcFlow;
2586
- trigger_condition: Condition | string;
2587
- }
2588
- export class Charge implements ICharge {
2589
- uid: string;
2590
- name: string;
2591
- percent: number;
2592
- calc_flow: CalcFlow;
2593
- trigger_condition: string;
2594
- }
2595
- export interface IInvoiceDiscount extends IDiscount {
2596
- /** the name can be the voucher or coupon name */
2597
- name?: string;
2598
- /** Discount Type */
2599
- type: DiscountType;
2600
- /** Discount unique id */
2601
- voucher_uid?: string;
2602
- /** Discount unique id */
2603
- coupon_uid?: string;
2604
- /** Calculation flow */
2605
- calc_flow: CalcFlow;
2606
- }
2607
- export class InvoiceDiscount implements IInvoiceDiscount {
2608
- calc_type: CalcType;
2609
- amount: number;
2610
- percent: number;
2611
- percent_amount: number;
2612
- type: DiscountType;
2613
- calc_flow: CalcFlow;
2614
- name: string;
2615
- voucher_uid: string;
2616
- coupon_uid: string;
2617
- uid: string;
2618
- }
2619
- export interface IInvoiceCoreLine {
2620
- /** Item unique id */
2621
- item_uid: string;
2622
- /** The item being sold on the line item. */
2623
- item: ICoreItem;
2624
- /** Item unit price */
2625
- price: number;
2626
- /** Unit of measure (1:quantity | 2:weight) */
2627
- unit_of_measure: UomType;
2628
- /** Quantity if it is quantity*/
2629
- quantity: number;
2630
- /** Whether it is sent to server*/
2631
- sent: number;
2632
- }
2633
- /**
2634
- * Represents a line item on an invoice.
2635
- */
2636
- export interface IInvoiceLine extends IAppCoreModel, Omit<IInvoiceCoreLine, 'item'> {
2637
- item: IItem;
2638
- /** Invoice Line unique id */
2639
- invoice_uid: string;
2640
- /** Line discount calculation type */
2641
- discount_calc_type: CalcType;
2642
- /** The amount of discount applied to the line item. */
2643
- discount_amount: number;
2644
- /** The percentage of discount applied to the line item. */
2645
- discount_percent: number;
2646
- /** The subtotal for the line item. */
2647
- subtotal: number;
2648
- /** The subtotal for the line item before any discounts were applied. */
2649
- subtotal_before_discount: number;
2650
- /** The unit price of the item. */
2651
- price: number;
2652
- /** The point value of the item. */
2653
- point: number;
2654
- /** The subtotal for the line item in points. */
2655
- point_subtotal: number;
2656
- /** The unit of measurement for the item. */
2657
- unit_of_measure: UomType;
2658
- /** The quantity of the item being sold on the line item. */
2659
- quantity: number;
2660
- /** Any additional remarks for the line item. */
2661
- remark: string;
2662
- /** Whether the item size is up-sized. */
2663
- up_size: boolean;
2664
- /** Whether the line item is for take-out. If so, the service charge is not counted. */
2665
- is_take_out: boolean;
2666
- /** Whether the line item is a duplicate. */
2667
- is_duplicate: boolean;
2668
- /** The line item that this line item is duplicated from. */
2669
- duplicated_from_uid: string;
2670
- /** Any modifiers applied to the line item. */
2671
- modifiers: IInvoiceCoreLine[];
2672
- /** Meta data for the line item */
2673
- meta: Record<string, any>;
2674
- }
2675
- export interface IInvoice extends IAppCoreModel {
2676
- /** Invoice reference number which is used for look-up */
2677
- ref_id: string;
2678
- /** The number which will be printed on kitchen slip
2679
- or receipt or display to call when order is ready */
2680
- call_num: string;
2681
- /** Table unique id */
2682
- table_uid: string;
2683
- /**
2684
- * Table name
2685
- */
2686
- table_name: string;
2687
- /** Invoice type */
2688
- type: InvoiceType;
2689
- /** Total number of people including adult, child and baby */
2690
- pax: number;
2691
- /** Number of Adult People */
2692
- adult_pax: number;
2693
- /** Number of Child People */
2694
- child_pax: number;
2695
- /** Number of Baby People */
2696
- baby_pax: number;
2697
- /** Invoice subtotal */
2698
- subtotal: number;
2699
- /** Invoice point subtotal */
2700
- point_subtotal: number;
2701
- /** Invoice subtotal applicable to service charge */
2702
- service_chargeable_subtotal: number;
2703
- /** Invoice subtotal applicable to discount */
2704
- discountable_subtotal: number;
2705
- /** Invoice service charge */
2706
- service_charge: number;
2707
- /** Online delivery id */
2708
- delivery_id: number;
2709
- /** Online delivery charge */
2710
- delivery_charge: number;
2711
- /** Online delivery type */
2712
- delivery_type: string;
2713
- /** Online delivery driver */
2714
- delivery_by: string;
2715
- /** If customer package is used in this invoice */
2716
- /** Package deduction amount */
2717
- /** If customer point is used in this invoice */
2718
- use_customer_point: boolean;
2719
- /** Add point */
2720
- add_point: number;
2721
- /** minus point */
2722
- minus_point: number;
2723
- /** rewarded point rate */
2724
- rewarded_point_rate: number;
2725
- /** Rewarded Point */
2726
- rewarded_point: number;
2727
- /** if customer balance is used in this invoice */
2728
- use_customer_balance: boolean;
2729
- /** add credit */
2730
- add_credit: number;
2731
- /** minus credit */
2732
- minus_credit: number;
2733
- /** rewarded credit rate */
2734
- rewarded_credit_rate: number;
2735
- /** Rewarded Credit */
2736
- rewarded_credit: number;
2737
- /** Discount List */
2738
- discounts: IInvoiceDiscount[];
2739
- /** Total discount amount */
2740
- discount_amount: number;
2741
- /** Tax */
2742
- tax: number;
2743
- /** Rounding */
2744
- rounding: number;
2745
- /** Tip Amount */
2746
- tip: number;
2747
- /** Grand Total */
2748
- grand_total: number;
2749
- /** Customer ID */
2750
- customer_id: number;
2751
- /** Remark */
2752
- remark: string;
2753
- /** Sales User ID */
2754
- sales_user_uid: string;
2755
- /** Status */
2756
- status: InvoiceStatus;
2757
- /** Payment Method */
2758
- paid_at: Date;
2759
- /** Human readable date */
2760
- humanized_paid_at: string;
2761
- /** Payment Method */
2762
- voided_at: Date;
2763
- /** Human readable date */
2764
- humanized_voided_at: string;
2765
- humanized_created_at: string;
2766
- /** Order ID */
2767
- order_id: number;
2768
- /** To Address */
2769
- to_address: IAddress;
2770
- /** Payment Source Method */
2771
- payment_source_method: string;
2772
- /** Payment Source Last4 */
2773
- payment_source_last4: string;
2774
- /** Payment Source Charge Reference */
2775
- payment_source_charge_ref: string;
2776
- /** Is Sales Exclusive */
2777
- is_sales_exclusive: boolean;
2778
- /** Etc */
2779
- etc: Record<string, any>;
2780
- /** Action */
2781
- action: InvoiceAction;
2782
- /** Invoice Lines */
2783
- lines: IInvoiceLine[];
2784
- /** Deleted invoice lines */
2785
- deleted_lines: IInvoiceLine[];
2786
- /** Invoice Signature */
2787
- /**
2788
- * if invoice payments has cash payment
2789
- */
2790
- payment_has_cash: boolean;
2791
- /** Payment */
2792
- payments: IPayment[];
2793
- /** Table Switch ID */
2794
- table_switch_id: number;
2795
- /** Customer Spend */
2796
- /** Reservation */
2797
- /** Receipt Print Override */
2798
- employee_uid: string;
2799
- /**Employee Name */
2800
- employee_name: string;
2801
- receipt_print_override: boolean;
2802
- /** Customer */
2803
- customer: ICustomer;
2804
- /** Is Duplicate */
2805
- is_duplicate: boolean;
2806
- /** Kitchen Print Override */
2807
- kitchen_print_override: boolean;
2808
- /** OTP */
2809
- otp: string;
2810
- /** Invoice Activity */
2811
- activities: any[];
2812
- /** Receipt printer unique id */
2813
- receipt_print_job_uid: string;
2814
- /** Additional charges */
2815
- charges: IInvoiceCharge[];
2816
- /** Flag to track if charge has been manually deleted by user */
2817
- is_charge_triggered?: boolean;
2818
- }
2819
- export class InvoiceCoreLine implements IInvoiceCoreLine {
2820
- item_uid: string;
2821
- item: CoreItem;
2822
- price: number;
2823
- unit_of_measure: UomType;
2824
- quantity: number;
2825
- sent: number;
2826
- constructor();
2827
- }
2828
- export class InvoiceLine extends AppCoreModel implements IInvoiceLine {
2829
- item_uid: string;
2830
- price: number;
2831
- unit_of_measure: UomType;
2832
- quantity: number;
2833
- remark: string;
2834
- invoice_uid: string;
2835
- discount_calc_type: CalcType;
2836
- discount_amount: number;
2837
- discount_percent: number;
2838
- subtotal: number;
2839
- subtotal_before_discount: number;
2840
- item: Item;
2841
- point: number;
2842
- point_subtotal: number;
2843
- up_size: boolean;
2844
- is_take_out: boolean;
2845
- is_duplicate: boolean;
2846
- modifiers: any[];
2847
- duplicated_from_uid: string;
2848
- sent: number;
2849
- meta: {};
2850
- constructor();
2851
- }
2852
- export class Invoice extends AppCoreModel implements IInvoice {
2853
- ref_id: string;
2854
- call_num: string;
2855
- table_uid: string;
2856
- table_name: string;
2857
- type: InvoiceType;
2858
- pax: number;
2859
- adult_pax: number;
2860
- child_pax: number;
2861
- baby_pax: number;
2862
- subtotal: number;
2863
- point_subtotal: number;
2864
- service_chargeable_subtotal: number;
2865
- discountable_subtotal: number;
2866
- service_charge: number;
2867
- delivery_id: number;
2868
- delivery_charge: number;
2869
- delivery_type: string;
2870
- delivery_by: string;
2871
- use_customer_point: boolean;
2872
- add_point: number;
2873
- minus_point: number;
2874
- rewarded_point_rate: number;
2875
- rewarded_point: number;
2876
- use_customer_balance: boolean;
2877
- add_credit: number;
2878
- minus_credit: number;
2879
- rewarded_credit_rate: number;
2880
- rewarded_credit: number;
2881
- discounts: any[];
2882
- discount_amount: number;
2883
- tax: number;
2884
- rounding: number;
2885
- tip: number;
2886
- grand_total: number;
2887
- customer_id: number;
2888
- remark: string;
2889
- sales_user_uid: string;
2890
- status: InvoiceStatus;
2891
- paid_at: Date;
2892
- voided_at: Date;
2893
- humanized_paid_at: string;
2894
- humanized_voided_at: string;
2895
- humanized_created_at: string;
2896
- order_id: number;
2897
- to_address: Address;
2898
- payment_source_method: string;
2899
- payment_source_last4: string;
2900
- payment_source_charge_ref: string;
2901
- is_sales_exclusive: boolean;
2902
- etc: Record<string, any>;
2903
- action: InvoiceAction.Create;
2904
- lines: IInvoiceLine[];
2905
- deleted_lines: IInvoiceLine[];
2906
- payment_has_cash: boolean;
2907
- payments: IPayment[];
2908
- table_switch_id: number;
2909
- employee_uid: string;
2910
- employee_name: string;
2911
- receipt_print_override: boolean;
2912
- customer: Customer;
2913
- is_duplicate: boolean;
2914
- kitchen_print_override: boolean;
2915
- otp: string;
2916
- activities: any[];
2917
- receipt_print_job_uid: string;
2918
- charges: IInvoiceCharge[];
2919
- /** Flag to track if charge has been manually deleted by user */
2920
- is_charge_triggered: boolean;
2921
- uid: string;
2922
- constructor();
2923
- }
2924
- export type CreateInvoiceOptions = {
2925
- invoice: IInvoice;
2926
- section_item: ISectionItem;
2927
- print_jobs?: IPrintJob[];
2928
- };
2929
- export type CancelInvoiceOptions = CreateInvoiceOptions & {
2930
- print_jobs?: IPrintJob[];
2931
- };
2932
- export type CheckInvoiceOptions = CreateInvoiceOptions & {
2933
- print_jobs?: IPrintJob[];
2934
- };
2935
- export type UpdateInvoiceOptions = CreateInvoiceOptions;
2936
- export type SwitchInvoiceOptions = {
2937
- invoice: IInvoice;
2938
- target_section_item: ISectionItem;
2939
- source_section_item: ISectionItem;
2940
- };
2941
- export type VoidInvoiceOptions = {
2942
- invoice: IInvoice;
2943
- till: ITill;
2944
- print_jobs?: IPrintJob[];
2945
- section_item?: ISectionItem;
2946
- };
2947
- export type PayInvoiceOptions = VoidInvoiceOptions & {
2948
- section_item: ISectionItem;
2949
- print_jobs?: IPrintJob[];
2950
- };
2951
- export type DirectPayInvoiceOptions = VoidInvoiceOptions & {
2952
- print_jobs?: IPrintJob[];
2953
- };
2954
-
2955
- }
2956
- declare module '@posx/core/types/merchant.type' {
2957
- export type IMerchantAsset = {
2958
- guid: string;
2959
- name: string;
2960
- tags: AssetTags[];
2961
- asset_type: AssetType;
2962
- url: string;
2963
- created_at: Date;
2964
- };
2965
- export enum AssetType {
2966
- Image = "image",
2967
- Video = "video",
2968
- Unsupported = "unsupported"
2969
- }
2970
- export enum AssetTags {
2971
- CdsFullScreenImage = "cds_full_screen_image",
2972
- CdsHalfScreenImage = "cds_half_screen_image"
2973
- }
2974
- export type IEtc = {
2975
- assets: IMerchantAsset[];
2976
- };
2977
- export class Merchant implements IMerchant {
2978
- name: string;
2979
- address: string;
2980
- postcode: string;
2981
- tel: string;
2982
- tax_number: string;
2983
- user_id: string;
2984
- uid: string;
2985
- api_key: string;
2986
- ip_address: string;
2987
- }
2988
- export type IMerchant = {
2989
- name: string;
2990
- address: string;
2991
- postcode: string;
2992
- tel: string;
2993
- tax_number: string;
2994
- user_id: string;
2995
- uid: string;
2996
- api_key: string;
2997
- ip_address: string;
2998
- };
2999
-
3000
- }
3001
- declare module '@posx/core/types/misc.type' {
3002
- export enum ModelPrefix {
3003
- Merchant = "mnt_",
3004
- Section = "sec_",
3005
- SectionItem = "sit_",
3006
- Category = "cat_",
3007
- Subcategory = "sat_",
3008
- Item = "itm_",
3009
- ItemModifier = "iod_",
3010
- ItemModifierCategory = "imc_",
3011
- Config = "cfg_",
3012
- Device = "dev_",
3013
- Invoice = "inv_",
3014
- InvoiceLine = "iln_",
3015
- InvoiceCharge = "ich_",
3016
- Payment = "pay_",
3017
- Employee = "emp_",
3018
- Shift = "shf_",
3019
- Till = "til_",
3020
- ReportCategory = "rpc_",
3021
- Report = "rpt_",
3022
- AppReport = "apr_",
3023
- PaymentMethod = "pmd_",
3024
- PrintTemplate = "ptl_",
3025
- PrintJob = "pjb_",
3026
- Printer = "prt_",
3027
- InvoiceDiscount = "ind_",
3028
- EmployeeRole = "emr_",
3029
- OrderDisplaySystem = "ods_",
3030
- Charge = "chr_"
3031
- }
3032
- export enum ModelType {
3033
- Merchant = "mnt",
3034
- Section = "sec",
3035
- SectionItem = "sit",
3036
- Category = "cat",
3037
- Subcategory = "sat",
3038
- Item = "itm",
3039
- Config = "cfg",
3040
- Device = "dev",
3041
- Invoice = "inv"
3042
- }
3043
- export enum ServiceMode {
3044
- LOCAL = "local",
3045
- CLOUD = "cloud"
3046
- }
3047
- export interface IServiceOptions {
3048
- mode: ServiceMode;
3049
- base_url: string;
3050
- device_uid: string;
3051
- merchant_uid: string;
3052
- token: string;
3053
- database: {
3054
- version: number;
3055
- name: string;
3056
- };
3057
- }
3058
- export class ServiceOptions implements IServiceOptions {
3059
- mode: ServiceMode;
3060
- base_url: string;
3061
- device_uid: string;
3062
- merchant_uid: string;
3063
- token: string;
3064
- database: {
3065
- version: 1;
3066
- name: '';
3067
- };
3068
- }
3069
- export enum MessageType {
3070
- Data = "DataMessage",
3071
- Event = "EventMessage"
3072
- }
3073
- /** Interface for push_data */
3074
- export interface IPushData {
3075
- model: string;
3076
- /** Push Data Content */
3077
- data: string;
3078
- has_many: boolean;
3079
- type: MessageType;
3080
- }
3081
- /** Model for push_data */
3082
- export class PushData implements IPushData {
3083
- model: string;
3084
- /** Push Data Content */
3085
- data: string;
3086
- has_many: boolean;
3087
- type: MessageType;
3088
- }
3089
- export class SystemError extends Error {
3090
- constructor(message: string);
3091
- }
3092
- export type CustomResponse<T> = {
3093
- data: T;
3094
- error: ErrorMsgs | string;
3095
- error_code: number;
3096
- };
3097
- export enum ErrorMsgs {
3098
- outdatedInvoice = "outdated invoice",
3099
- outdatedSectionItem = "outdated section item",
3100
- outdatedSourceSectionItem = "outdated source section item",
3101
- outdatedTargetSectionItem = "outdated target section item"
3102
- }
3103
- export interface IFileUploadResponse {
3104
- file_url: string;
3105
- thumbnail_url: string;
3106
- }
3107
-
3108
- }
3109
- declare module '@posx/core/types/note.type' {
3110
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
3111
- import { ModelType } from '@posx/core/types/misc.type';
3112
- export type INoteGroupEntity = IAppBaseModel;
3113
- export class NoteGroupEntity extends AppBaseModel implements INoteGroupEntity {
3114
- constructor();
3115
- }
3116
- export type INoteGroup = INoteGroupEntity;
3117
- export class NoteGroup extends NoteGroupEntity {
3118
- constructor();
3119
- }
3120
- export interface INoteEntity extends IAppBaseModel {
3121
- /** Group ID */
3122
- note_group_uid: string;
3123
- /** Type of the Note */
3124
- related_model: ModelType;
3125
- /** Usage */
3126
- usage: number;
3127
- }
3128
- export class NoteEntity extends AppBaseModel implements INoteEntity {
3129
- note_group_uid: string;
3130
- related_model: ModelType;
3131
- usage: number;
3132
- constructor();
3133
- }
3134
- export type INote = INoteEntity;
3135
- export class Note extends NoteEntity {
3136
- constructor();
3137
- }
3138
-
3139
- }
3140
- declare module '@posx/core/types/ods.type' {
3141
- import { AppCoreModel, IAppCoreModel } from "@posx/core/types/abstract.type";
3142
- export interface IOrderDisplay extends IAppCoreModel {
3143
- order_number: string;
3144
- status: OrderDisplayStatus;
3145
- }
3146
- export class OrderDisplay extends AppCoreModel implements IOrderDisplay {
3147
- uid: string;
3148
- order_number: string;
3149
- status: OrderDisplayStatus;
3150
- constructor();
3151
- }
3152
- export enum OrderDisplayStatus {
3153
- Preparing = "preparing",
3154
- ReadyForPickup = "ready_for_pickup"
3155
- }
3156
-
3157
- }
3158
- declare module '@posx/core/types/payment.type' {
3159
- import { AppBaseModel, AppCoreModel, IAppBaseModel, IAppCoreModel } from "@posx/core/types/abstract.type";
3160
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
3161
- /**
3162
- * Payment Entity Interface
3163
- */
3164
- export interface IPayment extends IAppCoreModel {
3165
- /** Invoice ID */
3166
- invoice_uid: string;
3167
- /** Tender Amount */
3168
- tender_amount: number;
3169
- /** Change Amount */
3170
- change_amount: number;
3171
- /** Payment Method ID */
3172
- payment_method_uid: string;
3173
- /** Payment Method Code */
3174
- payment_method_code: string;
3175
- /** Selected Payment Method */
3176
- payment_method_name: string;
3177
- /** Selected Payment Method */
3178
- payment_method: IPaymentMethod;
3179
- }
3180
- export class Payment extends AppCoreModel implements IPayment {
3181
- invoice_uid: string;
3182
- tender_amount: number;
3183
- change_amount: number;
3184
- payment_method_uid: string;
3185
- payment_method_code: string;
3186
- payment_method_name: string;
3187
- payment_method: PaymentMethod;
3188
- uid: string;
3189
- updated_at: Date;
3190
- constructor();
3191
- }
3192
- /**
3193
- * Payment Method Entity Interface
3194
- */
3195
- export interface IPaymentMethod extends IAppBaseModel, IAppModelSequence {
3196
- /** Payment Currency ID */
3197
- payment_currency_id: number;
3198
- /** Currency Code */
3199
- currency_code: string;
3200
- /** Payment Method Code */
3201
- currency_symbol: string;
3202
- /** Payment Method Code */
3203
- payment_method_code: string;
3204
- /** Payment Name */
3205
- name: string;
3206
- /** Code Name */
3207
- codename: string;
3208
- /** Name Abbreviation */
3209
- name_abbrev: string;
3210
- /** Enable Drawer */
3211
- enable_drawer: boolean;
3212
- /** Enable Receipt */
3213
- enable_receipt: boolean;
3214
- /** Image URL */
3215
- image_url: string;
3216
- /** Is Cash */
3217
- is_cash: boolean;
3218
- /** Is Integrated */
3219
- is_integrated: boolean;
3220
- /** Is Disabled */
3221
- is_disabled: boolean;
3222
- /** Type */
3223
- type: number;
3224
- /** API ID */
3225
- api_id: string;
3226
- /** API Key */
3227
- api_key: string;
3228
- /** Is Sales Exclusive */
3229
- is_sales_exclusive: boolean;
3230
- }
3231
- export class PaymentMethod extends AppBaseModel implements IPaymentMethod {
3232
- sequence: number;
3233
- payment_currency_id: number;
3234
- currency_code: string;
3235
- currency_symbol: string;
3236
- payment_method_code: string;
3237
- name: string;
3238
- codename: string;
3239
- name_abbrev: string;
3240
- enable_drawer: boolean;
3241
- enable_receipt: boolean;
3242
- image_url: string;
3243
- is_cash: boolean;
3244
- is_integrated: boolean;
3245
- is_disabled: boolean;
3246
- type: number;
3247
- api_id: string;
3248
- api_key: string;
3249
- is_sales_exclusive: boolean;
3250
- uid: string;
3251
- constructor();
3252
- }
3253
- export interface IStandardPaymentMethod {
3254
- /** Access Token */
3255
- access_token: string | null;
3256
- /** Base64 encoded image */
3257
- image_base64: string | null;
3258
- /** Error message */
3259
- error: string | null;
3260
- /** Currency code */
3261
- currency_code: string | null;
3262
- /** Payment method code */
3263
- payment_method_code: string;
3264
- /** Codename of the payment method */
3265
- codename: string | null;
3266
- /** Abbreviated name */
3267
- name_abbrev: string | null;
3268
- /** Full name */
3269
- name: string;
3270
- /** Flag to enable drawer */
3271
- enable_drawer: boolean;
3272
- /** Flag to enable receipt */
3273
- enable_receipt: boolean;
3274
- /** Image URL */
3275
- image_url: string;
3276
- /** Flag for cash payment */
3277
- is_cash: boolean;
3278
- /** Flag for integrated payment */
3279
- is_integrated: boolean;
3280
- /** Flag to disable the payment method */
3281
- is_disabled: boolean;
3282
- /** Type of payment method */
3283
- type: number;
3284
- /** API ID */
3285
- api_id: string | null;
3286
- /** API Key */
3287
- api_key: string | null;
3288
- /** Timestamp of creation */
3289
- timestamp_create: number;
3290
- /** Timestamp of last update */
3291
- timestamp_update: number;
3292
- toPaymentMethod(): PaymentMethod;
3293
- }
3294
- export class StandardPaymentMethod implements IStandardPaymentMethod {
3295
- access_token: any;
3296
- image_base64: any;
3297
- error: any;
3298
- currency_code: any;
3299
- payment_method_code: string;
3300
- codename: any;
3301
- name_abbrev: any;
3302
- name: string;
3303
- enable_drawer: boolean;
3304
- enable_receipt: boolean;
3305
- image_url: string;
3306
- is_cash: boolean;
3307
- is_integrated: boolean;
3308
- is_disabled: boolean;
3309
- type: number;
3310
- api_id: any;
3311
- api_key: any;
3312
- timestamp_create: number;
3313
- timestamp_update: number;
3314
- toPaymentMethod(): PaymentMethod;
3315
- constructor(init?: Partial<IPaymentMethod>);
3316
- }
3317
- export type IChangePaymentMethodOption = {
3318
- source_payment: IPayment;
3319
- target_payment_method: IPaymentMethod;
3320
- };
3321
- /**
3322
- * Payment sync status enum
3323
- */
3324
- export enum PaymentStatus {
3325
- STARTED = "payment_started",
3326
- PROCESSING = "payment_processing",
3327
- COMPLETED = "payment_completed",
3328
- FAILED = "payment_failed"
3329
- }
3330
- /**
3331
- * Payment sync data interface
3332
- */
3333
- export interface IPaymentSyncData {
3334
- /** Payment unique identifier */
3335
- payment_uid: string;
3336
- /** Associated invoice ID */
3337
- invoice_uid: string;
3338
- /** Table ID */
3339
- table_uid?: string;
3340
- /** Payment status */
3341
- status: PaymentStatus;
3342
- /** Payment method */
3343
- payment_method: IPaymentMethod;
3344
- /** Payment amount */
3345
- amount: number;
3346
- /** Actual tender amount */
3347
- tender_amount?: number;
3348
- /** Change amount */
3349
- change_amount?: number;
3350
- /** Payment result */
3351
- result?: 'success' | 'failed';
3352
- /** Error message */
3353
- error_message?: string;
3354
- /** Timestamp */
3355
- timestamp: Date;
3356
- /** Employee UID */
3357
- employee_uid?: string;
3358
- /** Terminal ID */
3359
- terminal_id?: string;
3360
- }
3361
-
3362
- }
3363
- declare module '@posx/core/types/printer.type' {
3364
- import { IPrintCommand, PrintCommand } from '@posx/core/libs/escpos.printer';
3365
- import { AppBaseModel, IAppBaseModel, IAppCoreModel } from '@posx/core/types/abstract.type';
3366
- import { IConfig } from '@posx/core/types/config.type';
3367
- import { IInvoice } from '@posx/core/types/invoice.type';
3368
- import { IReportData } from '@posx/core/types/report.type';
3369
- export interface IDevice extends IAppCoreModel {
3370
- machine_name: string;
3371
- connection_id: string;
3372
- type: DeviceType;
3373
- etc: DeviceEtc;
3374
- }
3375
- export type DeviceEtc = {
3376
- fomopay_terminal_id: string;
3377
- hirector_public_key: string;
3378
- hirector_private_key: string;
3379
- };
3380
- export type INode = IDevice;
3381
- export class Device extends AppBaseModel implements IDevice {
3382
- machine_name: string;
3383
- connection_id: string;
3384
- type: DeviceType;
3385
- etc: DeviceEtc;
3386
- constructor();
3387
- }
3388
- export class Node extends AppBaseModel implements INode {
3389
- type: DeviceType;
3390
- machine_name: string;
3391
- connection_id: string;
3392
- etc: DeviceEtc;
3393
- constructor();
3394
- }
3395
- export enum DeviceType {
3396
- Client = "client",
3397
- Node = "node"
3398
- }
3399
- export enum PrinterType {
3400
- ReceiptPrinter = "receipt_printer",
3401
- CheckPrinter = "check_printer",
3402
- OrderPrinter = "order_printer",
3403
- KitchenPrinter = "kitchen_printer",
3404
- KioskPrinter = "kiosk_printer",
3405
- LabelPrinter = "label_printer"
3406
- }
3407
- export interface INodePrinter {
3408
- printer_name: string;
3409
- status: string;
3410
- port_name: string;
3411
- error: string;
3412
- }
3413
- export class NodePrinter implements INodePrinter {
3414
- printer_name: string;
3415
- status: string;
3416
- port_name: string;
3417
- error: string;
3418
- }
3419
- export enum PrinterProtocols {
3420
- ESCPOS = "ESC/POS",
3421
- TSPL = "TSPL"
3422
- }
3423
- export enum PrinterConnections {
3424
- USB = "USB",
3425
- WINDOWS_DRIVER = "WINDOWS_DRIVER",
3426
- ETHERNET = "ETHERNET",
3427
- BLUETOOTH = "BLUETOOTH",
3428
- BUILTIN = "BUILTIN"
3429
- }
3430
- export type IPrintTemplateCore = {
3431
- header: string;
3432
- body: string;
3433
- footer: string;
3434
- commands: string;
3435
- };
3436
- export class PrintTemplateCore implements IPrintTemplateCore {
3437
- header: string;
3438
- body: string;
3439
- footer: string;
3440
- commands: string;
3441
- type: PrinterType;
3442
- constructor();
3443
- }
3444
- export type IPrintTemplate = IPrintTemplateCore & IAppBaseModel & {
3445
- printer_type: PrinterType;
3446
- report_code_name: string;
3447
- };
3448
- export class PrintTemplate extends AppBaseModel implements IPrintTemplate {
3449
- header: string;
3450
- body: string;
3451
- footer: string;
3452
- commands: string;
3453
- printer_type: PrinterType;
3454
- uid: string;
3455
- report_code_name: string;
3456
- constructor();
3457
- }
3458
- export enum PrintJobStatus {
3459
- Queued = "queued",
3460
- Printed = "printed",
3461
- Failed = "failed",
3462
- Expired = "expired"
3463
- }
3464
- export interface IPrintJob extends IAppCoreModel {
3465
- printer_name: string;
3466
- /** Actual printer name using printer driver*/
3467
- driver_printer_name: string;
3468
- printer_ip: string;
3469
- printer_uid: string;
3470
- printer_type: PrinterType;
3471
- protocol: PrinterProtocols;
3472
- connection_type: PrinterConnections;
3473
- data: IPrintCommand;
3474
- commands: string;
3475
- status: PrintJobStatus;
3476
- retries: number;
3477
- save_only: boolean;
3478
- print_times: number;
3479
- printed: number;
3480
- /** Targeting which device to print */
3481
- device_uid_to_print: string;
3482
- /** Designated Table Sections */
3483
- designated_table_section_uids: string[];
3484
- /** Job ID */
3485
- job_id: number;
3486
- }
3487
- export class PrintJob extends AppBaseModel implements IPrintJob {
3488
- printer_name: string;
3489
- driver_printer_name: string;
3490
- printer_ip: string;
3491
- printer_uid: string;
3492
- printer_type: PrinterType;
3493
- protocol: PrinterProtocols;
3494
- connection_type: PrinterConnections;
3495
- data: PrintCommand;
3496
- status: PrintJobStatus;
3497
- retries: number;
3498
- commands: string;
3499
- uid: string;
3500
- save_only: boolean;
3501
- print_times: number;
3502
- printed: number;
3503
- device_uid_to_print: string;
3504
- designated_table_section_uids: any[];
3505
- job_id: number;
3506
- constructor(printer: IPrinter, printData: IPrintCommand, saveOnly?: boolean, printTimes?: number);
3507
- }
3508
- export enum PrinterStatus {
3509
- Online = "online",
3510
- Offline = "offline"
3511
- }
3512
- export interface IPrinter extends IAppBaseModel {
3513
- /** Printer terminal ID */
3514
- device_uid: string;
3515
- /** Printer type */
3516
- type: PrinterType;
3517
- /** Actual printer name using printer driver*/
3518
- driver_printer_name: string;
3519
- /** Backup printer ID */
3520
- fallback_printer_uid: number;
3521
- /** Printer protocol */
3522
- protocol: PrinterProtocols;
3523
- /** Printer connection type */
3524
- connection_type: PrinterConnections;
3525
- /** Print template UID */
3526
- print_template_uid?: string;
3527
- /** Printer IP address */
3528
- ip_address?: string;
3529
- /** Printer status */
3530
- status: PrinterStatus;
3531
- /** if it is consolidated print or itemized print when it is kitchen printer */
3532
- kitchen_itemized_print: boolean;
3533
- /** Number of times to print */
3534
- print_times: number;
3535
- /** Number of retries */
3536
- retries: number;
3537
- }
3538
- export class Printer extends AppBaseModel implements IPrinter {
3539
- device_uid: string;
3540
- type: PrinterType;
3541
- driver_printer_name: string;
3542
- fallback_printer_uid: number;
3543
- protocol: PrinterProtocols;
3544
- connection_type: PrinterConnections;
3545
- print_template_uid: string;
3546
- uid: string;
3547
- ip_address: string;
3548
- status: PrinterStatus;
3549
- kitchen_itemized_print: boolean;
3550
- print_times: number;
3551
- retries: number;
3552
- constructor();
3553
- }
3554
- export interface TemplateData {
3555
- config: IConfig;
3556
- invoice: IInvoice;
3557
- printer_name: string;
3558
- printed_at: Date;
3559
- normalized_printed_at: string;
3560
- report_data: IReportData;
3561
- }
3562
- export class TemplateData implements TemplateData {
3563
- config: IConfig;
3564
- invoice: IInvoice;
3565
- report_data: IReportData;
3566
- printer_name: string;
3567
- printed_at: Date;
3568
- normalized_printed_at: string;
3569
- }
3570
- export type IRenderPrintTemplateOptions = {
3571
- printer_name: string;
3572
- kitchen_itemized_print: boolean;
3573
- };
3574
- export class RenderPrintTemplateOptions implements IRenderPrintTemplateOptions {
3575
- printer_name: string;
3576
- kitchen_itemized_print: boolean;
3577
- }
3578
-
3579
- }
3580
- declare module '@posx/core/types/product.type' {
3581
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
3582
- import { AppCoreModel, AppExtraModel, IAppCoreModel, IAppExtraModel } from '@posx/core/types/abstract.type';
3583
- export interface IProductBase extends IAppExtraModel, IAppModelSequence {
3584
- /**
3585
- * color of the object
3586
- */
3587
- color: string;
3588
- /**
3589
- * icon of the object
3590
- */
3591
- icon: string;
3592
- /**
3593
- * meta data
3594
- * @ignore
3595
- */
3596
- meta: Record<string, any>;
3597
- /**
3598
- * extra data
3599
- * @ignore
3600
- */
3601
- etc: Record<string, any>;
3602
- /**
3603
- * assets of the product (for image, etc)
3604
- * Predefined keys that can be used by the system
3605
- */
3606
- assets: ProductPartialAssets & Record<string, any>;
3607
- /**
3608
- * config of the product
3609
- * Predefined keys that can be used by the system
3610
- */
3611
- config: ProductPartialConfig & Record<string, any>;
3612
- }
3613
- /**
3614
- * Predefined asset keys that can be used in the product assets
3615
- */
3616
- export type ProductPartialAssets = {
3617
- /**
3618
- * large image url for online order
3619
- */
3620
- online_order_large_image_url?: string;
3621
- /**
3622
- * large image thumbnail url for online order
3623
- */
3624
- online_order_large_image_thumbnail_url?: string;
3625
- /**
3626
- * large image file path for online order
3627
- */
3628
- online_order_large_image_file_path?: string;
3629
- /**
3630
- * small image url for online order
3631
- */
3632
- online_order_small_image_url?: string;
3633
- /**
3634
- * small image thumbnail url for online order
3635
- */
3636
- online_order_small_image_thumbnail_url?: string;
3637
- /**
3638
- * small image file path for online order
3639
- */
3640
- online_order_small_image_file_path?: string;
3641
- };
3642
- /**
3643
- * Predefined config keys that can be used in the product configs
3644
- */
3645
- export type ProductPartialConfig = {
3646
- /**
3647
- * display large image for online order, if false, small image will be displayed
3648
- */
3649
- online_order_display_large_image: boolean;
3650
- };
3651
- export class ProductBase extends AppExtraModel implements IProductBase {
3652
- meta: {};
3653
- etc: {};
3654
- assets: {};
3655
- config: {
3656
- online_order_display_large_image: boolean;
3657
- };
3658
- color: string;
3659
- icon: string;
3660
- sequence: number;
3661
- constructor();
3662
- }
3663
- export interface IVisibility {
3664
- system: System;
3665
- visible: boolean;
3666
- sequence: number;
3667
- }
3668
- export class Visibility implements IVisibility {
3669
- system: System;
3670
- visible: boolean;
3671
- sequence: number;
3672
- constructor();
3673
- }
3674
- export enum System {
3675
- POS = "pos",
3676
- QrCodeOrder = "qr_code_order"
3677
- }
3678
- export interface ICoreCategory extends IProductBase {
3679
- type: CategoryType;
3680
- visibility: Array<Visibility>;
3681
- /**
3682
- * maximum order quantity before you can order
3683
- */
3684
- max_order: number;
3685
- /**
3686
- * minimum order quantity before you can order
3687
- */
3688
- min_order: number;
3689
- }
3690
- export interface ICategory extends ICoreCategory {
3691
- image_url: string;
3692
- /**
3693
- * image file path
3694
- */
3695
- image_file_path: string;
3696
- /**
3697
- *
3698
- */
3699
- image_thumbnail_url: string;
3700
- /**
3701
- * image thumbnail file path
3702
- */
3703
- image_thumbnail_file_path: string;
3704
- /** if category has subcategory */
3705
- has_subcategory: boolean;
3706
- /** Printing sequence number */
3707
- printing_sequence: number;
3708
- /**
3709
- * subcategories of the category
3710
- */
3711
- subcategories: Array<ISubcategory>;
3712
- }
3713
- export enum CategoryType {
3714
- Product = "product",
3715
- Modifier = "modifier"
3716
- }
3717
- export class CoreCategory extends ProductBase implements ICoreCategory {
3718
- type: CategoryType;
3719
- visibility: Visibility[];
3720
- uid: string;
3721
- max_order: number;
3722
- min_order: number;
3723
- constructor();
3724
- }
3725
- export class Category extends ProductBase implements ICategory {
3726
- image_url: string;
3727
- image_file_path: string;
3728
- image_thumbnail_url: string;
3729
- image_thumbnail_file_path: string;
3730
- has_subcategory: boolean;
3731
- name_translations: Record<string, string>;
3732
- visibility: Visibility[];
3733
- printing_sequence: number;
3734
- type: CategoryType;
3735
- subcategories: any[];
3736
- uid: string;
3737
- max_order: number;
3738
- min_order: number;
3739
- constructor();
3740
- }
3741
- export interface ISubcategory extends IProductBase {
3742
- /** Category ID */
3743
- category_uid: string;
3744
- }
3745
- export class Subcategory extends ProductBase implements ISubcategory {
3746
- category_uid: string;
3747
- uid: string;
3748
- constructor();
3749
- }
3750
- export enum ProductType {
3751
- ByQuantity = "by_quantity",
3752
- ByWeight = "by_weight",
3753
- Service = "service",
3754
- Combo = "combo",
3755
- Modifier = "modifier",
3756
- Package = "package"
3757
- }
3758
- /**
3759
- * Interface for a core item, which extends the IProductBase interface.
3760
- */
3761
- export interface ICoreItem extends IProductBase {
3762
- /**
3763
- * Rank of the item
3764
- */
3765
- image_url: string;
3766
- /**
3767
- * image file path
3768
- */
3769
- image_file_path: string;
3770
- /**
3771
- * @ignore
3772
- */
3773
- image_thumbnail_url: string;
3774
- /**
3775
- * image thumbnail file path
3776
- */
3777
- image_thumbnail_file_path: string;
3778
- /**
3779
- * The SKU (stock keeping unit) of the item.
3780
- */
3781
- sku: string;
3782
- /**
3783
- * The type of product.
3784
- */
3785
- type: ProductType;
3786
- /**
3787
- * The visibility of the item.
3788
- */
3789
- visibility: Array<Visibility>;
3790
- /**
3791
- * The barcode of the item.
3792
- */
3793
- barcode: string;
3794
- /**
3795
- * The price of the item.
3796
- */
3797
- price: number;
3798
- /**
3799
- * The unique identifier of the category that the item belongs to.
3800
- */
3801
- category_uid: string;
3802
- /**
3803
- * The current stock level of the item.
3804
- * @ignore
3805
- */
3806
- stock: number;
3807
- /**
3808
- * Whether or not the item is sold out.
3809
- */
3810
- is_sold_out: boolean;
3811
- /**
3812
- * Whether or not the item should be printed on the receipt.
3813
- */
3814
- print_on_receipt: boolean;
3815
- /**
3816
- * Whether or not the price of the item can be adjusted.
3817
- */
3818
- price_adjustable: boolean;
3819
- }
3820
- export class CoreItem extends ProductBase implements ICoreItem {
3821
- image_url: string;
3822
- image_file_path: string;
3823
- image_thumbnail_url: string;
3824
- image_thumbnail_file_path: string;
3825
- visibility: Visibility[];
3826
- sku: string;
3827
- type: ProductType;
3828
- barcode: string;
3829
- category_uid: string;
3830
- price: number;
3831
- stock: number;
3832
- print_on_receipt: boolean;
3833
- price_adjustable: boolean;
3834
- is_sold_out: boolean;
3835
- uid: string;
3836
- constructor();
3837
- }
3838
- /**
3839
- * Items
3840
- */
3841
- export interface IItem extends ICoreItem {
3842
- /**
3843
- * Codename of the item
3844
- */
3845
- codename: string;
3846
- /**
3847
- * Recipe of the item
3848
- */
3849
- recipe: string;
3850
- /**
3851
- * Credit value of the item
3852
- */
3853
- add_credit: number;
3854
- /**
3855
- * Subcategory ID of the item
3856
- */
3857
- subcategory_uid: string;
3858
- /**
3859
- * Unit of the item
3860
- * @ignore
3861
- */
3862
- unit: number;
3863
- /**
3864
- * Number of items sold
3865
- * @ignore
3866
- */
3867
- sold: number;
3868
- /**
3869
- * if editor will be opened by default when item is clicked
3870
- */
3871
- open_editor: boolean;
3872
- /**
3873
- * how many points will be used to purchase the item
3874
- */
3875
- minus_point: number;
3876
- /**
3877
- * Cost of the item
3878
- */
3879
- cost: number;
3880
- /**
3881
- * Indicates whether the item is discountable
3882
- */
3883
- discountable: boolean;
3884
- /**
3885
- * Printing sequence of the item
3886
- * @ignore
3887
- */
3888
- printing_sequence: number;
3889
- /**
3890
- * Number of likes for the item
3891
- * @ignore
3892
- */
3893
- likes: number;
3894
- /**
3895
- * Number of dislikes for the item
3896
- * @ignore
3897
- */
3898
- dislikes: number;
3899
- /**
3900
- * if the item is recommended
3901
- */
3902
- recommended: boolean;
3903
- /**
3904
- * Indicates whether the item is tax exempt
3905
- */
3906
- is_tax_exempt: boolean;
3907
- /**
3908
- * Indicates whether the item is service charge exempt
3909
- */
3910
- is_service_charge_exempt: boolean;
3911
- /**
3912
- * Indicates whether the item is point reward exempt
3913
- */
3914
- is_point_reward_exempt: boolean;
3915
- /**
3916
- * Indicates whether the item is credit reward exempt
3917
- */
3918
- is_credit_reward_exempt: boolean;
3919
- /**
3920
- * Indicates whether the item is internal and displayed in the POS only
3921
- */
3922
- is_internal: boolean;
3923
- /**
3924
- * Modifier IDs of the item
3925
- */
3926
- modifiers?: Array<ICoreItem>;
3927
- /**
3928
- * Modifier Group IDs of the item
3929
- */
3930
- modifier_categories?: Array<ICoreCategory>;
3931
- /**
3932
- * Kitchen printer IDs of the item
3933
- */
3934
- kitchen_printers_uids: Array<string>;
3935
- /**
3936
- * Order printer IDs of the item
3937
- */
3938
- order_printers_uids: Array<string>;
3939
- /**
3940
- * Label printer IDs of the item
3941
- */
3942
- label_printers_uids: Array<string>;
3943
- /**
3944
- * if editor will be opened by default when item is clicked
3945
- */
3946
- open_editor_panel: boolean;
3947
- /**
3948
- * if price editor will be opened by default when item is clicked
3949
- */
3950
- open_price_editor: boolean;
3951
- }
3952
- export class Item extends ProductBase implements IItem {
3953
- image_url: string;
3954
- image_file_path: string;
3955
- image_thumbnail_url: string;
3956
- image_thumbnail_file_path: string;
3957
- visibility: Visibility[];
3958
- codename: string;
3959
- sku: string;
3960
- recipe: string;
3961
- barcode: string;
3962
- type: ProductType;
3963
- add_credit: number;
3964
- category_uid: string;
3965
- subcategory_uid: string;
3966
- unit: number;
3967
- stock: number;
3968
- is_sold_out: boolean;
3969
- sold: number;
3970
- print_on_receipt: boolean;
3971
- price: number;
3972
- open_editor: boolean;
3973
- price_adjustable: boolean;
3974
- minus_point: number;
3975
- cost: number;
3976
- discountable: boolean;
3977
- printing_sequence: number;
3978
- recommended: boolean;
3979
- likes: number;
3980
- dislikes: number;
3981
- is_tax_exempt: boolean;
3982
- is_service_charge_exempt: boolean;
3983
- is_point_reward_exempt: boolean;
3984
- is_credit_reward_exempt: boolean;
3985
- is_internal: boolean;
3986
- uid: string;
3987
- kitchen_printers_uids: any[];
3988
- order_printers_uids: any[];
3989
- label_printers_uids: any[];
3990
- open_editor_panel: boolean;
3991
- open_price_editor: boolean;
3992
- constructor();
3993
- }
3994
- export interface IPrice extends IAppCoreModel {
3995
- /** keys to look up the price */
3996
- lookup_keys: Array<string>;
3997
- /** product uid*/
3998
- product_uid: string;
3999
- /** price of the item */
4000
- amount: number;
4001
- }
4002
- export class Price extends AppCoreModel implements IPrice {
4003
- lookup_keys: any[];
4004
- product_uid: string;
4005
- amount: any;
4006
- constructor();
4007
- }
4008
-
4009
- }
4010
- declare module '@posx/core/types/report.type' {
4011
- import { IAppBase, IAppCoreModel, AppCoreModel } from '@posx/core/types/abstract.type';
4012
- import { IConfig } from '@posx/core/types/config.type';
4013
- export type IReportCategory = IAppBase & {
4014
- reports: IReport[];
4015
- };
4016
- export type IReport = IAppBase & {
4017
- type: ReportType;
4018
- codename: string;
4019
- };
4020
- export enum ReportType {
4021
- 'printable' = 0,
4022
- 'generative' = 1
4023
- }
4024
- export class ReportCategory implements IReportCategory {
4025
- uid: string;
4026
- name: string;
4027
- name_translations: Record<string, string>;
4028
- reports: Report[];
4029
- created_at: Date;
4030
- created_at_timestamp: number;
4031
- updated_at: Date;
4032
- deleted_at: any;
4033
- constructor();
4034
- }
4035
- export class Report implements IReport {
4036
- uid: string;
4037
- name: string;
4038
- name_translations: Record<string, string>;
4039
- type: ReportType.printable;
4040
- codename: string;
4041
- created_at: Date;
4042
- created_at_timestamp: number;
4043
- updated_at: Date;
4044
- deleted_at: any;
4045
- constructor();
4046
- }
4047
- export interface IAppReport extends IAppCoreModel {
4048
- reports: IReportCategory[];
4049
- version: number;
4050
- }
4051
- export class AppReport extends AppCoreModel implements IAppReport {
4052
- uid: string;
4053
- reports: ReportCategory[];
4054
- version: number;
4055
- constructor();
4056
- }
4057
- export type IReportRequest = {
4058
- /**
4059
- * shift uid (if shift uid is provided, start and end date time will be ignored, and the report will be generated for the shift period.)
4060
- */
4061
- shift_uid: string;
4062
- /**
4063
- * start date and time
4064
- */
4065
- start_datetime: Date;
4066
- /**
4067
- * end date and time
4068
- */
4069
- end_datetime: Date;
4070
- /**
4071
- * report code name
4072
- */
4073
- report_code_name: string;
4074
- /**
4075
- * number of copies, default is 1
4076
- */
4077
- copies: number;
4078
- declared_amount: number;
4079
- };
4080
- export type IReportData = {
4081
- start_datetime: string;
4082
- humanized_start_datetime: string;
4083
- end_datetime: string;
4084
- humanized_end_datetime: string;
4085
- sales_summary: ISalesSummary;
4086
- drawer_summary: IDrawerSummary;
4087
- payments_summary: IPaymentSummary[];
4088
- loyalty_program_summary: ILoyaltyProgramSummary;
4089
- config: IConfig;
4090
- };
4091
- export class ReportData implements IReportData {
4092
- start_datetime: string;
4093
- humanized_start_datetime: string;
4094
- end_datetime: string;
4095
- humanized_end_datetime: string;
4096
- sales_summary: SalesSummary;
4097
- drawer_summary: DrawerSummary;
4098
- payments_summary: PaymentSummary[];
4099
- loyalty_program_summary: LoyaltyProgramSummary;
4100
- config: IConfig;
4101
- }
4102
- export type ISalesSummary = {
4103
- sales_total: number;
4104
- foc_sales_total: number;
4105
- foc_sales_count: number;
4106
- rounding_total: number;
4107
- tax_total: number;
4108
- service_charge_total: number;
4109
- discount_total: number;
4110
- voucher_total: number;
4111
- voucher_count: number;
4112
- coupon_total: number;
4113
- coupon_count: number;
4114
- paid_invoice_count: number;
4115
- paid_invoice_total: number;
4116
- void_invoice_count: number;
4117
- void_invoice_total: number;
4118
- total_pax: number;
4119
- };
4120
- export class SalesSummary implements ISalesSummary {
4121
- sales_total: number;
4122
- foc_sales_total: number;
4123
- foc_sales_count: number;
4124
- rounding_total: number;
4125
- tax_total: number;
4126
- service_charge_total: number;
4127
- discount_total: number;
4128
- voucher_total: number;
4129
- voucher_count: number;
4130
- coupon_total: number;
4131
- coupon_count: number;
4132
- paid_invoice_count: number;
4133
- paid_invoice_total: number;
4134
- void_invoice_count: number;
4135
- void_invoice_total: number;
4136
- total_pax: number;
4137
- }
4138
- export type IDrawerSummary = {
4139
- open_amount: number;
4140
- declared_amount: number;
4141
- drawer_amount: number;
4142
- difference: number;
4143
- pay_in_total: number;
4144
- pay_in_count: number;
4145
- pay_out_total: number;
4146
- pay_out_count: number;
4147
- };
4148
- export class DrawerSummary implements IDrawerSummary {
4149
- open_amount: number;
4150
- declared_amount: number;
4151
- drawer_amount: number;
4152
- difference: number;
4153
- pay_in_total: number;
4154
- pay_in_count: number;
4155
- cash_invoice_total: number;
4156
- cash_invoice_count: number;
4157
- pay_out_total: number;
4158
- pay_out_count: number;
4159
- }
4160
- export type IPaymentSummary = {
4161
- code: string;
4162
- name: string;
4163
- total: number;
4164
- count: number;
4165
- };
4166
- export class PaymentSummary implements IPaymentSummary {
4167
- code: string;
4168
- name: string;
4169
- total: number;
4170
- count: number;
4171
- }
4172
- export type ILoyaltyProgramSummary = {
4173
- add_credit_total: number;
4174
- add_credit_count: number;
4175
- rewarded_credit_total: number;
4176
- rewarded_credit_count: number;
4177
- minus_credit_total: number;
4178
- minus_credit_count: number;
4179
- rewarded_point_total: number;
4180
- rewarded_point_count: number;
4181
- minus_point_total: number;
4182
- minus_point_count: number;
4183
- };
4184
- export class LoyaltyProgramSummary implements ILoyaltyProgramSummary {
4185
- add_credit_total: number;
4186
- add_credit_count: number;
4187
- rewarded_credit_total: number;
4188
- rewarded_credit_count: number;
4189
- minus_credit_total: number;
4190
- minus_credit_count: number;
4191
- rewarded_point_total: number;
4192
- rewarded_point_count: number;
4193
- minus_point_total: number;
4194
- minus_point_count: number;
4195
- }
4196
-
4197
- }
4198
- declare module '@posx/core/types/request.type' {
4199
- export interface IFileUploadRequest {
4200
- name: string;
4201
- base64: string;
4202
- extension: string;
4203
- }
4204
- export class FileUploadRequest implements IFileUploadRequest {
4205
- name: string;
4206
- base64: string;
4207
- extension: string;
4208
- constructor(init?: Partial<IFileUploadRequest>);
4209
- }
4210
-
4211
- }
4212
- declare module '@posx/core/types/role.type' {
4213
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
4214
- export interface IEmployeeRole extends IAppBaseModel {
4215
- permissions: string[];
4216
- is_default: boolean;
4217
- }
4218
- export class EmployeeRole extends AppBaseModel implements IEmployeeRole {
4219
- permissions: string[];
4220
- is_default: boolean;
4221
- uid: string;
4222
- constructor();
4223
- }
4224
-
4225
- }
4226
- declare module '@posx/core/types/section.type' {
4227
- import { IAppModelSequence } from '@posx/core/services/abstract.service';
4228
- import { AppBaseModel, IAppBaseModel } from '@posx/core/types/abstract.type';
4229
- export enum SectionItemStatus {
4230
- CLOSED = "closed",
4231
- OPENED = "opened",
4232
- PAYMENT = "payment"
4233
- }
4234
- export interface ISectionItem extends IAppBaseModel {
4235
- /** List of printer ID order */
4236
- printer_id_order_list: number[];
4237
- /** Total amount */
4238
- total: number;
4239
- /** Time duration */
4240
- time: number;
4241
- /** Number of persons */
4242
- pax: number;
4243
- /** Invoice created timestamp */
4244
- invoice_created_at: string;
4245
- /** Number of child persons */
4246
- child_pax: number;
4247
- /** Number of baby persons */
4248
- baby_pax: number;
4249
- /** Invoice ID */
4250
- invoice_uid: string;
4251
- /** Section ID */
4252
- section_uid: string;
4253
- /** Table status */
4254
- status: SectionItemStatus;
4255
- /** Table size in X direction */
4256
- size_x: number;
4257
- /** Table size in Y direction */
4258
- size_y: number;
4259
- /** Table x axis */
4260
- row: number;
4261
- /** Table y axis */
4262
- col: number;
4263
- /** Flag for take out */
4264
- is_take_out: boolean;
4265
- /** Soup base quota */
4266
- soup_base_quota: number;
4267
- /** Soup base type */
4268
- soup_base_type: number;
4269
- }
4270
- export class SectionItem extends AppBaseModel implements ISectionItem {
4271
- printer_id_order_list: number[];
4272
- total: number;
4273
- time: number;
4274
- pax: number;
4275
- invoice_created_at: string;
4276
- child_pax: number;
4277
- baby_pax: number;
4278
- uid: string;
4279
- invoice_uid: string;
4280
- section_uid: string;
4281
- status: SectionItemStatus;
4282
- size_x: number;
4283
- size_y: number;
4284
- row: number;
4285
- col: number;
4286
- is_take_out: boolean;
4287
- soup_base_quota: number;
4288
- soup_base_type: number;
4289
- is_delete: boolean;
4290
- constructor();
4291
- }
4292
- export type ISection = IAppBaseModel & IAppModelSequence;
4293
- export class Section extends AppBaseModel implements ISection {
4294
- sequence: number;
4295
- uid: string;
4296
- constructor();
4297
- }
4298
-
4299
- }
4300
- declare module '@posx/core/types/shift.type' {
4301
- import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
4302
- export enum ShiftStatus {
4303
- Open = "opened",
4304
- Closed = "closed"
4305
- }
4306
- export interface IShift extends IAppCoreModel {
4307
- /** user uid */
4308
- user_uid: string;
4309
- /** shift started at */
4310
- started_at: Date;
4311
- /** shift closed at */
4312
- ended_at: Date;
4313
- /** amount declared by user */
4314
- declared_amount: number;
4315
- /** amount recorded by */
4316
- drawer_amount: number;
4317
- /** Operation Status */
4318
- status: ShiftStatus;
4319
- /** first invoice number */
4320
- first_invoice_number: number;
4321
- }
4322
- export class Shift extends AppCoreModel implements IShift {
4323
- user_uid: string;
4324
- started_at: Date;
4325
- ended_at: Date;
4326
- declared_amount: number;
4327
- drawer_amount: number;
4328
- first_invoice_number: number;
4329
- status: ShiftStatus;
4330
- uid: string;
4331
- constructor();
4332
- }
4333
- export enum TillType {
4334
- OpenDeposit = "open_deposit",
4335
- CashDeposit = "cash_deposit",
4336
- CashIn = "cash_in",
4337
- CashOut = "cash_out",
4338
- CashInvoice = "cash_invoice"
4339
- }
4340
- export interface ITill extends AppCoreModel {
4341
- /** user uid */
4342
- user_uid: string;
4343
- /** operation history id */
4344
- shift_uid: string;
4345
- /** invoice uid */
4346
- invoice_uid: string;
4347
- /** Till Type */
4348
- type: TillType;
4349
- /** Amount */
4350
- amount: number;
4351
- /** Note */
4352
- note: string;
4353
- }
4354
- export class Till extends AppCoreModel implements ITill {
4355
- user_uid: string;
4356
- shift_uid: string;
4357
- invoice_uid: string;
4358
- type: TillType;
4359
- amount: number;
4360
- note: string;
4361
- uid: string;
4362
- constructor();
4363
- }
4364
-
4365
- }
4366
- declare module '@posx/core/types/wyo.coupon.type' {
4367
- enum ApplyingType {
4368
- All = 1,
4369
- Inclusive = 2,
4370
- Exclusive = 3
4371
- }
4372
- enum CalcType {
4373
- Flat = 1,
4374
- Percent = 2
4375
- }
4376
- export interface IApplying<T> {
4377
- applyingType: ApplyingType;
4378
- applyingItems: T[];
4379
- }
4380
- export interface ICoupon {
4381
- /** Coupon guid */
4382
- guid: string;
4383
- /** Promotion code which is used to look up the coupon */
4384
- promo_code: string;
4385
- /** If this coupon can be used for multiple stores */
4386
- is_multi_stores?: boolean;
4387
- /** Coupon primary name */
4388
- name: string;
4389
- /** Coupon alias */
4390
- alias?: string;
4391
- /** Coupon primary description */
4392
- description?: string;
4393
- /** Coupon alias description */
4394
- description_alias?: string;
4395
- /** Applying PLUs (Price Lookup Code) */
4396
- applying_plus: IApplying<string>;
4397
- /** Applying User Tags */
4398
- applying_user_tags: IApplying<string>;
4399
- /** Applying User Groups */
4400
- applying_user_groups: IApplying<number>;
4401
- /** Discount Calculation Type */
4402
- discount_calc_type: CalcType;
4403
- /** Flat discount amount */
4404
- discount_amount?: number;
4405
- /** Percent discount (e.g. 30% => 0.3) */
4406
- discount_percent?: number;
4407
- /** Expiring duration in day after coupon is purchased */
4408
- duration?: number;
4409
- /** How many of this coupon has been redeemed */
4410
- usage_count: number;
4411
- /** How many of this coupon can be redeemed within an invoice */
4412
- usage_limit_per_invoice?: number;
4413
- /** Only above a specified invoice total before this coupon can be redeemed */
4414
- above_invoice_amount?: number;
4415
- /** Only below a specified invoice total before this coupon can be redeemed */
4416
- below_invoice_amount?: number;
4417
- /** Can this coupon be used to offset delivery fee */
4418
- is_delivery_free?: boolean;
4419
- /** If this coupon can only be used individually without stacking other coupons together */
4420
- is_individual_use?: boolean;
4421
- /** The amount of points to redeem this coupon */
4422
- price_in_points?: number;
4423
- /** Styles of the coupon */
4424
- styles?: Record<string, string>;
4425
- /** When this coupon will be expired */
4426
- expired_at?: Date;
4427
- /** If auto generation is true, the coupon will be automatically generated for all applicable users */
4428
- auto_gen?: boolean;
4429
- /** If this coupon has been disabled for purchasing */
4430
- can_sell?: boolean;
4431
- /** If this coupon has been disabled for redemption */
4432
- can_redeem?: boolean;
4433
- }
4434
- export class Coupon implements ICoupon {
4435
- guid: string;
4436
- promo_code: string;
4437
- is_multi_stores: boolean;
4438
- name: string;
4439
- alias?: string;
4440
- description?: string;
4441
- description_alias?: string;
4442
- applying_plus: IApplying<string>;
4443
- applying_user_tags: IApplying<string>;
4444
- applying_user_groups: IApplying<number>;
4445
- discount_calc_type: CalcType;
4446
- discount_amount?: number;
4447
- discount_percent?: number;
4448
- duration: number;
4449
- usage_count: number;
4450
- usage_limit_per_invoice: number;
4451
- above_invoice_amount?: number;
4452
- below_invoice_amount?: number;
4453
- is_delivery_free: boolean;
4454
- is_individual_use: boolean;
4455
- price_in_points?: number;
4456
- styles: Record<string, string>;
4457
- expired_at?: Date;
4458
- auto_gen: boolean;
4459
- can_sell: boolean;
4460
- can_redeem: boolean;
4461
- constructor(couponToClone?: Coupon);
4462
- }
4463
- export interface ICouponUsage {
4464
- invoice_uid: string;
4465
- }
4466
- export class CouponUsage implements ICouponUsage {
4467
- invoice_uid: string;
4468
- constructor(couponUsageToClone?: CouponUsage);
4469
- }
4470
- export interface ICouponItemized {
4471
- /** Coupon itemized guid */
4472
- guid: string;
4473
- /** A snapshot of coupon at the time of purchase */
4474
- coupon: ICoupon;
4475
- /** If this coupon can be used for multiple stores, default: false */
4476
- is_multi_stores?: boolean;
4477
- /** Coupon usage record if it is redeemed */
4478
- usage: ICouponUsage;
4479
- /** Employee unique id */
4480
- employee_uid: string;
4481
- /** Promotion code which is used to look up the coupon */
4482
- promo_code: string;
4483
- /** If coupons are expired */
4484
- is_expired: boolean;
4485
- /** If the coupons are fully redeemed */
4486
- is_redeemed: boolean;
4487
- /** If the coupon is generated instead of purchase */
4488
- is_generated: boolean;
4489
- }
4490
- export class CouponItemized implements ICouponItemized {
4491
- guid: string;
4492
- coupon: Coupon;
4493
- is_multi_stores?: boolean;
4494
- usage: CouponUsage;
4495
- employee_uid: string;
4496
- promo_code: string;
4497
- is_expired: boolean;
4498
- is_redeemed: boolean;
4499
- is_generated: boolean;
4500
- constructor(itemized?: CouponItemized);
4501
- }
4502
- export {};
4503
-
4504
- }
4505
- declare module '@posx/core/types/wyo.customer.type' {
4506
- export interface IAddress {
4507
- /** Address line 1 */
4508
- address1: string;
4509
- /** Address line 2 */
4510
- address2: string;
4511
- /** Latitude coordinate */
4512
- lat: string;
4513
- /** Longitude coordinate */
4514
- lng: string;
4515
- /** Postal code */
4516
- postcode: string;
4517
- /** Note associated with the address */
4518
- note: string;
4519
- /** Indicates if the address is the default one */
4520
- is_default: boolean;
4521
- /** Name associated with the address */
4522
- name: string;
4523
- /** Salutation associated with the address */
4524
- salute: string;
4525
- /** Phone number associated with the address */
4526
- phone_number: string;
4527
- }
4528
- /**
4529
- * Class representing the Address model.
4530
- */
4531
- export class Address implements IAddress {
4532
- address1: string;
4533
- address2: string;
4534
- lat: string;
4535
- lng: string;
4536
- postcode: string;
4537
- note: string;
4538
- is_default: boolean;
4539
- name: string;
4540
- salute: string;
4541
- phone_number: string;
4542
- constructor();
4543
- }
4544
- export interface IUser {
4545
- id: number;
4546
- /** Reference ID */
4547
- ref_id: string;
4548
- /** Image URL */
4549
- image_url: string;
4550
- /** Stripe Token */
4551
- stripe_token: string;
4552
- /** Stripe Customer ID */
4553
- stripe_customer_id: string;
4554
- /** User Name */
4555
- username: string;
4556
- /** Normalized User Name */
4557
- normalized_username: string;
4558
- /** Company */
4559
- company: string;
4560
- /** Identification Card */
4561
- ic: string;
4562
- /** Display Name */
4563
- display_name: string;
4564
- /** Full Name */
4565
- full_name: string;
4566
- /** Birth Date */
4567
- birth_date: string;
4568
- /** Gender */
4569
- gender: string;
4570
- /** Address */
4571
- address: string;
4572
- /** Postcode */
4573
- postcode: string;
4574
- /** Note */
4575
- note: string;
4576
- /** Language */
4577
- language: string;
4578
- /** Time Zone */
4579
- time_zone: string;
4580
- /** Created At */
4581
- created_at: Date;
4582
- /** Updated At */
4583
- updated_at: Date;
4584
- /** License IDs */
4585
- license_ids: string;
4586
- /** Security Stamp */
4587
- security_stamp: string;
4588
- /** Phone Number */
4589
- phone_number: string;
4590
- }
4591
- export class User implements IUser {
4592
- id: number;
4593
- ref_id: string;
4594
- image_url: string;
4595
- stripe_token: string;
4596
- stripe_customer_id: string;
4597
- username: string;
4598
- normalized_username: string;
4599
- company: string;
4600
- ic: string;
4601
- display_name: string;
4602
- full_name: string;
4603
- birth_date: string;
4604
- gender: string;
4605
- address: string;
4606
- postcode: string;
4607
- note: string;
4608
- language: string;
4609
- time_zone: string;
4610
- created_at: Date;
4611
- updated_at: Date;
4612
- license_ids: string;
4613
- security_stamp: string;
4614
- phone_number: string;
4615
- constructor();
4616
- }
4617
- export interface ICustomer extends IUser {
4618
- /** License ID */
4619
- license_id: number;
4620
- /** Credit */
4621
- credit: number;
4622
- /** Point */
4623
- point: number;
4624
- /** Transaction Total */
4625
- transaction_total: number;
4626
- /** Transaction Time */
4627
- transaction_time: number;
4628
- /** User Group ID */
4629
- user_group_id: number;
4630
- /** User Group Name */
4631
- user_group_name: string;
4632
- /** Group Expires At */
4633
- group_expires_at: Date | null;
4634
- /** Error */
4635
- error: string;
4636
- }
4637
- export class Customer extends User implements ICustomer {
4638
- license_id: number;
4639
- credit: number;
4640
- point: number;
4641
- transaction_total: number;
4642
- transaction_time: number;
4643
- user_group_id: number;
4644
- user_group_name: string;
4645
- group_expires_at: Date | null;
4646
- error: string;
4647
- constructor();
4648
- }
4649
-
4650
- }
4651
- declare module '@posx/core/utils/autoquery.utils' {
4652
- import { Operator, OperatorValueMap, SortOrder } from '@posx/core/types/auto.query.type';
4653
- export class QueryBuilder<T> {
4654
- private params;
4655
- addParam<K extends keyof T, O extends Operator<T[K]>>(property: K, operator: O, value: OperatorValueMap[O]): this;
4656
- addRawParam(key: string, value: string): this;
4657
- includeTotal(flag: boolean): this;
4658
- skip(skip: number): this;
4659
- take(take: number): this;
4660
- sortBy<K extends keyof T>(property: K, orderBy: SortOrder): this;
4661
- jsconfig(param: string): this;
4662
- /** @internal */
4663
- _build(): Record<string, string>;
4664
- }
4665
- export type QueryEtcParams = {
4666
- search_keywords: string | undefined;
4667
- };
4668
-
4669
- }
4670
- declare module '@posx/core/utils/http.utils' {
4671
- /**
4672
- * create a new instance of axios
4673
- * @param baseURL
4674
- * @param key
4675
- * @param uid
4676
- * @param token
4677
- * @returns
4678
- */
4679
- export function createInstance(baseURL: string, uid: string, token: string): import("axios").AxiosInstance;
4680
-
4681
- }
4682
- declare module '@posx/core/utils/misc.utils' {
4683
- export function humanizedData(date: Date): string;
4684
- export function normalizedDate(date: Date): string;
4685
-
4686
- }
4687
- declare module '@posx/core/utils/obj.utils' {
4688
- export function nameOf<T>(nameExtractor: (obj: T) => any): string;
4689
-
4690
- }
4691
- declare module '@posx/core' {
4692
- import main = require('@posx/core/index');
4693
- export = main;
4694
- }