@posx/core 5.3.69 → 5.3.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +94 -2
- package/build/index.js +1 -1
- package/package.json +1 -1
- package/package.publish.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare module '@posx/core/index' {
|
|
|
29
29
|
export * from '@posx/core/types/ods.type';
|
|
30
30
|
export * from '@posx/core/utils/autoquery.utils';
|
|
31
31
|
export * from '@posx/core/libs/electron.socket';
|
|
32
|
+
export * from '@posx/core/types/condition.type';
|
|
32
33
|
|
|
33
34
|
}
|
|
34
35
|
declare module '@posx/core/libs/FindOptions' {
|
|
@@ -967,6 +968,7 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
967
968
|
calculateAddCredit(invoice: IInvoice): void;
|
|
968
969
|
calculateRewardPoint(invoice: IInvoice, aboveInvoiceAmount: number, includeServiceCharge: boolean, includeTax: boolean): void;
|
|
969
970
|
calculateChangeAmount(invoice: IInvoice): void;
|
|
971
|
+
calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
|
|
970
972
|
}
|
|
971
973
|
export type LineOptions = {
|
|
972
974
|
quantity?: number;
|
|
@@ -1071,6 +1073,7 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1071
1073
|
private resetInvoiceCalculations;
|
|
1072
1074
|
private resetLineCalculations;
|
|
1073
1075
|
calculateChangeAmount(invoice: IInvoice): void;
|
|
1076
|
+
calculateInvoiceCharges(invoice: IInvoice, flow: CalcFlow): void;
|
|
1074
1077
|
}
|
|
1075
1078
|
/**
|
|
1076
1079
|
* Interface for the Invoice Operation Service, which extends the IInvoiceBaseService interface.
|
|
@@ -1386,6 +1389,23 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1386
1389
|
* @param payments payments to change
|
|
1387
1390
|
*/
|
|
1388
1391
|
changePayments(invoice: IInvoice, options: IChangePaymentMethodOption[]): Promise<IInvoice>;
|
|
1392
|
+
/**
|
|
1393
|
+
* Adds a charge to an invoice
|
|
1394
|
+
* @param invoice - The invoice to add the charge to
|
|
1395
|
+
* @param name - The name of the charge
|
|
1396
|
+
* @param percentage - The percentage of the charge (0 for flat amount)
|
|
1397
|
+
* @param amount - The flat amount of the charge (0 for percentage)
|
|
1398
|
+
* @param calcFlow - The calculation flow to use for the charge
|
|
1399
|
+
* @returns The updated invoice with the added charge
|
|
1400
|
+
*/
|
|
1401
|
+
addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
|
|
1402
|
+
/**
|
|
1403
|
+
* Removes a charge from an invoice
|
|
1404
|
+
* @param invoice - The invoice to remove the charge from
|
|
1405
|
+
* @param chargeUid - The uid of the charge to remove
|
|
1406
|
+
* @returns The updated invoice with the removed charge
|
|
1407
|
+
*/
|
|
1408
|
+
removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
|
|
1389
1409
|
}
|
|
1390
1410
|
export class InvoiceOperationService extends LineOperationService implements IInvoiceOperationService {
|
|
1391
1411
|
createInvoice(invoice: IInvoice, sectionItem: ISectionItem, employee?: IEmployee): Promise<CreateInvoiceOptions>;
|
|
@@ -1415,6 +1435,23 @@ declare module '@posx/core/services/invoice.service' {
|
|
|
1415
1435
|
private createOrderPrintJobs;
|
|
1416
1436
|
private filterLinesAndPrintersToPrint;
|
|
1417
1437
|
private preprocessInvoice;
|
|
1438
|
+
/**
|
|
1439
|
+
* Adds a charge to an invoice
|
|
1440
|
+
* @param invoice - The invoice to add the charge to
|
|
1441
|
+
* @param name - The name of the charge
|
|
1442
|
+
* @param percentage - The percentage of the charge (0 for flat amount)
|
|
1443
|
+
* @param amount - The flat amount of the charge (0 for percentage)
|
|
1444
|
+
* @param calcFlow - The calculation flow to use for the charge
|
|
1445
|
+
* @returns The updated invoice with the added charge
|
|
1446
|
+
*/
|
|
1447
|
+
addInvoiceCharge(invoice: IInvoice, name: string, percentage: number, amount: number, calcFlow?: CalcFlow): IInvoice;
|
|
1448
|
+
/**
|
|
1449
|
+
* Removes a charge from an invoice
|
|
1450
|
+
* @param invoice - The invoice to remove the charge from
|
|
1451
|
+
* @param chargeUid - The uid of the charge to remove
|
|
1452
|
+
* @returns The updated invoice with the removed charge
|
|
1453
|
+
*/
|
|
1454
|
+
removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
|
|
1418
1455
|
}
|
|
1419
1456
|
export type IInvoiceService = IInvoiceOperationService;
|
|
1420
1457
|
export class InvoiceService extends InvoiceOperationService implements IInvoiceService {
|
|
@@ -1743,6 +1780,13 @@ declare module '@posx/core/types/auto.query.type' {
|
|
|
1743
1780
|
Dec = "-12-"
|
|
1744
1781
|
}
|
|
1745
1782
|
|
|
1783
|
+
}
|
|
1784
|
+
declare module '@posx/core/types/condition.type' {
|
|
1785
|
+
export enum Condition {
|
|
1786
|
+
None = "",
|
|
1787
|
+
Always = "always"
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1746
1790
|
}
|
|
1747
1791
|
declare module '@posx/core/types/config.type' {
|
|
1748
1792
|
import { AppCoreModel, IAppCoreModel } from '@posx/core/types/abstract.type';
|
|
@@ -2254,6 +2298,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2254
2298
|
import { ISectionItem } from '@posx/core/types/section.type';
|
|
2255
2299
|
import { ITill } from '@posx/core/types/shift.type';
|
|
2256
2300
|
import { IPrintJob } from '@posx/core/types/printer.type';
|
|
2301
|
+
import { Condition } from '@posx/core/types/condition.type';
|
|
2257
2302
|
export enum InvoiceType {
|
|
2258
2303
|
DineIn = "dine_in",
|
|
2259
2304
|
TakeOut = "take_out",
|
|
@@ -2309,6 +2354,28 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2309
2354
|
Voucher = "voucher",
|
|
2310
2355
|
Coupon = "coupon"
|
|
2311
2356
|
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Interface for invoice charge items
|
|
2359
|
+
*/
|
|
2360
|
+
export interface IInvoiceCharge {
|
|
2361
|
+
/** Charge unique id */
|
|
2362
|
+
uid: string;
|
|
2363
|
+
/** Charge name */
|
|
2364
|
+
name: string;
|
|
2365
|
+
/** Charge amount */
|
|
2366
|
+
percentage: number;
|
|
2367
|
+
/** Charge amount */
|
|
2368
|
+
amount: number;
|
|
2369
|
+
/** Charge calculation flow */
|
|
2370
|
+
calc_flow: CalcFlow;
|
|
2371
|
+
}
|
|
2372
|
+
export class InvoiceCharge implements IInvoiceCharge {
|
|
2373
|
+
uid: string;
|
|
2374
|
+
name: string;
|
|
2375
|
+
percentage: number;
|
|
2376
|
+
amount: number;
|
|
2377
|
+
calc_flow: CalcFlow;
|
|
2378
|
+
}
|
|
2312
2379
|
export interface IInvoiceActivity {
|
|
2313
2380
|
/** Action */
|
|
2314
2381
|
action: InvoiceAction;
|
|
@@ -2330,6 +2397,21 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2330
2397
|
calc_type: CalcType;
|
|
2331
2398
|
amount: number;
|
|
2332
2399
|
percent: number;
|
|
2400
|
+
percent_amount: number;
|
|
2401
|
+
}
|
|
2402
|
+
export interface ICharge {
|
|
2403
|
+
uid: string;
|
|
2404
|
+
name: string;
|
|
2405
|
+
percent: number;
|
|
2406
|
+
calc_flow: CalcFlow;
|
|
2407
|
+
trigger_condition: Condition | string;
|
|
2408
|
+
}
|
|
2409
|
+
export class Charge implements ICharge {
|
|
2410
|
+
uid: string;
|
|
2411
|
+
name: string;
|
|
2412
|
+
percent: number;
|
|
2413
|
+
calc_flow: CalcFlow;
|
|
2414
|
+
trigger_condition: string;
|
|
2333
2415
|
}
|
|
2334
2416
|
export interface IInvoiceDiscount extends IDiscount {
|
|
2335
2417
|
/** the name can be the voucher or coupon name */
|
|
@@ -2347,6 +2429,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2347
2429
|
calc_type: CalcType;
|
|
2348
2430
|
amount: number;
|
|
2349
2431
|
percent: number;
|
|
2432
|
+
percent_amount: number;
|
|
2350
2433
|
type: DiscountType;
|
|
2351
2434
|
calc_flow: CalcFlow;
|
|
2352
2435
|
name: string;
|
|
@@ -2471,7 +2554,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2471
2554
|
/** Rewarded Credit */
|
|
2472
2555
|
rewarded_credit: number;
|
|
2473
2556
|
/** Discount List */
|
|
2474
|
-
discounts:
|
|
2557
|
+
discounts: IInvoiceDiscount[];
|
|
2475
2558
|
/** Total discount amount */
|
|
2476
2559
|
discount_amount: number;
|
|
2477
2560
|
/** Tax */
|
|
@@ -2547,6 +2630,10 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2547
2630
|
activities: any[];
|
|
2548
2631
|
/** Receipt printer unique id */
|
|
2549
2632
|
receipt_print_job_uid: string;
|
|
2633
|
+
/** Additional charges */
|
|
2634
|
+
charges: IInvoiceCharge[];
|
|
2635
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2636
|
+
is_charge_triggered?: boolean;
|
|
2550
2637
|
}
|
|
2551
2638
|
export class InvoiceCoreLine implements IInvoiceCoreLine {
|
|
2552
2639
|
item_uid: string;
|
|
@@ -2646,6 +2733,9 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2646
2733
|
otp: string;
|
|
2647
2734
|
activities: any[];
|
|
2648
2735
|
receipt_print_job_uid: string;
|
|
2736
|
+
charges: IInvoiceCharge[];
|
|
2737
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2738
|
+
is_charge_triggered: boolean;
|
|
2649
2739
|
uid: string;
|
|
2650
2740
|
constructor();
|
|
2651
2741
|
}
|
|
@@ -2740,6 +2830,7 @@ declare module '@posx/core/types/misc.type' {
|
|
|
2740
2830
|
Device = "dev_",
|
|
2741
2831
|
Invoice = "inv_",
|
|
2742
2832
|
InvoiceLine = "iln_",
|
|
2833
|
+
InvoiceCharge = "ich_",
|
|
2743
2834
|
Payment = "pay_",
|
|
2744
2835
|
Employee = "emp_",
|
|
2745
2836
|
Shift = "shf_",
|
|
@@ -2753,7 +2844,8 @@ declare module '@posx/core/types/misc.type' {
|
|
|
2753
2844
|
Printer = "prt_",
|
|
2754
2845
|
InvoiceDiscount = "ind_",
|
|
2755
2846
|
EmployeeRole = "emr_",
|
|
2756
|
-
OrderDisplaySystem = "ods_"
|
|
2847
|
+
OrderDisplaySystem = "ods_",
|
|
2848
|
+
Charge = "chr_"
|
|
2757
2849
|
}
|
|
2758
2850
|
export enum ModelType {
|
|
2759
2851
|
Merchant = "mnt",
|