@posx/core 5.5.117 → 5.5.118

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 CHANGED
@@ -438,7 +438,7 @@ declare module '@posx/core/services/app.service' {
438
438
  import { IPayment, IPaymentMethod } from '@posx/core/types/payment.type';
439
439
  import { INote, INoteGroup } from '@posx/core/types/note.type';
440
440
  import { ISection, ISectionItem } from '@posx/core/types/section.type';
441
- import { Category, ICategory, ICoreItem, IItem, ISubcategory } from '@posx/core/types/product.type';
441
+ import { Category, ICategory, ICoreItem, IItem, ISubcategory, TStockChange } from '@posx/core/types/product.type';
442
442
  import { AxiosInstance } from 'axios';
443
443
  import { IFileUploadResponse, IServiceOptions } from '@posx/core/types/misc.type';
444
444
  import Dexie from 'dexie';
@@ -595,6 +595,11 @@ declare module '@posx/core/services/app.service' {
595
595
  * @param stock the quantity to change the stock by, can be negative
596
596
  */
597
597
  changeStock(uid: string, stock: number): Promise<IItem>;
598
+ /**
599
+ * change the stock of multiple items
600
+ * @param stockChanges list of stock changes
601
+ */
602
+ changeItemsStock(stockChanges: TStockChange[]): Promise<void>;
598
603
  /**
599
604
  * Clone an item
600
605
  * @param item item to clone
@@ -630,6 +635,7 @@ declare module '@posx/core/services/app.service' {
630
635
  changeToSoldOut(uid: string): Promise<IItem>;
631
636
  changeToAvailable(uid: string, stock?: number): Promise<IItem>;
632
637
  changeStock(uid: string, stock: number): Promise<IItem>;
638
+ changeItemsStock(stockChanges: TStockChange[]): Promise<void>;
633
639
  private convertFileToBase64;
634
640
  private getFileExtension;
635
641
  cloneItem(item: IItem): Promise<IItem>;
@@ -1003,7 +1009,7 @@ declare module '@posx/core/services/invoice.service' {
1003
1009
  import { ICustomer } from '@posx/core/types/wyo.customer.type';
1004
1010
  import { IServiceOptions } from '@posx/core/types/misc.type';
1005
1011
  import { ISectionItem } from '@posx/core/types/section.type';
1006
- import { ITillService, ISectionItemService, ConfigService, PrintTemplateService, PrintJobService } from '@posx/core/services/app.service';
1012
+ import { ITillService, ISectionItemService, ConfigService, PrintTemplateService, PrintJobService, IItemService } from '@posx/core/services/app.service';
1007
1013
  import { AxiosInstance } from 'axios';
1008
1014
  import Dexie from 'dexie';
1009
1015
  import { SwitchInvoiceOptions, PayInvoiceOptions, VoidInvoiceOptions, UpdateInvoiceOptions } from '@posx/core/types/invoice.type';
@@ -1052,6 +1058,7 @@ declare module '@posx/core/services/invoice.service' {
1052
1058
  protected printTemplateService: PrintTemplateService;
1053
1059
  protected printerService: PrinterService;
1054
1060
  protected printJobService: PrintJobService;
1061
+ protected itemService: IItemService;
1055
1062
  constructor(http: AxiosInstance, db: Dexie, options: IServiceOptions, moduleName?: string, methodName?: string);
1056
1063
  calculate(invoice: IInvoice, appConfig: IAppConfig, disableRounding?: boolean): IInvoice;
1057
1064
  calculateLines(invoice: IInvoice): void;
@@ -1574,6 +1581,14 @@ declare module '@posx/core/services/invoice.service' {
1574
1581
  * @returns The updated invoice with the removed charge
1575
1582
  */
1576
1583
  removeInvoiceCharge(invoice: IInvoice, chargeUid: string): IInvoice;
1584
+ /**
1585
+ * Creates a list of stock changes for all items in an invoice when it is paid.
1586
+ * Returns stock changes with negative quantities for each item and their modifiers.
1587
+ * Consolidates multiple entries for the same item_uid by summing quantities.
1588
+ * @param invoice - The paid invoice containing items to create stock changes for
1589
+ * @private
1590
+ */
1591
+ private getStockChangeList;
1577
1592
  /**
1578
1593
  * Slices an invoice into multiple invoices where each invoice has a single line with quantity of 1
1579
1594
  * @param invoice - The invoice to slice
@@ -3672,6 +3687,19 @@ declare module '@posx/core/types/printer.type' {
3672
3687
  declare module '@posx/core/types/product.type' {
3673
3688
  import { IAppModelSequence } from '@posx/core/services/abstract.service';
3674
3689
  import { AppCoreModel, AppExtraModel, IAppCoreModel, IAppExtraModel } from '@posx/core/types/abstract.type';
3690
+ export type TStockChangeItem = {
3691
+ item_uid: string;
3692
+ quantity: number;
3693
+ };
3694
+ export type TStockChange = TStockChangeItem & {
3695
+ modifiers: TStockChangeItem[];
3696
+ };
3697
+ export class StockChange implements TStockChange {
3698
+ item_uid: string;
3699
+ quantity: number;
3700
+ modifiers: TStockChangeItem[];
3701
+ constructor(item_uid: string);
3702
+ }
3675
3703
  export interface IProductBase extends IAppExtraModel, IAppModelSequence {
3676
3704
  /**
3677
3705
  * color of the object