hvp-shared 9.3.0 → 9.5.0
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/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/contracts/supplier-orders/index.d.ts +5 -0
- package/dist/contracts/supplier-orders/index.js +21 -0
- package/dist/contracts/supplier-orders/requests.d.ts +24 -0
- package/dist/contracts/supplier-orders/requests.js +5 -0
- package/dist/contracts/supplier-orders/responses.d.ts +95 -0
- package/dist/contracts/supplier-orders/responses.js +5 -0
- package/package.json +1 -1
package/dist/contracts/index.js
CHANGED
|
@@ -37,3 +37,4 @@ __exportStar(require("./supplier-overlay"), exports);
|
|
|
37
37
|
__exportStar(require("./external-study"), exports);
|
|
38
38
|
__exportStar(require("./pending-dashboard"), exports);
|
|
39
39
|
__exportStar(require("./document"), exports);
|
|
40
|
+
__exportStar(require("./supplier-orders"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Supplier Orders API Contracts
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./requests"), exports);
|
|
21
|
+
__exportStar(require("./responses"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supplier Orders API Requests
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Query filters for fetching supplier order suggestions.
|
|
6
|
+
*
|
|
7
|
+
* Used for: GET /api/inventory/supplier-orders
|
|
8
|
+
*
|
|
9
|
+
* @example GET /api/inventory/supplier-orders?supplier=DESEGO&months=12
|
|
10
|
+
*/
|
|
11
|
+
export interface SupplierOrderQueryFilters {
|
|
12
|
+
supplier: string;
|
|
13
|
+
months?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Query filters for the supplier list endpoint.
|
|
17
|
+
*
|
|
18
|
+
* Used for: GET /api/inventory/supplier-orders/suppliers
|
|
19
|
+
*
|
|
20
|
+
* @example GET /api/inventory/supplier-orders/suppliers?months=12
|
|
21
|
+
*/
|
|
22
|
+
export interface SupplierListQueryFilters {
|
|
23
|
+
months?: number;
|
|
24
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supplier Orders API Responses
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Stock figures (current / min / optimal) for a single warehouse or aggregated globally.
|
|
6
|
+
*
|
|
7
|
+
* Values are expressed in **sale units** (the unit that stock is tracked in:
|
|
8
|
+
* ml, tablets, individual items). To convert to purchase units (bottle, box,
|
|
9
|
+
* case), divide by `conversionFactor`.
|
|
10
|
+
*/
|
|
11
|
+
export interface SupplierOrderStockFigures {
|
|
12
|
+
currentStock: number;
|
|
13
|
+
minStock: number;
|
|
14
|
+
optimalStock: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Per-warehouse breakdown of stock for a single product (in sale units).
|
|
18
|
+
*/
|
|
19
|
+
export interface SupplierOrderWarehouseBreakdown extends SupplierOrderStockFigures {
|
|
20
|
+
warehouse: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Single product line in the supplier order suggestions response.
|
|
24
|
+
*
|
|
25
|
+
* Stock and the sale-unit gap are tracked in **sale units**, but the suggested
|
|
26
|
+
* order quantity is expressed in **purchase units** (bottle, box) — that's how
|
|
27
|
+
* suppliers actually fulfill orders. The conversion uses `ceil` because you
|
|
28
|
+
* can't buy 0.9 bottles.
|
|
29
|
+
*
|
|
30
|
+
* - `gapSaleUnits` = max(optimalStock - currentStock, 0) (sale units)
|
|
31
|
+
* - `global.suggested` = ceil(gapSaleUnits / conversionFactor) (purchase units)
|
|
32
|
+
* - `suggestedSubtotal` = global.suggested × purchaseUnitPrice (MXN, no IVA)
|
|
33
|
+
*/
|
|
34
|
+
export interface SupplierOrderItemResponse {
|
|
35
|
+
qvetCode: number;
|
|
36
|
+
name: string;
|
|
37
|
+
/** Unit in which the supplier sells (e.g. "BOTELLA", "CAJA"). Drives the order quantity. */
|
|
38
|
+
purchaseUnit: string;
|
|
39
|
+
/** Unit in which the product is dispensed/sold (e.g. "ML", "PIEZA"). Drives stock figures. */
|
|
40
|
+
saleUnit: string;
|
|
41
|
+
/** Sale units contained in one purchase unit (e.g. 100 if a bottle has 100 ml). */
|
|
42
|
+
conversionFactor: number;
|
|
43
|
+
/** Price per purchase unit (BI, no IVA). */
|
|
44
|
+
purchaseUnitPrice: number;
|
|
45
|
+
/** Price per sale unit (BI, no IVA). Informative — used for granular calculations. */
|
|
46
|
+
saleUnitPrice: number;
|
|
47
|
+
/**
|
|
48
|
+
* Global stock figures across all warehouses, in sale units.
|
|
49
|
+
* `suggested` here is in **purchase units** (the field used in the order).
|
|
50
|
+
* `gapSaleUnits` is the raw gap before conversion.
|
|
51
|
+
*/
|
|
52
|
+
global: SupplierOrderStockFigures & {
|
|
53
|
+
gapSaleUnits: number;
|
|
54
|
+
suggested: number;
|
|
55
|
+
};
|
|
56
|
+
/** Per-warehouse breakdown (sale units). */
|
|
57
|
+
byWarehouse: SupplierOrderWarehouseBreakdown[];
|
|
58
|
+
/** Line cost = global.suggested × purchaseUnitPrice (MXN, no IVA). */
|
|
59
|
+
suggestedSubtotal: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Aggregate totals for the suggested order across all items.
|
|
63
|
+
*/
|
|
64
|
+
export interface SupplierOrderTotals {
|
|
65
|
+
subtotalBeforeTax: number;
|
|
66
|
+
subtotalAfterTax: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Supplier Order Suggestions Response.
|
|
70
|
+
*
|
|
71
|
+
* Lists all products purchased from the given supplier within the time window,
|
|
72
|
+
* with current stock, min/opt thresholds, suggested quantity to order and totals.
|
|
73
|
+
*
|
|
74
|
+
* Used for: Supplier Orders dashboard page (manual order planning by supplier).
|
|
75
|
+
*
|
|
76
|
+
* @example GET /api/inventory/supplier-orders?supplier=DESEGO&months=12
|
|
77
|
+
*/
|
|
78
|
+
export interface SupplierOrderSuggestionsResponse {
|
|
79
|
+
supplier: string;
|
|
80
|
+
months: number;
|
|
81
|
+
items: SupplierOrderItemResponse[];
|
|
82
|
+
totals: SupplierOrderTotals;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Supplier List Response.
|
|
86
|
+
*
|
|
87
|
+
* Distinct list of supplier names with at least one purchase within the window.
|
|
88
|
+
*
|
|
89
|
+
* Used for: Supplier dropdown on the Supplier Orders dashboard page.
|
|
90
|
+
*
|
|
91
|
+
* @example GET /api/inventory/supplier-orders/suppliers?months=12
|
|
92
|
+
*/
|
|
93
|
+
export interface SupplierListResponse {
|
|
94
|
+
suppliers: string[];
|
|
95
|
+
}
|