asv-hlps-market 1.0.1 → 1.0.2
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/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +17 -0
- package/lib/cjs/models/Market.d.ts +8 -0
- package/lib/cjs/models/Market.js +2 -0
- package/lib/cjs/models/UMarket.d.ts +11 -0
- package/lib/cjs/models/UMarket.js +2 -0
- package/lib/cjs/models/index.d.ts +2 -0
- package/lib/cjs/models/index.js +18 -0
- package/lib/cjs/products/hlpProduct.d.ts +13 -0
- package/lib/cjs/products/hlpProduct.js +49 -0
- package/lib/cjs/products/index.d.ts +2 -0
- package/lib/cjs/products/index.js +23 -0
- package/lib/cjs/products/models/Product.d.ts +39 -0
- package/lib/cjs/products/models/Product.js +2 -0
- package/lib/cjs/products/models/ProductAsset.d.ts +8 -0
- package/lib/cjs/products/models/ProductAsset.js +2 -0
- package/lib/cjs/products/models/ProductCat.d.ts +3 -0
- package/lib/cjs/products/models/ProductCat.js +2 -0
- package/lib/cjs/products/models/ProductCollection.d.ts +3 -0
- package/lib/cjs/products/models/ProductCollection.js +2 -0
- package/lib/cjs/products/models/ProductDepot.d.ts +11 -0
- package/lib/cjs/products/models/ProductDepot.js +2 -0
- package/lib/cjs/products/models/ProductElt.d.ts +3 -0
- package/lib/cjs/products/models/ProductElt.js +2 -0
- package/lib/cjs/products/models/ProductGrp.d.ts +3 -0
- package/lib/cjs/products/models/ProductGrp.js +2 -0
- package/lib/cjs/products/models/ProductImage.d.ts +5 -0
- package/lib/cjs/products/models/ProductImage.js +2 -0
- package/lib/cjs/products/models/ProductIn.d.ts +42 -0
- package/lib/cjs/products/models/ProductIn.js +2 -0
- package/lib/cjs/products/models/ProductState.d.ts +3 -0
- package/lib/cjs/products/models/ProductState.js +2 -0
- package/lib/cjs/products/models/ProductStock.d.ts +6 -0
- package/lib/cjs/products/models/ProductStock.js +2 -0
- package/lib/cjs/products/models/ProductTag.d.ts +3 -0
- package/lib/cjs/products/models/ProductTag.js +2 -0
- package/lib/cjs/products/models/ProductVariant.d.ts +6 -0
- package/lib/cjs/products/models/ProductVariant.js +2 -0
- package/lib/cjs/products/models/index.d.ts +13 -0
- package/lib/cjs/products/models/index.js +29 -0
- package/lib/cjs/sales/index.d.ts +1 -0
- package/lib/cjs/sales/index.js +17 -0
- package/lib/cjs/sales/models/Sale.d.ts +8 -0
- package/lib/cjs/sales/models/Sale.js +2 -0
- package/lib/cjs/sales/models/SalePayment.d.ts +21 -0
- package/lib/cjs/sales/models/SalePayment.js +2 -0
- package/lib/cjs/sales/models/SaleProduct.d.ts +8 -0
- package/lib/cjs/sales/models/SaleProduct.js +2 -0
- package/lib/cjs/sales/models/index.d.ts +3 -0
- package/lib/cjs/sales/models/index.js +19 -0
- package/lib/cjs/shops/index.d.ts +1 -0
- package/lib/cjs/shops/index.js +17 -0
- package/lib/cjs/shops/models/Shop.d.ts +13 -0
- package/lib/cjs/shops/models/Shop.js +2 -0
- package/lib/cjs/users/models/User.d.ts +7 -0
- package/lib/cjs/users/models/User.js +2 -0
- package/lib/esm/index.d.ts +2 -0
- package/lib/esm/index.js +2 -1
- package/lib/esm/models/Market.d.ts +8 -0
- package/lib/esm/models/Market.js +1 -0
- package/lib/esm/models/UMarket.d.ts +11 -0
- package/lib/esm/models/UMarket.js +1 -0
- package/lib/esm/models/index.d.ts +2 -0
- package/lib/esm/models/index.js +2 -0
- package/lib/esm/products/hlpProduct.d.ts +13 -0
- package/lib/esm/products/hlpProduct.js +47 -0
- package/lib/esm/products/index.d.ts +2 -0
- package/lib/esm/products/index.js +2 -0
- package/lib/esm/products/models/Product.d.ts +39 -0
- package/lib/esm/products/models/Product.js +1 -0
- package/lib/esm/products/models/ProductAsset.d.ts +8 -0
- package/lib/esm/products/models/ProductAsset.js +1 -0
- package/lib/esm/products/models/ProductCat.d.ts +3 -0
- package/lib/esm/products/models/ProductCat.js +1 -0
- package/lib/esm/products/models/ProductCollection.d.ts +3 -0
- package/lib/esm/products/models/ProductCollection.js +1 -0
- package/lib/esm/products/models/ProductDepot.d.ts +11 -0
- package/lib/esm/products/models/ProductDepot.js +1 -0
- package/lib/esm/products/models/ProductElt.d.ts +3 -0
- package/lib/esm/products/models/ProductElt.js +1 -0
- package/lib/esm/products/models/ProductGrp.d.ts +3 -0
- package/lib/esm/products/models/ProductGrp.js +1 -0
- package/lib/esm/products/models/ProductImage.d.ts +5 -0
- package/lib/esm/products/models/ProductImage.js +1 -0
- package/lib/esm/products/models/ProductIn.d.ts +42 -0
- package/lib/esm/products/models/ProductIn.js +1 -0
- package/lib/esm/products/models/ProductState.d.ts +3 -0
- package/lib/esm/products/models/ProductState.js +1 -0
- package/lib/esm/products/models/ProductStock.d.ts +6 -0
- package/lib/esm/products/models/ProductStock.js +1 -0
- package/lib/esm/products/models/ProductTag.d.ts +3 -0
- package/lib/esm/products/models/ProductTag.js +1 -0
- package/lib/esm/products/models/ProductVariant.d.ts +6 -0
- package/lib/esm/products/models/ProductVariant.js +1 -0
- package/lib/esm/products/models/index.d.ts +13 -0
- package/lib/esm/products/models/index.js +13 -0
- package/lib/esm/sales/index.d.ts +1 -0
- package/lib/esm/sales/index.js +1 -0
- package/lib/esm/sales/models/Sale.d.ts +8 -0
- package/lib/esm/sales/models/Sale.js +1 -0
- package/lib/esm/sales/models/SalePayment.d.ts +21 -0
- package/lib/esm/sales/models/SalePayment.js +1 -0
- package/lib/esm/sales/models/SaleProduct.d.ts +8 -0
- package/lib/esm/sales/models/SaleProduct.js +1 -0
- package/lib/esm/sales/models/index.d.ts +3 -0
- package/lib/esm/sales/models/index.js +3 -0
- package/lib/esm/shops/index.d.ts +1 -0
- package/lib/esm/shops/index.js +1 -0
- package/lib/esm/shops/models/Shop.d.ts +13 -0
- package/lib/esm/shops/models/Shop.js +1 -0
- package/lib/esm/users/models/User.d.ts +7 -0
- package/lib/esm/users/models/User.js +1 -0
- package/package.json +2 -2
package/lib/cjs/index.d.ts
CHANGED
package/lib/cjs/index.js
CHANGED
@@ -1 +1,18 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./models"), exports);
|
18
|
+
__exportStar(require("./products/models"), exports);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./Market"), exports);
|
18
|
+
__exportStar(require("./UMarket"), exports);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import Product from "./models/Product";
|
2
|
+
import ProductStock from "./models/ProductStock";
|
3
|
+
declare class HlpProduct {
|
4
|
+
qtityInAllDepots(stock: ProductStock, prms?: {
|
5
|
+
exceptDepots?: string[];
|
6
|
+
main?: "master" | "slave";
|
7
|
+
}): number;
|
8
|
+
getStockSalable(product: Product): number;
|
9
|
+
stock: (product: Product, param: "salable" | "packs" | "units") => number;
|
10
|
+
extraFiilters: (row: Product) => string;
|
11
|
+
}
|
12
|
+
declare const _default: HlpProduct;
|
13
|
+
export default _default;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
class HlpProduct {
|
4
|
+
constructor() {
|
5
|
+
this.stock = (product, param) => {
|
6
|
+
const salable = (+product.stock.sumIns || 0) - (+product.stock.sumOuts || 0);
|
7
|
+
const packs = Math.trunc(salable / product.stock.qtityPerPackaging || 0);
|
8
|
+
const units = salable % product.stock.qtityPerPackaging || 0;
|
9
|
+
switch (param) {
|
10
|
+
case "salable":
|
11
|
+
return salable;
|
12
|
+
case "packs":
|
13
|
+
return packs;
|
14
|
+
case "units":
|
15
|
+
return units;
|
16
|
+
default:
|
17
|
+
return salable;
|
18
|
+
}
|
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" : ""); */
|
29
|
+
}
|
30
|
+
qtityInAllDepots(stock, prms) {
|
31
|
+
const ins = stock.sumIns - stock.sumOuts;
|
32
|
+
return ins <= 0 ? 0 : ins;
|
33
|
+
}
|
34
|
+
getStockSalable(product) {
|
35
|
+
const stockAllSalable = +this.qtityInAllDepots(product.stock);
|
36
|
+
const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
|
37
|
+
/* let stockSalable: number = 0;
|
38
|
+
|
39
|
+
if (stockAllSalable <= stockStore) {
|
40
|
+
stockSalable = stockAllSalable;
|
41
|
+
}
|
42
|
+
if (stockAllSalable > stockStore) {
|
43
|
+
stockSalable = stockStore;
|
44
|
+
} */
|
45
|
+
// return stockSalable || 0;
|
46
|
+
return stockProduct || 0;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
exports.default = new HlpProduct();
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
+
};
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
+
exports.HlpProduct = void 0;
|
21
|
+
var hlpProduct_1 = require("./hlpProduct");
|
22
|
+
Object.defineProperty(exports, "HlpProduct", { enumerable: true, get: function () { return __importDefault(hlpProduct_1).default; } });
|
23
|
+
__exportStar(require("./models"), exports);
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Market } from "../../models/Market";
|
2
|
+
import { Shop } from "../../shops/models/Shop";
|
3
|
+
import ProductCat from "./ProductCat";
|
4
|
+
import ProductImage from "./ProductImage";
|
5
|
+
import ProductIn from "./ProductIn";
|
6
|
+
interface Stock {
|
7
|
+
sumIns: number;
|
8
|
+
sumOuts: number;
|
9
|
+
qtityPerPackaging: number;
|
10
|
+
}
|
11
|
+
export default interface Product {
|
12
|
+
capacity: string;
|
13
|
+
cat: ProductCat;
|
14
|
+
createdAt: Date;
|
15
|
+
description: string;
|
16
|
+
designation: string;
|
17
|
+
disabled?: boolean;
|
18
|
+
iconName: string;
|
19
|
+
iconPack: string;
|
20
|
+
id: number;
|
21
|
+
images: ProductImage[];
|
22
|
+
ins: ProductIn[];
|
23
|
+
isActive: boolean;
|
24
|
+
isAvailable?: boolean;
|
25
|
+
isBulk: boolean;
|
26
|
+
market: Market;
|
27
|
+
price: number;
|
28
|
+
publicPrice: number;
|
29
|
+
qtityLimit: number;
|
30
|
+
qtityUnit: number;
|
31
|
+
stock: Stock;
|
32
|
+
qtityPerBox: number;
|
33
|
+
qtityPerPackaging: number;
|
34
|
+
ref: string;
|
35
|
+
salePrice: number;
|
36
|
+
shop: Shop;
|
37
|
+
updatedAt: Date;
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import EInOutMotive from "asv-hlps/lib/cjs/shared/models/EInOutMotive";
|
2
|
+
import Product from "./Product";
|
3
|
+
import ProductDepot from "./ProductDepot";
|
4
|
+
export default interface ProductIn {
|
5
|
+
id: number;
|
6
|
+
createdAt: Date;
|
7
|
+
lot: string;
|
8
|
+
qtity: number;
|
9
|
+
comment: string;
|
10
|
+
isEdit: boolean;
|
11
|
+
motive: EInOutMotive;
|
12
|
+
authorId: number;
|
13
|
+
qtityPerPackaging: number;
|
14
|
+
/**
|
15
|
+
* remaining qtity
|
16
|
+
*/
|
17
|
+
qtityIn: number;
|
18
|
+
isOutDate: boolean;
|
19
|
+
/**
|
20
|
+
* expired
|
21
|
+
*/
|
22
|
+
isOut: boolean;
|
23
|
+
/**
|
24
|
+
* if true the productIn is created from transfering qtity from another productin
|
25
|
+
*/
|
26
|
+
fromTransfert: boolean;
|
27
|
+
/**
|
28
|
+
* indique the qtity waiting to transfert after transfert validation
|
29
|
+
*/
|
30
|
+
qtityInTransfert: number;
|
31
|
+
/**
|
32
|
+
* is true if the transfert not validate
|
33
|
+
*/
|
34
|
+
inTransfert: boolean;
|
35
|
+
depotId: number;
|
36
|
+
productId: number;
|
37
|
+
designation: string;
|
38
|
+
salePrice: number;
|
39
|
+
publicPrice: number;
|
40
|
+
product: Product;
|
41
|
+
depot: ProductDepot;
|
42
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from "./Product";
|
2
|
+
export * from "./ProductAsset";
|
3
|
+
export * from "./ProductCat";
|
4
|
+
export * from "./ProductCollection";
|
5
|
+
export * from "./ProductDepot";
|
6
|
+
export * from "./ProductElt";
|
7
|
+
export * from "./ProductGrp";
|
8
|
+
export * from "./ProductImage";
|
9
|
+
export * from "./ProductIn";
|
10
|
+
export * from "./ProductState";
|
11
|
+
export * from "./ProductStock";
|
12
|
+
export * from "./ProductTag";
|
13
|
+
export * from "./ProductVariant";
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./Product"), exports);
|
18
|
+
__exportStar(require("./ProductAsset"), exports);
|
19
|
+
__exportStar(require("./ProductCat"), exports);
|
20
|
+
__exportStar(require("./ProductCollection"), exports);
|
21
|
+
__exportStar(require("./ProductDepot"), exports);
|
22
|
+
__exportStar(require("./ProductElt"), exports);
|
23
|
+
__exportStar(require("./ProductGrp"), exports);
|
24
|
+
__exportStar(require("./ProductImage"), exports);
|
25
|
+
__exportStar(require("./ProductIn"), exports);
|
26
|
+
__exportStar(require("./ProductState"), exports);
|
27
|
+
__exportStar(require("./ProductStock"), exports);
|
28
|
+
__exportStar(require("./ProductTag"), exports);
|
29
|
+
__exportStar(require("./ProductVariant"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./models"), exports);
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Bank, BankAccount, PaymentMode } from "asv-hlps/lib/cjs/cashs";
|
2
|
+
import User from "../../users/models/User";
|
3
|
+
import Sale from "./Sale";
|
4
|
+
export interface SalePayment {
|
5
|
+
id: number;
|
6
|
+
ref: string;
|
7
|
+
createdAt: Date;
|
8
|
+
paymentDate: Date;
|
9
|
+
prevAmount: number;
|
10
|
+
paidAmount: number;
|
11
|
+
cashReceived: number;
|
12
|
+
cashReturned: number;
|
13
|
+
restAmount: number;
|
14
|
+
checkNumber: string;
|
15
|
+
checkDate: string;
|
16
|
+
sale: Sale;
|
17
|
+
encoder: User;
|
18
|
+
account: BankAccount;
|
19
|
+
bank: Bank;
|
20
|
+
mode: PaymentMode;
|
21
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./Sale"), exports);
|
18
|
+
__exportStar(require("./SalePayment"), exports);
|
19
|
+
__exportStar(require("./SaleProduct"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models/Shop";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./models/Shop"), exports);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import UMarket from "../../models/UMarket";
|
2
|
+
import Product from "../../products/models/Product";
|
3
|
+
export interface Shop {
|
4
|
+
id: number;
|
5
|
+
name: string;
|
6
|
+
title: string;
|
7
|
+
description: string;
|
8
|
+
logo: string;
|
9
|
+
banner: string;
|
10
|
+
isActive: boolean;
|
11
|
+
products: Product[];
|
12
|
+
umarket: UMarket;
|
13
|
+
}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
export * from "./models";
|
2
|
+
export * from "./products/models";
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import Product from "./models/Product";
|
2
|
+
import ProductStock from "./models/ProductStock";
|
3
|
+
declare class HlpProduct {
|
4
|
+
qtityInAllDepots(stock: ProductStock, prms?: {
|
5
|
+
exceptDepots?: string[];
|
6
|
+
main?: "master" | "slave";
|
7
|
+
}): number;
|
8
|
+
getStockSalable(product: Product): number;
|
9
|
+
stock: (product: Product, param: "salable" | "packs" | "units") => number;
|
10
|
+
extraFiilters: (row: Product) => string;
|
11
|
+
}
|
12
|
+
declare const _default: HlpProduct;
|
13
|
+
export default _default;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class HlpProduct {
|
2
|
+
constructor() {
|
3
|
+
this.stock = (product, param) => {
|
4
|
+
const salable = (+product.stock.sumIns || 0) - (+product.stock.sumOuts || 0);
|
5
|
+
const packs = Math.trunc(salable / product.stock.qtityPerPackaging || 0);
|
6
|
+
const units = salable % product.stock.qtityPerPackaging || 0;
|
7
|
+
switch (param) {
|
8
|
+
case "salable":
|
9
|
+
return salable;
|
10
|
+
case "packs":
|
11
|
+
return packs;
|
12
|
+
case "units":
|
13
|
+
return units;
|
14
|
+
default:
|
15
|
+
return salable;
|
16
|
+
}
|
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" : ""); */
|
27
|
+
}
|
28
|
+
qtityInAllDepots(stock, prms) {
|
29
|
+
const ins = stock.sumIns - stock.sumOuts;
|
30
|
+
return ins <= 0 ? 0 : ins;
|
31
|
+
}
|
32
|
+
getStockSalable(product) {
|
33
|
+
const stockAllSalable = +this.qtityInAllDepots(product.stock);
|
34
|
+
const stockProduct = Math.trunc(stockAllSalable / product.qtityUnit);
|
35
|
+
/* let stockSalable: number = 0;
|
36
|
+
|
37
|
+
if (stockAllSalable <= stockStore) {
|
38
|
+
stockSalable = stockAllSalable;
|
39
|
+
}
|
40
|
+
if (stockAllSalable > stockStore) {
|
41
|
+
stockSalable = stockStore;
|
42
|
+
} */
|
43
|
+
// return stockSalable || 0;
|
44
|
+
return stockProduct || 0;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
export default new HlpProduct();
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Market } from "../../models/Market";
|
2
|
+
import { Shop } from "../../shops/models/Shop";
|
3
|
+
import ProductCat from "./ProductCat";
|
4
|
+
import ProductImage from "./ProductImage";
|
5
|
+
import ProductIn from "./ProductIn";
|
6
|
+
interface Stock {
|
7
|
+
sumIns: number;
|
8
|
+
sumOuts: number;
|
9
|
+
qtityPerPackaging: number;
|
10
|
+
}
|
11
|
+
export default interface Product {
|
12
|
+
capacity: string;
|
13
|
+
cat: ProductCat;
|
14
|
+
createdAt: Date;
|
15
|
+
description: string;
|
16
|
+
designation: string;
|
17
|
+
disabled?: boolean;
|
18
|
+
iconName: string;
|
19
|
+
iconPack: string;
|
20
|
+
id: number;
|
21
|
+
images: ProductImage[];
|
22
|
+
ins: ProductIn[];
|
23
|
+
isActive: boolean;
|
24
|
+
isAvailable?: boolean;
|
25
|
+
isBulk: boolean;
|
26
|
+
market: Market;
|
27
|
+
price: number;
|
28
|
+
publicPrice: number;
|
29
|
+
qtityLimit: number;
|
30
|
+
qtityUnit: number;
|
31
|
+
stock: Stock;
|
32
|
+
qtityPerBox: number;
|
33
|
+
qtityPerPackaging: number;
|
34
|
+
ref: string;
|
35
|
+
salePrice: number;
|
36
|
+
shop: Shop;
|
37
|
+
updatedAt: Date;
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import EInOutMotive from "asv-hlps/lib/cjs/shared/models/EInOutMotive";
|
2
|
+
import Product from "./Product";
|
3
|
+
import ProductDepot from "./ProductDepot";
|
4
|
+
export default interface ProductIn {
|
5
|
+
id: number;
|
6
|
+
createdAt: Date;
|
7
|
+
lot: string;
|
8
|
+
qtity: number;
|
9
|
+
comment: string;
|
10
|
+
isEdit: boolean;
|
11
|
+
motive: EInOutMotive;
|
12
|
+
authorId: number;
|
13
|
+
qtityPerPackaging: number;
|
14
|
+
/**
|
15
|
+
* remaining qtity
|
16
|
+
*/
|
17
|
+
qtityIn: number;
|
18
|
+
isOutDate: boolean;
|
19
|
+
/**
|
20
|
+
* expired
|
21
|
+
*/
|
22
|
+
isOut: boolean;
|
23
|
+
/**
|
24
|
+
* if true the productIn is created from transfering qtity from another productin
|
25
|
+
*/
|
26
|
+
fromTransfert: boolean;
|
27
|
+
/**
|
28
|
+
* indique the qtity waiting to transfert after transfert validation
|
29
|
+
*/
|
30
|
+
qtityInTransfert: number;
|
31
|
+
/**
|
32
|
+
* is true if the transfert not validate
|
33
|
+
*/
|
34
|
+
inTransfert: boolean;
|
35
|
+
depotId: number;
|
36
|
+
productId: number;
|
37
|
+
designation: string;
|
38
|
+
salePrice: number;
|
39
|
+
publicPrice: number;
|
40
|
+
product: Product;
|
41
|
+
depot: ProductDepot;
|
42
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from "./Product";
|
2
|
+
export * from "./ProductAsset";
|
3
|
+
export * from "./ProductCat";
|
4
|
+
export * from "./ProductCollection";
|
5
|
+
export * from "./ProductDepot";
|
6
|
+
export * from "./ProductElt";
|
7
|
+
export * from "./ProductGrp";
|
8
|
+
export * from "./ProductImage";
|
9
|
+
export * from "./ProductIn";
|
10
|
+
export * from "./ProductState";
|
11
|
+
export * from "./ProductStock";
|
12
|
+
export * from "./ProductTag";
|
13
|
+
export * from "./ProductVariant";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export * from "./Product";
|
2
|
+
export * from "./ProductAsset";
|
3
|
+
export * from "./ProductCat";
|
4
|
+
export * from "./ProductCollection";
|
5
|
+
export * from "./ProductDepot";
|
6
|
+
export * from "./ProductElt";
|
7
|
+
export * from "./ProductGrp";
|
8
|
+
export * from "./ProductImage";
|
9
|
+
export * from "./ProductIn";
|
10
|
+
export * from "./ProductState";
|
11
|
+
export * from "./ProductStock";
|
12
|
+
export * from "./ProductTag";
|
13
|
+
export * from "./ProductVariant";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models";
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Bank, BankAccount, PaymentMode } from "asv-hlps/lib/cjs/cashs";
|
2
|
+
import User from "../../users/models/User";
|
3
|
+
import Sale from "./Sale";
|
4
|
+
export interface SalePayment {
|
5
|
+
id: number;
|
6
|
+
ref: string;
|
7
|
+
createdAt: Date;
|
8
|
+
paymentDate: Date;
|
9
|
+
prevAmount: number;
|
10
|
+
paidAmount: number;
|
11
|
+
cashReceived: number;
|
12
|
+
cashReturned: number;
|
13
|
+
restAmount: number;
|
14
|
+
checkNumber: string;
|
15
|
+
checkDate: string;
|
16
|
+
sale: Sale;
|
17
|
+
encoder: User;
|
18
|
+
account: BankAccount;
|
19
|
+
bank: Bank;
|
20
|
+
mode: PaymentMode;
|
21
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models/Shop";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./models/Shop";
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import UMarket from "../../models/UMarket";
|
2
|
+
import Product from "../../products/models/Product";
|
3
|
+
export interface Shop {
|
4
|
+
id: number;
|
5
|
+
name: string;
|
6
|
+
title: string;
|
7
|
+
description: string;
|
8
|
+
logo: string;
|
9
|
+
banner: string;
|
10
|
+
isActive: boolean;
|
11
|
+
products: Product[];
|
12
|
+
umarket: UMarket;
|
13
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "asv-hlps-market",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
4
4
|
"description": "helpers for markets app",
|
5
5
|
"main": "./lib/cjs/index.js",
|
6
6
|
"module": "./lib/esm/index.js",
|
@@ -19,6 +19,6 @@
|
|
19
19
|
"typescript": "^5.7.3"
|
20
20
|
},
|
21
21
|
"dependencies": {
|
22
|
-
"asv-hlps": "^1.4.
|
22
|
+
"asv-hlps": "^1.4.9"
|
23
23
|
}
|
24
24
|
}
|