asv-hlps-market 1.0.11 → 1.0.12

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.
@@ -14,6 +14,7 @@ export interface BuyProduct {
14
14
  qtityPackDlvr?: number;
15
15
  qtityUnitOdr?: number;
16
16
  qtityUnitDlvr?: number;
17
+ qtityUnit?: number;
17
18
  updatedAt?: Date;
18
19
  qrCode?: string;
19
20
  expirationDate: Date | string;
@@ -1,12 +1,13 @@
1
1
  import Product from "./models/Product";
2
2
  import ProductStock from "./models/ProductStock";
3
3
  declare class HlpProduct {
4
- stock: (product: Product, param: "salable" | "packs" | "units") => number;
5
4
  qtityInAllDepots(stock: ProductStock, prms?: {
6
5
  exceptDepots?: string[];
7
6
  main?: "master" | "slave";
8
7
  }): number;
9
8
  getStockSalable(product: Product): number;
9
+ stock: (product: Product, param: "salable" | "packs" | "units") => number;
10
+ extraFiilters: (row: Product) => string;
10
11
  }
11
12
  declare const _default: HlpProduct;
12
13
  export default _default;
@@ -17,22 +17,31 @@ class HlpProduct {
17
17
  return salable;
18
18
  }
19
19
  };
20
+ this.extraFiilters = (row) => row.designation; /* +
21
+ row.codeCompta +
22
+ (row.tva > 0 ? "@tva" : "") +
23
+ (row.isAvailable ? "@dispo" : "") +
24
+ (!row.isAvailable ? "@indispo" : "") +
25
+ (row.isActive ? "@actif" : "") +
26
+ (!row.isActive ? "@inactif" : "") +
27
+ (row.isPrivate ? "@private" : "") +
28
+ (!row.isPrivate ? "@noprivate" : ""); */
20
29
  }
21
30
  qtityInAllDepots(stock, prms) {
22
31
  const ins = stock.sumIns - stock.sumOuts;
23
32
  return ins <= 0 ? 0 : ins;
24
33
  }
25
34
  getStockSalable(product) {
26
- const stockAllSalable = this.qtityInAllDepots(product.stock);
35
+ const stockAllSalable = +this.qtityInAllDepots(product.stock);
27
36
  const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
28
37
  /* let stockSalable: number = 0;
29
38
 
30
- if (stockAllSalable <= stockStore) {
31
- stockSalable = stockAllSalable;
32
- }
33
- if (stockAllSalable > stockStore) {
34
- stockSalable = stockStore;
35
- } */
39
+ if (stockAllSalable <= stockStore) {
40
+ stockSalable = stockAllSalable;
41
+ }
42
+ if (stockAllSalable > stockStore) {
43
+ stockSalable = stockStore;
44
+ } */
36
45
  // return stockSalable || 0;
37
46
  return stockProduct || 0;
38
47
  }
@@ -14,6 +14,7 @@ export interface BuyProduct {
14
14
  qtityPackDlvr?: number;
15
15
  qtityUnitOdr?: number;
16
16
  qtityUnitDlvr?: number;
17
+ qtityUnit?: number;
17
18
  updatedAt?: Date;
18
19
  qrCode?: string;
19
20
  expirationDate: Date | string;
@@ -1,12 +1,13 @@
1
1
  import Product from "./models/Product";
2
2
  import ProductStock from "./models/ProductStock";
3
3
  declare class HlpProduct {
4
- stock: (product: Product, param: "salable" | "packs" | "units") => number;
5
4
  qtityInAllDepots(stock: ProductStock, prms?: {
6
5
  exceptDepots?: string[];
7
6
  main?: "master" | "slave";
8
7
  }): number;
9
8
  getStockSalable(product: Product): number;
9
+ stock: (product: Product, param: "salable" | "packs" | "units") => number;
10
+ extraFiilters: (row: Product) => string;
10
11
  }
11
12
  declare const _default: HlpProduct;
12
13
  export default _default;
@@ -15,22 +15,31 @@ class HlpProduct {
15
15
  return salable;
16
16
  }
17
17
  };
18
+ this.extraFiilters = (row) => row.designation; /* +
19
+ row.codeCompta +
20
+ (row.tva > 0 ? "@tva" : "") +
21
+ (row.isAvailable ? "@dispo" : "") +
22
+ (!row.isAvailable ? "@indispo" : "") +
23
+ (row.isActive ? "@actif" : "") +
24
+ (!row.isActive ? "@inactif" : "") +
25
+ (row.isPrivate ? "@private" : "") +
26
+ (!row.isPrivate ? "@noprivate" : ""); */
18
27
  }
19
28
  qtityInAllDepots(stock, prms) {
20
29
  const ins = stock.sumIns - stock.sumOuts;
21
30
  return ins <= 0 ? 0 : ins;
22
31
  }
23
32
  getStockSalable(product) {
24
- const stockAllSalable = this.qtityInAllDepots(product.stock);
33
+ const stockAllSalable = +this.qtityInAllDepots(product.stock);
25
34
  const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
26
35
  /* let stockSalable: number = 0;
27
36
 
28
- if (stockAllSalable <= stockStore) {
29
- stockSalable = stockAllSalable;
30
- }
31
- if (stockAllSalable > stockStore) {
32
- stockSalable = stockStore;
33
- } */
37
+ if (stockAllSalable <= stockStore) {
38
+ stockSalable = stockAllSalable;
39
+ }
40
+ if (stockAllSalable > stockStore) {
41
+ stockSalable = stockStore;
42
+ } */
34
43
  // return stockSalable || 0;
35
44
  return stockProduct || 0;
36
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps-market",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",