@posx/core 5.3.69 → 5.3.71
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 +100 -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';
|
|
@@ -1874,6 +1918,10 @@ declare module '@posx/core/types/config.type' {
|
|
|
1874
1918
|
* An alternative name or shorthand for the company used for convenience.
|
|
1875
1919
|
*/
|
|
1876
1920
|
company_name_alias: string;
|
|
1921
|
+
/**
|
|
1922
|
+
* The logo of the company
|
|
1923
|
+
*/
|
|
1924
|
+
company_logo: string;
|
|
1877
1925
|
/**
|
|
1878
1926
|
* The official tax identification number for the company, used for legal and financial documentation.
|
|
1879
1927
|
*/
|
|
@@ -1932,6 +1980,8 @@ declare module '@posx/core/types/config.type' {
|
|
|
1932
1980
|
company_name: string;
|
|
1933
1981
|
/** Alias for the company name */
|
|
1934
1982
|
company_name_alias: string;
|
|
1983
|
+
/** Logo of the company */
|
|
1984
|
+
company_logo: string;
|
|
1935
1985
|
/** Tax registration number of the company */
|
|
1936
1986
|
company_tax_reg_no: string;
|
|
1937
1987
|
/** Postcode of the company */
|
|
@@ -2254,6 +2304,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2254
2304
|
import { ISectionItem } from '@posx/core/types/section.type';
|
|
2255
2305
|
import { ITill } from '@posx/core/types/shift.type';
|
|
2256
2306
|
import { IPrintJob } from '@posx/core/types/printer.type';
|
|
2307
|
+
import { Condition } from '@posx/core/types/condition.type';
|
|
2257
2308
|
export enum InvoiceType {
|
|
2258
2309
|
DineIn = "dine_in",
|
|
2259
2310
|
TakeOut = "take_out",
|
|
@@ -2309,6 +2360,28 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2309
2360
|
Voucher = "voucher",
|
|
2310
2361
|
Coupon = "coupon"
|
|
2311
2362
|
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Interface for invoice charge items
|
|
2365
|
+
*/
|
|
2366
|
+
export interface IInvoiceCharge {
|
|
2367
|
+
/** Charge unique id */
|
|
2368
|
+
uid: string;
|
|
2369
|
+
/** Charge name */
|
|
2370
|
+
name: string;
|
|
2371
|
+
/** Charge amount */
|
|
2372
|
+
percentage: number;
|
|
2373
|
+
/** Charge amount */
|
|
2374
|
+
amount: number;
|
|
2375
|
+
/** Charge calculation flow */
|
|
2376
|
+
calc_flow: CalcFlow;
|
|
2377
|
+
}
|
|
2378
|
+
export class InvoiceCharge implements IInvoiceCharge {
|
|
2379
|
+
uid: string;
|
|
2380
|
+
name: string;
|
|
2381
|
+
percentage: number;
|
|
2382
|
+
amount: number;
|
|
2383
|
+
calc_flow: CalcFlow;
|
|
2384
|
+
}
|
|
2312
2385
|
export interface IInvoiceActivity {
|
|
2313
2386
|
/** Action */
|
|
2314
2387
|
action: InvoiceAction;
|
|
@@ -2330,6 +2403,21 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2330
2403
|
calc_type: CalcType;
|
|
2331
2404
|
amount: number;
|
|
2332
2405
|
percent: number;
|
|
2406
|
+
percent_amount: number;
|
|
2407
|
+
}
|
|
2408
|
+
export interface ICharge {
|
|
2409
|
+
uid: string;
|
|
2410
|
+
name: string;
|
|
2411
|
+
percent: number;
|
|
2412
|
+
calc_flow: CalcFlow;
|
|
2413
|
+
trigger_condition: Condition | string;
|
|
2414
|
+
}
|
|
2415
|
+
export class Charge implements ICharge {
|
|
2416
|
+
uid: string;
|
|
2417
|
+
name: string;
|
|
2418
|
+
percent: number;
|
|
2419
|
+
calc_flow: CalcFlow;
|
|
2420
|
+
trigger_condition: string;
|
|
2333
2421
|
}
|
|
2334
2422
|
export interface IInvoiceDiscount extends IDiscount {
|
|
2335
2423
|
/** the name can be the voucher or coupon name */
|
|
@@ -2347,6 +2435,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2347
2435
|
calc_type: CalcType;
|
|
2348
2436
|
amount: number;
|
|
2349
2437
|
percent: number;
|
|
2438
|
+
percent_amount: number;
|
|
2350
2439
|
type: DiscountType;
|
|
2351
2440
|
calc_flow: CalcFlow;
|
|
2352
2441
|
name: string;
|
|
@@ -2471,7 +2560,7 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2471
2560
|
/** Rewarded Credit */
|
|
2472
2561
|
rewarded_credit: number;
|
|
2473
2562
|
/** Discount List */
|
|
2474
|
-
discounts:
|
|
2563
|
+
discounts: IInvoiceDiscount[];
|
|
2475
2564
|
/** Total discount amount */
|
|
2476
2565
|
discount_amount: number;
|
|
2477
2566
|
/** Tax */
|
|
@@ -2547,6 +2636,10 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2547
2636
|
activities: any[];
|
|
2548
2637
|
/** Receipt printer unique id */
|
|
2549
2638
|
receipt_print_job_uid: string;
|
|
2639
|
+
/** Additional charges */
|
|
2640
|
+
charges: IInvoiceCharge[];
|
|
2641
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2642
|
+
is_charge_triggered?: boolean;
|
|
2550
2643
|
}
|
|
2551
2644
|
export class InvoiceCoreLine implements IInvoiceCoreLine {
|
|
2552
2645
|
item_uid: string;
|
|
@@ -2646,6 +2739,9 @@ declare module '@posx/core/types/invoice.type' {
|
|
|
2646
2739
|
otp: string;
|
|
2647
2740
|
activities: any[];
|
|
2648
2741
|
receipt_print_job_uid: string;
|
|
2742
|
+
charges: IInvoiceCharge[];
|
|
2743
|
+
/** Flag to track if charge has been manually deleted by user */
|
|
2744
|
+
is_charge_triggered: boolean;
|
|
2649
2745
|
uid: string;
|
|
2650
2746
|
constructor();
|
|
2651
2747
|
}
|
|
@@ -2740,6 +2836,7 @@ declare module '@posx/core/types/misc.type' {
|
|
|
2740
2836
|
Device = "dev_",
|
|
2741
2837
|
Invoice = "inv_",
|
|
2742
2838
|
InvoiceLine = "iln_",
|
|
2839
|
+
InvoiceCharge = "ich_",
|
|
2743
2840
|
Payment = "pay_",
|
|
2744
2841
|
Employee = "emp_",
|
|
2745
2842
|
Shift = "shf_",
|
|
@@ -2753,7 +2850,8 @@ declare module '@posx/core/types/misc.type' {
|
|
|
2753
2850
|
Printer = "prt_",
|
|
2754
2851
|
InvoiceDiscount = "ind_",
|
|
2755
2852
|
EmployeeRole = "emr_",
|
|
2756
|
-
OrderDisplaySystem = "ods_"
|
|
2853
|
+
OrderDisplaySystem = "ods_",
|
|
2854
|
+
Charge = "chr_"
|
|
2757
2855
|
}
|
|
2758
2856
|
export enum ModelType {
|
|
2759
2857
|
Merchant = "mnt",
|