@posx/core 5.3.58

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